How to use the xcffib.xproto.EventMask.Exposure function in xcffib

To help you get started, we’ve selected a few xcffib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qtile / qtile / test / scripts / window.py View on Github external
print("Error opening test window: ", type(v), v, file=sys.stderr)
        sys.exit(1)
    break
else:
    print("Could not open window on display %s" % (sys.argv[1]), file=sys.stderr)
    sys.exit(1)

screen = conn.get_setup().roots[conn.pref_screen]

window = conn.generate_id()
background = conn.core.AllocColor(screen.default_colormap, 0x2828, 0x8383, 0xCECE).reply().pixel  # Color "#2883ce"
conn.core.CreateWindow(xcffib.CopyFromParent, window, screen.root,
                       100, 100, 100, 100, 1,
                       xcffib.xproto.WindowClass.InputOutput, screen.root_visual,
                       xcffib.xproto.CW.BackPixel | xcffib.xproto.CW.EventMask,
                       [background, xcffib.xproto.EventMask.StructureNotify | xcffib.xproto.EventMask.Exposure])

conn.core.ChangeProperty(xcffib.xproto.PropMode.Replace,
                         window, xcffib.xproto.Atom.WM_NAME,
                         xcffib.xproto.Atom.STRING, 8, len(sys.argv[2]),
                         sys.argv[2])

wm_protocols = "WM_PROTOCOLS"
wm_protocols = conn.core.InternAtom(0, len(wm_protocols), wm_protocols).reply().atom

wm_delete_window = "WM_DELETE_WINDOW"
wm_delete_window = conn.core.InternAtom(0, len(wm_delete_window), wm_delete_window).reply().atom

conn.core.ChangeProperty(xcffib.xproto.PropMode.Replace,
                         window, wm_protocols,
                         xcffib.xproto.Atom.ATOM, 32, 1,
                         [wm_delete_window])
github Kozea / cairocffi / cairocffi / test_xcb.py View on Github external
def create_window(conn, width, height):
    """Creates a window of the given dimensions and returns the XID"""
    wid = conn.generate_id()
    default_screen = conn.setup.roots[conn.pref_screen]

    conn.core.CreateWindow(
        default_screen.root_depth,  # depth
        wid,                        # id
        default_screen.root,        # parent
        0, 0, width, height, 0,     # x, y, w, h, border width
        xcffib.xproto.WindowClass.InputOutput,  # window class
        default_screen.root_visual,             # visual
        CW.BackPixel | CW.EventMask,            # value mask
        [                                       # value list
            default_screen.black_pixel,
            EventMask.Exposure | EventMask.StructureNotify
        ]
    )

    return wid
github qtile / qtile / libqtile / backend / x11 / xcbq.py View on Github external
def create_window(self, x, y, width, height):
        wid = self.conn.generate_id()
        self.conn.core.CreateWindow(
            self.default_screen.root_depth,
            wid,
            self.default_screen.root.wid,
            x, y, width, height, 0,
            WindowClass.InputOutput,
            self.default_screen.root_visual,
            CW.BackPixel | CW.EventMask,
            [
                self.default_screen.black_pixel,
                EventMask.StructureNotify | EventMask.Exposure
            ]
        )
        return Window(self, wid)
github asrp / guitktk / xcb_doc.py View on Github external
def __init__(self, width, height):
        self.width = width
        self.height = height
        self.connection = xcb.connect()
        self.xsetup = self.connection.get_setup()
        self.window = self.connection.generate_id()
        self.pixmap = self.connection.generate_id()
        self.gc = self.connection.generate_id()
        events = [self.xsetup.roots[0].white_pixel,
                  EventMask.ButtonPress | EventMask.ButtonRelease | EventMask.EnterWindow | EventMask.LeaveWindow | EventMask.Exposure | EventMask.PointerMotion | EventMask.ButtonMotion | EventMask.KeyPress | EventMask.KeyRelease]
        self.connection.core.CreateWindow(self.xsetup.roots[0].root_depth,
                                          self.window,
                                          # Parent is the root window
                                          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)
github qtile / qtile / libqtile / widget / systray.py View on Github external
def handle_DestroyNotify(self, event):  # noqa: N802
        wid = event.window
        del(self.qtile.windows_map[wid])
        del(self.systray.icons[wid])
        self.systray.bar.draw()
        return False

    handle_UnmapNotify = handle_DestroyNotify  # noqa: N815


class Systray(window._Window, base._Widget):
    """A widget that manages system tray"""

    _window_mask = EventMask.StructureNotify | \
        EventMask.Exposure

    orientations = base.ORIENTATION_HORIZONTAL

    defaults = [
        ('icon_size', 20, 'Icon width'),
        ('padding', 5, 'Padding between icons'),
    ]

    def __init__(self, **config):
        base._Widget.__init__(self, bar.CALCULATED, **config)
        self.add_defaults(Systray.defaults)
        self.icons = {}
        self.screen = 0

    def calculate_length(self):
        width = sum(i.width for i in self.icons.values())
github qtile / qtile / libqtile / window.py View on Github external
wm_icon_name=self.window.get_wm_icon_name(),
            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)