Xnest: move per-screen screensaver window to xnest_screen_info struct

This commit is contained in:
Enrico Weigelt, metux IT consult 2024-08-30 20:30:03 +02:00
parent 56c646cb63
commit 81b041cae3
4 changed files with 16 additions and 11 deletions

View File

@ -281,9 +281,11 @@ xnestSetScreenSaverColormapWindow(ScreenPtr pScreen)
{ {
free(xnestOldInstalledColormapWindows); free(xnestOldInstalledColormapWindows);
struct xnest_screen_info *screenPriv = xnest_screen_priv(pScreen);
xnest_wm_colormap_windows(xnestUpstreamInfo.conn, xnest_wm_colormap_windows(xnestUpstreamInfo.conn,
xnest_screen_priv(pScreen)->upstream_frame_window, xnest_screen_priv(pScreen)->upstream_frame_window,
&xnestScreenSaverWindows[pScreen->myNum], &screenPriv->upstream_saver_window,
1); 1);
xnestOldInstalledColormapWindows = NULL; xnestOldInstalledColormapWindows = NULL;

View File

@ -47,7 +47,6 @@ is" without express or implied warranty.
#include "Args.h" #include "Args.h"
#include "mipointrst.h" #include "mipointrst.h"
xcb_window_t xnestScreenSaverWindows[MAXSCREENS];
DevPrivateKeyRec xnestScreenCursorFuncKeyRec; DevPrivateKeyRec xnestScreenCursorFuncKeyRec;
DevScreenPrivateKeyRec xnestScreenCursorPrivKeyRec; DevScreenPrivateKeyRec xnestScreenCursorPrivKeyRec;
@ -77,33 +76,35 @@ offset(unsigned long mask)
static Bool static Bool
xnestSaveScreen(ScreenPtr pScreen, int what) xnestSaveScreen(ScreenPtr pScreen, int what)
{ {
struct xnest_screen_info *screenPriv = xnest_screen_priv(pScreen);
if (xnestSoftwareScreenSaver) if (xnestSoftwareScreenSaver)
return FALSE; return FALSE;
else { else {
switch (what) { switch (what) {
case SCREEN_SAVER_ON: case SCREEN_SAVER_ON:
xcb_map_window(xnestUpstreamInfo.conn, xnestScreenSaverWindows[pScreen->myNum]); xcb_map_window(xnestUpstreamInfo.conn, screenPriv->upstream_saver_window);
uint32_t value = XCB_STACK_MODE_ABOVE; uint32_t value = XCB_STACK_MODE_ABOVE;
xcb_configure_window(xnestUpstreamInfo.conn, xcb_configure_window(xnestUpstreamInfo.conn,
xnestScreenSaverWindows[pScreen->myNum], screenPriv->upstream_saver_window,
XCB_CONFIG_WINDOW_STACK_MODE, XCB_CONFIG_WINDOW_STACK_MODE,
&value); &value);
xnestSetScreenSaverColormapWindow(pScreen); xnestSetScreenSaverColormapWindow(pScreen);
break; break;
case SCREEN_SAVER_OFF: case SCREEN_SAVER_OFF:
xcb_unmap_window(xnestUpstreamInfo.conn, xnestScreenSaverWindows[pScreen->myNum]); xcb_unmap_window(xnestUpstreamInfo.conn, screenPriv->upstream_saver_window);
xnestSetInstalledColormapWindows(pScreen); xnestSetInstalledColormapWindows(pScreen);
break; break;
case SCREEN_SAVER_FORCER: case SCREEN_SAVER_FORCER:
lastEventTime = GetTimeInMillis(); lastEventTime = GetTimeInMillis();
xcb_unmap_window(xnestUpstreamInfo.conn, xnestScreenSaverWindows[pScreen->myNum]); xcb_unmap_window(xnestUpstreamInfo.conn, screenPriv->upstream_saver_window);
xnestSetInstalledColormapWindows(pScreen); xnestSetInstalledColormapWindows(pScreen);
break; break;
case SCREEN_SAVER_CYCLE: case SCREEN_SAVER_CYCLE:
xcb_unmap_window(xnestUpstreamInfo.conn, xnestScreenSaverWindows[pScreen->myNum]); xcb_unmap_window(xnestUpstreamInfo.conn, screenPriv->upstream_saver_window);
xnestSetInstalledColormapWindows(pScreen); xnestSetInstalledColormapWindows(pScreen);
break; break;
} }
@ -495,10 +496,10 @@ breakout:
attributes.back_pixmap = xnestScreenSaverPixmap; attributes.back_pixmap = xnestScreenSaverPixmap;
attributes.colormap = xnestUpstreamInfo.screenInfo->default_colormap; attributes.colormap = xnestUpstreamInfo.screenInfo->default_colormap;
xnestScreenSaverWindows[pScreen->myNum] = xcb_generate_id(xnestUpstreamInfo.conn); screenPriv->upstream_saver_window = xcb_generate_id(xnestUpstreamInfo.conn);
xcb_aux_create_window(xnestUpstreamInfo.conn, xcb_aux_create_window(xnestUpstreamInfo.conn,
xnestUpstreamInfo.screenInfo->root_depth, xnestUpstreamInfo.screenInfo->root_depth,
xnestScreenSaverWindows[pScreen->myNum], screenPriv->upstream_saver_window,
screenPriv->upstream_frame_window, screenPriv->upstream_frame_window,
0, 0,
0, 0,

View File

@ -20,8 +20,6 @@ is" without express or implied warranty.
#include <xcb/xcb.h> #include <xcb/xcb.h>
extern xcb_window_t xnestScreenSaverWindows[MAXSCREENS];
ScreenPtr xnestScreen(xcb_window_t window); ScreenPtr xnestScreen(xcb_window_t window);
Bool xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[]); Bool xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[]);
Bool xnestCloseScreen(ScreenPtr pScreen); Bool xnestCloseScreen(ScreenPtr pScreen);

View File

@ -24,6 +24,10 @@ struct xnest_screen_info {
several things easier, eg. embedding Xnest into another application, or maybe several things easier, eg. embedding Xnest into another application, or maybe
even adding some control widgets (eg. scroll bars) */ even adding some control widgets (eg. scroll bars) */
xcb_window_t upstream_frame_window; xcb_window_t upstream_frame_window;
/* the SAVER window also is child of the FRAME. It's only mapped while the
screen saver is active, and then overlapping our ROOT window. */
xcb_window_t upstream_saver_window;
}; };
struct xnest_upstream_info { struct xnest_upstream_info {