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
  • Loading branch information
totaam committed May 22, 2023
1 parent 608b600 commit 4b51161
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions xpra/x11/bindings/window_bindings.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ cdef extern from "X11/Xlib.h":
int SelectionNotify
int ConfigureNotify

int CopyFromParent

int NoEventMask
int KeyPressMask
int KeyReleaseMask
Expand Down Expand Up @@ -921,28 +923,27 @@ cdef class X11WindowBindingsInstance(X11CoreBindingsInstance):

def CreateCorralWindow(self, Window parent, Window xid, int x, int y):
self.context_check()
#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 4b51161

Please sign in to comment.