Bug 5311

Summary: Spurious events when menu is popped up
Product: xorg Reporter: Ron Yorston <rmy>
Component: Server/GeneralAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED NOTABUG QA Contact:
Severity: normal    
Priority: high    
Version: 6.8.2   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Test program none

Description Ron Yorston 2005-12-11 04:24:34 UTC
The attached test program is based on an example from the O'Reilly Motif book
and xev.  To see the problem:

   Run the program
   Click MB1 in the drawing area
   Press MB3 to pop up the menu
   Select Exit

The program prints all events processed.  The interesting events are those
associated with the MB3 press.  (The MB1 press is just for orientation.)  I've
tried this with the following X servers:

   Xsun 6.4.1.0 (Solaris 8)
   XFree86 4.2.1 (Red Hat 7.3)
   XFree86 4.3.0 (CentOS 3)
   X.org 6.7.0 (Fedora Core 3)

In each case the events look like this:

ButtonPress event, serial 321, synthetic NO, window 0x220001d,
    root 0x3a, subw 0x0, time 301894, (42,51), root:(51,77),
    state 0x0, button 1, same_screen YES
button press

ButtonRelease event, serial 321, synthetic NO, window 0x220001d,
    root 0x3a, subw 0x0, time 301962, (42,51), root:(51,77),
    state 0x100, button 1, same_screen YES

ButtonPress event, serial 322, synthetic NO, window 0x220001d,
    root 0x3a, subw 0x0, time 303195, (42,51), root:(51,77),
    state 0x0, button 3, same_screen YES
button press

ConfigureNotify event, serial 325, synthetic NO, window 0x2200015,
    event 0x2200015, window 0x2200015, (51,77), width 99, height 90,
    border_width 0, above 0x2200002, override YES

I've tried the same thing with some 6.8 servers:

   X.org 6.8.1 (Centos 4.0)
   X.org 6.8.2 (RHEL 4 update 2)

The events I see here are:

ButtonPress event, serial 321, synthetic NO, window 0x2e0001d,
    root 0x48, subw 0x0, time 78326, (62,54), root:(71,80),
    state 0x0, button 1, same_screen YES
button press

ButtonRelease event, serial 322, synthetic NO, window 0x2e0001d,
    root 0x48, subw 0x0, time 78422, (62,54), root:(71,80),
    state 0x100, button 1, same_screen YES

LeaveNotify event, serial 322, synthetic NO, window 0x2e0001d,
    root 0x48, subw 0x0, time 79535, (62,54), root:(71,80),
    mode NotifyGrab, detail NotifyAncestor, same_screen YES,
    focus YES, state 1024

EnterNotify event, serial 322, synthetic NO, window 0x2e00018,
    root 0x48, subw 0x0, time 79535, (66,58), root:(71,80),
    mode NotifyGrab, detail NotifyInferior, same_screen YES,
    focus YES, state 1024

LeaveNotify event, serial 322, synthetic NO, window 0x2e00018,
    root 0x48, subw 0x0, time 79538, (66,58), root:(71,80),
    mode NotifyUngrab, detail NotifyInferior, same_screen YES,
    focus YES, state 1024

EnterNotify event, serial 322, synthetic NO, window 0x2e00019,
    root 0x48, subw 0x2e0001c, time 79538, (66,58), root:(71,80),
    mode NotifyUngrab, detail NotifyVirtual, same_screen YES,
    focus YES, state 1024

EnterNotify event, serial 322, synthetic NO, window 0x2e0001d,
    root 0x48, subw 0x0, time 79538, (62,54), root:(71,80),
    mode NotifyUngrab, detail NotifyAncestor, same_screen YES,
    focus YES, state 1024

MotionNotify event, serial 322, synthetic NO, window 0x2e0001d,
    root 0x48, subw 0x0, time 79538, (62,54), root:(71,80),
    state 0x400, is_hint 0, same_screen YES
mouse move

ButtonPress event, serial 322, synthetic NO, window 0x2e0001d,
    root 0x48, subw 0x0, time 79535, (62,54), root:(71,80),
    state 0x0, button 3, same_screen YES
button press

ConfigureNotify event, serial 325, synthetic NO, window 0x2e00015,
    event 0x2e00015, window 0x2e00015, (71,80), width 99, height 90,
    border_width 0, above 0x2e00002, override YES

That is, between the MB1 release and the MB3 press there's a whole heap of
events that I wasn't expecting.  In particular, our programs were very confused
by the MotionNotify event with state 0x400 (MB3 pressed).

The mouse hasn't moved, so why do we get a MotionNotify event?
Comment 1 Ron Yorston 2005-12-11 04:27:04 UTC
Created attachment 4066 [details]
Test program
Comment 2 Ron Yorston 2006-02-26 00:04:54 UTC
I've now tested this with the X.org server that comes with Fedora Core 5 Test 3.
 I think this is 7.0, though all the separate parts now have their own version
number.

Anyway, the problem is also present in this version.
Comment 3 Ron Yorston 2006-02-27 04:02:44 UTC
This seems to depend on the window manager.  With X.org 7.0 on FC5t3 I get
spurious events with the following:

   kwin 3.5.1
   metacity 2.4.55
   metacity 2.13.89

With the following I don't get the spurious events:

   twm from X.org 7.0
   fvwm 2.4.19
   fvwm 2.5.16
   no window manager at all
Comment 4 Ron Yorston 2006-07-14 03:05:13 UTC
It seems that the spurious events I was seeing are due to the way metacity
works.  There's a discussion about these issues here:

   http://bugzilla.gnome.org/show_bug.cgi?id=115072

See comments #55 and #57. 

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.