aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla
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 /embed/mozilla
parentd5b5f70b1cca8ea489ca5be9900d0b47275b5a23 (diff)
downloadgsoc2013-epiphany-3241ea896ff4f8939c038ab65f03948d026ed520.tar
gsoc2013-epiphany-3241ea896ff4f8939c038ab65f03948d026ed520.tar.gz
gsoc2013-epiphany-3241ea896ff4f8939c038ab65f03948d026ed520.tar.bz2
gsoc2013-epiphany-3241ea896ff4f8939c038ab65f03948d026ed520.tar.lz
gsoc2013-epiphany-3241ea896ff4f8939c038ab65f03948d026ed520.tar.xz
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.
Diffstat (limited to 'embed/mozilla')
-rw-r--r--embed/mozilla/EventContext.cpp19
-rw-r--r--embed/mozilla/mozilla-embed.cpp67
2 files changed, 57 insertions, 29 deletions
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