Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/browser_window_gtk.h" | 5 #include "chrome/browser/gtk/browser_window_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 326 | 326 |
| 327 BrowserWindowGtk::BrowserWindowGtk(Browser* browser) | 327 BrowserWindowGtk::BrowserWindowGtk(Browser* browser) |
| 328 : browser_(browser), | 328 : browser_(browser), |
| 329 state_(GDK_WINDOW_STATE_WITHDRAWN), | 329 state_(GDK_WINDOW_STATE_WITHDRAWN), |
| 330 frame_cursor_(NULL), | 330 frame_cursor_(NULL), |
| 331 is_active_(true), | 331 is_active_(true), |
| 332 last_click_time_(0), | 332 last_click_time_(0), |
| 333 maximize_after_show_(false), | 333 maximize_after_show_(false), |
| 334 suppress_window_raise_(false), | 334 suppress_window_raise_(false), |
| 335 accel_group_(NULL) { | 335 accel_group_(NULL) { |
| 336 ActiveWindowWatcherX::AddObserver(this); | |
|
tony
2010/07/13 22:09:47
What is the reason for this move? Should there be
Evan Stade
2010/07/13 22:29:40
the reason is so that the observer gets called fir
| |
| 337 | |
| 336 use_custom_frame_pref_.Init(prefs::kUseCustomChromeFrame, | 338 use_custom_frame_pref_.Init(prefs::kUseCustomChromeFrame, |
| 337 browser_->profile()->GetPrefs(), this); | 339 browser_->profile()->GetPrefs(), this); |
| 338 | 340 |
| 339 // In some (older) versions of compiz, raising top-level windows when they | 341 // In some (older) versions of compiz, raising top-level windows when they |
| 340 // are partially off-screen causes them to get snapped back on screen, not | 342 // are partially off-screen causes them to get snapped back on screen, not |
| 341 // always even on the current virtual desktop. If we are running under | 343 // always even on the current virtual desktop. If we are running under |
| 342 // compiz, suppress such raises, as they are not necessary in compiz anyway. | 344 // compiz, suppress such raises, as they are not necessary in compiz anyway. |
| 343 std::string wm_name; | 345 std::string wm_name; |
| 344 if (x11_util::GetWindowManagerName(&wm_name) && wm_name == "compiz") | 346 if (x11_util::GetWindowManagerName(&wm_name) && wm_name == "compiz") |
| 345 suppress_window_raise_ = true; | 347 suppress_window_raise_ = true; |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 367 } | 369 } |
| 368 | 370 |
| 369 ConnectAccelerators(); | 371 ConnectAccelerators(); |
| 370 | 372 |
| 371 // Set the initial background color of widgets. | 373 // Set the initial background color of widgets. |
| 372 SetBackgroundColor(); | 374 SetBackgroundColor(); |
| 373 HideUnsupportedWindowFeatures(); | 375 HideUnsupportedWindowFeatures(); |
| 374 | 376 |
| 375 registrar_.Add(this, NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, | 377 registrar_.Add(this, NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, |
| 376 NotificationService::AllSources()); | 378 NotificationService::AllSources()); |
| 377 | |
| 378 ActiveWindowWatcherX::AddObserver(this); | |
| 379 } | 379 } |
| 380 | 380 |
| 381 BrowserWindowGtk::~BrowserWindowGtk() { | 381 BrowserWindowGtk::~BrowserWindowGtk() { |
| 382 ActiveWindowWatcherX::RemoveObserver(this); | 382 ActiveWindowWatcherX::RemoveObserver(this); |
| 383 | 383 |
| 384 browser_->tabstrip_model()->RemoveObserver(this); | 384 browser_->tabstrip_model()->RemoveObserver(this); |
| 385 | 385 |
| 386 if (frame_cursor_) { | 386 if (frame_cursor_) { |
| 387 gdk_cursor_unref(frame_cursor_); | 387 gdk_cursor_unref(frame_cursor_); |
| 388 frame_cursor_ = NULL; | 388 frame_cursor_ = NULL; |
| (...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2150 // special-case the ones where the custom frame should be used. These names | 2150 // special-case the ones where the custom frame should be used. These names |
| 2151 // are taken from the WMs' source code. | 2151 // are taken from the WMs' source code. |
| 2152 return (wm_name == "Blackbox" || | 2152 return (wm_name == "Blackbox" || |
| 2153 wm_name == "compiz" || | 2153 wm_name == "compiz" || |
| 2154 wm_name == "e16" || // Enlightenment DR16 | 2154 wm_name == "e16" || // Enlightenment DR16 |
| 2155 wm_name == "Metacity" || | 2155 wm_name == "Metacity" || |
| 2156 wm_name == "Mutter" || | 2156 wm_name == "Mutter" || |
| 2157 wm_name == "Openbox" || | 2157 wm_name == "Openbox" || |
| 2158 wm_name == "Xfwm4"); | 2158 wm_name == "Xfwm4"); |
| 2159 } | 2159 } |
| OLD | NEW |