OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/apps/native_app_window_gtk.h" | 5 #include "chrome/browser/ui/gtk/apps/native_app_window_gtk.h" |
6 | 6 |
7 #include <gdk/gdkx.h> | 7 #include <gdk/gdkx.h> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/message_loop/message_pump_gtk.h" | 10 #include "base/message_loop/message_pump_gtk.h" |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 x_event->xproperty.atom == atom_cache_.GetAtom("_NET_WM_STATE") && | 323 x_event->xproperty.atom == atom_cache_.GetAtom("_NET_WM_STATE") && |
324 GTK_WIDGET(window_)->window && | 324 GTK_WIDGET(window_)->window && |
325 ui::GetAtomArrayProperty(GDK_WINDOW_XWINDOW(GTK_WIDGET(window_)->window), | 325 ui::GetAtomArrayProperty(GDK_WINDOW_XWINDOW(GTK_WIDGET(window_)->window), |
326 "_NET_WM_STATE", | 326 "_NET_WM_STATE", |
327 &atom_list)) { | 327 &atom_list)) { |
328 std::vector< ::Atom>::iterator it = | 328 std::vector< ::Atom>::iterator it = |
329 std::find(atom_list.begin(), | 329 std::find(atom_list.begin(), |
330 atom_list.end(), | 330 atom_list.end(), |
331 atom_cache_.GetAtom("_NET_WM_STATE_HIDDEN")); | 331 atom_cache_.GetAtom("_NET_WM_STATE_HIDDEN")); |
332 | 332 |
| 333 GdkWindowState previous_state = state_; |
333 state_ = (it != atom_list.end()) ? GDK_WINDOW_STATE_ICONIFIED : | 334 state_ = (it != atom_list.end()) ? GDK_WINDOW_STATE_ICONIFIED : |
334 static_cast<GdkWindowState>(state_ & ~GDK_WINDOW_STATE_ICONIFIED); | 335 static_cast<GdkWindowState>(state_ & ~GDK_WINDOW_STATE_ICONIFIED); |
335 | 336 |
336 // TODO(mlamouri): we don't need to send a change event all the time here. | 337 if (previous_state != state_) { |
337 // Only when |state_| has actually changed. | 338 shell_window_->OnNativeWindowChanged(); |
338 shell_window_->OnNativeWindowChanged(); | 339 } |
339 } | 340 } |
340 | 341 |
341 return GDK_FILTER_CONTINUE; | 342 return GDK_FILTER_CONTINUE; |
342 } | 343 } |
343 | 344 |
344 void NativeAppWindowGtk::FlashFrame(bool flash) { | 345 void NativeAppWindowGtk::FlashFrame(bool flash) { |
345 gtk_window_set_urgency_hint(window_, flash); | 346 gtk_window_set_urgency_hint(window_, flash); |
346 } | 347 } |
347 | 348 |
348 bool NativeAppWindowGtk::IsAlwaysOnTop() const { | 349 bool NativeAppWindowGtk::IsAlwaysOnTop() const { |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 hints_mask |= GDK_HINT_MAX_SIZE; | 711 hints_mask |= GDK_HINT_MAX_SIZE; |
711 } | 712 } |
712 if (hints_mask) { | 713 if (hints_mask) { |
713 gtk_window_set_geometry_hints( | 714 gtk_window_set_geometry_hints( |
714 window_, | 715 window_, |
715 GTK_WIDGET(window_), | 716 GTK_WIDGET(window_), |
716 &hints, | 717 &hints, |
717 static_cast<GdkWindowHints>(hints_mask)); | 718 static_cast<GdkWindowHints>(hints_mask)); |
718 } | 719 } |
719 } | 720 } |
OLD | NEW |