diff options
author | Reinhard Tartler <siretart@tauware.de> | 2011-10-10 17:58:30 +0200 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2011-10-10 17:58:30 +0200 |
commit | 9e3371021541dbb7d8428b419c2e77156b166f1a (patch) | |
tree | 752906c36559aa58c53945824724222f2646d850 /nx-X11/programs/Xserver/hw/nxagent/Events.h | |
parent | edddbe8765d46b5040fdde7b04eeee8e21282114 (diff) | |
download | nx-libs-9e3371021541dbb7d8428b419c2e77156b166f1a.tar.gz nx-libs-9e3371021541dbb7d8428b419c2e77156b166f1a.tar.bz2 nx-libs-9e3371021541dbb7d8428b419c2e77156b166f1a.zip |
Imported nxagent-3.1.0-2.tar.gznxagent/3.1.0-2
Summary: Imported nxagent-3.1.0-2.tar.gz
Keywords:
Imported nxagent-3.1.0-2.tar.gz
into Git repository
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Events.h')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Events.h | 223 |
1 files changed, 223 insertions, 0 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.h b/nx-X11/programs/Xserver/hw/nxagent/Events.h new file mode 100644 index 000000000..4870f83e0 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.h @@ -0,0 +1,223 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */ +/* */ +/* NXAGENT, NX protocol compression and NX extensions to this software */ +/* are copyright of NoMachine. Redistribution and use of the present */ +/* software is allowed according to terms specified in the file LICENSE */ +/* which comes in the source distribution. */ +/* */ +/* Check http://www.nomachine.com/licensing.html for applicability. */ +/* */ +/* NX and NoMachine are trademarks of NoMachine S.r.l. */ +/* */ +/* All rights reserved. */ +/* */ +/**************************************************************************/ + +#ifndef __Events_H__ +#define __Events_H__ + +#include <X11/Xmd.h> + +#define ProcessedExpose (LASTEvent + 1) +#define ProcessedNotify (LASTEvent + 2) + +#define EXPOSED_SIZE 256 + +enum HandleEventResult +{ + doNothing = 0, + doMinimize, + doCloseSession, + doStartKbd, + doSwitchFullscreen, + doViewportLeft, + doViewportUp, + doViewportRight, + doViewportDown, + doSwitchResizeMode, + doSwitchDeferMode +}; + +extern CARD32 nxagentLastEventTime; + +/* + * Manage incoming events. + */ + +typedef Bool (*PredicateFuncPtr)(Display*, XEvent*, XPointer); + +extern void nxagentDispatchEvents(PredicateFuncPtr); + +typedef int (*GetResourceFuncPtr)(Display*); + +int nxagentWaitForResource(GetResourceFuncPtr, PredicateFuncPtr); + +Bool nxagentCollectGrabPointerPredicate(Display *display, XEvent *X, XPointer ptr); + +int nxagentInputEventPredicate(Display *display, XEvent *event, XPointer parameter); + +/* + * Enable and disable notification of + * remote X server events. + */ + +extern void nxagentEnableKeyboardEvents(void); +extern void nxagentEnablePointerEvents(void); + +extern void nxagentDisableKeyboardEvents(void); +extern void nxagentDisablePointerEvents(void); + +/* + * Manage default event mask. + */ + +extern void nxagentInitDefaultEventMask(void); +extern void nxagentGetDefaultEventMask(Mask *mask_return); +extern void nxagentSetDefaultEventMask(Mask mask); +extern void nxagentGetEventMask(WindowPtr pWin, Mask *mask_return); + +/* + * Bring keyboard device in known state. It needs + * a round-trip so it only gets called if a pre- + * vious XKB event did not implicitly initialized + * the internal state. This is unlikely to happen. + */ + +extern int nxagentInitKeyboardState(void); + +/* + * Update the keyboard state according + * to focus and XKB events received + * from the remote X server. + */ + +extern int nxagentHandleKeyboardEvent(XEvent *X); + +/* + * Handle sync and karma messages and + * other notification event coming + * from proxy. + */ + +extern int nxagentHandleProxyEvent(XEvent *X); + +/* + * Other functions providing the ad-hoc + * handling of the remote X events. + */ + +extern int nxagentHandleExposeEvent(XEvent *X); +extern int nxagentHandleGraphicsExposeEvent(XEvent *X); +extern int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult*); +extern int nxagentHandlePropertyNotify(XEvent *X); +extern int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult*); +extern int nxagentHandleReparentNotify(XEvent *X); +extern int nxagentHandleConfigureNotify(XEvent *X); + +/* + * Send a fake keystroke to the remote + * X server. + */ + +extern void nxagentSendFakeKey(int key); + +/* + * Called to manage grab of pointer and + * keyboard when running in fullscreen + * mode. + */ + +extern void nxagentGrabPointerAndKeyboard(XEvent *X); +extern void nxagentUngrabPointerAndKeyboard(XEvent *X); + +extern void nxagentDeactivatePointerGrab(void); + +/* + * Handle the selection property received + * in the event loop. + */ + +void nxagentCollectPropertyEvent(int resource); + +/* + * Synchronize expose events between agent and + * the real X server. + */ + +typedef struct _ExposuresRec +{ + WindowPtr pWindow; + RegionPtr localRegion; + RegionPtr remoteRegion; + Bool remoteRegionIsCompleted; + int serial; + int synchronize; + +} ExposuresRec; + +extern RegionPtr nxagentRemoteExposeRegion; + +typedef struct _ExposeQueue +{ + unsigned int start; + int length; + ExposuresRec exposures[EXPOSED_SIZE]; +} ExposeQueue; + +extern void nxagentSynchronizeExpose(void); +extern int nxagentLookupByWindow(WindowPtr pWin); +extern void nxagentUpdateExposeArray(void); + +extern ExposeQueue nxagentExposeQueue; + +/* + * Handle the split related notifications. + */ + +int nxagentWaitSplitEvent(int resource); + +void nxagentHandleNoSplitEvent(int resource); +void nxagentHandleStartSplitEvent(int resource); +void nxagentHandleCommitSplitEvent(int resource, int request, int position); +void nxagentHandleEndSplitEvent(int resource); +void nxagentHandleEmptySplitEvent(void); + +void nxagentInitRemoteExposeRegion(void); +void nxagentAddRectToRemoteExposeRegion(BoxPtr); + +extern int nxagentUserInput(void *p); + +/* +* We have to check these before launching the terminate + * dialog in rootless mode. + */ + +extern Bool nxagentLastWindowDestroyed; +extern Time nxagentLastWindowDestroyedTime; + +/* + * Set this flag if an user input event is received. + */ + +extern int nxagentInputEvent; + +/* + * Event-handling utilities. + */ + +Bool nxagentPendingEvents(Display *dpy); + +#define nxagentQueuedEvents(display) \ + XQLength((display)) + +#define nxagentReadEvents(display) \ + XEventsQueued((display), QueuedAfterReading) + +#define nxagentCheckEvents(display, event, predicate, argument) \ + XCheckIfEventNoFlush((display), (event), (predicate), (argument)) + +int nxagentWaitEvents(Display *, struct timeval *); + +#endif /* __Events_H__ */ |