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 <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
#include <X11/XF86keysym.h>
#include "nsWidgetAtoms.h"
#ifdef MOZ_ENABLE_STARTUP_NOTIFICATION
#define SN_API_NOT_YET_FROZEN
@ -2236,6 +2239,15 @@ is_latin_shortcut_key(guint aKeyval)
(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
nsWindow::OnKeyPressEvent(GtkWidget *aWidget, GdkEventKey *aEvent)
{
@ -2297,6 +2309,25 @@ nsWindow::OnKeyPressEvent(GtkWidget *aWidget, GdkEventKey *aEvent)
|| aEvent->keyval == GDK_Meta_R) {
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);
InitKeyEvent(event, aEvent);
if (isKeyDownCancelled) {

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

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