aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Events.h
diff options
context:
space:
mode:
authorReinhard Tartler <siretart@tauware.de>2011-10-10 18:02:52 +0200
committerReinhard Tartler <siretart@tauware.de>2011-10-10 18:02:52 +0200
commit5b4ca0f93c44d7bbc8d6a3eebdd5c458e3a84c14 (patch)
treeb6f59ec830436134aaccf47aa71a070aa2ad2992 /nx-X11/programs/Xserver/hw/nxagent/Events.h
parente29a112097fa74b520ba619eb07e2e0e0a7f2f3e (diff)
parente01b9177b41f7d27a934d41fa38d550fa0026b45 (diff)
downloadnx-libs-5b4ca0f93c44d7bbc8d6a3eebdd5c458e3a84c14.tar.gz
nx-libs-5b4ca0f93c44d7bbc8d6a3eebdd5c458e3a84c14.tar.bz2
nx-libs-5b4ca0f93c44d7bbc8d6a3eebdd5c458e3a84c14.zip
Merge branch 'nxagent'
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Events.h')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Events.h230
1 files changed, 230 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..c74fa151f
--- /dev/null
+++ b/nx-X11/programs/Xserver/hw/nxagent/Events.h
@@ -0,0 +1,230 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 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 Medialogic S.p.A. */
+/* */
+/* 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,
+ doDebugTree,
+ doCloseSession,
+ doStartKbd,
+ doSwitchFullscreen,
+ doSwitchAllScreens,
+ doViewportMoveUp,
+ doViewportMoveLeft,
+ doViewportMoveRight,
+ doViewportMoveDown,
+ 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);
+extern int nxagentHandleXFixesSelectionNotify(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__ */