From 3802b10cdb38818c2ffb6db241b3beea8ec81b90 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Thu, 5 Sep 2024 15:19:24 +0200 Subject: [PATCH] Xnest: move xnestEventmask into struct xnest_upstream_info This is per upstream connection state, so it's better of in the upstream information struct. Signed-off-by: Enrico Weigelt, metux IT consult --- hw/xnest/Display.c | 5 ++--- hw/xnest/Display.h | 1 - hw/xnest/Keyboard.c | 8 ++++---- hw/xnest/Pointer.c | 8 ++++---- hw/xnest/Screen.c | 4 ++-- hw/xnest/xnest-xcb.h | 1 + 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/hw/xnest/Display.c b/hw/xnest/Display.c index 2b1f141f2..60fa81547 100644 --- a/hw/xnest/Display.c +++ b/hw/xnest/Display.c @@ -41,7 +41,6 @@ int xnestNumPixmapFormats; Drawable xnestDefaultDrawables[MAXDEPTH + 1]; Pixmap xnestIconBitmap; Pixmap xnestScreenSaverPixmap; -uint32_t xnestEventMask; void xnestOpenDisplay(int argc, char *argv[]) @@ -57,9 +56,9 @@ xnestOpenDisplay(int argc, char *argv[]) FatalError("Unable to open display \"%s\".\n", xnestDisplayName); if (xnestParentWindow != (Window) 0) - xnestEventMask = XCB_EVENT_MASK_STRUCTURE_NOTIFY; + xnestUpstreamInfo.eventMask = XCB_EVENT_MASK_STRUCTURE_NOTIFY; else - xnestEventMask = 0L; + xnestUpstreamInfo.eventMask = 0; for (i = 0; i <= MAXDEPTH; i++) xnestDefaultDrawables[i] = XCB_WINDOW_NONE; diff --git a/hw/xnest/Display.h b/hw/xnest/Display.h index 00f88ccdf..9634e2fa4 100644 --- a/hw/xnest/Display.h +++ b/hw/xnest/Display.h @@ -26,7 +26,6 @@ extern int xnestNumPixmapFormats; extern Drawable xnestDefaultDrawables[MAXDEPTH + 1]; extern Pixmap xnestIconBitmap; extern Pixmap xnestScreenSaverPixmap; -extern uint32_t xnestEventMask; void xnestOpenDisplay(int argc, char *argv[]); void xnestCloseDisplay(void); diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c index dcb405b32..08c445db2 100644 --- a/hw/xnest/Keyboard.c +++ b/hw/xnest/Keyboard.c @@ -215,20 +215,20 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff) break; } case DEVICE_ON: - xnestEventMask |= XNEST_KEYBOARD_EVENT_MASK; + xnestUpstreamInfo.eventMask |= XNEST_KEYBOARD_EVENT_MASK; for (i = 0; i < xnestNumScreens; i++) xcb_change_window_attributes(xnestUpstreamInfo.conn, xnest_screen_by_id(i)->upstream_frame_window, XCB_CW_EVENT_MASK, - &xnestEventMask); + &xnestUpstreamInfo.eventMask); break; case DEVICE_OFF: - xnestEventMask &= ~XNEST_KEYBOARD_EVENT_MASK; + xnestUpstreamInfo.eventMask &= ~XNEST_KEYBOARD_EVENT_MASK; for (i = 0; i < xnestNumScreens; i++) xcb_change_window_attributes(xnestUpstreamInfo.conn, xnest_screen_by_id(i)->upstream_frame_window, XCB_CW_EVENT_MASK, - &xnestEventMask); + &xnestUpstreamInfo.eventMask); break; case DEVICE_CLOSE: break; diff --git a/hw/xnest/Pointer.c b/hw/xnest/Pointer.c index 85bd51bbc..e7f71a246 100644 --- a/hw/xnest/Pointer.c +++ b/hw/xnest/Pointer.c @@ -104,20 +104,20 @@ xnestPointerProc(DeviceIntPtr pDev, int onoff) break; } case DEVICE_ON: - xnestEventMask |= XNEST_POINTER_EVENT_MASK; + xnestUpstreamInfo.eventMask |= XNEST_POINTER_EVENT_MASK; for (i = 0; i < xnestNumScreens; i++) xcb_change_window_attributes(xnestUpstreamInfo.conn, xnest_screen_by_id(i)->upstream_frame_window, XCB_CW_EVENT_MASK, - &xnestEventMask); + &xnestUpstreamInfo.eventMask); break; case DEVICE_OFF: - xnestEventMask &= ~XNEST_POINTER_EVENT_MASK; + xnestUpstreamInfo.eventMask &= ~XNEST_POINTER_EVENT_MASK; for (i = 0; i < xnestNumScreens; i++) xcb_change_window_attributes(xnestUpstreamInfo.conn, xnest_screen_by_id(i)->upstream_frame_window, XCB_CW_EVENT_MASK, - &xnestEventMask); + &xnestUpstreamInfo.eventMask); break; case DEVICE_CLOSE: break; diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c index 647a298ea..fffe166bf 100644 --- a/hw/xnest/Screen.c +++ b/hw/xnest/Screen.c @@ -410,7 +410,7 @@ breakout: xcb_params_cw_t attributes = { .back_pixel = xnestUpstreamInfo.screenInfo->white_pixel, - .event_mask = xnestEventMask, + .event_mask = xnestUpstreamInfo.eventMask, .colormap = xnest_visual_to_upstream_cmap(pScreen->rootVisual), }; @@ -423,7 +423,7 @@ breakout: xcb_change_window_attributes(xnestUpstreamInfo.conn, screenPriv->upstream_frame_window, XCB_CW_EVENT_MASK, - &xnestEventMask); + &xnestUpstreamInfo.eventMask); } else { screenPriv->upstream_frame_window = xcb_generate_id(xnestUpstreamInfo.conn); diff --git a/hw/xnest/xnest-xcb.h b/hw/xnest/xnest-xcb.h index 4d8f2e635..80e4416fe 100644 --- a/hw/xnest/xnest-xcb.h +++ b/hw/xnest/xnest-xcb.h @@ -37,6 +37,7 @@ struct xnest_upstream_info { const xcb_setup_t *setup; struct xnest_event_queue eventQueue; xcb_gc_t bitmapGC; + uint32_t eventMask; }; extern struct xnest_screen_info xnestScreens[MAXSCREENS];