xpra icon
Bug tracker and wiki

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#556 closed defect (fixed)

Qt 5 menus closing immediately

Reported by: rikky Owned by: rikky
Priority: critical Milestone:
Component: server Version: 0.12.x
Keywords: Cc:

Description

Since version 0.12.0-1 menus of qt 5.0 apps are closed immediately. You only see the menu flash open for a very short time. The left click window menu and the right click context menus are affected. Going back to 0.11.6-1 fixes the issue.

The server is running on Ubuntu Saucy 64-bit and I tested with a local (mmap) client and a remote Windows client. The client type and version makes no difference, only the server version seems to matter.

Attachments (1)

disable-grabs.patch (1.3 KB) - added by Antoine Martin 6 years ago.
disables the grab helper code

Download all attachments as: .zip

Change History (12)

comment:1 Changed 6 years ago by Antoine Martin

Owner: changed from Antoine Martin to Antoine Martin
Priority: majorcritical
Status: newassigned

Do you have an example application I can use for testing?

comment:2 Changed 6 years ago by rikky

I see this issue with Qt Creator 3.

comment:3 Changed 6 years ago by rikky

Sorry. Forgot to mention. I start qtcreator in a chroot and therefore qtcreator uses some older X client libs than in default Ubuntu Saucy. Maybe the blinking menu is related to these libs. i.e libxext6 2:1.1.1-2ubuntu0.1 instead of 2:1.3.2-1

Changed 6 years ago by Antoine Martin

Attachment: disable-grabs.patch added

disables the grab helper code

comment:4 Changed 6 years ago by Antoine Martin

Thanks for the details, I believe I have narrowed it down to the new "grab" code in 0.12

You should be able to work as normal by applying attachment/ticket/556/disable-grabs.patch, it works for me with the qt5 calculator example's context menu.

comment:5 Changed 6 years ago by rikky

That was quick. Thanks. The patch works great. The right click menu is perfect now. The window menu context is drawn a little bit to high, but that is not an real issue. Thanks

comment:6 Changed 6 years ago by Antoine Martin

The plot thickens: it only misbehaves if I have another xpra window active anywhere on screen (ie: even just an xterm), but not if it is minimized.

I think that the grab code ends up listening for too many windows, and emits an ungrab for the other window, causing the menu to close.

comment:7 Changed 6 years ago by Antoine Martin

With just the calculator shown (wid=2, xid=0xa00006=10485766L): I focus it, right click in the text area, the menu comes up, then I click outside it and it disappears:

  • server side (sanitized):
    10:58:35,975 focus_out_event(<X11Event { \
        'send_event': 0, 'delivered_to_xid': 4194335L, 'xid': 4194335L, \
        'detail': 3, 'mode': 0, 'serial': 1872L, 'type': 10 \
        }>) mode=NotifyNormal
    10:58:38,347 PointerGrabHelper.__init__(0xa0000f)
    10:58:38,351 grab: listening for: ['0xa0000fL']
    10:58:38,352 focus_out_event(<X11Event { \
        'send_event': 0, 'delivered_to_xid': 4194334L, 'xid': 4194334L, \
        'detail': 4, 'mode': 1, 'serial': 2256L, 'type': 10 \
        }>) mode=NotifyGrab
    10:58:38,352 emitting grab on PointerGrabHelper(0xa00006)
    10:58:45,207 focus_in_event(<X11Event {
        'send_event': 0, 'delivered_to_xid': 4194334L, 'xid': 4194334L, \
        'detail': 4, 'mode': 2, 'serial': 2874L, 'type': 9 \
        }>) mode=NotifyUngrab
    10:58:45,208 emitting ungrab on PointerGrabHelper(0xa00006)
    10:58:45,211 force ungrab (has_grab=False) destroying window
    10:58:45,212 grab: unmap <X11Event { \
        'send_event': 0, 'delivered_to_xid': 10485775L, 'xid': 10485775L, \
        'serial': 2874L, 'type': 18}>
    10:58:45,212 force ungrab (has_grab=False) <X11Event { \
        'send_event': 0, 'delivered_to_xid': 10485775L, 'xid': 10485775L, \
        'serial': 2874L, 'type': 18}>
    
  • client side:
    10:58:35,972 focus-in-event for wid=2
    10:58:35,972 GLClientWindow(2 : GLPixmapBacking(2, (314, 301), None)) \
        focus_change((ClientWindow(2), <GParamBoolean 'has-toplevel-focus'>)) \
        had-toplevel-focus=False, has-toplevel-focus=True, _been_mapped=True
    10:58:35,973 update_focus(2, True) _focused=None
    10:58:35,973 send_focus(2)
    10:58:38,402 grabbing GLClientWindow(2 : GLPixmapBacking(2, (314, 301), None))
    10:58:45,212 ungrabbing GLClientWindow(2 : GLPixmapBacking(2, (314, 301), None))
    10:58:45,215 _unfocus() wid=3
    10:58:45,915 focus-out-event for wid=2
    10:58:45,916 GLClientWindow(2 : GLPixmapBacking(2, (314, 301), None)) \
        focus_change((ClientWindow(2), <GParamBoolean 'has-toplevel-focus'>)) \
        had-toplevel-focus=True, has-toplevel-focus=False, _been_mapped=True
    10:58:45,916 update_focus(2, False) _focused=2
    10:58:45,916 send_focus(0)
    

Now with the xterm (wid=1, xid=0x800022=8388642) also shown (buggy):

  • server side:
    11:10:21,615 focus_out_event(<X11Event { \
        'send_event': 0, 'delivered_to_xid': 4194335L, 'xid': 4194335L, 'detail': 3, \
        'mode': 0, 'serial': 4326L, 'type': 10 \
        }>) mode=NotifyNormal
    11:10:21,615 focus_out_event(<X11Event { \
        'send_event': 0, 'delivered_to_xid': 4194335L, 'xid': 4194335L, 'detail': 3, \
        'mode': 0, 'serial': 4326L, 'type': 10, \
        }>) mode=NotifyNormal
    11:10:23,365 PointerGrabHelper.__init__(0xa00014)
    11:10:23,369 grab: listening for: ['0xa00014L']
    11:10:23,373 focus_out_event(<X11Event { \
        'send_event': 0, 'delivered_to_xid': 4194334L, 'xid': 4194334L, 'detail': 4, \
        'mode': 1, 'serial': 4507L, 'type': 10, \
        }>) mode=NotifyGrab
    11:10:23,373 emitting grab on PointerGrabHelper(0x800022)
    11:10:23,373 focus_out_event(<X11Event { \
        'send_event': 0, 'delivered_to_xid': 4194334L, 'xid': 4194334L, 'detail': 4, \
        'mode': 1, 'serial': 4507L, 'type': 10, \
        }>) mode=NotifyGrab
    11:10:23,373 emitting grab on PointerGrabHelper(0xa00006)
    11:10:23,494 focus_in_event(<X11Event { \
        'send_event': 0, 'delivered_to_xid': 4194335L, 'xid': 4194335L, 'detail': 3, \
        'mode': 3, 'serial': 4590L, 'type': 9, \
        }>) mode=None
    11:10:23,495 focus_in_event(<X11Event { \
        'send_event': 0, 'delivered_to_xid': 4194335L, 'xid': 4194335L, 'detail': 3, \
        'mode': 3, 'serial': 4590L, 'type': 9, \
        }>) mode=None
    11:10:23,495 focus_in_event(<X11Event { \
        'send_event': 0, 'delivered_to_xid': 4194334L, 'xid': 4194334L, 'detail': 4, \
        'mode': 2, 'serial': 4591L, 'type': 9, \
        }>) mode=NotifyUngrab
    11:10:23,496 emitting ungrab on PointerGrabHelper(0x800022)
    11:10:23,496 focus_in_event(<X11Event { \
        'send_event': 0, 'delivered_to_xid': 4194334L, 'xid': 4194334L, 'detail': 4, \
        'mode': 2, 'serial': 4591L, 'type': 9, \
        }>) mode=NotifyUngrab
    11:10:23,496 emitting ungrab on PointerGrabHelper(0xa00006)
    11:10:23,498 focus_in_event(<X11Event { \
        'send_event': 0, 'delivered_to_xid': 4194335L, 'xid': 4194335L, 'detail': 3, \
        'mode': 2, 'serial': 4591L, 'type': 9, \
        }>) mode=NotifyUngrab
    11:10:23,498 emitting ungrab on PointerGrabHelper(0x800022)
    11:10:23,498 focus_in_event(<X11Event { \
        'send_event': 0, 'delivered_to_xid': 4194335L, 'xid': 4194335L, 'detail': 3, \
        'mode': 2, 'serial': 4591L, 'type': 9, \
        }>) mode=NotifyUngrab
    11:10:23,499 emitting ungrab on PointerGrabHelper(0xa00006)
    11:10:23,500 force ungrab (has_grab=False) destroying window
    11:10:23,500 grab: unmap <X11Event { \
        'send_event': 0, 'delivered_to_xid': 10485780L, 'xid': 10485780L, \
        'serial': 4591L, 'type': 18}>
    11:10:23,500 force ungrab (has_grab=False) <X11Event { \
        'send_event': 0, 'delivered_to_xid': 10485780L, 'xid': 10485780L, \
        'serial': 4591L, 'type': 18}>
    11:10:23,518 focus_out_event(<X11Event { \
        'send_event': 0, 'delivered_to_xid': 4194335L, 'xid': 4194335L, 'detail': 3, \
        'mode': 0, 'serial': 4637L, 'type': 10, \
        }>) mode=NotifyNormal
    11:10:23,518 focus_out_event(<X11Event { \
        'send_event': 0, 'delivered_to_xid': 4194335L, 'xid': 4194335L, 'detail': 3, \
        'mode': 0, 'serial': 4637L, 'type': 10, \
        }>) mode=NotifyNormal
    11:10:25,303 focus_in_event(<X11Event { \
        'send_event': 0, 'delivered_to_xid': 4194335L, 'xid': 4194335L, 'detail': 3, \
        'mode': 0, 'serial': 4735L, 'type': 9, \
        }>) mode=NotifyNormal
    11:10:25,303 focus_in_event(<X11Event { \
        'send_event': 0, 'delivered_to_xid': 4194335L, 'xid': 4194335L, 'detail': 3, \
        'mode': 0, 'serial': 4735L, 'type': 9, \
        }>) mode=NotifyNormal
    
  • client side:
    11:10:21,612 focus-in-event for wid=2
    11:10:21,613 GLClientWindow(2 : GLPixmapBacking(2, (314, 301), None)) \
        focus_change((ClientWindow(2), <GParamBoolean 'has-toplevel-focus'>)) \
        had-toplevel-focus=False, has-toplevel-focus=True, _been_mapped=True
    11:10:21,613 update_focus(2, True) _focused=None
    11:10:21,613 send_focus(2)
    11:10:23,460 grabbing GLClientWindow(1 : GLPixmapBacking(1, (499, 316), None))
    11:10:23,461 grabbing GLClientWindow(2 : GLPixmapBacking(2, (314, 301), None))
    11:10:23,490 focus-out-event for wid=2
    11:10:23,490 GLClientWindow(2 : GLPixmapBacking(2, (314, 301), None)) \
        focus_change((ClientWindow(2), <GParamBoolean 'has-toplevel-focus'>)) \
        had-toplevel-focus=True, has-toplevel-focus=False, _been_mapped=True
    11:10:23,491 update_focus(2, False) _focused=2
    11:10:23,491 send_focus(0)
    11:10:23,492 focus-in-event for wid=1
    11:10:23,492 GLClientWindow(1 : GLPixmapBacking(1, (499, 316), None)) \
        focus_change((ClientWindow(1), <GParamBoolean 'has-toplevel-focus'>)) \
        had-toplevel-focus=False, has-toplevel-focus=True, _been_mapped=True
    11:10:23,492 update_focus(1, True) _focused=None
    11:10:23,493 send_focus(1)
    11:10:23,493 focus-out-event for wid=1
    11:10:23,494 GLClientWindow(1 : GLPixmapBacking(1, (499, 316), None)) \
        focus_change((ClientWindow(1), <GParamBoolean 'has-toplevel-focus'>)) \
        had-toplevel-focus=True, has-toplevel-focus=False, _been_mapped=True
    11:10:23,494 update_focus(1, False) _focused=1
    11:10:23,494 send_focus(0)
    11:10:23,494 focus-in-event for wid=2
    11:10:23,494 GLClientWindow(2 : GLPixmapBacking(2, (314, 301), None)) \
        focus_change((ClientWindow(2), <GParamBoolean 'has-toplevel-focus'>)) \
        had-toplevel-focus=False, has-toplevel-focus=True, _been_mapped=True
    11:10:23,495 update_focus(2, True) _focused=None
    11:10:23,495 send_focus(2)
    11:10:23,497 ungrabbing GLClientWindow(1 : GLPixmapBacking(1, (499, 316), None))
    11:10:23,498 ungrabbing GLClientWindow(2 : GLPixmapBacking(2, (314, 301), None))
    11:10:23,531 ungrabbing GLClientWindow(1 : GLPixmapBacking(1, (499, 316), None))
    11:10:23,531 ungrabbing GLClientWindow(2 : GLPixmapBacking(2, (314, 301), None))
    11:10:23,534 _unfocus() wid=4
    11:10:25,299 focus-out-event for wid=2
    11:10:25,299 GLClientWindow(2 : GLPixmapBacking(2, (314, 301), None)) \
        focus_change((ClientWindow(2), <GParamBoolean 'has-toplevel-focus'>)) \
        had-toplevel-focus=True, has-toplevel-focus=False, _been_mapped=True
    11:10:25,300 update_focus(2, False) _focused=2
    11:10:25,300 send_focus(0)
    
Last edited 6 years ago by Antoine Martin (previous) (diff)

comment:8 Changed 6 years ago by Antoine Martin

Owner: changed from Antoine Martin to rikky
Status: assignednew

With r6057, r6058 and r6059 applied, I managed to get enough debugging info to see where the problem was: the PointerGrabHelper for each window ended up listening on all the windows up to and including the world window which we use for focus events.
So when the grab happened on the second window, both windows got the grab events and we duly forwarded one after the other to the client, which caused a focus event when the first one lost its grab to the second one... breaking the grab and closing the menu window.

r6060 fixes this. It isn't particularly elegant as it introduces a dependency from the window helpers to the world window - which is a little ugly, but it solves the problem for me, and this is the minimal patch suitable for a v0.12.x backport. I may yet do things differently for trunk if I can find a cleaner or better approach. Also, the same thing may be useful for CompositeHelper and may prevent unnecessary pixmap refreshes on focus events.

@rikky: does r6060 work for you too?

Regarding:

The window menu context is drawn a little bit too high, but that is not an real issue


I have moved this one to #557

Version 1, edited 6 years ago by Antoine Martin (previous) (next) (diff)

comment:9 Changed 6 years ago by rikky

I just tested with 0.12.3-1 and this issue is fixed. Also the position of the context menu is perfect now. thanks

comment:10 Changed 6 years ago by rikky

Resolution: fixed
Status: newclosed

comment:11 Changed 6 years ago by Antoine Martin

Unfortunately... this broke grabs (#139).

Note: See TracTickets for help on using tickets.