diff options
author | Philip Langdale <philipl@mail.utexas.edu> | 2005-10-26 14:27:34 +0800 |
---|---|---|
committer | Philip Langdale <philipl@src.gnome.org> | 2005-10-26 14:27:34 +0800 |
commit | 923b47f0d09b21fcfb2a131c08b4e313a4d58c05 (patch) | |
tree | 15b47f9877c31068df1d422e97a39dd3de92c637 /src/ephy-link-action.c | |
parent | 12a8233cc88965fa9aee22095cb2005eb4f57532 (diff) | |
download | gsoc2013-epiphany-923b47f0d09b21fcfb2a131c08b4e313a4d58c05.tar gsoc2013-epiphany-923b47f0d09b21fcfb2a131c08b4e313a4d58c05.tar.gz gsoc2013-epiphany-923b47f0d09b21fcfb2a131c08b4e313a4d58c05.tar.bz2 gsoc2013-epiphany-923b47f0d09b21fcfb2a131c08b4e313a4d58c05.tar.lz gsoc2013-epiphany-923b47f0d09b21fcfb2a131c08b4e313a4d58c05.tar.xz gsoc2013-epiphany-923b47f0d09b21fcfb2a131c08b4e313a4d58c05.tar.zst gsoc2013-epiphany-923b47f0d09b21fcfb2a131c08b4e313a4d58c05.zip |
src/ephy-link-action.c
2005-10-25 Philip Langdale <philipl@mail.utexas.edu>
* src/ephy-link-action.c
* src/ephy-link-action.h:
(proxy_button_press_event_cb),
(proxy_button_release_event_cb), (proxy_drag_begin_cb),
(ephy_link_action_connect_proxy),
(ephy_link_action_disconnect_proxy),
(ephy_link_action_class_init), (ephy_link_action_init):
Well, that didn't last long. Turns out this was a solved
problem in EphyBookmarkAction but no one pointed it out
until just now. Using gtk_button_pressed/released fixes
everything.
Diffstat (limited to 'src/ephy-link-action.c')
-rw-r--r-- | src/ephy-link-action.c | 67 |
1 files changed, 19 insertions, 48 deletions
diff --git a/src/ephy-link-action.c b/src/ephy-link-action.c index da627f451..f5be71675 100644 --- a/src/ephy-link-action.c +++ b/src/ephy-link-action.c @@ -32,17 +32,23 @@ #include <gtk/gtkmenuitem.h> #include <gtk/gtkmenutoolbutton.h> -#define EPHY_LINK_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_LINK_ACTION, EphyLinkActionPrivate)) +static GObjectClass *parent_class = NULL; -struct _EphyLinkActionPrivate +static gboolean +proxy_button_press_event_cb (GtkButton *button, + GdkEventButton *event, + EphyLinkAction *action) { - gboolean ignore_next_middle_click; -}; + if (event->button == 2) + { + gtk_button_pressed(button); + } -static GObjectClass *parent_class = NULL; + return FALSE; +} static gboolean -proxy_button_release_event_cb (GtkWidget *widget, +proxy_button_release_event_cb (GtkButton *button, GdkEventButton *event, EphyLinkAction *action) { @@ -53,37 +59,12 @@ proxy_button_release_event_cb (GtkWidget *widget, */ if (event->button == 2) { - if (!action->priv->ignore_next_middle_click) - { - gtk_action_activate (GTK_ACTION (action)); - } - action->priv->ignore_next_middle_click = FALSE; + gtk_button_released(button); } return FALSE; } -static void -proxy_drag_begin_cb (GtkWidget *widget, - GdkDragContext *context, - EphyLinkAction *action) -{ - GdkEventMotion *event; - GdkEvent *base_event = gtk_get_current_event (); - - g_return_if_fail (base_event != NULL); - g_return_if_fail (base_event->type == GDK_MOTION_NOTIFY); - - event = (GdkEventMotion *) base_event; - - if (event->state & GDK_BUTTON2_MASK) - { - action->priv->ignore_next_middle_click = TRUE; - } - - gdk_event_free(base_event); -} - static GtkWidget * get_event_widget (GtkWidget *proxy) { @@ -137,12 +118,12 @@ ephy_link_action_connect_proxy (GtkAction *action, GtkWidget *proxy) widget = get_event_widget(proxy); if (widget) { + g_signal_connect (widget, "button-press-event", + G_CALLBACK (proxy_button_press_event_cb), + action); g_signal_connect (widget, "button-release-event", G_CALLBACK (proxy_button_release_event_cb), action); - g_signal_connect (widget, "drag-begin", - G_CALLBACK (proxy_drag_begin_cb), - action); } GTK_ACTION_CLASS (parent_class)->connect_proxy (action, proxy); @@ -159,10 +140,10 @@ ephy_link_action_disconnect_proxy (GtkAction *action, GtkWidget *proxy) if (widget) { g_signal_handlers_disconnect_by_func (widget, - G_CALLBACK (proxy_button_release_event_cb), + G_CALLBACK (proxy_button_press_event_cb), action); g_signal_handlers_disconnect_by_func (widget, - G_CALLBACK (proxy_drag_begin_cb), + G_CALLBACK (proxy_button_release_event_cb), action); } @@ -172,22 +153,12 @@ ephy_link_action_disconnect_proxy (GtkAction *action, GtkWidget *proxy) static void ephy_link_action_class_init (EphyLinkActionClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (class); GtkActionClass *action_class = GTK_ACTION_CLASS (class); parent_class = g_type_class_peek_parent (class); action_class->connect_proxy = ephy_link_action_connect_proxy; action_class->disconnect_proxy = ephy_link_action_disconnect_proxy; - - g_type_class_add_private (object_class, sizeof (EphyLinkActionPrivate)); -} - -static void -ephy_link_action_init (EphyLinkAction *action) -{ - action->priv = EPHY_LINK_ACTION_GET_PRIVATE (action); - action->priv->ignore_next_middle_click = FALSE; } GType @@ -207,7 +178,7 @@ ephy_link_action_get_type (void) NULL, /* class_data */ sizeof (EphyLinkAction), 0, /* n_preallocs */ - (GInstanceInitFunc) ephy_link_action_init + NULL /* instance_init */ }; static const GInterfaceInfo link_info = { |