Bug 66519 - "Supporting Internet keys in XFree86 4" [p=ventnor.bugzilla@yahoo.com.au (Michael Ventnor) r+sr=roc a1.9=schrep]

This commit is contained in:
reed@reedloden.com 2008-02-06 13:56:02 -08:00
Родитель 709e15bc9b
Коммит a72e4b883c
2 изменённых файлов: 33 добавлений и 0 удалений

Просмотреть файл

@ -59,6 +59,9 @@
#include <gtk/gtkwindow.h> #include <gtk/gtkwindow.h>
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h> #include <gdk/gdkkeysyms.h>
#include <X11/XF86keysym.h>
#include "nsWidgetAtoms.h"
#ifdef MOZ_ENABLE_STARTUP_NOTIFICATION #ifdef MOZ_ENABLE_STARTUP_NOTIFICATION
#define SN_API_NOT_YET_FROZEN #define SN_API_NOT_YET_FROZEN
@ -2236,6 +2239,15 @@ is_latin_shortcut_key(guint aKeyval)
(GDK_a <= aKeyval && aKeyval <= GDK_z)); (GDK_a <= aKeyval && aKeyval <= GDK_z));
} }
PRBool
nsWindow::DispatchCommandKeyEvent(nsIAtom* aCommand)
{
nsEventStatus status;
nsCommandEvent event(PR_TRUE, nsWidgetAtoms::onAppCommand, aCommand, this);
DispatchEvent(&event, status);
return TRUE;
}
gboolean gboolean
nsWindow::OnKeyPressEvent(GtkWidget *aWidget, GdkEventKey *aEvent) nsWindow::OnKeyPressEvent(GtkWidget *aWidget, GdkEventKey *aEvent)
{ {
@ -2297,6 +2309,25 @@ nsWindow::OnKeyPressEvent(GtkWidget *aWidget, GdkEventKey *aEvent)
|| aEvent->keyval == GDK_Meta_R) { || aEvent->keyval == GDK_Meta_R) {
return TRUE; return TRUE;
} }
// Look for specialized app-command keys
switch (aEvent->keyval) {
case XF86XK_Back:
return DispatchCommandKeyEvent(nsWidgetAtoms::Back);
case XF86XK_Forward:
return DispatchCommandKeyEvent(nsWidgetAtoms::Forward);
case XF86XK_Refresh:
return DispatchCommandKeyEvent(nsWidgetAtoms::Reload);
case XF86XK_Stop:
return DispatchCommandKeyEvent(nsWidgetAtoms::Stop);
case XF86XK_Search:
return DispatchCommandKeyEvent(nsWidgetAtoms::Search);
case XF86XK_Favorites:
return DispatchCommandKeyEvent(nsWidgetAtoms::Bookmarks);
case XF86XK_HomePage:
return DispatchCommandKeyEvent(nsWidgetAtoms::Home);
}
nsKeyEvent event(PR_TRUE, NS_KEY_PRESS, this); nsKeyEvent event(PR_TRUE, NS_KEY_PRESS, this);
InitKeyEvent(event, aEvent); InitKeyEvent(event, aEvent);
if (isKeyDownCancelled) { if (isKeyDownCancelled) {

Просмотреть файл

@ -50,6 +50,7 @@
#include "nsIDragService.h" #include "nsIDragService.h"
#include "nsITimer.h" #include "nsITimer.h"
#include "nsWidgetAtoms.h"
#include <gtk/gtk.h> #include <gtk/gtk.h>
@ -362,6 +363,7 @@ private:
nsresult SetWindowIconList(const nsCStringArray &aIconList); nsresult SetWindowIconList(const nsCStringArray &aIconList);
void SetDefaultIcon(void); void SetDefaultIcon(void);
void InitButtonEvent(nsMouseEvent &aEvent, GdkEventButton *aGdkEvent); void InitButtonEvent(nsMouseEvent &aEvent, GdkEventButton *aGdkEvent);
PRBool DispatchCommandKeyEvent(nsIAtom* aCommand);
GtkWidget *mShell; GtkWidget *mShell;
MozContainer *mContainer; MozContainer *mContainer;