static gboolean emoticon_tool_button_button_release_event_cb (EEmoticonToolButton *button, GdkEventButton *event) { GtkToggleToolButton *tool_button; GtkWidget *event_widget; gboolean popup_in_progress; tool_button = GTK_TOGGLE_TOOL_BUTTON (button); event_widget = gtk_get_event_widget ((GdkEvent *) event); popup_in_progress = button->priv->popup_in_progress; button->priv->popup_in_progress = FALSE; if (event_widget != GTK_WIDGET (button)) goto popdown; if (popup_in_progress) return FALSE; if (gtk_toggle_tool_button_get_active (tool_button)) goto popdown; return FALSE; popdown: e_emoticon_tool_button_popdown (button); return TRUE; }
static gint gtk_combo_button_press (GtkWidget * widget, GdkEvent * event, GtkCombo * combo) { GtkWidget *child; child = gtk_get_event_widget (event); /* We don't ask for button press events on the grab widget, so * if an event is reported directly to the grab widget, it must * be on a window outside the application (and thus we remove * the popup window). Otherwise, we check if the widget is a child * of the grab widget, and only remove the popup window if it * is not. */ if (child != widget) { while (child) { if (child == widget) return FALSE; child = child->parent; } } gtk_widget_hide (combo->popwin); gtk_grab_remove (combo->popwin); gdk_pointer_ungrab (event->button.time); return TRUE; }
static gint gtk_dateentry_button_press (GtkWidget * widget, GdkEvent * event, gpointer data) { GtkWidget *child; DB( g_print(" (dateentry) button_press\n") ); child = gtk_get_event_widget (event); if (child != widget) { while (child) { if (child == widget) return FALSE; child = child->parent; } } gtk_widget_hide (widget); gtk_grab_remove (widget); gdk_pointer_ungrab (GDK_CURRENT_TIME); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(GTK_DATE_ENTRY(data)->arrow), FALSE); return TRUE; }
static gboolean emoticon_tool_button_press_event (GtkWidget *widget, GdkEventButton *event) { EEmoticonToolButton *button; GtkToggleToolButton *toggle_button; GtkWidget *event_widget; button = E_EMOTICON_TOOL_BUTTON (widget); event_widget = gtk_get_event_widget ((GdkEvent *) event); if (event_widget == button->priv->window) return TRUE; if (event_widget != widget) return FALSE; toggle_button = GTK_TOGGLE_TOOL_BUTTON (widget); if (gtk_toggle_tool_button_get_active (toggle_button)) return FALSE; e_emoticon_tool_button_popup (button); button->priv->popup_in_progress = TRUE; return TRUE; }
static gboolean event_window_button_press_event_cb (GstyleSlidein *self, GdkEvent *event, GstyleSlidein *unused) { GdkEventButton *button_event = (GdkEventButton *)event; GtkAllocation child_alloc; gboolean is_in_slide; GtkWidget *src_widget; gint dest_x, dest_y; g_assert (GSTYLE_IS_SLIDEIN (self)); src_widget = gtk_get_event_widget (event); gtk_widget_translate_coordinates (src_widget, GTK_WIDGET (self->overlay_child), button_event->x, button_event->y, &dest_x, &dest_y); gtk_widget_get_allocated_size (self->overlay_child, &child_alloc, NULL); is_in_slide = (0 <= dest_x && dest_x <= child_alloc.width && 0 <= dest_y && dest_y <= child_alloc.height); if (!is_in_slide) { gtk_grab_remove (GTK_WIDGET (self)); gstyle_slidein_reveal_slide (self, FALSE); return GDK_EVENT_PROPAGATE; } else return GDK_EVENT_STOP; }
static gboolean gimp_ruler_track_widget_motion_notify (GtkWidget *widget, GdkEventMotion *mevent, GimpRuler *ruler) { gint widget_x; gint widget_y; gint ruler_x; gint ruler_y; widget = gtk_get_event_widget ((GdkEvent *) mevent); gimp_ruler_event_to_widget_coords (widget, mevent->window, mevent->x, mevent->y, &widget_x, &widget_y); if (gtk_widget_translate_coordinates (widget, GTK_WIDGET (ruler), widget_x, widget_y, &ruler_x, &ruler_y)) { gimp_ruler_update_position (ruler, ruler_x, ruler_y); } return FALSE; }
static gboolean button_press_popup (GtkWidget *widget, GdkEventButton *event, PopupContainer *container) { GtkWidget *child; child = gtk_get_event_widget ((GdkEvent *) event); /* We don't ask for button press events on the grab widget, so * if an event is reported directly to the grab widget, it must * be on a window outside the application (and thus we remove * the popup window). Otherwise, we check if the widget is a child * of the grab widget, and only remove the popup window if it * is not. */ if (child != widget) { while (child) { if (child == widget) return FALSE; child = gtk_widget_get_parent (child); } } gtk_widget_hide (GTK_WIDGET (container)); gtk_grab_remove (GTK_WIDGET (container)); return TRUE; }
static gint gtk_popup_button_press (GtkWidget *widget, GdkEvent *gdk_event, wxPopupWindow* win ) { GtkWidget *child = gtk_get_event_widget (gdk_event); /* We don't ask for button press events on the grab widget, so * if an event is reported directly to the grab widget, it must * be on a window outside the application (and thus we remove * the popup window). Otherwise, we check if the widget is a child * of the grab widget, and only remove the popup window if it * is not. */ if (child != widget) { while (child) { if (child == widget) return FALSE; child = child->parent; } } wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() ); event.SetEventObject( win ); (void)win->HandleWindowEvent( event ); return TRUE; }
static gboolean gimp_tool_progress_button_press (GtkWidget *widget, const GdkEventButton *bevent, GimpTool *tool) { if (bevent->type == GDK_BUTTON_PRESS && bevent->button == 1) { GtkWidget *event_widget; GimpDisplayShell *shell; event_widget = gtk_get_event_widget ((GdkEvent *) bevent); shell = gimp_display_get_shell (tool->progress_display); if (shell->canvas == event_widget) { gint x, y; gimp_display_shell_unzoom_xy (shell, bevent->x, bevent->y, &x, &y, FALSE); if (gimp_canvas_item_hit (tool->progress, x, y)) { gimp_progress_cancel (GIMP_PROGRESS (tool)); } } } return TRUE; }
static gboolean gtk_ellipsis_leave_notify (GtkWidget *widget, GdkEventCrossing *event) { GtkEllipsis *ellipsis = GTK_ELLIPSIS (widget); GtkWidget *event_widget; event_widget = gtk_get_event_widget ((GdkEvent *) event); if (event_widget == widget && event->detail != GDK_NOTIFY_INFERIOR) { ellipsis->priv->prelight = FALSE; if (ellipsis->priv->label && widget->state != GTK_STATE_SELECTED) { gtk_widget_set_state (ellipsis->priv->label, GTK_STATE_NORMAL); gtk_widget_set_state (ellipsis->priv->ellipsis_label, GTK_STATE_NORMAL); } gtk_ellipsis_redraw_ellipsis (ellipsis); } return FALSE; }
static VALUE rg_m_get_event_widget(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE event; rb_scan_args(argc, argv, "01", &event); return GOBJ2RVAL(gtk_get_event_widget(NIL_P(event) ? NULL :RVAL2GEV(event))); }
static gboolean button_press (GtkWidget *widget, GdkEventButton *event) { if (gtk_get_event_widget ((GdkEvent *) event) == widget) { menu_start_hide (MENU_START (widget)); } return FALSE; }
static gint gtk_combo_button_release (GtkWidget * widget, GdkEvent * event, GtkCombo * combo) { GtkWidget *child; if ((combo->current_button != 0) && (event->button.button == 1)) { /* This was the initial button press */ GdkEventCrossing tmp_event; combo->current_button = 0; if (widget != combo->button) gtk_widget_event (combo->button, event); /* Un-pre-hightlight */ tmp_event.type = GDK_LEAVE_NOTIFY; tmp_event.window = combo->button->window; tmp_event.send_event = TRUE; tmp_event.subwindow = NULL; tmp_event.detail = GDK_NOTIFY_ANCESTOR; gtk_widget_event (combo->button, (GdkEvent *)&tmp_event); /* Check to see if we released inside the button */ child = gtk_get_event_widget ((GdkEvent*) event); while (child && child != (combo->button)) child = child->parent; if (child == combo->button) { gtk_grab_add (combo->popwin); gdk_pointer_grab (combo->popwin->window, TRUE, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, NULL, NULL, GDK_CURRENT_TIME); return FALSE; } } else { /* The user has clicked inside the popwin and released */ if (GTK_WIDGET_HAS_GRAB (combo->popwin)) { gtk_grab_remove (combo->popwin); gdk_pointer_ungrab (event->button.time); } } gtk_widget_hide (combo->popwin); return TRUE; }
static gboolean eek_preview_leave_cb( GtkWidget* widget, GdkEventCrossing* event ) { if ( gtk_get_event_widget( (GdkEvent*)event ) == widget ) { EekPreview* preview = EEK_PREVIEW(widget); preview->_within = FALSE; gtk_widget_set_state( widget, GTK_STATE_NORMAL ); } return FALSE; }
static gboolean eek_preview_enter_cb( GtkWidget* widget, GdkEventCrossing* event ) { if ( gtk_get_event_widget( (GdkEvent*)event ) == widget ) { EekPreview* preview = EEK_PREVIEW(widget); preview->_within = TRUE; gtk_widget_set_state( widget, preview->_hot ? GTK_STATE_ACTIVE : GTK_STATE_PRELIGHT ); } return FALSE; }
static gint cb_ccombo_button_release (GtkWidget *popup, GdkEventButton *event, GtkTreeView *list) { if (event->button == 1) { if (gtk_get_event_widget ((GdkEvent *) event) == GTK_WIDGET (list)) return ccombo_activate (list, FALSE); g_signal_handlers_disconnect_by_func (popup, G_CALLBACK (cb_ccombo_popup_motion), list); ccombo_autoscroll_set (G_OBJECT (list), 0); } return FALSE; }
static gint go_combo_box_button_press (GtkWidget *widget, GdkEventButton *event, GOComboBox *combo_box) { GtkWidget *child = gtk_get_event_widget ((GdkEvent *) event); if (child != widget){ while (child){ if (child == widget) return FALSE; child = child->parent; } } go_combo_box_popup_hide (combo_box); return TRUE; }
static gboolean gimp_view_leave_notify_event (GtkWidget *widget, GdkEventCrossing *event) { GimpView *view = GIMP_VIEW (widget); GtkWidget *event_widget = gtk_get_event_widget ((GdkEvent *) event); if ((event_widget == widget) && (event->detail != GDK_NOTIFY_INFERIOR)) { view->in_button = FALSE; } return FALSE; }
static gboolean fish_leave_notify (GtkWidget *widget, GdkEventCrossing *event) { FishApplet *fish; GtkWidget *event_widget; fish = FISH_APPLET (widget); event_widget = gtk_get_event_widget ((GdkEvent*) event); if ((event_widget == widget) && (event->detail != GDK_NOTIFY_INFERIOR)) fish->in_applet = FALSE; return FALSE; }
static gint layer_list_events (GtkWidget *widget, GdkEvent *event) { GdkEventKey *kevent; GdkEventButton *bevent; GtkWidget *event_widget; DiaLayerWidget *layer_widget; event_widget = gtk_get_event_widget (event); if (GTK_IS_LIST_ITEM (event_widget)) { layer_widget = DIA_LAYER_WIDGET(event_widget); switch (event->type) { case GDK_BUTTON_PRESS: bevent = (GdkEventButton *) event; break; case GDK_2BUTTON_PRESS: bevent = (GdkEventButton *) event; layer_dialog_edit_layer(layer_widget, NULL, NULL); return TRUE; case GDK_KEY_PRESS: kevent = (GdkEventKey *) event; switch (kevent->keyval) { case GDK_Up: /* printf ("up arrow\n"); */ break; case GDK_Down: /* printf ("down arrow\n"); */ break; default: return FALSE; } return TRUE; default: break; } } return FALSE; }
static gboolean ygtk_popup_window_button_press_event (GtkWidget *widget, GdkEventButton *event) { // NOTE: You can't rely on events x and y since the event may take place // outside of the window. // So, we'll check if this widget (or any of its kids) got the event // If that's not the case, close the menu GtkWidget *child = gtk_get_event_widget ((GdkEvent *) event); if (child != widget) while (child) { if (child == widget) return FALSE; child = gtk_widget_get_parent(child); } gtk_widget_hide (widget); return TRUE; }
static gboolean eek_preview_button_release_cb( GtkWidget* widget, GdkEventButton* event ) { if ( gtk_get_event_widget( (GdkEvent*)event ) == widget ) { EekPreview* preview = EEK_PREVIEW(widget); preview->_hot = FALSE; gtk_widget_set_state( widget, GTK_STATE_NORMAL ); if ( preview->_within && event->button == PRIME_BUTTON_MAGIC_NUMBER ) { gboolean isAlt = (event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK; if ( isAlt ) { g_signal_emit( widget, eek_preview_signals[ALTCLICKED_SIGNAL], 0, 2 ); } else { g_signal_emit( widget, eek_preview_signals[CLICKED_SIGNAL], 0 ); } } } return FALSE; }
static gboolean gnc_date_edit_button_released (GtkWidget *widget, GdkEventButton *event, gpointer data) { GNCDateEdit *gde = GNC_DATE_EDIT(data); GtkWidget *ewidget = gtk_get_event_widget ((GdkEvent *)event); gboolean popup_in_progress = FALSE; ENTER("widget=%p, ewidget=%p, event=%p, gde=%p", widget, ewidget, event, gde); if (gde->popup_in_progress) { popup_in_progress = TRUE; gde->popup_in_progress = FALSE; } /* Propagate releases on the calendar. */ if (ewidget == gde->calendar) { LEAVE("Button release on calendar."); return FALSE; } if (ewidget == gde->date_button) { /* Pop down if we're up and it isn't due to the preceding press. */ if (!popup_in_progress && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gde->date_button))) { gnc_date_edit_popdown (gde); LEAVE("Release on button, not in progress. Popped down."); return TRUE; } LEAVE("Button release on button. Allowing."); return FALSE; } /* Pop down on a release anywhere else. */ gnc_date_edit_popdown (gde); LEAVE("Release not on button or calendar. Popping down."); return TRUE; }
static gboolean eek_preview_button_press_cb( GtkWidget* widget, GdkEventButton* event ) { if ( gtk_get_event_widget( (GdkEvent*)event ) == widget ) { EekPreview* preview = EEK_PREVIEW(widget); if ( preview->_takesFocus && !GTK_WIDGET_HAS_FOCUS(widget) ) { gtk_widget_grab_focus(widget); } if ( event->button == PRIME_BUTTON_MAGIC_NUMBER ) { preview->_hot = TRUE; if ( preview->_within ) { gtk_widget_set_state( widget, GTK_STATE_ACTIVE ); } } } return FALSE; }
static gboolean gtk_button_enter_notify (GtkWidget *widget, GdkEventCrossing *event) { GtkButton *button; GtkWidget *event_widget; button = GTK_BUTTON (widget); event_widget = gtk_get_event_widget ((GdkEvent*) event); if ((event_widget == widget) && (event->detail != GDK_NOTIFY_INFERIOR)) { button->in_button = TRUE; gtk_button_enter (button); } return FALSE; }
static gboolean on_notebook_scroll_event_null_cb (GtkWidget *widget, GdkEventScroll *event) { GtkNotebook *notebook = GTK_NOTEBOOK (widget); GtkWidget* child; GtkWidget* originator; if (!gtk_notebook_get_current_page (notebook)) return FALSE; child = gtk_notebook_get_nth_page (notebook, gtk_notebook_get_current_page (notebook)); originator = gtk_get_event_widget ((GdkEvent *)event); /* ignore scroll events from the content of the page */ if (!originator || gtk_widget_is_ancestor (originator, child)) return FALSE; return TRUE; }
static gint gtk_combo_list_enter (GtkWidget *widget, GdkEventCrossing *event, GtkCombo *combo) { GtkWidget *event_widget; event_widget = gtk_get_event_widget ((GdkEvent*) event); if ((event_widget == combo->list) && (combo->current_button != 0) && (!GTK_WIDGET_HAS_GRAB (combo->list))) { GdkEvent tmp_event; gint x, y; GdkModifierType mask; gtk_grab_remove (combo->popwin); /* Transfer the grab over to the list by synthesizing * a button press event */ gdk_window_get_pointer (combo->list->window, &x, &y, &mask); tmp_event.button.type = GDK_BUTTON_PRESS; tmp_event.button.window = combo->list->window; tmp_event.button.send_event = TRUE; tmp_event.button.time = GDK_CURRENT_TIME; /* bad */ tmp_event.button.x = x; tmp_event.button.y = y; /* We leave all the XInput fields unfilled here, in the expectation * that GtkList doesn't care. */ tmp_event.button.button = combo->current_button; tmp_event.button.state = mask; gtk_widget_event (combo->list, &tmp_event); } return FALSE; }
static gboolean gimp_popup_button_press (GtkWidget *widget, GdkEventButton *bevent) { GtkWidget *event_widget; gboolean cancel = FALSE; event_widget = gtk_get_event_widget ((GdkEvent *) bevent); if (event_widget == widget) { GtkAllocation allocation; gtk_widget_get_allocation (widget, &allocation); /* the event was on the popup, which can either be really on the * popup or outside gimp (owner_events == TRUE, see map()) */ if (bevent->x < 0 || bevent->y < 0 || bevent->x > allocation.width || bevent->y > allocation.height) { /* the event was outsde gimp */ cancel = TRUE; } } else if (gtk_widget_get_toplevel (event_widget) != widget) { /* the event was on a gimp widget, but not inside the popup */ cancel = TRUE; } if (cancel) g_signal_emit (widget, popup_signals[CANCEL], 0); return cancel; }
static gboolean gimp_context_help_button_press (GtkWidget *widget, GdkEventButton *bevent, gpointer data) { GtkWidget *event_widget = gtk_get_event_widget ((GdkEvent *) bevent); if (event_widget && bevent->button == 1 && bevent->type == GDK_BUTTON_PRESS) { GdkDisplay *display = gtk_widget_get_display (widget); gtk_grab_remove (widget); gdk_display_keyboard_ungrab (display, bevent->time); gdk_display_pointer_ungrab (display, bevent->time); gtk_widget_destroy (widget); if (event_widget != widget) g_idle_add (gimp_context_help_idle_show_help, event_widget); } return TRUE; }
static gboolean gtk_expander_enter_notify (GtkWidget *widget, GdkEventCrossing *event) { GtkExpander *expander = GTK_EXPANDER (widget); GtkWidget *event_widget; event_widget = gtk_get_event_widget ((GdkEvent *) event); if (event_widget == widget && event->detail != GDK_NOTIFY_INFERIOR) { expander->priv->prelight = TRUE; if (expander->priv->label_widget) gtk_widget_set_state (expander->priv->label_widget, GTK_STATE_PRELIGHT); gtk_expander_redraw_expander (expander); } return FALSE; }