Esempio n. 1
0
 def do_child_configure_request_event(self, event):
     # The point of this method is to handle configure requests on
     # withdrawn windows.  We simply allow them to move/resize any way they
     # want.  This is harmless because the window isn't visible anyway (and
     # apps can create unmapped windows with whatever coordinates they want
     # anyway, no harm in letting them move existing ones around), and it
     # means that when the window actually gets mapped, we have more
     # accurate info on what the app is actually requesting.
     model = self._windows.get(event.window)
     if model:
         # the window has been reparented already,
         # but we're getting the configure request event on the root window
         # forward it to the model
         log(
             "do_child_configure_request_event(%s) value_mask=%s, forwarding to %s",
             event,
             configure_bits(event.value_mask),
             model,
         )
         model.do_child_configure_request_event(event)
         return
     log(
         "do_child_configure_request_event(%s) value_mask=%s, reconfigure on withdrawn window",
         event,
         configure_bits(event.value_mask),
     )
     with xswallow:
         xid = event.window.xid
         x, y, w, h = X11Window.getGeometry(xid)[:4]
         if event.value_mask & CWX:
             x = event.x
         if event.value_mask & CWY:
             y = event.y
         if event.value_mask & CWWidth:
             w = event.width
         if event.value_mask & CWHeight:
             h = event.height
         if event.value_mask & (CWX | CWY | CWWidth | CWHeight):
             log(
                 "updated window geometry for window %#x from %s to %s",
                 xid,
                 X11Window.getGeometry(xid)[:4],
                 (x, y, w, h),
             )
         X11Window.configureAndNotify(xid, x, y, w, h, event.value_mask)
Esempio n. 2
0
 def do_child_configure_request_event(self, event):
     # The point of this method is to handle configure requests on
     # withdrawn windows.  We simply allow them to move/resize any way they
     # want.  This is harmless because the window isn't visible anyway (and
     # apps can create unmapped windows with whatever coordinates they want
     # anyway, no harm in letting them move existing ones around), and it
     # means that when the window actually gets mapped, we have more
     # accurate info on what the app is actually requesting.
     model = self._windows.get(event.window)
     if model:
         #the window has been reparented already,
         #but we're getting the configure request event on the root window
         #forward it to the model
         log(
             "do_child_configure_request_event(%s) value_mask=%s, forwarding to %s",
             event, configure_bits(event.value_mask), model)
         model.do_child_configure_request_event(event)
         return
     log(
         "do_child_configure_request_event(%s) value_mask=%s, reconfigure on withdrawn window",
         event, configure_bits(event.value_mask))
     with xswallow:
         xid = event.window.xid
         x, y, w, h = X11Window.getGeometry(xid)[:4]
         if event.value_mask & CWX:
             x = event.x
         if event.value_mask & CWY:
             y = event.y
         if event.value_mask & CWWidth:
             w = event.width
         if event.value_mask & CWHeight:
             h = event.height
         if event.value_mask & (CWX | CWY | CWWidth | CWHeight):
             log("updated window geometry for window %#x from %s to %s",
                 xid,
                 X11Window.getGeometry(xid)[:4], (x, y, w, h))
         X11Window.configureAndNotify(xid, x, y, w, h, event.value_mask)