From 04d2fe3aef464560de16d5b15ed91f8d63c6fb09 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 13 Jun 2016 01:56:07 +0200 Subject: nxagentReversePointerMap: Don't assume Xevent.xbutton.button is always greater than zero. We have seen Xevent.xbutton.button being set to AnyButton (equaling 0). Fixes ArcticaProject/nx-libs#92 Fixes X2GoBTS#791 --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent/Events.c') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index ffb593750..0a6540fa3 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -1252,7 +1252,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was X.xbutton.subwindow == None)) { x.u.u.type = ButtonPress; - x.u.u.detail = inputInfo.pointer -> button -> map[nxagentReversePointerMap[X.xbutton.button - 1]]; + x.u.u.detail = inputInfo.pointer -> button -> map[nxagentReversePointerMap[X.xbutton.button]]; x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis(); if (nxagentOption(Rootless)) @@ -1325,7 +1325,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was if (minimize != True) { x.u.u.type = ButtonRelease; - x.u.u.detail = inputInfo.pointer -> button -> map[nxagentReversePointerMap[X.xbutton.button - 1]]; + x.u.u.detail = inputInfo.pointer -> button -> map[nxagentReversePointerMap[X.xbutton.button]]; x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis(); if (nxagentOption(Rootless)) -- cgit v1.2.3 From c61bb8cc59bf645f1bf4dbc5fd5464d559b3ecad Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 20 Jun 2016 12:18:53 +0200 Subject: Move each screen's root-window pointer into ScreenRec. Backported from X.org: commit e7fae9ecc42ab5e73b89117722dbf4117d928f9a Author: Jamey Sharp Date: Sat May 22 00:26:28 2010 -0700 Move each screen's root-window pointer into ScreenRec. Many references to the WindowTable array already had the corresponding screen pointer handy, which meant they usually looked like "WindowTable[pScreen->myNum]". Adding a field to ScreenRec instead of keeping this information in a parallel array simplifies those expressions, and eliminates a MAXSCREENS-sized array. Since dix uses this data, a screen private entry isn't appropriate. xf86-video-dummy currently uses WindowTable, so it needs to be updated to reflect this change. Signed-off-by: Jamey Sharp Reviewed-by: Tiago Vignatti Tested-by: Tiago Vignatti (i686 GNU/Linux) Backport to nx-libs: Mike Gabriel --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 30 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent/Events.c') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 0a6540fa3..52b869f71 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -629,8 +629,8 @@ void nxagentShadowSwitchResizeMode(ScreenPtr pScreen) { nxagentShadowSetRatio(1.0, 1.0); - nxagentShadowCreateMainWindow(screenInfo.screens[DefaultScreen(nxagentDisplay)], WindowTable[0], - WindowTable[0] -> drawable.width, WindowTable[0] -> drawable.height); + nxagentShadowCreateMainWindow(screenInfo.screens[DefaultScreen(nxagentDisplay)], screenInfo.screens[0]->root, + screenInfo.screens[0]->root -> drawable.width, screenInfo.screens[0]->root -> drawable.height); sizeHints.max_width = nxagentOption(RootWidth); sizeHints.max_height = nxagentOption(RootHeight); @@ -640,13 +640,13 @@ void nxagentShadowSwitchResizeMode(ScreenPtr pScreen) else { nxagentShadowSetRatio(nxagentOption(Width) * 1.0 / - WindowTable[0] -> drawable.width, + screenInfo.screens[0]->root -> drawable.width, nxagentOption(Height) * 1.0 / - WindowTable[0] -> drawable.height); + screenInfo.screens[0]->root -> drawable.height); nxagentShadowCreateMainWindow(screenInfo.screens[DefaultScreen(nxagentDisplay)], - WindowTable[0], WindowTable[0] -> drawable.width, - WindowTable[0] -> drawable.height); + screenInfo.screens[0]->root, screenInfo.screens[0]->root -> drawable.width, + screenInfo.screens[0]->root -> drawable.height); sizeHints.max_width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); sizeHints.max_height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); @@ -963,10 +963,10 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) case doDebugTree: { fprintf(stderr, "\n ========== nxagentRemoteWindowsTree ==========\n"); - nxagentRemoteWindowsTree(nxagentWindow(WindowTable[0]), 0); + nxagentRemoteWindowsTree(nxagentWindow(screenInfo.screens[0]->root), 0); fprintf(stderr, "\n========== nxagentInternalWindowsTree ==========\n"); - nxagentInternalWindowsTree(WindowTable[0], 0); + nxagentInternalWindowsTree(screenInfo.screens[0]->root, 0); break; } @@ -1405,7 +1405,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was (X.xmotion.y_root < nxagentLastEnteredTopLevelWindow -> drawable.y + 4)) { if (pWin && nxagentClientIsDialog(wClient(pWin)) == 0 && - nxagentLastEnteredTopLevelWindow -> parent == WindowTable[0] && + nxagentLastEnteredTopLevelWindow -> parent == screenInfo.screens[0]->root && nxagentLastEnteredTopLevelWindow -> overrideRedirect == False && X.xmotion.x_root > (nxagentLastEnteredTopLevelWindow -> drawable.x + (nxagentLastEnteredTopLevelWindow -> drawable.width >> 1) - 50) && @@ -1625,7 +1625,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was if (pWin != NULL) { for (pTLWin = pWin; - pTLWin -> parent != WindowTable[pTLWin -> drawable.pScreen -> myNum]; + pTLWin -> parent != pTLWin -> drawable.pScreen -> root; pTLWin = pTLWin -> parent); } @@ -2454,7 +2454,7 @@ FIXME: This can be maybe optimized by consuming the RegionValidate(&sum, &overlap); RegionIntersect(&sum, &sum, - &WindowTable[pWin->drawable.pScreen->myNum]->winSize); + &pWin->drawable.pScreen->root->winSize); #ifdef DEBUG fprintf(stderr, "nxagentHandleExposeEvent: Sending events for window id [%ld].\n", @@ -3147,7 +3147,7 @@ int nxagentCheckWindowConfiguration(XConfigureEvent* X) fprintf(stderr, "nxagentCheckWindowConfiguration: Before restacking top level window [%p]\n", (void *) nxagentWindowPtr(X -> window)); - for (pSib = WindowTable[0] -> firstChild; pSib; pSib = pSib -> nextSib) + for (pSib = screenInfo.screens[0]->root -> firstChild; pSib; pSib = pSib -> nextSib) { fprintf(stderr, "nxagentCheckWindowConfiguration: Top level window: [%p].\n", (void *) pSib); @@ -3431,7 +3431,7 @@ int nxagentHandleConfigureNotify(XEvent* X) nxagentUpdateViewportFrame(0, 0, nxagentOption(RootWidth), nxagentOption(RootHeight)); - XMoveWindow(nxagentDisplay, nxagentWindow(WindowTable[pScreen -> myNum]), + XMoveWindow(nxagentDisplay, nxagentWindow(pScreen->root), nxagentOption(RootX), nxagentOption(RootY)); } @@ -4245,7 +4245,7 @@ void nxagentForwardRemoteExpose(void) fprintf(stderr, "nxagentForwardRemoteExpose: Going to forward events.\n"); #endif - TraverseTree(WindowTable[0], nxagentClipAndSendExpose, (void *)nxagentRemoteExposeRegion); + TraverseTree(screenInfo.screens[0]->root, nxagentClipAndSendExpose, (void *)nxagentRemoteExposeRegion); /* * Now this region should be empty. @@ -4420,7 +4420,7 @@ int nxagentHandleRRScreenChangeNotify(XEvent *X) nxagentResizeScreen(screenInfo.screens[DefaultScreen(nxagentDisplay)], Xr -> width, Xr -> height, Xr -> mwidth, Xr -> mheight); - nxagentShadowCreateMainWindow(screenInfo.screens[DefaultScreen(nxagentDisplay)], WindowTable[0], + nxagentShadowCreateMainWindow(screenInfo.screens[DefaultScreen(nxagentDisplay)], screenInfo.screens[0]->root, Xr -> width, Xr -> height); nxagentShadowSetWindowsSize(); -- cgit v1.2.3