xserver: Branch 'master' - 2 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Sep 1 00:41:51 UTC 2024
hw/xnest/Events.c | 57 ++++++++++++++++++++++++++++++++++++++++--------------
1 file changed, 43 insertions(+), 14 deletions(-)
New commits:
commit 0d3ae986616ed0dc75875d526b8c9a6db1ffab24
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date: Wed Aug 21 11:17:15 2024 +0200
Xnest: split off event handler
Tidy it up a bit and split the actual request handler from the request
reading loop, making upcoming reworks easier to review (smaller diffs).
Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1661>
diff --git a/hw/xnest/Events.c b/hw/xnest/Events.c
index f478c8e44..337f62a55 100644
--- a/hw/xnest/Events.c
+++ b/hw/xnest/Events.c
@@ -108,13 +108,10 @@ xnestQueueKeyEvent(int type, unsigned int keycode)
QueueKeyboardEvents(xnestKeyboardDevice, type, keycode);
}
-void
-xnestCollectEvents(void)
+static void
+xnest_handle_event(XEvent X)
{
- XEvent X;
-
- while (XCheckIfEvent(xnestDisplay, &X, xnestNotExposurePredicate, NULL)) {
- switch (X.type) {
+ switch (X.type) {
case KeyPress:
{
xnestUpdateModifierState(X.xkey.state);
@@ -239,6 +236,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);
}
}
commit 3597323d488350219712d2b6d40276f8979abf46
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date: Wed Aug 21 10:31:12 2024 +0200
Xnest: xnestCollectEvents(): scope local variables
Make the code easier to read/understand by scoping variables to where
exactly they're needed. Also a preparation for subsequent reworks
(keep the diff smaller and thus easier to review)
Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1661>
diff --git a/hw/xnest/Events.c b/hw/xnest/Events.c
index 67221c260..f478c8e44 100644
--- a/hw/xnest/Events.c
+++ b/hw/xnest/Events.c
@@ -112,39 +112,49 @@ void
xnestCollectEvents(void)
{
XEvent X;
- int valuators[2];
- ValuatorMask mask;
- ScreenPtr pScreen;
while (XCheckIfEvent(xnestDisplay, &X, xnestNotExposurePredicate, NULL)) {
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 +162,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 +206,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:
More information about the xorg-commit
mailing list