Bug 591216 Fix Gtk-WARNING gtk_window_set_wmclass: shouldn't set wmclass after window is realized r=roc a=roc
authorGinn Chen <ginn.chen@sun.com>
Thu, 02 Sep 2010 15:23:52 +0800
changeset 51873 cc06207827f47e5351e62fdc09b4bfbce5505078
parent 51872 04e11820280cd5a7b413dd404a3a8bdfd84b4656
child 51874 f2aaa2cc5059e73dfcf720d76297d1c3f62c9e31
push id15460
push userginn.chen@sun.com
push dateThu, 02 Sep 2010 07:29:10 +0000
treeherdermozilla-central@cc06207827f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, roc
bugs591216
milestone2.0b6pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 591216 Fix Gtk-WARNING gtk_window_set_wmclass: shouldn't set wmclass after window is realized r=roc a=roc
widget/src/gtk2/nsWindow.cpp
--- a/widget/src/gtk2/nsWindow.cpp
+++ b/widget/src/gtk2/nsWindow.cpp
@@ -3772,49 +3772,48 @@ nsWindow::Create(nsIWidget        *aPare
         else if (mWindowType == eWindowType_popup) {
             // Popups that are not noautohide are only temporary. The are used
             // for menus and the like and disappear when another window is used.
             if (!aInitData->mNoAutoHide) {
                 // For most popups, use the standard GtkWindowType
                 // GTK_WINDOW_POPUP, which will use a Window with the
                 // override-redirect attribute (for temporary windows).
                 mShell = gtk_window_new(GTK_WINDOW_POPUP);
+                gtk_window_set_wmclass(GTK_WINDOW(mShell), "Popup", cBrand.get());
             } else {
                 // For long-lived windows, their stacking order is managed by
                 // the window manager, as indicated by GTK_WINDOW_TOPLEVEL ...
                 mShell = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-                GtkWindow* gtkWin = GTK_WINDOW(mShell);
+                gtk_window_set_wmclass(GTK_WINDOW(mShell), "Popup", cBrand.get());
                 // ... but the window manager does not decorate this window,
                 // nor provide a separate taskbar icon.
                 if (mBorderStyle == eBorderStyle_default) {
                   gtk_window_set_decorated(GTK_WINDOW(mShell), FALSE);
                 }
                 else {
                   PRBool decorate = mBorderStyle & eBorderStyle_title;
                   gtk_window_set_decorated(GTK_WINDOW(mShell), decorate);
                   if (decorate) {
                     gtk_window_set_deletable(GTK_WINDOW(mShell), mBorderStyle & eBorderStyle_close);
                   }
                 }
-                gtk_window_set_skip_taskbar_hint(gtkWin, TRUE);
+                gtk_window_set_skip_taskbar_hint(GTK_WINDOW(mShell), TRUE);
                 // Element focus is managed by the parent window so the
                 // WM_HINTS input field is set to False to tell the window
                 // manager not to set input focus to this window ...
-                gtk_window_set_accept_focus(gtkWin, FALSE);
+                gtk_window_set_accept_focus(GTK_WINDOW(mShell), FALSE);
 #ifdef MOZ_X11
                 // ... but when the window manager offers focus through
                 // WM_TAKE_FOCUS, focus is requested on the parent window.
                 gtk_widget_realize(mShell);
                 gdk_window_add_filter(mShell->window,
                                       popup_take_focus_filter, NULL); 
 #endif
             }
 
-            gtk_window_set_wmclass(GTK_WINDOW(mShell), "Popup", cBrand.get());
-
             GdkWindowTypeHint gtkTypeHint;
             switch (aInitData->mPopupHint) {
                 case ePopupTypeMenu:
                     gtkTypeHint = GDK_WINDOW_TYPE_HINT_POPUP_MENU;
                     break;
                 case ePopupTypeTooltip:
                     gtkTypeHint = GDK_WINDOW_TYPE_HINT_TOOLTIP;
                     break;