Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt 5 menus closing immediately #556

Closed
totaam opened this issue Apr 7, 2014 · 18 comments
Closed

Qt 5 menus closing immediately #556

totaam opened this issue Apr 7, 2014 · 18 comments

Comments

@totaam
Copy link
Collaborator

totaam commented Apr 7, 2014

Issue migrated from trac ticket # 556

component: server | priority: critical | resolution: fixed

2014-04-07 14:28:08: rikky created the issue


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.

@totaam
Copy link
Collaborator Author

totaam commented Apr 7, 2014

2014-04-07 14:29:07: totaam changed priority from major to critical

@totaam
Copy link
Collaborator Author

totaam commented Apr 7, 2014

2014-04-07 14:29:07: totaam changed status from new to assigned

@totaam
Copy link
Collaborator Author

totaam commented Apr 7, 2014

2014-04-07 14:29:07: totaam changed owner from antoine to totaam

@totaam
Copy link
Collaborator Author

totaam commented Apr 7, 2014

2014-04-07 14:29:07: totaam commented


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

@totaam
Copy link
Collaborator Author

totaam commented Apr 7, 2014

2014-04-07 14:38:42: rikky commented


I see this issue with Qt Creator 3.

@totaam
Copy link
Collaborator Author

totaam commented Apr 7, 2014

2014-04-07 15:15:59: rikky commented


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

@totaam
Copy link
Collaborator Author

totaam commented Apr 7, 2014

2014-04-07 15:16:58: totaam uploaded file disable-grabs.patch (1.3 KiB)

disables the grab helper code

@totaam
Copy link
Collaborator Author

totaam commented Apr 7, 2014

2014-04-07 15:18:23: totaam commented


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.

@totaam
Copy link
Collaborator Author

totaam commented Apr 7, 2014

2014-04-07 15:31:48: rikky commented


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

@totaam
Copy link
Collaborator Author

totaam commented Apr 7, 2014

2014-04-07 15:55:13: totaam commented


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.

@totaam
Copy link
Collaborator Author

totaam commented Apr 8, 2014

2014-04-08 05:23:04: totaam commented


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)

@totaam
Copy link
Collaborator Author

totaam commented Apr 8, 2014

2014-04-08 11:17:48: totaam changed status from assigned to new

@totaam
Copy link
Collaborator Author

totaam commented Apr 8, 2014

2014-04-08 11:17:48: totaam changed owner from totaam to rikky

@totaam
Copy link
Collaborator Author

totaam commented Apr 8, 2014

2014-04-08 11:17:48: totaam commented


With r6057, r6058 and r6059 applied, I managed to get enough debugging info to see where the problem was: the [/browser/xpra/trunk/src/xpra/x11/gtk_x11/pointer_grab.py PointerGrabHelper] for each window ended up listening on all the windows up to and including the [/browser/xpra/trunk/src/xpra/x11/gtk_x11/world_window.py 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 [/browser/xpra/trunk/src/xpra/x11/gtk_x11/composite.py CompositeHelper] and may prevent unnecessary pixmap refreshes on focus events.

@rikky: does r6060 work for you too?

Regarding:
[[BR]]

The window menu context is drawn a little bit too high, but that is not an real issue
[[BR]]
I have moved this one to #557, it is actually a huge regression - please take a look.

@totaam
Copy link
Collaborator Author

totaam commented Apr 10, 2014

2014-04-10 13:12:28: rikky commented


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

@totaam
Copy link
Collaborator Author

totaam commented Apr 10, 2014

2014-04-10 14:54:45: rikky changed status from new to closed

@totaam
Copy link
Collaborator Author

totaam commented Apr 10, 2014

2014-04-10 14:54:45: rikky changed resolution from ** to fixed

@totaam totaam closed this as completed Apr 10, 2014
@totaam
Copy link
Collaborator Author

totaam commented Apr 19, 2014

2014-04-19 04:49:52: totaam commented


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant