| 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 "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" |
| 6 | 6 |
| 7 #include <X11/extensions/shape.h> | 7 #include <X11/extensions/shape.h> |
| 8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
| 9 #include <X11/Xatom.h> | 9 #include <X11/Xatom.h> |
| 10 #include <X11/Xregion.h> | 10 #include <X11/Xregion.h> |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 | 493 |
| 494 void DesktopWindowTreeHostX11::Maximize() { | 494 void DesktopWindowTreeHostX11::Maximize() { |
| 495 // When we are in the process of requesting to maximize a window, we can | 495 // When we are in the process of requesting to maximize a window, we can |
| 496 // accurately keep track of our restored bounds instead of relying on the | 496 // accurately keep track of our restored bounds instead of relying on the |
| 497 // heuristics that are in the PropertyNotify and ConfigureNotify handlers. | 497 // heuristics that are in the PropertyNotify and ConfigureNotify handlers. |
| 498 restored_bounds_ = bounds_; | 498 restored_bounds_ = bounds_; |
| 499 | 499 |
| 500 SetWMSpecState(true, | 500 SetWMSpecState(true, |
| 501 atom_cache_.GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"), | 501 atom_cache_.GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"), |
| 502 atom_cache_.GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")); | 502 atom_cache_.GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")); |
| 503 if (IsMinimized()) |
| 504 ShowWindowWithState(ui::SHOW_STATE_NORMAL); |
| 503 } | 505 } |
| 504 | 506 |
| 505 void DesktopWindowTreeHostX11::Minimize() { | 507 void DesktopWindowTreeHostX11::Minimize() { |
| 506 x11_capture_.reset(); | 508 x11_capture_.reset(); |
| 507 XIconifyWindow(xdisplay_, xwindow_, 0); | 509 XIconifyWindow(xdisplay_, xwindow_, 0); |
| 508 } | 510 } |
| 509 | 511 |
| 510 void DesktopWindowTreeHostX11::Restore() { | 512 void DesktopWindowTreeHostX11::Restore() { |
| 511 SetWMSpecState(false, | 513 SetWMSpecState(false, |
| 512 atom_cache_.GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"), | 514 atom_cache_.GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"), |
| 513 atom_cache_.GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")); | 515 atom_cache_.GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")); |
| 516 if (IsMinimized()) |
| 517 ShowWindowWithState(ui::SHOW_STATE_NORMAL); |
| 514 } | 518 } |
| 515 | 519 |
| 516 bool DesktopWindowTreeHostX11::IsMaximized() const { | 520 bool DesktopWindowTreeHostX11::IsMaximized() const { |
| 517 return (HasWMSpecProperty("_NET_WM_STATE_MAXIMIZED_VERT") && | 521 return (HasWMSpecProperty("_NET_WM_STATE_MAXIMIZED_VERT") && |
| 518 HasWMSpecProperty("_NET_WM_STATE_MAXIMIZED_HORZ")); | 522 HasWMSpecProperty("_NET_WM_STATE_MAXIMIZED_HORZ")); |
| 519 } | 523 } |
| 520 | 524 |
| 521 bool DesktopWindowTreeHostX11::IsMinimized() const { | 525 bool DesktopWindowTreeHostX11::IsMinimized() const { |
| 522 return HasWMSpecProperty("_NET_WM_STATE_HIDDEN"); | 526 return HasWMSpecProperty("_NET_WM_STATE_HIDDEN"); |
| 523 } | 527 } |
| (...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1683 if (linux_ui) { | 1687 if (linux_ui) { |
| 1684 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 1688 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
| 1685 if (native_theme) | 1689 if (native_theme) |
| 1686 return native_theme; | 1690 return native_theme; |
| 1687 } | 1691 } |
| 1688 | 1692 |
| 1689 return ui::NativeTheme::instance(); | 1693 return ui::NativeTheme::instance(); |
| 1690 } | 1694 } |
| 1691 | 1695 |
| 1692 } // namespace views | 1696 } // namespace views |
| OLD | NEW |