diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-06-16 00:15:10 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-06-16 00:15:10 +0800 |
commit | d5b5f70b1cca8ea489ca5be9900d0b47275b5a23 (patch) | |
tree | d797809cd8b2903ba01dde9b147b1a65291d5b32 /embed/mozilla/EventContext.cpp | |
parent | 41eafad36cb938d63f242ccd8dc2ad4988653614 (diff) | |
download | gsoc2013-epiphany-d5b5f70b1cca8ea489ca5be9900d0b47275b5a23.tar gsoc2013-epiphany-d5b5f70b1cca8ea489ca5be9900d0b47275b5a23.tar.gz gsoc2013-epiphany-d5b5f70b1cca8ea489ca5be9900d0b47275b5a23.tar.bz2 gsoc2013-epiphany-d5b5f70b1cca8ea489ca5be9900d0b47275b5a23.tar.lz gsoc2013-epiphany-d5b5f70b1cca8ea489ca5be9900d0b47275b5a23.tar.xz gsoc2013-epiphany-d5b5f70b1cca8ea489ca5be9900d0b47275b5a23.tar.zst gsoc2013-epiphany-d5b5f70b1cca8ea489ca5be9900d0b47275b5a23.zip |
Shift+F10 show context menus on the embed. (Less invasive way until
2003-06-15 Marco Pesenti Gritti <marco@it.gnome.org>
* embed/ephy-embed-event.c: (ephy_embed_event_init):
* embed/ephy-embed-event.h:
* embed/ephy-embed-popup-bw.c: (popup_menu_at_coords),
(ephy_embed_popup_bw_show_impl):
* embed/ephy-embed.c: (ephy_embed_base_init):
* embed/ephy-embed.h:
* embed/mozilla/EventContext.cpp:
* embed/mozilla/EventContext.h:
* embed/mozilla/mozilla-embed.cpp:
* src/ephy-tab.c: (popup_menu_at_coords),
(ephy_tab_show_embed_popup), (ephy_tab_context_menu_cb),
(ephy_tab_init):
Shift+F10 show context menus on the embed.
(Less invasive way until gtkmozembed has a context_menu
signal)
From galeon.
Diffstat (limited to 'embed/mozilla/EventContext.cpp')
-rw-r--r-- | embed/mozilla/EventContext.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/embed/mozilla/EventContext.cpp b/embed/mozilla/EventContext.cpp index 7fa44acc0..229f8d3be 100644 --- a/embed/mozilla/EventContext.cpp +++ b/embed/mozilla/EventContext.cpp @@ -586,6 +586,64 @@ nsresult EventContext::GetMouseEventInfo (nsIDOMMouseEvent *aMouseEvent, EphyEmb return NS_OK; } +nsresult EventContext::GetKeyEventInfo (nsIDOMKeyEvent *aKeyEvent, EphyEmbedEvent *info) +{ + nsresult rv; + + PRUint32 keyCode; + rv = aKeyEvent->GetKeyCode(&keyCode); + if (NS_FAILED(rv)) return rv; + info->keycode = keyCode; + + nsCOMPtr<nsIDOMEventTarget> target; + rv = aKeyEvent->GetTarget(getter_AddRefs(target)); + if (NS_FAILED(rv) || !target) return NS_ERROR_FAILURE; + + /* Calculate the node coordinates relative to the widget origin */ + nsCOMPtr<nsIDOMNSHTMLElement> elem = do_QueryInterface(target, &rv); + if (NS_FAILED(rv)) return rv; + + PRInt32 x = 0, y = 0; + while (elem) + { + PRInt32 val; + elem->GetOffsetTop(&val); y += val; + elem->GetScrollTop(&val); y -= val; + elem->GetOffsetLeft(&val); x += val; + elem->GetScrollLeft(&val); x -= val; + + nsCOMPtr<nsIDOMElement> parent; + elem->GetOffsetParent(getter_AddRefs(parent)); + elem = do_QueryInterface(parent, &rv); + } + info->x = x; + info->y = y; + + /* Context */ + rv = GetEventContext (target, info); + if (NS_FAILED(rv)) return rv; + + /* Get the modifier */ + + PRBool mod_key; + + info->modifier = 0; + + aKeyEvent->GetAltKey(&mod_key); + if (mod_key) info->modifier |= GDK_MOD1_MASK; + + aKeyEvent->GetShiftKey(&mod_key); + if (mod_key) info->modifier |= GDK_SHIFT_MASK; + + aKeyEvent->GetMetaKey(&mod_key); + if (mod_key) info->modifier |= GDK_Meta_L; + + aKeyEvent->GetCtrlKey(&mod_key); + if (mod_key) info->modifier |= GDK_CONTROL_MASK; + + return NS_OK; +} + nsresult EventContext::IsPageFramed (nsIDOMNode *node, PRBool *Framed) { nsresult result; |