Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def create_gc(conn):
"""Creates a simple graphics context"""
gc = conn.generate_id()
default_screen = conn.setup.roots[conn.pref_screen]
conn.core.CreateGC(
gc, default_screen.root, # gc id, drawable
GC.Foreground | GC.Background, # value mask
[ # value list
default_screen.black_pixel,
default_screen.white_pixel
]
)
return gc
self.xsetup.roots[0].root,
0, 0, self.width, self.height,
0, WindowClass.InputOutput,
self.xsetup.roots[0].root_visual,
CW.BackPixel | CW.EventMask,
events)
self.connection.core.CreatePixmap(self.xsetup.roots[0].root_depth,
self.pixmap,
self.xsetup.roots[0].root,
self.width,
self.height)
self.connection.core.CreateGC(self.gc,
self.xsetup.roots[0].root,
GC.Foreground | GC.Background,
[self.xsetup.roots[0].black_pixel,
self.xsetup.roots[0].white_pixel])
self.surface = cairo.XCBSurface (self.connection,
self.pixmap,
self.xsetup.roots[0].allowed_depths[0].visuals[0],
self.width,
self.height)
self.context = cairo.Context(self.surface)
self.surfaces = {"screen":self.surface}
self.contexts = {"screen":self.context}
self.layers = OrderedDict() #Layer roots
self.lastupdate = {}
self.lastdrawn = {}
self.wid, self.width, self.height = wid, width, height
self.pixmap = self.qtile.conn.conn.generate_id()
self.gc = self.qtile.conn.conn.generate_id()
self.qtile.conn.conn.core.CreatePixmap(
self.qtile.conn.default_screen.root_depth,
self.pixmap,
self.wid,
self.width,
self.height
)
self.qtile.conn.conn.core.CreateGC(
self.gc,
self.wid,
xcffib.xproto.GC.Foreground | xcffib.xproto.GC.Background,
[
self.qtile.conn.default_screen.black_pixel,
self.qtile.conn.default_screen.white_pixel
]
)
self.surface = cairocffi.XCBSurface(
qtile.conn.conn,
self.pixmap,
self.find_root_visual(),
self.width,
self.height,
)
self.ctx = self.new_ctx()
self.clear((0, 0, 1))