зеркало из https://github.com/mozilla/gecko-dev.git
fix for bug 27734 r=saari
This commit is contained in:
Родитель
5015db0f79
Коммит
0be3cbafce
|
@ -594,7 +594,7 @@ void handle_scrollbar_value_changed(GtkAdjustment *adj, gpointer p)
|
|||
#endif
|
||||
}
|
||||
|
||||
static gint composition_start(GdkEventKey *aEvent, nsWindow *aWin)
|
||||
static gint composition_start(GdkEventKey *aEvent, nsWidget *aWin)
|
||||
{
|
||||
nsCompositionEvent compEvent;
|
||||
|
||||
|
@ -615,7 +615,7 @@ static gint composition_start(GdkEventKey *aEvent, nsWindow *aWin)
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
static gint composition_draw(GdkEventKey *aEvent, nsWindow *aWin)
|
||||
static gint composition_draw(GdkEventKey *aEvent, nsWidget *aWin)
|
||||
{
|
||||
nsresult res= NS_OK;
|
||||
if (!aWin->mIMECompositionUniString) {
|
||||
|
@ -669,7 +669,7 @@ static gint composition_draw(GdkEventKey *aEvent, nsWindow *aWin)
|
|||
return True;
|
||||
}
|
||||
|
||||
static gint composition_end(GdkEventKey *aEvent, nsWindow *aWin)
|
||||
static gint composition_end(GdkEventKey *aEvent, nsWidget *aWin)
|
||||
{
|
||||
nsCompositionEvent compEvent;
|
||||
|
||||
|
@ -758,7 +758,10 @@ gint handle_key_release_event_for_text(GtkObject *w, GdkEventKey* event,
|
|||
gint handle_key_press_event(GtkObject *w, GdkEventKey* event, gpointer p)
|
||||
{
|
||||
nsKeyEvent kevent;
|
||||
nsWindow* win = (nsWindow*)p;
|
||||
nsWidget *win = (nsWidget*)p;
|
||||
|
||||
if (win->focusWindow)
|
||||
win = win->focusWindow;
|
||||
|
||||
// work around for annoying things.
|
||||
if (event->keyval == GDK_Tab)
|
||||
|
@ -774,14 +777,16 @@ gint handle_key_press_event(GtkObject *w, GdkEventKey* event, gpointer p)
|
|||
return PR_TRUE;
|
||||
|
||||
NS_ADDREF(win);
|
||||
|
||||
//
|
||||
// First, dispatch the Key event as a virtual key down event
|
||||
// but lie about where it came from and say it is from the
|
||||
// window that currently has focus inside our app...
|
||||
//
|
||||
InitKeyEvent(event, p, kevent, NS_KEY_DOWN);
|
||||
InitKeyEvent(event, win, kevent, NS_KEY_DOWN);
|
||||
win->OnKey(kevent);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Second, dispatch the Key event as a key press event w/ a Unicode
|
||||
// character code. Note we have to check for modifier keys, since
|
||||
|
@ -793,16 +798,17 @@ gint handle_key_press_event(GtkObject *w, GdkEventKey* event, gpointer p)
|
|||
composition_draw(event, win);
|
||||
composition_end(event, win);
|
||||
} else {
|
||||
InitKeyPressEvent(event,p, kevent);
|
||||
InitKeyPressEvent(event, win, kevent);
|
||||
win->OnKey(kevent);
|
||||
|
||||
}
|
||||
} else { // for Home/End/Up/Down/Left/Right/PageUp/PageDown key
|
||||
InitKeyPressEvent(event,p, kevent);
|
||||
InitKeyPressEvent(event, win, kevent);
|
||||
win->OnKey(kevent);
|
||||
}
|
||||
|
||||
NS_RELEASE(win);
|
||||
|
||||
if (w)
|
||||
{
|
||||
gtk_signal_emit_stop_by_name (GTK_OBJECT(w), "key_press_event");
|
||||
|
@ -821,10 +827,13 @@ gint handle_key_release_event(GtkObject *w, GdkEventKey* event, gpointer p)
|
|||
|| event->keyval == GDK_Control_R)
|
||||
return PR_TRUE;
|
||||
|
||||
nsKeyEvent kevent;
|
||||
InitKeyEvent(event, p, kevent, NS_KEY_UP);
|
||||
nsWidget *win = (nsWidget *)p;
|
||||
if (win->focusWindow)
|
||||
win = win->focusWindow;
|
||||
|
||||
nsKeyEvent kevent;
|
||||
InitKeyEvent(event, win, kevent, NS_KEY_UP);
|
||||
|
||||
nsWindow * win = (nsWindow *) p;
|
||||
NS_ADDREF(win);
|
||||
win->OnKey(kevent);
|
||||
NS_RELEASE(win);
|
||||
|
|
|
@ -226,8 +226,14 @@ protected:
|
|||
|
||||
// this is set when a given widget has the focus.
|
||||
PRBool mHasFocus;
|
||||
|
||||
|
||||
// if anyone uses this for public access other than the key press/release code on the main window, i will kill you. pav
|
||||
public:
|
||||
// this is the current GdkSuperWin with the focus
|
||||
static nsWidget *focusWindow;
|
||||
|
||||
protected:
|
||||
//
|
||||
PRBool mIsDragDest;
|
||||
|
||||
|
|
|
@ -1749,6 +1749,17 @@ NS_METHOD nsWindow::CreateNative(GtkObject *parentWidget)
|
|||
InstallToplevelDragMotionSignal();
|
||||
InstallToplevelDragDropSignal();
|
||||
InstallToplevelDragDataReceivedSignal();
|
||||
|
||||
AddToEventMask(mShell, GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK);
|
||||
gtk_signal_connect(GTK_OBJECT(mShell),
|
||||
"key_press_event",
|
||||
GTK_SIGNAL_FUNC(handle_key_press_event),
|
||||
this);
|
||||
gtk_signal_connect(GTK_OBJECT(mShell),
|
||||
"key_release_event",
|
||||
GTK_SIGNAL_FUNC(handle_key_release_event),
|
||||
this);
|
||||
|
||||
// set the shell window as a drop target
|
||||
gtk_drag_dest_set (mShell,
|
||||
(GtkDestDefaults)0,
|
||||
|
|
Загрузка…
Ссылка в новой задаче