Re: gtk_widget_set_sensitive and mouse pointer



On Mon, 14 Jul 2008 09:34:13 -0400
"Eric Masson @ Savant Protection" <emasson savantprotection com> wrote:

To fix this, do the following after making the widget sensitive:
gint x,y;
GdkWindow *windowUnderMouse=gdk_window_at_pointer(&x,&y);
if(windowUnderMouse){
    GdkEventCrossing e;
    e.type=GDK_ENTER_NOTIFY;
    e.window=windowUnderMouse;
    e.send_event=1;
    e.subwindow=0;
    e.time=GDK_CURRENT_TIME;
    e.x=0;
    e.y=0;
    e.x_root=0;
    e.y_root=0;
    e.mode=GDK_CROSSING_NORMAL;
    e.detail=GDK_NOTIFY_UNKNOWN;
    e.focus=true;
    e.state=0;
    gdk_event_put((GdkEvent *)&e);
}

I tried porting this piece of code to PyGTK and while it works for the
most part one thing that jumps out is that, if the widget in question
has a tooltip, the tooltip does not show up at the pointer location but
rather in the top left corner of the screen.
One difference between this code and the PyGTK version is that PyGTK
insists on e.subwindow to the a GdkWindow instance (gtk.gdk.Window). I
am setting e.subwindow to windowUnderMouse (which seems to make sense
since it is the window that was entered or left) but I am not sure
whether that creates the problem with the tooltips.

Any input?

-- 
Mitko Haralanov
==========================================
You know, Callahan's is a peaceable bar, but if you ask that dog what
his favorite formatter is, and he says "roff! roff!", well, I'll just
have to...



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