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

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

Issue 6879127: GTK: Set WMCLASS in a way docks notice while still solving display issues on XFCE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 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>
11 11
12 #include "base/base_paths.h" 12 #include "base/base_paths.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/environment.h"
14 #include "base/i18n/file_util_icu.h" 15 #include "base/i18n/file_util_icu.h"
15 #include "base/logging.h" 16 #include "base/logging.h"
16 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/singleton.h" 18 #include "base/memory/singleton.h"
18 #include "base/message_loop.h" 19 #include "base/message_loop.h"
20 #include "base/nix/xdg_util.h"
19 #include "base/path_service.h" 21 #include "base/path_service.h"
20 #include "base/string_util.h" 22 #include "base/string_util.h"
21 #include "base/time.h" 23 #include "base/time.h"
22 #include "base/utf_string_conversions.h" 24 #include "base/utf_string_conversions.h"
23 #include "chrome/app/chrome_command_ids.h" 25 #include "chrome/app/chrome_command_ids.h"
24 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" 26 #include "chrome/browser/autocomplete/autocomplete_edit_view.h"
25 #include "chrome/browser/bookmarks/bookmark_utils.h" 27 #include "chrome/browser/bookmarks/bookmark_utils.h"
26 #include "chrome/browser/browser_process.h" 28 #include "chrome/browser/browser_process.h"
27 #include "chrome/browser/debugger/devtools_window.h" 29 #include "chrome/browser/debugger/devtools_window.h"
28 #include "chrome/browser/download/download_item_model.h" 30 #include "chrome/browser/download/download_item_model.h"
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 320
319 // Add this window to its own unique window group to allow for 321 // Add this window to its own unique window group to allow for
320 // window-to-parent modality. 322 // window-to-parent modality.
321 gtk_window_group_add_window(gtk_window_group_new(), window_); 323 gtk_window_group_add_window(gtk_window_group_new(), window_);
322 g_object_unref(gtk_window_get_group(window_)); 324 g_object_unref(gtk_window_get_group(window_));
323 325
324 if (browser_->type() & Browser::TYPE_APP) { 326 if (browser_->type() & Browser::TYPE_APP) {
325 std::string app_name = browser_->app_name(); 327 std::string app_name = browser_->app_name();
326 if (app_name != DevToolsWindow::kDevToolsApp) { 328 if (app_name != DevToolsWindow::kDevToolsApp) {
327 std::string wmclassname = web_app::GetWMClassFromAppName(app_name); 329 std::string wmclassname = web_app::GetWMClassFromAppName(app_name);
328 gtk_window_set_wmclass(window_, 330
329 wmclassname.c_str(), 331 scoped_ptr<base::Environment> env(base::Environment::Create());
330 gdk_get_program_class()); 332 if (base::nix::GetDesktopEnvironment(env.get()) ==
333 base::nix::DESKTOP_ENVIRONMENT_XFCE) {
Marco Trevisan (Treviño) 2011/04/21 21:02:29 If you prefer you can also mix these two cases int
Elliot Glaysher 2011/04/21 21:25:17 I don't think that helps. The whole point is that
334 // Workaround for XFCE. XFCE seems to treat the class as a user
335 // displayed title, which our app name certainly isn't. They don't have
336 // a dock or application based behaviour so do what looks good.
Evan Martin 2011/04/21 20:54:34 Relevant docs: http://developer.gimp.org/api/2.0/g
Daniel Erat 2011/04/21 21:10:28 (Sorry if I'm stating stuff that you guys already
Elliot Glaysher 2011/04/21 21:23:31 It's not setting the window title; xfce's alt-tab
337 gtk_window_set_wmclass(window_,
338 wmclassname.c_str(),
339 gdk_get_program_class());
340 } else {
341 // Most everything else uses the wmclass_class to group windows
342 // together (docks, per application stuff, etc). Hopefully they won't
343 // display wmclassname to the user.
344 gtk_window_set_wmclass(window_,
345 window_->wmclass_name,
346 wmclassname.c_str());
347 }
348
349 gtk_window_set_role(window_, wmclassname.c_str());
331 } 350 }
332 } 351 }
333 352
334 // For popups, we initialize widgets then set the window geometry, because 353 // For popups, we initialize widgets then set the window geometry, because
335 // popups need the widgets inited before they can set the window size 354 // popups need the widgets inited before they can set the window size
336 // properly. For other windows, we set the geometry first to prevent resize 355 // properly. For other windows, we set the geometry first to prevent resize
337 // flicker. 356 // flicker.
338 if (browser_->type() & Browser::TYPE_POPUP) { 357 if (browser_->type() & Browser::TYPE_POPUP) {
339 InitWidgets(); 358 InitWidgets();
340 SetGeometryHints(); 359 SetGeometryHints();
(...skipping 1988 matching lines...) Expand 10 before | Expand all | Expand 10 after
2329 // special-case the ones where the custom frame should be used. These names 2348 // special-case the ones where the custom frame should be used. These names
2330 // are taken from the WMs' source code. 2349 // are taken from the WMs' source code.
2331 return (wm_name == "Blackbox" || 2350 return (wm_name == "Blackbox" ||
2332 wm_name == "compiz" || 2351 wm_name == "compiz" ||
2333 wm_name == "e16" || // Enlightenment DR16 2352 wm_name == "e16" || // Enlightenment DR16
2334 wm_name == "Metacity" || 2353 wm_name == "Metacity" ||
2335 wm_name == "Mutter" || 2354 wm_name == "Mutter" ||
2336 wm_name == "Openbox" || 2355 wm_name == "Openbox" ||
2337 wm_name == "Xfwm4"); 2356 wm_name == "Xfwm4");
2338 } 2357 }
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