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

Side by Side Diff: chrome/browser/ui/panels/panel_browser_window_gtk.cc

Issue 8595003: Have panels respond to changes in work area on Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review feedback. Created 9 years, 1 month 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
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/panels/panel_browser_window_gtk.h" 5 #include "chrome/browser/ui/panels/panel_browser_window_gtk.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/ui/browser_list.h" 8 #include "chrome/browser/ui/browser_list.h"
9 #include "chrome/browser/ui/panels/panel.h" 9 #include "chrome/browser/ui/panels/panel.h"
10 #include "chrome/browser/ui/panels/panel_manager.h" 10 #include "chrome/browser/ui/panels/panel_manager.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 PanelBrowserWindowGtk::~PanelBrowserWindowGtk() { 64 PanelBrowserWindowGtk::~PanelBrowserWindowGtk() {
65 if (drag_widget_) { 65 if (drag_widget_) {
66 // Terminate the grab if we have it. We could do this using any widget, 66 // Terminate the grab if we have it. We could do this using any widget,
67 // |drag_widget_| is just convenient. 67 // |drag_widget_| is just convenient.
68 gtk_grab_add(drag_widget_); 68 gtk_grab_add(drag_widget_);
69 gtk_grab_remove(drag_widget_); 69 gtk_grab_remove(drag_widget_);
70 DestroyDragWidget(); 70 DestroyDragWidget();
71 } 71 }
72 panel_->OnNativePanelClosed(); 72 panel_->OnNativePanelClosed();
73 ui::WorkAreaWatcherX::RemoveObserver(this);
73 } 74 }
74 75
75 void PanelBrowserWindowGtk::Init() { 76 void PanelBrowserWindowGtk::Init() {
76 BrowserWindowGtk::Init(); 77 BrowserWindowGtk::Init();
77 78
78 // Keep the window docked to the bottom of the screen on resizes. 79 // Keep the window docked to the bottom of the screen on resizes.
79 gtk_window_set_gravity(window(), GDK_GRAVITY_SOUTH_EAST); 80 gtk_window_set_gravity(window(), GDK_GRAVITY_SOUTH_EAST);
80 81
81 // Keep the window always on top. 82 // Keep the window always on top.
82 gtk_window_set_keep_above(window(), TRUE); 83 gtk_window_set_keep_above(window(), TRUE);
83 84
84 // Show the window on all the virtual desktops. 85 // Show the window on all the virtual desktops.
85 gtk_window_stick(window()); 86 gtk_window_stick(window());
86 87
87 // Do not show an icon in the task bar. Window operations such as close, 88 // Do not show an icon in the task bar. Window operations such as close,
88 // minimize etc. can only be done from the panel UI. 89 // minimize etc. can only be done from the panel UI.
89 gtk_window_set_skip_taskbar_hint(window(), TRUE); 90 gtk_window_set_skip_taskbar_hint(window(), TRUE);
90 91
91 g_signal_connect(titlebar_widget(), "button-press-event", 92 g_signal_connect(titlebar_widget(), "button-press-event",
92 G_CALLBACK(OnTitlebarButtonPressEventThunk), this); 93 G_CALLBACK(OnTitlebarButtonPressEventThunk), this);
93 g_signal_connect(titlebar_widget(), "button-release-event", 94 g_signal_connect(titlebar_widget(), "button-release-event",
94 G_CALLBACK(OnTitlebarButtonReleaseEventThunk), this); 95 G_CALLBACK(OnTitlebarButtonReleaseEventThunk), this);
96
97 ui::WorkAreaWatcherX::AddObserver(this);
95 } 98 }
96 99
97 bool PanelBrowserWindowGtk::GetWindowEdge(int x, int y, GdkWindowEdge* edge) { 100 bool PanelBrowserWindowGtk::GetWindowEdge(int x, int y, GdkWindowEdge* edge) {
98 // Since panels are not resizable or movable by the user, we should not 101 // Since panels are not resizable or movable by the user, we should not
99 // detect the window edge for behavioral purposes. The edge, if any, 102 // detect the window edge for behavioral purposes. The edge, if any,
100 // is present only for visual aspects. 103 // is present only for visual aspects.
101 return FALSE; 104 return FALSE;
102 } 105 }
103 106
104 bool PanelBrowserWindowGtk::HandleTitleBarLeftMousePress( 107 bool PanelBrowserWindowGtk::HandleTitleBarLeftMousePress(
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 NULL); 221 NULL);
219 *title = title_with_markup; 222 *title = title_with_markup;
220 g_free(title_escaped); 223 g_free(title_escaped);
221 g_free(title_with_markup); 224 g_free(title_with_markup);
222 return BrowserWindowGtk::PANGO_MARKUP; 225 return BrowserWindowGtk::PANGO_MARKUP;
223 } else { 226 } else {
224 return BrowserWindowGtk::GetWindowTitle(title); 227 return BrowserWindowGtk::GetWindowTitle(title);
225 } 228 }
226 } 229 }
227 230
231 void PanelBrowserWindowGtk::WorkAreaChanged() {
232 panel_->manager()->OnDisplayChanged();
233 }
234
228 void PanelBrowserWindowGtk::ShowPanel() { 235 void PanelBrowserWindowGtk::ShowPanel() {
229 Show(); 236 Show();
230 } 237 }
231 238
232 void PanelBrowserWindowGtk::ShowPanelInactive() { 239 void PanelBrowserWindowGtk::ShowPanelInactive() {
233 ShowInactive(); 240 ShowInactive();
234 } 241 }
235 242
236 gfx::Rect PanelBrowserWindowGtk::GetPanelBounds() const { 243 gfx::Rect PanelBrowserWindowGtk::GetPanelBounds() const {
237 return bounds_; 244 return bounds_;
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 } 735 }
729 } 736 }
730 737
731 bool NativePanelTestingGtk::IsWindowSizeKnown() const { 738 bool NativePanelTestingGtk::IsWindowSizeKnown() const {
732 return panel_browser_window_gtk_->window_size_known_; 739 return panel_browser_window_gtk_->window_size_known_;
733 } 740 }
734 741
735 bool NativePanelTestingGtk::IsAnimatingBounds() const { 742 bool NativePanelTestingGtk::IsAnimatingBounds() const {
736 return panel_browser_window_gtk_->IsAnimatingBounds(); 743 return panel_browser_window_gtk_->IsAnimatingBounds();
737 } 744 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698