From 1ab6200563bc7279c13c171bd54851367f992b14 Mon Sep 17 00:00:00 2001 From: totaam Date: Mon, 22 May 2023 12:10:37 +0700 Subject: [PATCH] #3822 copy window depth and visual from parent window which is the root window. We don't hardcode 24 bit depth because it should be possible to run the seamless server against a 16-bit display --- xpra/x11/bindings/window_bindings.pyx | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/xpra/x11/bindings/window_bindings.pyx b/xpra/x11/bindings/window_bindings.pyx index f397495db4..a614262902 100644 --- a/xpra/x11/bindings/window_bindings.pyx +++ b/xpra/x11/bindings/window_bindings.pyx @@ -62,6 +62,8 @@ cdef extern from "X11/Xlib.h": int SelectionNotify int ConfigureNotify + int CopyFromParent + int CWEventMask int CWColormap int CWBorderWidth @@ -883,26 +885,26 @@ cdef class X11WindowBindingsInstance(X11CoreBindingsInstance): self.context_check("CreateCorralWindow") #copy most attributes from the window we will wrap: cdef int ox, oy - cdef Window root_return + cdef Window root cdef unsigned int width, height, border_width, depth - if not XGetGeometry(self.display, xid, &root_return, + if not XGetGeometry(self.display, xid, &root, &ox, &oy, &width, &height, &border_width, &depth): return None - cdef XWindowAttributes attrs - cdef Status status = XGetWindowAttributes(self.display, xid, &attrs) - if status==0: - return None cdef XSetWindowAttributes attributes memset( &attributes, 0, sizeof(XSetWindowAttributes)) # We enable PropertyChangeMask so that we can call # get_server_time on this window. attributes.event_mask = PropertyChangeMask | StructureNotifyMask | SubstructureNotifyMask - attributes.colormap = attrs.colormap - cdef Visual *visual = attrs.visual - cdef unsigned long valuemask = CWEventMask | CWColormap + #get depth from parent window: + cdef int px, py + cdef unsigned int pw, ph, pborder, pdepth + if not XGetGeometry(self.display, parent, &root, + &px, &py, &pw, &ph, &pborder, &pdepth): + return None + cdef unsigned long valuemask = CWEventMask cdef Window window = XCreateWindow(self.display, parent, - x, y, width, height, border_width, depth, - InputOutput, visual, + x, y, width, height, 0, pdepth, + InputOutput, CopyFromParent, valuemask, &attributes) return window