Bug 52456 - [bug] Weston titlebar right-click menu timing issue
Summary: [bug] Weston titlebar right-click menu timing issue
Status: VERIFIED FIXED
Alias: None
Product: Wayland
Classification: Unclassified
Component: weston (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Wayland bug list
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-24 17:42 UTC by Brian Lovin
Modified: 2012-11-27 23:08 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Brian Lovin 2012-07-24 17:42:46 UTC
System Environment:
--------------------------
Distro: Ubuntu 12.04
Arch: x86_64
glproto master ec1eec4355ee4a6c5134f2178192f10b6d28a87a
mesa master 82fc813ca870c4002502e098519bead7bec1a7e8
wayland master eadb68ec32df8ee54ccba175d19adcdedfaa5015
pixman master 56321eff65832791252c7c324930d14c44d4d5f7
weston master 2327d1f490a5362e6b6199ca68b14d11e2f13408
drm master ebd7904877d08525beb5039e4ea2f5b6c0a7c23f
cairo master 21e3f2e9034b64131075d82a4e34868dc72f2249
libX11 master 8042f88ace33573f9d0dfaa21ed54ac7cef266d5
macros master 0890e4003aacfa7113ab3f4e3ad7c5636f8e922a
libxkbcommon master fe4f990902c7cd8f395b9f3be14dc6e8cad7cae9
dri2proto master 4eeacce4c4a300b938b7e3fb78a8e443c491780b
kbproto master 391a1f6de6315fc0196d407d800597488315ccc

Detailed Description:
-----------------------------
Run weston, then start weston-terminal (as an example)
then within ~500ms:
Right click on the title bar
Left click "close" (should be right under mouse cursor, so this is just rightclick-leftclick in quick succession)
Observe that nothing happens until a timeout has passed.

Steps to Reproduce:
----------------------------
1. start weston under X11 or DRM mode
2. ./weston-terminal (as an example, any client should do)
***Quickly (within ~500ms)***:
3. Right-click weston-terminal title bar
4. Left-click "Close"
5. Observe no effect until a timeout has passed and then close works as expected.
Comment 1 Brian Lovin 2012-08-14 22:17:42 UTC
I was looking at this bug earlier and found that it's because of this if statement in weston's clients/window.c:

if (state == WL_POINTER_BUTTON_STATE_PRESSED &&
    time - menu->time > 500) {...}

One can change the time - menu->time compare to > 100 and clicking an item is much snappier, but it seems that this timeout may not be a bug as it is explicitly written this way. Still a bug, should it be fixed?

I also noticed this comment bellow:
/* Either relase after press-drag-release or
 * click-motion-click. */

Which raises another interesting issue with the menu - it doesn't act like the comment suggests, which is the way menus work in X11 and Windows so it seems this is another bug. (The menu commits it's action as soon as the mouse button is depressed, as the if statement says, instead of when the mouse button is released as X11/Win do) I'll leave it in this BZ as another item to fix if it is a bug.

Tested with these sys environments:
glproto master ec1eec4355ee4a6c5134f2178192f10b6d28a87a
mesa master 4e087de51ad0e7ba4a7199d3664e1d096f8dc510
wayland master b57694ca0e9dc7d2845ce9fb0ac9c4b0ebc940ce
pixman master 09cb1ae10b1976970233c934d27c36e0a4203e1c
wayland-test master 14cdb54b5f9320aac9dd3c4dfe490952a40b0250
weston master 4272e639912cac247a04c49ce2a6216100aab65a
drm master 6fa2b29d226306870eebe93afb2106ca7d79569b
efl http://svn.enlightenment.org/svn/e/trunk 74948
cairo master 95b7f4fe3a5deea6766538d843c75626e4bb68cf
libX11 master 8042f88ace33573f9d0dfaa21ed54ac7cef266d5
macros master 0890e4003aacfa7113ab3f4e3ad7c5636f8e922a
libxkbcommon master 4c21275301c453757196d9aa74c00861c0d0d54f
dri2proto master 4eeacce4c4a300b938b7e3fb78a8e443c491780b
kbproto master 391a1f6de6315fc0196d407d800597488315cccb
Comment 2 Kristian Høgsberg 2012-10-30 17:49:48 UTC
commit d2fbb3870cfaea623a87ba28c9587676bbdc93f7
Author: Kristian Høgsberg <krh@bitplanet.net>
Date:   Tue Oct 30 13:45:22 2012 -0400

    window: Make press-drag-release menu selection mode work
    
    The intended behavior is that a quick click (press and then release
    within 500ms) just pops up the menu and doesn't select anything.  Then
    we can mouse around and and click to select an item.  Alternatively, a
    click and hold (ie press and release after 500ms) lets you press right
    button, mouse down on the menu item you want and release to select it.
    This is how menus work in most toolkits.
    
    The handling in weston is fine, it's there to handle the case where
    the button release happens outside any client window, since the client
    doesn't get those events.  If such a release happens late or we get a
    second release outside the popup window we shut down the popup.
    
    The problem is in toytoolkit, where we need to select the item if we
    get a release within 500ms or if we get a second release.  A second
    release is the case where the first release came after 500ms and
    didn't pop down the menu, and the second release event is from a click
    on a menu item.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=52456
Comment 3 Brian Lovin 2012-11-27 23:08:22 UTC
Changing to verified.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.