Xlib python: cannot map firefox menus
Asked Answered
T

2

1

I'm making a small window manager based on:

simplewm.py https://github.com/mpnordland/Mozzarella/blob/master/cheesewm.py~

I'm trying to get firefox working but have been unable to get the unmapped windows (which are the firefox menu/right click options) to appear.

I have tried window.map() however that only makes the menu flicker and disappear again. It also causes an event of "Xlib.X.UnmapNotify"

When I right click (or click the menu) in firefox it causes 2 xlib events:

    Xlib.protocol.event.ClientMessage(type = 161, window = <Xlib.display.Window 0x010005a9>, client_type = 343, data = (32, array('I', [0L, 383L, 0L, 0L, 0L])), sequence_number = 3106)


    Xlib.protocol.event.UnmapNotify(window = <Xlib.display.Window 0x010005a9>, type = 146, event = <Xlib.display.Window 0x00000292>, sequence_number = 3108, from_configure = 0)

So it would appear Firefox is unmapping the menus I'm trying to map... :/

Toxicity answered 4/9, 2015 at 5:36 Comment(0)
T
0

Found it!

The issue is with the window focus. Firefox will not allow the menu or right click dialog box to stay open unless the input focus is set on the main Firefox window.

window.set_input_focus(Xlib.X.RevertToPointerRoot, Xlib.X.CurrentTime)
Toxicity answered 5/9, 2015 at 0:6 Comment(2)
Ok, i'm having the exact same problem, but this solution doesn't seems to solve the problem. What happens is that after the mapnotify event, i have two UnMapNotify. Here my SO question: https://mcmap.net/q/321377/-xlib-and-firefox-behavior if you can help i will appreciate! (i'm stuck with that problem since july :D)Burgeon
And another question, when do you set_input_focus? in which event?Burgeon
B
0

I've been searching for a solution for about a week too and this helped.

More specifically set_input_focus() has to be called on the main client window when you get an EnterNotify on the frame window. (That is, in a focus-follows-mouse mode). It doesn't seem to matter whether you use RevertToPointerRoot or RevertToParent.

Burgeon answered 5/9, 2015 at 20:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.