Re: how to determine if a window has been entered/exited



Hey Brian,

I'm really glad that helped :)

There light be, however, a problem with that impl. I could not find a
fix myself.

Actually the code I sent comes from my taskbar for xfce4. It's used for
the "autohide" stuff.

Unfortunately, it happen that this particular code doesn't work when a
menu that is wider than the window is opened. The menu grabs the
keyboard/mouse and if the user clicks on a menu item outside the
toplevel window, then the toplevel window doesn't receive the leave
notify event...

A bit of ASCII art to explain what I mean:

+----------------+
|Toplevel window |
| +-------+      |
| | Menu  |      |
| |-------|      |
+-|Entry 1|------+
  |Entry 2|   
  |...    |  
  |Entry n|
  +-------+

If the user clicks on <Entry n> for example, the toplevel window will
not receive the leave notify event.

I noticed that the GNOME panel suffer the same problem. It won't hide if
a taskbar menu is popped up/popped down.

It's not a major issue for me and my taskbar, but I guess you might like
to know... 

On the other hand if you (or someone else) find an easy work arround
this problem, I'd like to know :)

Cheers,
Olivier.



Cheers,
Olivier.

On Thu, 2003-05-08 at 16:58, Brian Cameron wrote:
> Oliver:
> 
> Much apologies.  I misread your suggestion.  Now that I see the "!="
> instead of "==", your suggestion is working much better.
> 
> Problem solved.  Thanks for helping!
> 
> Brian
> 
> > > Brian Cameron <Brian Cameron sun com> writes:
> > > 
> > > > Since the GdkCrossing structure only gives you the x/y location
> > > > at the time that the event was generated, it seems impossible to use
> > > > this to determine if the user entered the window from outside window
> > > > or if the user entered the window from a button (and the similar
> > > > problem for leaving).
> > > 
> > > I think you should be able to differentiate between these events by
> > > looking at the GdkNotifyType which is part of the GdkCrossing
> > > structure.
> > 
> > Unfortunately this doesn't seem to be the case. Using a few programs
> > to check, I notice that the detail is either NotifyVirtual or
> > NotifyAncestor when I move the mouse into the window.  You can see
> > this using the example GTK_MODULE that I sent in my last email.
> > Just run gnome-calculator as follows, for example:
> > 
> >   gnome-calculator --gtk-module=/path/dwellmouselistener.so
> > 
> > The "detail" value seems to be NotifyAncestor if the mouse is moving
> > into an area of the screen that is considered a part of the GtkWindow
> > (like the areas around the calculator buttons).  It is NotifyVirtual
> > otherwise. 
> > 
> > Using gnome-calculator for an example, I get "NotifyVirtual" if I
> > move into the menubar or the numerical display area of the screen
> > and I get "NotifyAncestor" if I move into the area where the buttons
> > are located.  The difference seems to be that the areas around the
> > buttons are considered a part of the GtkWindow whereas the menubar
> > and numerical display area don't have such space around them.  I
> > notice similar behavior with other programs.
> > 
> > I can get other "NotifyAncestor" enter events to happen moving around 
> > within the window.  I can't seem to find a situation where I can get
> > "MotionVirtual" to happen without entering the window from outside
> > the border.  So it doesn't seem that this is the full solution, 
> > unless there is something I am still missing.
> > 
> > I have also tried calling gdk_window_get_frame_extents and comparing
> > the values with the x_root and y_root that are passed in with the 
> > event.  I was hoping that I could use these to help me determine if
> > the mouse truly entered or left the window.  Unfortunately I notice
> > that this doesn't work either.  Sometimes you leave the window and
> > it tells you that the x_root and y_root are still inside the window.
> > sigh...  The new attachment shows this problem.
> > 
> > So Oliver's suggestion to use NotifyInferior doesn't seem to be 
> > a help, nor do I see how to use this GdkNotifyType in general
> > to determine the situation either.
> > 
> > Brian
> 
> 
> Brian
> 
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list
-- 
Olivier Fourdan <fourdan xfce org>
http://www.xfce.org




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]