]> khamidou — GitHub mirrors - electron.git/commitdiff
linux: Set WM_WINDOW_ROLE correctly
authorCheng Zhao <zcbenz@gmail.com>
Mon, 24 Nov 2014 07:23:02 +0000 (15:23 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 24 Nov 2014 07:23:02 +0000 (15:23 +0800)
WM_WINDOW_ROLE is used to specify the "role" of the window, and all
browser windows in atom-shell should have the same role.

atom/browser/native_window_views.cc

index eb5f31d459749f2bdb4f8669decd2f727bb4a0d0..7136efccbd6fb2a6ea26c3ce85958ac24b6cb760 100644 (file)
@@ -35,7 +35,6 @@
 #include "atom/browser/ui/x/x_window_utils.h"
 #include "base/environment.h"
 #include "base/nix/xdg_util.h"
-#include "base/strings/stringprintf.h"
 #include "chrome/browser/ui/libgtk2ui/unity_service.h"
 #include "dbus/bus.h"
 #include "dbus/object_proxy.h"
@@ -63,10 +62,6 @@ const int kMenuBarHeight = 25;
 #endif
 
 #if defined(USE_X11)
-// Counts how many window has already been created, it will be used to set the
-// window role for X11.
-int kWindowsCreated = 0;
-
 // Returns true if the bus name "com.canonical.AppMenu.Registrar" is available.
 bool ShouldUseGlobalMenuBar() {
   dbus::Bus::Options options;
@@ -183,9 +178,7 @@ NativeWindowViews::NativeWindowViews(content::WebContents* web_contents,
 
 #if defined(USE_X11)
   // Set WM_WINDOW_ROLE.
-  params.wm_role_name = base::StringPrintf(
-      "%s/%s/%d", "Atom Shell", Browser::Get()->GetName().c_str(),
-      ++kWindowsCreated);
+  params.wm_role_name = "atom-shell app";
   // Set WM_CLASS.
   params.wm_class_name = "atom";
   params.wm_class_class = "Atom";