Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: chrome/browser/ui/gtk/browser_window_gtk.cc

Issue 7562022: GTK: Possible WM_CLASS fix. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/gtk/browser_window_gtk.h" 5 #include "chrome/browser/ui/gtk/browser_window_gtk.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 8
9 #include <dlfcn.h> 9 #include <dlfcn.h>
10 #include <string> 10 #include <string>
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } 289 }
290 gtk_window_resize(window, new_size.width(), new_size.height()); 290 gtk_window_resize(window, new_size.width(), new_size.height());
291 } 291 }
292 292
293 GQuark GetBrowserWindowQuarkKey() { 293 GQuark GetBrowserWindowQuarkKey() {
294 static GQuark quark = g_quark_from_static_string(kBrowserWindowKey); 294 static GQuark quark = g_quark_from_static_string(kBrowserWindowKey);
295 return quark; 295 return quark;
296 } 296 }
297 297
298 // Set a custom WM_CLASS for a window. 298 // Set a custom WM_CLASS for a window.
299 // This would normally be a simple gtk_window_set_wmclass call but we have
300 // an XFCE workaround.
301 void SetWindowCustomClass(GtkWindow* window, const std::string& wmclass) { 299 void SetWindowCustomClass(GtkWindow* window, const std::string& wmclass) {
302 scoped_ptr<base::Environment> env(base::Environment::Create()); 300 gtk_window_set_wmclass(window,
303 if (base::nix::GetDesktopEnvironment(env.get()) == 301 wmclass.c_str(),
304 base::nix::DESKTOP_ENVIRONMENT_XFCE) { 302 gdk_get_program_class());
305 // Workaround for XFCE. XFCE seems to treat the class as a user
306 // displayed title, which our app name certainly isn't. They don't have
307 // a dock or application based behaviour so do what looks good.
308 gtk_window_set_wmclass(window,
309 wmclass.c_str(),
310 gdk_get_program_class());
311 } else {
312 // Most everything else uses the wmclass_class to group windows
313 // together (docks, per application stuff, etc). Hopefully they won't
314 // display wmclassname to the user.
315 gtk_window_set_wmclass(window,
316 g_get_prgname(),
317 wmclass.c_str());
318 }
319 303
320 // Set WM_WINDOW_ROLE for session management purposes. 304 // Set WM_WINDOW_ROLE for session management purposes.
321 // See http://tronche.com/gui/x/icccm/sec-5.html . 305 // See http://tronche.com/gui/x/icccm/sec-5.html .
322 gtk_window_set_role(window, wmclass.c_str()); 306 gtk_window_set_role(window, wmclass.c_str());
323 } 307 }
324 308
325 } // namespace 309 } // namespace
326 310
327 std::map<XID, GtkWindow*> BrowserWindowGtk::xid_map_; 311 std::map<XID, GtkWindow*> BrowserWindowGtk::xid_map_;
328 312
(...skipping 2061 matching lines...) Expand 10 before | Expand all | Expand 10 after
2390 // are taken from the WMs' source code. 2374 // are taken from the WMs' source code.
2391 return (wm_name == "Blackbox" || 2375 return (wm_name == "Blackbox" ||
2392 wm_name == "compiz" || 2376 wm_name == "compiz" ||
2393 wm_name == "Compiz" || 2377 wm_name == "Compiz" ||
2394 wm_name == "e16" || // Enlightenment DR16 2378 wm_name == "e16" || // Enlightenment DR16
2395 wm_name == "Metacity" || 2379 wm_name == "Metacity" ||
2396 wm_name == "Mutter" || 2380 wm_name == "Mutter" ||
2397 wm_name == "Openbox" || 2381 wm_name == "Openbox" ||
2398 wm_name == "Xfwm4"); 2382 wm_name == "Xfwm4");
2399 } 2383 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698