aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-06-16 07:47:33 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-06-16 07:47:33 +0800
commit3241ea896ff4f8939c038ab65f03948d026ed520 (patch)
tree4cf5adff6fe56404f7cbb49f0e86bf4b9720965a
parentd5b5f70b1cca8ea489ca5be9900d0b47275b5a23 (diff)
downloadgsoc2013-epiphany-3241ea896ff4f8939c038ab65f03948d026ed520.tar.gz
gsoc2013-epiphany-3241ea896ff4f8939c038ab65f03948d026ed520.tar.zst
gsoc2013-epiphany-3241ea896ff4f8939c038ab65f03948d026ed520.zip
Remove some obsolete entries.
2003-06-16 Marco Pesenti Gritti <marco@it.gnome.org> * data/ui/nautilus-epiphany-view.xml.in: Remove some obsolete entries. * embed/Makefile.am: * embed/ephy-embed-event.c: (ephy_embed_event_init), (ephy_embed_event_get_event_type): * embed/ephy-embed-event.h: Make more generic and allow to make distinction between mouse and key events. * embed/ephy-embed-popup-bw.c: * embed/ephy-embed-popup-bw.h: Remove, unused. * embed/ephy-embed.c: (ephy_embed_base_init): * embed/ephy-embed.h: * embed/mozilla/mozilla-embed.cpp: Emit context signals only when necessary, get rid of unused mouse_down signal. * embed/ephy-embed-popup-control.c: (ephy_embed_popup_control_show_impl): * embed/mozilla/EventContext.cpp: * src/ephy-nautilus-view.c: (ephy_nautilus_view_instance_init), (gnv_embed_dom_mouse_click_cb), (gnv_embed_context_menu_cb): * src/ephy-tab.c: (ephy_tab_dom_mouse_click_cb), (ephy_tab_context_menu_cb): Use new event api.
-rw-r--r--ChangeLog37
-rw-r--r--data/ui/nautilus-epiphany-view.xml.in2
-rw-r--r--embed/Makefile.am2
-rw-r--r--embed/ephy-embed-event.c7
-rw-r--r--embed/ephy-embed-event.h14
-rw-r--r--embed/ephy-embed-popup-bw.c198
-rw-r--r--embed/ephy-embed-popup-bw.h58
-rw-r--r--embed/ephy-embed-popup-control.c7
-rw-r--r--embed/ephy-embed.c11
-rw-r--r--embed/ephy-embed.h2
-rw-r--r--embed/mozilla/EventContext.cpp19
-rw-r--r--embed/mozilla/mozilla-embed.cpp67
-rw-r--r--src/ephy-nautilus-view.c52
-rw-r--r--src/ephy-tab.c16
14 files changed, 149 insertions, 343 deletions
diff --git a/ChangeLog b/ChangeLog
index c22b27569..9bc432885 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,40 @@
+2003-06-16 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * data/ui/nautilus-epiphany-view.xml.in:
+
+ Remove some obsolete entries.
+
+ * embed/Makefile.am:
+ * embed/ephy-embed-event.c: (ephy_embed_event_init),
+ (ephy_embed_event_get_event_type):
+ * embed/ephy-embed-event.h:
+
+ Make more generic and allow to make distinction
+ between mouse and key events.
+
+ * embed/ephy-embed-popup-bw.c:
+ * embed/ephy-embed-popup-bw.h:
+
+ Remove, unused.
+
+ * embed/ephy-embed.c: (ephy_embed_base_init):
+ * embed/ephy-embed.h:
+ * embed/mozilla/mozilla-embed.cpp:
+
+ Emit context signals only when necessary,
+ get rid of unused mouse_down signal.
+
+ * embed/ephy-embed-popup-control.c:
+ (ephy_embed_popup_control_show_impl):
+ * embed/mozilla/EventContext.cpp:
+ * src/ephy-nautilus-view.c: (ephy_nautilus_view_instance_init),
+ (gnv_embed_dom_mouse_click_cb), (gnv_embed_context_menu_cb):
+ * src/ephy-tab.c: (ephy_tab_dom_mouse_click_cb),
+ (ephy_tab_context_menu_cb):
+
+ Use new event api.
+
+
2003-06-15 Marco Pesenti Gritti <marco@it.gnome.org>
* embed/ephy-embed-event.c: (ephy_embed_event_init):
diff --git a/data/ui/nautilus-epiphany-view.xml.in b/data/ui/nautilus-epiphany-view.xml.in
index 325c7782f..3d9a5ffd1 100644
--- a/data/ui/nautilus-epiphany-view.xml.in
+++ b/data/ui/nautilus-epiphany-view.xml.in
@@ -94,7 +94,6 @@
<menuitem name="DPSavePageAs" verb=""/>
<menuitem name="DPSaveBackgroundAs" verb=""/>
<menuitem name="DPCopyLocation" verb=""/>
- <submenu name="DPOpenWith" _label="Open With"/>
<placeholder name="FrameItems">
<separator/>
<menuitem name="DPOpenFrame" verb=""/>
@@ -118,7 +117,6 @@
</placeholder>
<placeholder name="ImageItems">
<menuitem name="EPOpenImage" verb=""/>
- <submenu name="EPOpenImageWith" _label="Open Image With"/>
<menuitem name="EPOpenImageInNewWindow" verb=""/>
<menuitem name="EPSaveImageAs" verb=""/>
<menuitem name="EPSetImageAsBackground" verb=""/>
diff --git a/embed/Makefile.am b/embed/Makefile.am
index 96d440d4f..6355dbac2 100644
--- a/embed/Makefile.am
+++ b/embed/Makefile.am
@@ -29,8 +29,6 @@ libephyembed_la_SOURCES = \
ephy-embed-persist.h \
ephy-embed-popup.c \
ephy-embed-popup.h \
- ephy-embed-popup-bw.c \
- ephy-embed-popup-bw.h \
ephy-embed-popup-control.c \
ephy-embed-popup-control.h \
ephy-embed-prefs.h \
diff --git a/embed/ephy-embed-event.c b/embed/ephy-embed-event.c
index 3df03f3dc..396410453 100644
--- a/embed/ephy-embed-event.c
+++ b/embed/ephy-embed-event.c
@@ -87,7 +87,6 @@ ephy_embed_event_init (EphyEmbedEvent *event)
event->priv->props = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, free_g_value);
- event->mouse_button = -1;
}
static void
@@ -129,10 +128,10 @@ ephy_embed_event_get_modifier (EphyEmbedEvent *event)
}
gresult
-ephy_embed_event_get_mouse_button (EphyEmbedEvent *event,
- guint *mouse_button)
+ephy_embed_event_get_event_type (EphyEmbedEvent *event,
+ EphyEmbedEventType *type)
{
- *mouse_button = event->mouse_button;
+ *type = event->type;
return G_OK;
}
diff --git a/embed/ephy-embed-event.h b/embed/ephy-embed-event.h
index 44448cce6..40eb15c55 100644
--- a/embed/ephy-embed-event.h
+++ b/embed/ephy-embed-event.h
@@ -50,6 +50,14 @@ typedef enum
EMBED_CONTEXT_EMAIL_LINK = 1 << 8
} EmbedEventContext;
+typedef enum
+{
+ EPHY_EMBED_EVENT_MOUSE_BUTTON1,
+ EPHY_EMBED_EVENT_MOUSE_BUTTON2,
+ EPHY_EMBED_EVENT_MOUSE_BUTTON3,
+ EPHY_EMBED_EVENT_KEY
+} EphyEmbedEventType;
+
struct EphyEmbedEvent
{
GObject parent;
@@ -57,7 +65,7 @@ struct EphyEmbedEvent
/* Public to the embed implementations */
guint modifier;
- guint mouse_button;
+ EphyEmbedEventType type;
guint context;
guint x, y;
guint keycode;
@@ -74,8 +82,8 @@ EphyEmbedEvent *ephy_embed_event_new (void);
guint ephy_embed_event_get_modifier (EphyEmbedEvent *event);
-gresult ephy_embed_event_get_mouse_button (EphyEmbedEvent *event,
- guint *mouse_button);
+gresult ephy_embed_event_get_event_type (EphyEmbedEvent *event,
+ EphyEmbedEventType *type);
gresult ephy_embed_event_get_coords (EphyEmbedEvent *event,
guint *x, guint *y);
diff --git a/embed/ephy-embed-popup-bw.c b/embed/ephy-embed-popup-bw.c
deleted file mode 100644
index f72e44e6e..000000000
--- a/embed/ephy-embed-popup-bw.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include "ephy-embed-popup-bw.h"
-#include "ephy-gobject-misc.h"
-
-#include <gtk/gtkmain.h>
-
-enum
-{
- PROP_0,
- PROP_BONOBO_WINDOW
-};
-
-struct EphyEmbedPopupBWPrivate
-{
- BonoboWindow *window;
- GtkWidget *menu;
-};
-
-static void
-ephy_embed_popup_bw_class_init (EphyEmbedPopupBWClass *klass);
-static void
-ephy_embed_popup_bw_init (EphyEmbedPopupBW *gep);
-static void
-ephy_embed_popup_bw_finalize (GObject *object);
-static void
-ephy_embed_popup_bw_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void
-ephy_embed_popup_bw_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void
-ephy_embed_popup_bw_set_window (EphyEmbedPopupBW *p,
- BonoboWindow *window);
-static void
-ephy_embed_popup_bw_show_impl (EphyEmbedPopup *p,
- EphyEmbed *embed);
-
-static EphyEmbedPopupClass *parent_class = NULL;
-
-MAKE_GET_TYPE (ephy_embed_popup_bw, "EphyEmbedPopupBW", EphyEmbedPopupBW,
- ephy_embed_popup_bw_class_init, ephy_embed_popup_bw_init, EPHY_EMBED_POPUP_TYPE);
-
-static void
-ephy_embed_popup_bw_class_init (EphyEmbedPopupBWClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = EPHY_EMBED_POPUP_CLASS (g_type_class_peek_parent (klass));
-
- object_class->finalize = ephy_embed_popup_bw_finalize;
- object_class->set_property = ephy_embed_popup_bw_set_property;
- object_class->get_property = ephy_embed_popup_bw_get_property;
-
- g_object_class_install_property (object_class,
- PROP_BONOBO_WINDOW,
- g_param_spec_object ("BonoboWindow",
- "BonoboWindow",
- "Bonobo window",
- BONOBO_TYPE_WINDOW,
- G_PARAM_READWRITE));
-
- EPHY_EMBED_POPUP_CLASS (klass)->show = ephy_embed_popup_bw_show_impl;
-}
-
-static void
-ephy_embed_popup_bw_init (EphyEmbedPopupBW *gep)
-{
- gep->priv = g_new0 (EphyEmbedPopupBWPrivate, 1);
- gep->priv->window = NULL;
- gep->priv->menu = NULL;
-}
-
-static void
-ephy_embed_popup_bw_finalize (GObject *object)
-{
- EphyEmbedPopupBW *gep;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_EPHY_EMBED_POPUP_BW (object));
-
- gep = EPHY_EMBED_POPUP_BW (object);
-
- g_return_if_fail (gep->priv != NULL);
-
- g_free (gep->priv);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-ephy_embed_popup_bw_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- EphyEmbedPopupBW *p = EPHY_EMBED_POPUP_BW (object);
-
- switch (prop_id)
- {
- case PROP_BONOBO_WINDOW:
- ephy_embed_popup_bw_set_window (p, g_value_get_object (value));
- break;
- }
-}
-
-static void
-ephy_embed_popup_bw_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EphyEmbedPopupBW *p = EPHY_EMBED_POPUP_BW (object);
-
- switch (prop_id)
- {
- case PROP_BONOBO_WINDOW:
- g_value_set_object (value, p->priv->window);
- break;
- }
-}
-
-static void
-ephy_embed_popup_bw_set_window (EphyEmbedPopupBW *p,
- BonoboWindow *window)
-{
- p->priv->window = window;
-}
-
-EphyEmbedPopupBW *
-ephy_embed_popup_bw_new (BonoboWindow *window)
-{
- EphyEmbedPopupBW *p;
-
- p = EPHY_EMBED_POPUP_BW (g_object_new (EPHY_EMBED_POPUP_BW_TYPE,
- "BonoboWindow", window,
- NULL));
-
- g_return_val_if_fail (p->priv != NULL, NULL);
-
- return p;
-}
-
-static void
-popup_menu_at_coords (GtkMenu *menu, gint *x, gint *y, gboolean *push_in,
- gpointer user_data)
-{
- EphyEmbedEvent *event = user_data;
-
- *x = event->x;
- *y = event->y;
- *push_in = FALSE;
-}
-
-static void
-ephy_embed_popup_bw_show_impl (EphyEmbedPopup *pp,
- EphyEmbed *embed)
-{
- EphyEmbedPopupBW *p = EPHY_EMBED_POPUP_BW (pp);
- EphyEmbedEvent *event = ephy_embed_popup_get_event (pp);
- guint button;
-
- ephy_embed_popup_set_embed (pp, embed);
-
- ephy_embed_event_get_mouse_button (event, &button);
-
- p->priv->menu = gtk_menu_new ();
- gtk_widget_show (p->priv->menu);
-
- bonobo_window_add_popup (p->priv->window,
- GTK_MENU (p->priv->menu),
- ephy_embed_popup_get_popup_path (EPHY_EMBED_POPUP (p)));
-
- gtk_menu_popup (GTK_MENU (p->priv->menu),
- NULL, NULL, button == 2 ? popup_menu_at_coords : NULL, event,
- button, gtk_get_current_event_time ());
-}
-
diff --git a/embed/ephy-embed-popup-bw.h b/embed/ephy-embed-popup-bw.h
deleted file mode 100644
index 49f8fecd5..000000000
--- a/embed/ephy-embed-popup-bw.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef EPHY_EMBED_POPUP_BW_H
-#define EPHY_EMBED_POPUP_BW_H
-
-#include "ephy-embed-popup.h"
-#include <bonobo/bonobo-window.h>
-
-G_BEGIN_DECLS
-
-typedef struct EphyEmbedPopupBWClass EphyEmbedPopupBWClass;
-
-#define EPHY_EMBED_POPUP_BW_TYPE (ephy_embed_popup_bw_get_type ())
-#define EPHY_EMBED_POPUP_BW(obj) (GTK_CHECK_CAST ((obj), EPHY_EMBED_POPUP_BW_TYPE, \
- EphyEmbedPopupBW))
-#define EPHY_EMBED_POPUP_BW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EPHY_EMBED_POPUP_BW_TYPE,\
- EphyEmbedPopupBWClass))
-#define IS_EPHY_EMBED_POPUP_BW(obj) (GTK_CHECK_TYPE ((obj), EPHY_EMBED_POPUP_BW_TYPE))
-#define IS_EPHY_EMBED_POPUP_BW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EPHY_EMBED_POPUP_BW))
-#define EPHY_EMBED_POPUP_BW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- EPHY_EMBED_POPUP_BW_TYPE, EphyEmbedPopupBWClass))
-
-typedef struct EphyEmbedPopupBW EphyEmbedPopupBW;
-typedef struct EphyEmbedPopupBWPrivate EphyEmbedPopupBWPrivate;
-
-struct EphyEmbedPopupBW
-{
- EphyEmbedPopup parent;
- EphyEmbedPopupBWPrivate *priv;
-};
-
-struct EphyEmbedPopupBWClass
-{
- EphyEmbedPopupClass parent_class;
-};
-
-GType ephy_embed_popup_bw_get_type (void);
-EphyEmbedPopupBW * ephy_embed_popup_bw_new (BonoboWindow *window);
-
-G_END_DECLS
-
-#endif
diff --git a/embed/ephy-embed-popup-control.c b/embed/ephy-embed-popup-control.c
index a74249cc8..866c6789f 100644
--- a/embed/ephy-embed-popup-control.c
+++ b/embed/ephy-embed-popup-control.c
@@ -166,21 +166,18 @@ ephy_embed_popup_control_show_impl (EphyEmbedPopup *pp,
EphyEmbed *embed)
{
EphyEmbedPopupControl *p = EPHY_EMBED_POPUP_CONTROL (pp);
- EphyEmbedEvent *event = ephy_embed_popup_get_event (pp);
BonoboUIComponent *uic = bonobo_control_get_popup_ui_component (p->priv->control);
const char *path;
char *path_dst;
- guint button;
- ephy_embed_event_get_mouse_button (event, &button);
ephy_embed_popup_set_embed (pp, embed);
path = ephy_embed_popup_get_popup_path (pp);
- path_dst = g_strdup_printf ("/popups/button%d", button);
+ path_dst = g_strdup_printf ("/popups/button%d", 2);
/* this is a hack because bonobo apis for showing popups are broken */
ephy_bonobo_replace_path (uic, path, path_dst);
- bonobo_control_do_popup (p->priv->control, button,
+ bonobo_control_do_popup (p->priv->control, 2,
gtk_get_current_event_time ());
g_free (path_dst);
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index ebc33b833..f8e9cadc1 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -42,7 +42,6 @@ enum
OPEN_URI,
SIZE_TO,
DOM_MOUSE_CLICK,
- DOM_MOUSE_DOWN,
SECURITY_CHANGE,
ZOOM_CHANGE,
LAST_SIGNAL
@@ -220,16 +219,6 @@ ephy_embed_base_init (gpointer g_class)
2,
G_TYPE_INT,
G_TYPE_INT);
- ephy_embed_signals[DOM_MOUSE_DOWN] =
- g_signal_new ("ge_dom_mouse_down",
- EPHY_EMBED_TYPE,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EphyEmbedClass, dom_mouse_down),
- NULL, NULL,
- ephy_marshal_INT__OBJECT,
- G_TYPE_INT,
- 1,
- G_TYPE_POINTER);
ephy_embed_signals[DOM_MOUSE_CLICK] =
g_signal_new ("ge_dom_mouse_click",
EPHY_EMBED_TYPE,
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index 6371dea98..1564d0b35 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -194,8 +194,6 @@ struct EphyEmbedClass
gint height);
gint (* dom_mouse_click) (EphyEmbed *embed,
EphyEmbedEvent *event);
- gint (* dom_mouse_down) (EphyEmbed *embed,
- EphyEmbedEvent *event);
void (* security_change) (EphyEmbed *embed,
EmbedSecurityLevel level);
void (* zoom_change) (EphyEmbed *embed,
diff --git a/embed/mozilla/EventContext.cpp b/embed/mozilla/EventContext.cpp
index 229f8d3be..5d8e30075 100644
--- a/embed/mozilla/EventContext.cpp
+++ b/embed/mozilla/EventContext.cpp
@@ -525,7 +525,22 @@ nsresult EventContext::GetMouseEventInfo (nsIDOMMouseEvent *aMouseEvent, EphyEmb
/* casting 32-bit guint* to PRUint16* below will break on big-endian */
PRUint16 btn;
aMouseEvent->GetButton (&btn);
- info->mouse_button = (guint)btn;
+
+ switch (btn)
+ {
+ case 0:
+ info->type = EPHY_EMBED_EVENT_MOUSE_BUTTON1;
+ break;
+ case 1:
+ info->type = EPHY_EMBED_EVENT_MOUSE_BUTTON2;
+ break;
+ case 2:
+ info->type = EPHY_EMBED_EVENT_MOUSE_BUTTON3;
+ break;
+
+ default:
+ g_warning ("Unknown mouse button");
+ }
/* OTOH, casting only between (un)signedness is safe */
aMouseEvent->GetScreenX ((PRInt32*)&info->x);
@@ -590,6 +605,8 @@ nsresult EventContext::GetKeyEventInfo (nsIDOMKeyEvent *aKeyEvent, EphyEmbedEven
{
nsresult rv;
+ info->type = EPHY_EMBED_EVENT_KEY;
+
PRUint32 keyCode;
rv = aKeyEvent->GetKeyCode(&keyCode);
if (NS_FAILED(rv)) return rv;
diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp
index 95dd0190e..0e69d58fb 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -1334,12 +1334,6 @@ mozilla_embed_dom_key_down_cb (GtkMozEmbed *embed, gpointer dom_event,
gboolean ret = FALSE;
- // Just check for Shift-F10 so that we know to popup the context menu.
- //
- // The DOM_VK_* keycodes are not compatible with the keycodes defined
- // in GDK, so making a generic dom_key_down signal is probably not
- // worth the trouble.
-
nsresult rv;
EventContext ctx;
ctx.Init (wrapper);
@@ -1348,8 +1342,8 @@ mozilla_embed_dom_key_down_cb (GtkMozEmbed *embed, gpointer dom_event,
(info->keycode == nsIDOMKeyEvent::DOM_VK_F10 &&
info->modifier == GDK_SHIFT_MASK))
{
- // Translate relative coordinates to absolute values, and try
- // to avoid covering links by adding a little offset.
+ /* Translate relative coordinates to absolute values, and try
+ to avoid covering links by adding a little offset. */
int x, y;
gdk_window_get_origin (GTK_WIDGET(membed)->window, &x, &y);
@@ -1381,9 +1375,8 @@ mozilla_embed_destroy_brsr_cb (GtkMozEmbed *embed,
}
static gint
-mozilla_embed_emit_mouse_signal (MozillaEmbed *membed,
- gpointer dom_event,
- const char *signal_name)
+mozilla_embed_dom_mouse_click_cb (GtkMozEmbed *embed, gpointer dom_event,
+ MozillaEmbed *membed)
{
EphyEmbedEvent *info;
EventContext event_context;
@@ -1398,6 +1391,7 @@ mozilla_embed_emit_mouse_signal (MozillaEmbed *membed,
event_context.Init (wrapper);
result = event_context.GetMouseEventInfo (static_cast<nsIDOMMouseEvent*>(dom_event), info);
+
if (NS_SUCCEEDED(result))
{
nsCOMPtr<nsIDOMDocument> domDoc;
@@ -1407,7 +1401,7 @@ mozilla_embed_emit_mouse_signal (MozillaEmbed *membed,
result = wrapper->PushTargetDocument (domDoc);
if (NS_SUCCEEDED(result))
{
- g_signal_emit_by_name (membed, signal_name,
+ g_signal_emit_by_name (membed, "ge_dom_mouse_click",
info, &return_value);
wrapper->PopTargetDocument ();
}
@@ -1416,34 +1410,51 @@ mozilla_embed_emit_mouse_signal (MozillaEmbed *membed,
}
g_object_unref (info);
-
- return return_value;
-}
-static gint
-mozilla_embed_dom_mouse_click_cb (GtkMozEmbed *embed, gpointer dom_event,
- MozillaEmbed *membed)
-{
- return mozilla_embed_emit_mouse_signal
- (membed, dom_event, "ge_dom_mouse_click");
+ return return_value;
}
static gint
mozilla_embed_dom_mouse_down_cb (GtkMozEmbed *embed, gpointer dom_event,
MozillaEmbed *membed)
{
- int ret;
+ EphyEmbedEvent *info;
+ EventContext event_context;
+ gint return_value = 0;
+ EphyWrapper *wrapper;
+ nsresult result;
+ EphyEmbedEventType type;
- ret = mozilla_embed_emit_mouse_signal
- (membed, dom_event, "ge_dom_mouse_down");
+ info = ephy_embed_event_new ();
+
+ wrapper = MOZILLA_EMBED(membed)->priv->wrapper;
+ g_return_val_if_fail (wrapper != NULL, G_FAILED);
+
+ event_context.Init (wrapper);
+ result = event_context.GetMouseEventInfo (static_cast<nsIDOMMouseEvent*>(dom_event), info);
- if (!ret)
+ ephy_embed_event_get_event_type (info, &type);
+
+ if (NS_SUCCEEDED(result) && (type == EPHY_EMBED_EVENT_MOUSE_BUTTON3))
{
- ret = mozilla_embed_emit_mouse_signal
- (membed, dom_event, "ge_context_menu");
+ nsCOMPtr<nsIDOMDocument> domDoc;
+ result = event_context.GetTargetDocument (getter_AddRefs(domDoc));
+ if (NS_SUCCEEDED(result))
+ {
+ result = wrapper->PushTargetDocument (domDoc);
+ if (NS_SUCCEEDED(result))
+ {
+ g_signal_emit_by_name (membed, "ge_context_menu",
+ info, &return_value);
+ wrapper->PopTargetDocument ();
+ }
+ }
+
}
- return ret;
+ g_object_unref (info);
+
+ return return_value;
}
static void
diff --git a/src/ephy-nautilus-view.c b/src/ephy-nautilus-view.c
index cec56630e..897d67af3 100644
--- a/src/ephy-nautilus-view.c
+++ b/src/ephy-nautilus-view.c
@@ -44,7 +44,10 @@ static void gnv_embed_new_window_cb (EphyEmbed *embed,
static void gnv_embed_link_message_cb (EphyEmbed *embed,
const char *message,
EphyNautilusView *view);
-static gint gnv_embed_dom_mouse_down_cb (EphyEmbed *embed,
+static gint gnv_embed_dom_mouse_click_cb (EphyEmbed *embed,
+ EphyEmbedEvent *event,
+ EphyNautilusView *view);
+static void gnv_embed_context_menu_cb (EphyEmbed *embed,
EphyEmbedEvent *event,
EphyNautilusView *view);
static void gnv_embed_zoom_change_cb (EphyNautilusView *embed,
@@ -195,9 +198,13 @@ ephy_nautilus_view_instance_init (EphyNautilusView *view)
GTK_SIGNAL_FUNC (gnv_embed_dom_mouse_click_cb),
view);
*/
- g_signal_connect (view->priv->embed, "ge_dom_mouse_down",
- GTK_SIGNAL_FUNC (gnv_embed_dom_mouse_down_cb),
+ g_signal_connect (view->priv->embed, "ge_dom_mouse_click",
+ GTK_SIGNAL_FUNC (gnv_embed_dom_mouse_click_cb),
view);
+ g_signal_connect (view->priv->embed, "ge_context_menu",
+ GTK_SIGNAL_FUNC (gnv_embed_context_menu_cb),
+ view);
+
/*
g_signal_connect (view->priv->embed, "ge_security_change",
GTK_SIGNAL_FUNC (gnv_embed_security_change_cb),
@@ -314,29 +321,19 @@ ephy_nautilus_view_class_init (EphyNautilusViewClass *class)
G_OBJECT_CLASS (class)->finalize = ephy_nautilus_view_finalize;
}
-
-
static gint
-gnv_embed_dom_mouse_down_cb (EphyEmbed *embed,
- EphyEmbedEvent *event,
- EphyNautilusView *view)
+gnv_embed_dom_mouse_click_cb (EphyEmbed *embed,
+ EphyEmbedEvent *event,
+ EphyNautilusView *view)
{
- EphyNautilusViewPrivate *p = view->priv;
- int button;
+ EphyEmbedEventType type;
EmbedEventContext context;
- ephy_embed_event_get_mouse_button (event, &button);
- ephy_embed_event_get_context (event, &context);
+ ephy_embed_event_get_event_type (event, &type);
+ ephy_embed_event_get_context (event, &context);
- if (button == 2)
- {
- ephy_embed_popup_set_event (EPHY_EMBED_POPUP (p->popup), event);
- ephy_embed_popup_show (EPHY_EMBED_POPUP (p->popup), embed);
- return TRUE;
-
- }
- else if (button == 1
- && (context & EMBED_CONTEXT_LINK))
+ if (type == EPHY_EMBED_EVENT_MOUSE_BUTTON2
+ && (context & EMBED_CONTEXT_LINK))
{
const GValue *value;
const gchar *url;
@@ -353,6 +350,19 @@ gnv_embed_dom_mouse_down_cb (EphyEmbed *embed,
}
static void
+gnv_embed_context_menu_cb (EphyEmbed *embed,
+ EphyEmbedEvent *event,
+ EphyNautilusView *view)
+{
+ EphyNautilusViewPrivate *p = view->priv;
+ EmbedEventContext context;
+
+ ephy_embed_event_get_context (event, &context);
+ ephy_embed_popup_set_event (EPHY_EMBED_POPUP (p->popup), event);
+ ephy_embed_popup_show (EPHY_EMBED_POPUP (p->popup), embed);
+}
+
+static void
gnv_embed_link_message_cb (EphyEmbed *embed, const char *message, EphyNautilusView *view)
{
g_return_if_fail (EPHY_IS_NAUTILUS_VIEW (view));
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index 106c79566..35a50e712 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -956,7 +956,7 @@ ephy_tab_dom_mouse_click_cb (EphyEmbed *embed,
EphyTab *tab)
{
EphyWindow *window;
- int button;
+ EphyEmbedEventType type;
EmbedEventContext context;
g_assert (IS_EPHY_EMBED_EVENT(event));
@@ -964,10 +964,10 @@ ephy_tab_dom_mouse_click_cb (EphyEmbed *embed,
window = ephy_tab_get_window (tab);
g_return_val_if_fail (window != NULL, FALSE);
- ephy_embed_event_get_mouse_button (event, &button);
+ ephy_embed_event_get_event_type (event, &type);
ephy_embed_event_get_context (event, &context);
- if (button == 1
+ if (type == EPHY_EMBED_EVENT_MOUSE_BUTTON2
&& (context & EMBED_CONTEXT_LINK))
{
const GValue *value;
@@ -977,7 +977,7 @@ ephy_tab_dom_mouse_click_cb (EphyEmbed *embed,
g_value_get_string (value),
EPHY_NEW_TAB_OPEN_PAGE);
}
- else if (button == 1 &&
+ else if (type == EPHY_EMBED_EVENT_MOUSE_BUTTON2 &&
eel_gconf_get_boolean (CONF_INTERFACE_MIDDLE_CLICK_OPEN_URL) &&
!(context & EMBED_CONTEXT_LINK
|| context & EMBED_CONTEXT_EMAIL_LINK
@@ -999,20 +999,20 @@ ephy_tab_context_menu_cb (EphyEmbed *embed,
EphyTab *tab)
{
EphyWindow *window;
- int button;
+ EphyEmbedEventType type;
g_assert (IS_EPHY_EMBED_EVENT(event));
window = ephy_tab_get_window (tab);
g_return_val_if_fail (window != NULL, FALSE);
- ephy_embed_event_get_mouse_button (event, &button);
+ ephy_embed_event_get_event_type (event, &type);
- if (button == 2)
+ if (type == EPHY_EMBED_EVENT_MOUSE_BUTTON3)
{
ephy_tab_show_embed_popup (tab, event);
}
- else if (button == -1)
+ else
{
int x, y;