Skip to content

Commit

Permalink
#3822 copy window depth and visual from parent window
Browse files Browse the repository at this point in the history
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
  • Loading branch information
totaam committed May 22, 2023
1 parent ea1399a commit 1ab6200
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions xpra/x11/bindings/window_bindings.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ cdef extern from "X11/Xlib.h":
int SelectionNotify
int ConfigureNotify

int CopyFromParent

int CWEventMask
int CWColormap
int CWBorderWidth
Expand Down Expand Up @@ -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(<void*> &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, <Visual*> CopyFromParent,
valuemask, &attributes)
return window

Expand Down

0 comments on commit 1ab6200

Please sign in to comment.