Beispiel #1
0
def win_send_event(root, window, ctype, data, mask=None):
    data = (data + ([0] * (5 - len(data))))[:5]
    ev = event.ClientMessage(window=window,
                             client_type=ctype,
                             data=(32, (data)))
    root.send_event(ev,
                    event_mask=X.SubstructureRedirectMask
                    | X.SubstructureNotifyMask)
Beispiel #2
0
    def client_message(self, atom, data):

        dataSize = 32
        mask = X.SubstructureRedirectMask | X.SubstructureNotifyMask
        ev = xevent.ClientMessage(window=self.xwindow,
                                  client_type=atom,
                                  data=(dataSize, data))
        self.root.send_event(ev, event_mask=mask)
        self.disp.flush()
Beispiel #3
0
    def send_client_message(self,
                            message="Visible\0\0\0\0\0\0\0\0\0\0\0\0\0",
                            mtype='Gladevcp'):
        print('X11 message sent')
        mess_type = self.d.intern_atom(mtype)
        #TODO add check of message for 20 characters

        cm_event = event.ClientMessage(window=self.receiver_id,
                                       client_type=mess_type,
                                       data=(8, message))
        self.d.send_event(self.receiver_id, cm_event)
Beispiel #4
0
    def setEwmhProp(self, win, prop, data, mask=None):
        if type(data) is str:
            dataSize = 8
        else:
            data = (data + [0] * (5 - len(data)))[:5]
            dataSize = 32

        ev = event.ClientMessage(window=win,
                                 client_type=prop,
                                 data=(dataSize, data))

        if not mask:
            mask = (X.SubstructureRedirectMask | X.SubstructureNotifyMask)
        self.root.send_event(ev, event_mask=mask)
        self.disp.pending_events()
Beispiel #5
0
    def sync(self):
        rnd = random.randint(0, 2147483647)

        message = event.ClientMessage(
            window=self.root,
            data=([32, [self.send_window.id, rnd, 0, 0, 0]]),
            message_type=self.sync_atom,
            client_type=self.sync_atom,
            sequence_number=0)

        self.display.send_event(self.root, message, X.SubstructureRedirectMask)

        while True:
            e = self.display.next_event()
            if e.type == X.ClientMessage and e.client_type == self.sync_atom:
                fmt, data = e.data
                if data[0] == self.send_window.id and data[1] == rnd:
                    break