b=568404 don't make NS_DEACTIVATE dispatch conditional on gFocusWindow being in the same toplevel window r=enndeakin

--HG--
extra : rebase_source : a9f6d3ce267791710e7be40343601e2e2eea2df2
This commit is contained in:
Karl Tomlinson 2010-06-18 13:11:08 +12:00
Родитель 03f950fc53
Коммит 14a4f0b283
1 изменённых файлов: 7 добавлений и 51 удалений

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

@ -161,7 +161,6 @@ static PRBool is_mouse_in_window(GdkWindow* aWindow,
gdouble aMouseX, gdouble aMouseY);
static nsWindow *get_window_for_gtk_widget(GtkWidget *widget);
static nsWindow *get_window_for_gdk_window(GdkWindow *window);
static nsWindow *get_owning_window_for_gdk_window(GdkWindow *window);
static GtkWidget *get_gtk_widget_for_gdk_window(GdkWindow *window);
static GdkCursor *get_gtk_cursor(nsCursor aCursor);
@ -3112,45 +3111,15 @@ nsWindow::OnContainerFocusOutEvent(GtkWidget *aWidget, GdkEventFocus *aEvent)
}
#endif /* MOZ_X11 */
// Figure out if the focus widget is the child of this window. If
// it is, send a deactivate event for it.
if (!gFocusWindow)
return;
GdkWindow *tmpWindow;
tmpWindow = (GdkWindow *)gFocusWindow->GetNativeData(NS_NATIVE_WINDOW);
nsWindow *tmpnsWindow = get_window_for_gdk_window(tmpWindow);
while (tmpWindow && tmpnsWindow) {
// found it!
if (tmpnsWindow == this)
goto foundit;
tmpWindow = gdk_window_get_parent(tmpWindow);
if (!tmpWindow)
break;
tmpnsWindow = get_owning_window_for_gdk_window(tmpWindow);
if (gFocusWindow) {
nsRefPtr<nsWindow> kungFuDeathGrip = gFocusWindow;
if (gFocusWindow->mIMModule) {
gFocusWindow->mIMModule->OnBlurWindow(gFocusWindow);
}
gFocusWindow = nsnull;
}
LOGFOCUS(("The focus widget was not a child of this window [%p]\n",
(void *)this));
return;
foundit:
nsRefPtr<nsWindow> kungFuDeathGrip = gFocusWindow;
if (gFocusWindow->mIMModule) {
gFocusWindow->mIMModule->OnBlurWindow(gFocusWindow);
}
// We only dispatch a deactivate event if we are a toplevel
// window, otherwise the embedding code takes care of it.
if (NS_LIKELY(!gFocusWindow->mIsDestroyed))
DispatchDeactivateEvent();
gFocusWindow = nsnull;
DispatchDeactivateEvent();
LOGFOCUS(("Done with container focus out [%p]\n", (void *)this));
}
@ -5480,19 +5449,6 @@ get_window_for_gdk_window(GdkWindow *window)
return static_cast<nsWindow *>(user_data);
}
/* static */
nsWindow *
get_owning_window_for_gdk_window(GdkWindow *window)
{
GtkWidget *owningWidget = get_gtk_widget_for_gdk_window(window);
if (!owningWidget)
return nsnull;
gpointer user_data = g_object_get_data(G_OBJECT(owningWidget), "nsWindow");
return static_cast<nsWindow *>(user_data);
}
/* static */
GtkWidget *
get_gtk_widget_for_gdk_window(GdkWindow *window)