[Xcb] How to properly handle EnterNotifyEvents for gtk3

Micah Nordland mpnordland at gmail.com
Sat Aug 25 15:24:44 PDT 2012


Ok, I've updated my code so that in Window's __init__() this is called:

        #What is our focus modal?
        protos = self.get_wm_protocols()
        hints = self.get_wm_hints()
        input = False
        take_focus = False
        if hints and hints['input']:
            input = True
        if protos and util.get_atom("WM_TAKE_FOCUS") in protos:
            take_focus = True
        if input and take_focus:
            print self.get_wm_name()
            print "local_active"
            self.local_active = True
        elif input and not take_focus:
            print self.get_wm_name()
            print "passive"
            self.passive = True
        elif take_focus and not input:
            print self.get_wm_name()
            print "global_active"
            self.global_active = True
        else:
            print "no_input"
            self.no_input = True
and from the print statements I know that it is working. Window.focus() is
now:
    def focus(self):
        if self.passive :
            self.conn.core.SetInputFocus(xproto.InputFocus.PointerRoot,
self.win)
        elif self.local_active:
            err =
self.conn.core.SetInputFocusChecked(xproto.InputFocus.PointerRoot, self.win)
            err.check()
            packed = event.pack_client_message(self.win, "WM_PROTOCOLS",
util.get_atom("WM_TAKE_FOCUS"), xproto.Time.CurrentTime)
            err = event.send_event_checked(self.win, [],packed)
            err.check()
        elif self.global_active:
            packed = event.pack_client_message(self.win, "WM_PROTOCOLS",
util.get_atom("WM_TAKE_FOCUS"), xproto.Time.CurrentTime)
            err = event.send_event_checked(self.win, [],packed)
            err.check()
        else:
            return

        ewmh.set_active_window(self.win)
according to the checked requests, everything is fine, i.e. no exceptions.
Insofar as I can understand, I am following the icccm.

-- 
Praising my Savior all the day long,
Micah Nordland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/xcb/attachments/20120825/c8763167/attachment.html>


More information about the Xcb mailing list