static gboolean gimp_pick_button_mouse_release (GtkWidget *invisible, GdkEventButton *event, GimpPickButton *button) { gint x_root; gint y_root; if (event->button != 1) return FALSE; gdk_window_get_origin (event->window, &x_root, &y_root); x_root += event->x; y_root += event->y; gimp_pick_button_pick (gdk_event_get_screen ((GdkEvent *) event), x_root, y_root, button); gimp_pick_button_shutdown (button); g_signal_handlers_disconnect_by_func (invisible, gimp_pick_button_mouse_motion, button); g_signal_handlers_disconnect_by_func (invisible, gimp_pick_button_mouse_release, button); return TRUE; }
static gboolean gimp_pick_button_mouse_press (GtkWidget *invisible, GdkEventButton *event, GimpPickButton *button) { if (event->type == GDK_BUTTON_PRESS && event->button == 1) { g_signal_connect (invisible, "motion-notify-event", G_CALLBACK (gimp_pick_button_mouse_motion), button); g_signal_connect (invisible, "button-release-event", G_CALLBACK (gimp_pick_button_mouse_release), button); g_signal_handlers_disconnect_by_func (invisible, gimp_pick_button_mouse_press, button); g_signal_handlers_disconnect_by_func (invisible, gimp_pick_button_key_press, button); gimp_pick_button_pick (button, (GdkEvent *) event); return TRUE; } return FALSE; }
static gboolean gimp_pick_button_mouse_motion (GtkWidget *invisible, GdkEventMotion *event, GimpPickButton *button) { gimp_pick_button_pick (button, (GdkEvent *) event); return TRUE; }
static gboolean gimp_pick_button_mouse_motion (GtkWidget *invisible, GdkEventMotion *event, GimpPickButton *button) { gint x_root; gint y_root; gdk_window_get_origin (event->window, &x_root, &y_root); x_root += event->x; y_root += event->y; gimp_pick_button_pick (gdk_event_get_screen ((GdkEvent *) event), x_root, y_root, button); return TRUE; }
static gboolean gimp_pick_button_mouse_release (GtkWidget *invisible, GdkEventButton *event, GimpPickButton *button) { if (event->button != 1) return FALSE; gimp_pick_button_pick (button, (GdkEvent *) event); gimp_pick_button_shutdown (button); g_signal_handlers_disconnect_by_func (invisible, gimp_pick_button_mouse_motion, button); g_signal_handlers_disconnect_by_func (invisible, gimp_pick_button_mouse_release, button); return TRUE; }