summaryrefslogtreecommitdiff
path: root/hw/xnest/Events.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/xnest/Events.c')
-rw-r--r--hw/xnest/Events.c69
1 files changed, 48 insertions, 21 deletions
diff --git a/hw/xnest/Events.c b/hw/xnest/Events.c
index 88db0d18f..0cc0d225d 100644
--- a/hw/xnest/Events.c
+++ b/hw/xnest/Events.c
@@ -11,15 +11,15 @@ the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
-
-#ifdef HAVE_XNEST_CONFIG_H
-#include <xnest-config.h>
-#endif
+#include <dix-config.h>
#include <X11/X.h>
#include <X11/Xdefs.h>
#include <X11/Xproto.h>
+#include "dix/cursor_priv.h"
+#include "mi/mi_priv.h"
+
#include "screenint.h"
#include "input.h"
#include "misc.h"
@@ -29,8 +29,6 @@ is" without express or implied warranty.
#include "inputstr.h"
#include "inpututils.h"
-#include "mi.h"
-
#include "Xnest.h"
#include "Args.h"
@@ -96,7 +94,7 @@ xnestCollectExposures(void)
RegionInit(&Rgn, &Box, 1);
- miSendExposures(pWin, &Rgn, Box.x2, Box.y2);
+ miSendExposures(pWin, &Rgn, Box.x1, Box.y1);
}
}
}
@@ -108,43 +106,50 @@ xnestQueueKeyEvent(int type, unsigned int keycode)
QueueKeyboardEvents(xnestKeyboardDevice, type, keycode);
}
-void
-xnestCollectEvents(void)
+static void
+xnest_handle_event(XEvent X)
{
- XEvent X;
- int valuators[2];
- ValuatorMask mask;
- ScreenPtr pScreen;
-
- while (XCheckIfEvent(xnestDisplay, &X, xnestNotExposurePredicate, NULL)) {
- switch (X.type) {
+ switch (X.type) {
case KeyPress:
+ {
xnestUpdateModifierState(X.xkey.state);
xnestQueueKeyEvent(KeyPress, X.xkey.keycode);
break;
+ }
case KeyRelease:
+ {
xnestUpdateModifierState(X.xkey.state);
xnestQueueKeyEvent(KeyRelease, X.xkey.keycode);
break;
+ }
case ButtonPress:
+ {
+ ValuatorMask mask;
valuator_mask_set_range(&mask, 0, 0, NULL);
xnestUpdateModifierState(X.xkey.state);
lastEventTime = GetTimeInMillis();
QueuePointerEvents(xnestPointerDevice, ButtonPress,
X.xbutton.button, POINTER_RELATIVE, &mask);
break;
+ }
case ButtonRelease:
+ {
+ ValuatorMask mask;
valuator_mask_set_range(&mask, 0, 0, NULL);
xnestUpdateModifierState(X.xkey.state);
lastEventTime = GetTimeInMillis();
QueuePointerEvents(xnestPointerDevice, ButtonRelease,
X.xbutton.button, POINTER_RELATIVE, &mask);
break;
+ }
case MotionNotify:
+ {
+ ValuatorMask mask;
+ int valuators[2];
valuators[0] = X.xmotion.x;
valuators[1] = X.xmotion.y;
valuator_mask_set_range(&mask, 0, 2, valuators);
@@ -152,30 +157,38 @@ xnestCollectEvents(void)
QueuePointerEvents(xnestPointerDevice, MotionNotify,
0, POINTER_ABSOLUTE, &mask);
break;
+ }
case FocusIn:
+ {
if (X.xfocus.detail != NotifyInferior) {
- pScreen = xnestScreen(X.xfocus.window);
+ ScreenPtr pScreen = xnestScreen(X.xfocus.window);
if (pScreen)
xnestDirectInstallColormaps(pScreen);
}
break;
+ }
case FocusOut:
+ {
if (X.xfocus.detail != NotifyInferior) {
- pScreen = xnestScreen(X.xfocus.window);
+ ScreenPtr pScreen = xnestScreen(X.xfocus.window);
if (pScreen)
xnestDirectUninstallColormaps(pScreen);
}
break;
+ }
case KeymapNotify:
break;
case EnterNotify:
+ {
if (X.xcrossing.detail != NotifyInferior) {
- pScreen = xnestScreen(X.xcrossing.window);
+ ScreenPtr pScreen = xnestScreen(X.xcrossing.window);
if (pScreen) {
+ ValuatorMask mask;
+ int valuators[2];
NewCurrentScreen(inputInfo.pointer, pScreen, X.xcrossing.x,
X.xcrossing.y);
valuators[0] = X.xcrossing.x;
@@ -188,21 +201,26 @@ xnestCollectEvents(void)
}
}
break;
+ }
case LeaveNotify:
+ {
if (X.xcrossing.detail != NotifyInferior) {
- pScreen = xnestScreen(X.xcrossing.window);
+ ScreenPtr pScreen = xnestScreen(X.xcrossing.window);
if (pScreen) {
xnestDirectUninstallColormaps(pScreen);
}
}
break;
+ }
case DestroyNotify:
+ {
if (xnestParentWindow != (Window) 0 &&
X.xdestroywindow.window == xnestParentWindow)
exit(0);
break;
+ }
case CirculateNotify:
case ConfigureNotify:
@@ -216,6 +234,15 @@ xnestCollectEvents(void)
default:
ErrorF("xnest warning: unhandled event: %d\n", X.type);
break;
- }
+ }
+}
+
+void
+xnestCollectEvents(void)
+{
+ XEvent X;
+
+ while (XCheckIfEvent(xnestDisplay, &X, xnestNotExposurePredicate, NULL)) {
+ xnest_handle_event(X);
}
}