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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 // Replace the frame and layout the contents. Even though we don't have a | 675 // Replace the frame and layout the contents. Even though we don't have a |
676 // swapable glass frame like on Windows, we still replace the frame because | 676 // swapable glass frame like on Windows, we still replace the frame because |
677 // the button assets don't update otherwise. | 677 // the button assets don't update otherwise. |
678 native_widget_delegate_->AsWidget()->non_client_view()->UpdateFrame(); | 678 native_widget_delegate_->AsWidget()->non_client_view()->UpdateFrame(); |
679 } | 679 } |
680 | 680 |
681 void DesktopWindowTreeHostX11::SetFullscreen(bool fullscreen) { | 681 void DesktopWindowTreeHostX11::SetFullscreen(bool fullscreen) { |
682 if (is_fullscreen_ == fullscreen) | 682 if (is_fullscreen_ == fullscreen) |
683 return; | 683 return; |
684 is_fullscreen_ = fullscreen; | 684 is_fullscreen_ = fullscreen; |
| 685 |
| 686 // Work around a bug where if we try to unfullscreen, metacity immediately |
| 687 // fullscreens us again. This is a little flickery and not necessary if |
| 688 // there's a gnome-panel, but it's not easy to detect whether there's a |
| 689 // panel or not. |
| 690 bool unmaximize_and_remaximize = !fullscreen && IsMaximized() && |
| 691 ui::GuessWindowManager() == ui::WM_METACITY; |
| 692 |
| 693 if (unmaximize_and_remaximize) |
| 694 Restore(); |
685 SetWMSpecState(fullscreen, | 695 SetWMSpecState(fullscreen, |
686 atom_cache_.GetAtom("_NET_WM_STATE_FULLSCREEN"), | 696 atom_cache_.GetAtom("_NET_WM_STATE_FULLSCREEN"), |
687 None); | 697 None); |
| 698 if (unmaximize_and_remaximize) |
| 699 Maximize(); |
| 700 |
688 // Try to guess the size we will have after the switch to/from fullscreen: | 701 // Try to guess the size we will have after the switch to/from fullscreen: |
689 // - (may) avoid transient states | 702 // - (may) avoid transient states |
690 // - works around Flash content which expects to have the size updated | 703 // - works around Flash content which expects to have the size updated |
691 // synchronously. | 704 // synchronously. |
692 // See https://crbug.com/361408 | 705 // See https://crbug.com/361408 |
693 if (fullscreen) { | 706 if (fullscreen) { |
694 restored_bounds_ = bounds_; | 707 restored_bounds_ = bounds_; |
695 const gfx::Display display = | 708 const gfx::Display display = |
696 gfx::Screen::GetScreenFor(NULL)->GetDisplayNearestWindow(window()); | 709 gfx::Screen::GetScreenFor(NULL)->GetDisplayNearestWindow(window()); |
697 bounds_ = display.bounds(); | 710 bounds_ = display.bounds(); |
(...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1843 if (linux_ui) { | 1856 if (linux_ui) { |
1844 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 1857 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
1845 if (native_theme) | 1858 if (native_theme) |
1846 return native_theme; | 1859 return native_theme; |
1847 } | 1860 } |
1848 | 1861 |
1849 return ui::NativeTheme::instance(); | 1862 return ui::NativeTheme::instance(); |
1850 } | 1863 } |
1851 | 1864 |
1852 } // namespace views | 1865 } // namespace views |
OLD | NEW |