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



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




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