Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def hide(self):
self.screen = None
with self.disable_mask(xcffib.xproto.EventMask.EnterWindow |
xcffib.xproto.EventMask.FocusChange |
xcffib.xproto.EventMask.LeaveWindow):
for i in self.windows:
i.hide()
self.layout.hide()
def send_event(self, synthevent, mask=EventMask.NoEvent):
self.conn.conn.core.SendEvent(False, self.wid, mask, synthevent.pack())
wm_client_machine=self.window.get_wm_client_machine(),
normalhints=normalhints,
hints=hints,
state=state,
float_info=self._float_info
)
class Internal(_Window):
"""An internal window, that should not be managed by qtile"""
_window_mask = EventMask.StructureNotify | \
EventMask.PropertyChange | \
EventMask.EnterWindow | \
EventMask.FocusChange | \
EventMask.Exposure | \
EventMask.ButtonPress | \
EventMask.ButtonRelease | \
EventMask.KeyPress
@classmethod
def create(cls, qtile, x, y, width, height, opacity=1.0):
win = qtile.conn.create_window(x, y, width, height)
win.set_property("QTILE_INTERNAL", 1)
i = Internal(win, qtile)
i.place(x, y, width, height, 0, None)
i.opacity = opacity
return i
def __repr__(self):
return "Internal(%r, %s)" % (self.name, self.window.wid)
def kill(self):
normalhints=normalhints,
hints=hints,
state=state,
float_info=self._float_info
)
class Internal(_Window):
"""An internal window, that should not be managed by qtile"""
_window_mask = EventMask.StructureNotify | \
EventMask.PropertyChange | \
EventMask.EnterWindow | \
EventMask.FocusChange | \
EventMask.Exposure | \
EventMask.ButtonPress | \
EventMask.ButtonRelease | \
EventMask.KeyPress
@classmethod
def create(cls, qtile, x, y, width, height, opacity=1.0):
win = qtile.conn.create_window(x, y, width, height)
win.set_property("QTILE_INTERNAL", 1)
i = Internal(win, qtile)
i.place(x, y, width, height, 0, None)
i.opacity = opacity
return i
def __repr__(self):
return "Internal(%r, %s)" % (self.name, self.window.wid)
def kill(self):
self.qtile.conn.conn.core.DestroyWindow(self.window.wid)
event.mods = []
for attrib in dir(KeyButMask):
if not attrib.startswith("__"):
if event.state & getattr(KeyButMask, attrib):
event.mods.append(attrib.lower())
if event.type == Event.mouse_press and event.button == 1:
startdrag = event.xy
logger.info("Wrapped: %s", (event.__class__.__name__, event.button, event.xy, event.mods))
elif event.type == Event.motion:
event.xy = numpy.array([event.event_x, event.event_y])
event.txy = numpy.linalg.solve(doc["drawing"].transform, numpy.append(event.xy, [1]))[:2]
if event.state & EventMask.Button1Motion:
event.drag_button = 1
elif event.state & EventMask.Button2Motion:
event.drag_button = 2
elif event.state & EventMask.Button1Motion:
event.drag_button = 3
else:
event.drag_button = None
if event.drag_button:
event.diff = event.xy - startdrag
if event.drag_button:
logger.info("Wrapped: %s", (event.__class__.__name__, event.drag_button, event.xy, event.diff))
logger.info("Wrapped: %s", (event.type, event.__class__.__name__, event.xy))
return i
def __repr__(self):
return "Internal(%r, %s)" % (self.name, self.window.wid)
def kill(self):
self.qtile.conn.conn.core.DestroyWindow(self.window.wid)
def cmd_kill(self):
self.kill()
class Static(_Window):
"""An internal window, that should not be managed by qtile"""
_window_mask = EventMask.StructureNotify | \
EventMask.PropertyChange | \
EventMask.EnterWindow | \
EventMask.FocusChange | \
EventMask.Exposure
def __init__(self, win, qtile, screen,
x=None, y=None, width=None, height=None):
_Window.__init__(self, win, qtile)
self.update_name()
self.conf_x = x
self.conf_y = y
self.conf_width = width
self.conf_height = height
self.x = x or 0
self.y = y or 0
self.width = width or 0
self.height = height or 0
raise QtileError("No DISPLAY set")
self.conn = xcbq.Connection(display_name)
self._display_name = display_name
# Because we only do Xinerama multi-screening,
# we can assume that the first
# screen's root is _the_ root.
self._root = self.conn.default_screen.root
self._root.set_attribute(
eventmask=(
xcffib.xproto.EventMask.StructureNotify
| xcffib.xproto.EventMask.SubstructureNotify
| xcffib.xproto.EventMask.SubstructureRedirect
| xcffib.xproto.EventMask.EnterWindow
| xcffib.xproto.EventMask.LeaveWindow
)
)
self._root.set_property(
"_NET_SUPPORTED", [self.conn.atoms[x] for x in xcbq.SUPPORTED_ATOMS]
)
wmname = "qtile"
self._supporting_wm_check_window = self.conn.create_window(-1, -1, 1, 1)
self._supporting_wm_check_window.set_property("_NET_WM_NAME", wmname)
self._supporting_wm_check_window.set_property(
"_NET_SUPPORTING_WM_CHECK", self._supporting_wm_check_window.wid
)
self._root.set_property(
"_NET_SUPPORTING_WM_CHECK", self._supporting_wm_check_window.wid
)