RE: tracking mouse pointer
- From: "Tom Liu" <tom liu flextrade com>
- To: "'Paul Pogonyshev'" <pogonyshev gmx net>, <gtk-app-devel-list gnome org>
- Subject: RE: tracking mouse pointer
- Date: Tue, 30 Dec 2003 09:35:25 -0500
This is my test program to handle the motion, the event->state tell you
the key sataus like shift or ctrl.
gboolean butt_motion(GtkWidget *widget, GdkEventMotion *event,
gpointer user_data)
{
printf("buttonmotion:%s,%x\n",user_data,event->state);
int x, y;
GdkModifierType state;
gdk_window_get_pointer (event->window, &x, &y, &state);
return TRUE;
}
-----Original Message-----
From: gtk-app-devel-list-admin gnome org [mailto:gtk-app-devel-list-
admin gnome org] On Behalf Of Paul Pogonyshev
Sent: Monday, December 29, 2003 10:12 PM
To: gtk-app-devel-list gnome org
Subject: tracking mouse pointer
Hi.
In my application, i use a widget that can be clicked for certain
actions.
As the pointer is moved over the widget, it provides a visual
feedback,
which hints about particular action that will be performed at given
position.
In general, it works just fine by intercepting "motion-notify-event".
There
are two minor, but annoying problems, though.
First of all, i would like it to provide feedback when the window
containing
the widget is "popped" (i.e shown, deiconified, or maybe shown
together
with
its desktop etc.) I tried to make "show", "map" or
"enter-notify-event"
callbacks to call gtk_widget_get_pointer() and use its information,
but
either that didn't work at all, or the coordinates were wrong. Any
ideas?
Another problem is that i use modifier keys (like Shift) to alter the
action
performed. This would in turn alter the feedback depending on
currently
pressed keys. However, i have to use events like
"key-(press|release)-
event"
instead of "motion-notify-event" (one can (de)press Shift without
touching
his mouse) and those events report "lagged" modifiers. I.e. event
structure
for a "key-press-event" for Shift would still claim that Shift is
depressed.
Is there some way to get proper modifiers, or do i have to do that by
hands?
Paul Pogonyshev
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]