After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 102209 - clicking on window causes leave/enter events
clicking on window causes leave/enter events
Status: RESOLVED NOTGNOME
Product: metacity
Classification: Other
Component: general
2.4.x
Other other
: High normal
: ---
Assigned To: Metacity maintainers list
Metacity maintainers list
: 98233 114625 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2002-12-30 12:37 UTC by Gustavo Carneiro
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.3/2.4


Attachments
A small gtk test program (1.40 KB, application/octet-stream)
2002-12-30 12:38 UTC, Gustavo Carneiro
Details

Description Gustavo Carneiro 2002-12-30 12:37:49 UTC
I made a small test program. With metacity, when I click on the window, I
receive the following events:

** Message: leave_notify_event
** Message: enter_notify_event
** Message: button_press_event
** Message: -----------

  In contrast, with other window managers (I tested with fvwm2), I get this:
** Message: button_press_event
** Message: -----------

  The extra leave/enter events are crippling a program I'm working on.
Can't this be fixed?
Comment 1 Gustavo Carneiro 2002-12-30 12:38:34 UTC
Created attachment 13272 [details]
A small gtk test program
Comment 2 Havoc Pennington 2003-02-25 21:38:45 UTC
*** Bug 98233 has been marked as a duplicate of this bug. ***
Comment 3 Kjartan Maraas 2003-05-11 15:25:12 UTC
This is still the same I assume?
Comment 4 Havoc Pennington 2003-06-07 05:07:35 UTC
I checked in a fix that should work, give it a try.
Comment 5 Havoc Pennington 2003-06-07 17:35:35 UTC
*** Bug 114625 has been marked as a duplicate of this bug. ***
Comment 6 Rob Adams 2003-06-07 21:27:18 UTC
This fix seems to have made it so that windows don't raise any more on
click, unless it's a frame click.  Was this intended?
Comment 7 Havoc Pennington 2003-06-07 23:37:44 UTC
Was not intended, but on the other hand it works for me.

I guess in sloppy focus you can focus a window without raising it
and then you'd have that problem. I was thinking of changing 
back to no-raise-on-click in mouse focus mode anyway, coincidentally.
Though this is kind of an odd way to implement that.

I guess the way to fix the problem would be to select for 
button press events, but don't do the XGrabButton.

Anyhow let's open a new bug for that.
Comment 8 oa 2003-07-25 22:54:26 UTC
what's the new bug? I upgraded to gnome 2.3.3 from 2.2.2, and windows
became very difficult to raise (I'm using sloppy focus).

Actually, a raise on doubleclick would make me happiest, but I'd
gladly take back the old functionality. Looking for the frame to raise
windows makes sloppy focus nearly useless.
Comment 9 oa 2003-07-26 22:52:25 UTC
Hmm. I realized I'm being inconsistent, having asked for pretty much
the opposite earlier. The power of habit, or something.
Comment 10 Rob Adams 2004-01-05 07:25:05 UTC
this bug is back in sloppy and mouse focus, but unfortunately we can't
fix it.  Workaround is to use click-to-focus.  Long-term the X
protocol should be changed to allow this to be fixed properly.
Comment 11 Gregory Merchan 2004-01-05 08:41:25 UTC
if ((GdkEventCrossing *) event->mode == GDK_CROSSING_NORMAL)
  {
    /* Do whatever you want to do when the pointer
     * really enters or leaves the window.
     */
  }
else
  {
    /* Don't do it. */
  }
Comment 12 Gustavo Carneiro 2004-01-05 12:10:23 UTC
  I find it strange that this is a problem with X protocol,
considering that other window manager don't show this problem at all.
Comment 13 Havoc Pennington 2004-01-05 14:05:08 UTC
If you know another WM without this problem in the case of:
mouse/sloppy focus, and *raising on click of the window client area*,
then please let us know which WM that is and we'll look at how it does it.
Comment 14 Gustavo Carneiro 2004-01-05 14:25:50 UTC
  As I mentioned at the top of this report, I tested fvwm2 and it
works well.  I just don't exactly remember if fvwm2 uses "sloppy focs"
or "focus follows mouse" by default.  I tested now Window Maker
(0.80.1) with "sloppy focus", and it also works fine.
  To tell the truth, now I'm using metacity with "click to focus" :P 
But still this could lead to buggy behaviour in some applications when
used with metacity in "sloppy focus" mode.  Not to mention the
additional processing required by some canvas systems that change
state of objects on enter/leave notify, for example.
Comment 15 Gregory Merchan 2004-01-07 05:25:30 UTC
Damn C syntax; parentheses are needed around the cast and `event'.

if (((GdkEventCrossing *) event)->mode == GDK_CROSSING_NORMAL)
  {
    ... etc.
Comment 16 Havoc Pennington 2004-01-07 14:15:35 UTC
The problem with simply ignoring enter/leave caused by a grab is that
the mouse can move during the grab, and grabs can be caused by lots of
clients in lots of situations. So if you ignore these events you can
also get bugs where the wrong window is focused.
Comment 17 Gregory Merchan 2004-01-08 00:36:15 UTC
Ignoring the grab crossings is for applications, not the window
manager. However, indeed it semes the grab/ungrab crossings can't
just be ignored for what Mozilla is trying to do - they need the
real `mouseout'.

There's at least one other way for mozilla to get the `mouseout'.
When it needs to know where the pointer is, it can query the
pointer. Xeyes does this and so it is able to update regardless of
grabs. Of course, Mozilla, unlike Xeyes, should not query the
pointer all of the time.

In other words, the resolution of this bug is correct.
The problem is not GNOME's. It's not even X's.