OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/panels/panel_gtk.h" | 5 #include "chrome/browser/ui/gtk/panels/panel_gtk.h" |
6 | 6 |
7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
9 #include <X11/XF86keysym.h> | 9 #include <X11/XF86keysym.h> |
10 | 10 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 const gfx::Rect& bounds, | 202 const gfx::Rect& bounds, |
203 bool always_on_top) { | 203 bool always_on_top) { |
204 PanelGtk* panel_gtk = new PanelGtk(panel, bounds, always_on_top); | 204 PanelGtk* panel_gtk = new PanelGtk(panel, bounds, always_on_top); |
205 panel_gtk->Init(); | 205 panel_gtk->Init(); |
206 return panel_gtk; | 206 return panel_gtk; |
207 } | 207 } |
208 | 208 |
209 PanelGtk::PanelGtk(Panel* panel, const gfx::Rect& bounds, bool always_on_top) | 209 PanelGtk::PanelGtk(Panel* panel, const gfx::Rect& bounds, bool always_on_top) |
210 : panel_(panel), | 210 : panel_(panel), |
211 bounds_(bounds), | 211 bounds_(bounds), |
212 always_on_top_(always_on_top), | 212 always_on_top_(always_on_top), |
Dmitry Titov
2013/06/01 01:01:55
How about you initialize this to 'false', and then
| |
213 is_shown_(false), | 213 is_shown_(false), |
214 paint_state_(PAINT_AS_INACTIVE), | 214 paint_state_(PAINT_AS_INACTIVE), |
215 is_drawing_attention_(false), | 215 is_drawing_attention_(false), |
216 frame_cursor_(NULL), | 216 frame_cursor_(NULL), |
217 is_active_(!ui::ActiveWindowWatcherX::WMSupportsActivation()), | 217 is_active_(!ui::ActiveWindowWatcherX::WMSupportsActivation()), |
218 is_minimized_(false), | 218 is_minimized_(false), |
219 window_(NULL), | 219 window_(NULL), |
220 window_container_(NULL), | 220 window_container_(NULL), |
221 window_vbox_(NULL), | 221 window_vbox_(NULL), |
222 render_area_event_box_(NULL), | 222 render_area_event_box_(NULL), |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
309 gtk_container_add(GTK_CONTAINER(render_area_event_box_), | 309 gtk_container_add(GTK_CONTAINER(render_area_event_box_), |
310 contents_expanded_); | 310 contents_expanded_); |
311 gtk_widget_show(render_area_event_box_); | 311 gtk_widget_show(render_area_event_box_); |
312 gtk_box_pack_end(GTK_BOX(window_vbox_), render_area_event_box_, | 312 gtk_box_pack_end(GTK_BOX(window_vbox_), render_area_event_box_, |
313 TRUE, TRUE, 0); | 313 TRUE, TRUE, 0); |
314 | 314 |
315 gtk_container_add(GTK_CONTAINER(window_), window_container_); | 315 gtk_container_add(GTK_CONTAINER(window_), window_container_); |
316 gtk_widget_show(window_container_); | 316 gtk_widget_show(window_container_); |
317 | 317 |
318 ConnectAccelerators(); | 318 ConnectAccelerators(); |
319 | |
320 UpdateWindowAlwaysOnTopState(); | |
319 } | 321 } |
320 | 322 |
321 void PanelGtk::SetWindowCornerStyle(panel::CornerStyle corner_style) { | 323 void PanelGtk::SetWindowCornerStyle(panel::CornerStyle corner_style) { |
322 corner_style_ = corner_style; | 324 corner_style_ = corner_style; |
323 UpdateWindowShape(); | 325 UpdateWindowShape(); |
324 } | 326 } |
325 | 327 |
326 void PanelGtk::MinimizePanelBySystem() { | 328 void PanelGtk::MinimizePanelBySystem() { |
327 gtk_window_iconify(window_); | 329 gtk_window_iconify(window_); |
328 } | 330 } |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1003 | 1005 |
1004 bool PanelGtk::IsPanelAlwaysOnTop() const { | 1006 bool PanelGtk::IsPanelAlwaysOnTop() const { |
1005 return always_on_top_; | 1007 return always_on_top_; |
1006 } | 1008 } |
1007 | 1009 |
1008 void PanelGtk::SetPanelAlwaysOnTop(bool on_top) { | 1010 void PanelGtk::SetPanelAlwaysOnTop(bool on_top) { |
1009 if (always_on_top_ == on_top) | 1011 if (always_on_top_ == on_top) |
1010 return; | 1012 return; |
1011 always_on_top_ = on_top; | 1013 always_on_top_ = on_top; |
1012 | 1014 |
1013 gtk_window_set_keep_above(window_, on_top); | 1015 UpdateWindowAlwaysOnTopState(); |
1016 } | |
1017 | |
1018 void PanelGtk::UpdateWindowAlwaysOnTopState() { | |
1019 gtk_window_set_keep_above(window_, always_on_top_); | |
1014 | 1020 |
1015 // Do not show an icon in the task bar for always-on-top windows. | 1021 // Do not show an icon in the task bar for always-on-top windows. |
1016 // Window operations such as close, minimize etc. can only be done | 1022 // Window operations such as close, minimize etc. can only be done |
1017 // from the panel UI. | 1023 // from the panel UI. |
1018 gtk_window_set_skip_taskbar_hint(window_, on_top); | 1024 gtk_window_set_skip_taskbar_hint(window_, always_on_top_); |
1019 | 1025 |
1020 // Show always-on-top windows on all the virtual desktops. | 1026 // Show always-on-top windows on all the virtual desktops. |
1021 if (on_top) | 1027 if (always_on_top_) |
1022 gtk_window_stick(window_); | 1028 gtk_window_stick(window_); |
1023 else | 1029 else |
1024 gtk_window_unstick(window_); | 1030 gtk_window_unstick(window_); |
1025 } | 1031 } |
1026 | 1032 |
1027 void PanelGtk::EnableResizeByMouse(bool enable) { | 1033 void PanelGtk::EnableResizeByMouse(bool enable) { |
1028 } | 1034 } |
1029 | 1035 |
1030 void PanelGtk::UpdatePanelMinimizeRestoreButtonVisibility() { | 1036 void PanelGtk::UpdatePanelMinimizeRestoreButtonVisibility() { |
1031 titlebar_->UpdateMinimizeRestoreButtonVisibility(); | 1037 titlebar_->UpdateMinimizeRestoreButtonVisibility(); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1184 default: | 1190 default: |
1185 NOTREACHED(); | 1191 NOTREACHED(); |
1186 return false; | 1192 return false; |
1187 } | 1193 } |
1188 return gtk_widget_get_visible(button->widget()); | 1194 return gtk_widget_get_visible(button->widget()); |
1189 } | 1195 } |
1190 | 1196 |
1191 panel::CornerStyle GtkNativePanelTesting::GetWindowCornerStyle() const { | 1197 panel::CornerStyle GtkNativePanelTesting::GetWindowCornerStyle() const { |
1192 return panel_gtk_->corner_style_; | 1198 return panel_gtk_->corner_style_; |
1193 } | 1199 } |
OLD | NEW |