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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
698 // Replace the frame and layout the contents. Even though we don't have a | 698 // Replace the frame and layout the contents. Even though we don't have a |
699 // swapable glass frame like on Windows, we still replace the frame because | 699 // swapable glass frame like on Windows, we still replace the frame because |
700 // the button assets don't update otherwise. | 700 // the button assets don't update otherwise. |
701 native_widget_delegate_->AsWidget()->non_client_view()->UpdateFrame(); | 701 native_widget_delegate_->AsWidget()->non_client_view()->UpdateFrame(); |
702 } | 702 } |
703 | 703 |
704 void DesktopWindowTreeHostX11::SetFullscreen(bool fullscreen) { | 704 void DesktopWindowTreeHostX11::SetFullscreen(bool fullscreen) { |
705 if (is_fullscreen_ == fullscreen) | 705 if (is_fullscreen_ == fullscreen) |
706 return; | 706 return; |
707 is_fullscreen_ = fullscreen; | 707 is_fullscreen_ = fullscreen; |
708 if (is_fullscreen_) | |
709 delayed_resize_task_.Cancel(); | |
708 | 710 |
709 // Work around a bug where if we try to unfullscreen, metacity immediately | 711 // Work around a bug where if we try to unfullscreen, metacity immediately |
710 // fullscreens us again. This is a little flickery and not necessary if | 712 // fullscreens us again. This is a little flickery and not necessary if |
711 // there's a gnome-panel, but it's not easy to detect whether there's a | 713 // there's a gnome-panel, but it's not easy to detect whether there's a |
712 // panel or not. | 714 // panel or not. |
713 bool unmaximize_and_remaximize = !fullscreen && IsMaximized() && | 715 bool unmaximize_and_remaximize = !fullscreen && IsMaximized() && |
714 ui::GuessWindowManager() == ui::WM_METACITY; | 716 ui::GuessWindowManager() == ui::WM_METACITY; |
715 | 717 |
716 if (unmaximize_and_remaximize) | 718 if (unmaximize_and_remaximize) |
717 Restore(); | 719 Restore(); |
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1711 xev->xconfigure.width, xev->xconfigure.height); | 1713 xev->xconfigure.width, xev->xconfigure.height); |
1712 bool size_changed = bounds_.size() != bounds.size(); | 1714 bool size_changed = bounds_.size() != bounds.size(); |
1713 bool origin_changed = bounds_.origin() != bounds.origin(); | 1715 bool origin_changed = bounds_.origin() != bounds.origin(); |
1714 previous_bounds_ = bounds_; | 1716 previous_bounds_ = bounds_; |
1715 bounds_ = bounds; | 1717 bounds_ = bounds; |
1716 | 1718 |
1717 if (origin_changed) | 1719 if (origin_changed) |
1718 OnHostMoved(bounds_.origin()); | 1720 OnHostMoved(bounds_.origin()); |
1719 | 1721 |
1720 if (size_changed) { | 1722 if (size_changed) { |
1723 window_size_ = bounds.size(); | |
1721 delayed_resize_task_.Reset(base::Bind( | 1724 delayed_resize_task_.Reset(base::Bind( |
1722 &DesktopWindowTreeHostX11::DelayedResize, | 1725 &DesktopWindowTreeHostX11::DelayedResize, |
1723 close_widget_factory_.GetWeakPtr(), | 1726 close_widget_factory_.GetWeakPtr())); |
Elliot Glaysher
2014/09/04 17:19:19
I suspect that you should be writing this a differ
tzik
2014/09/05 04:12:23
Hm, right. I misunderstood something..
The previou
| |
1724 bounds.size())); | |
1725 base::MessageLoop::current()->PostTask( | 1727 base::MessageLoop::current()->PostTask( |
1726 FROM_HERE, delayed_resize_task_.callback()); | 1728 FROM_HERE, delayed_resize_task_.callback()); |
1727 } | 1729 } |
1728 break; | 1730 break; |
1729 } | 1731 } |
1730 case GenericEvent: { | 1732 case GenericEvent: { |
1731 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); | 1733 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); |
1732 if (!factory->ShouldProcessXI2Event(xev)) | 1734 if (!factory->ShouldProcessXI2Event(xev)) |
1733 break; | 1735 break; |
1734 | 1736 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1884 break; | 1886 break; |
1885 } | 1887 } |
1886 case SelectionNotify: { | 1888 case SelectionNotify: { |
1887 drag_drop_client_->OnSelectionNotify(xev->xselection); | 1889 drag_drop_client_->OnSelectionNotify(xev->xselection); |
1888 break; | 1890 break; |
1889 } | 1891 } |
1890 } | 1892 } |
1891 return ui::POST_DISPATCH_STOP_PROPAGATION; | 1893 return ui::POST_DISPATCH_STOP_PROPAGATION; |
1892 } | 1894 } |
1893 | 1895 |
1894 void DesktopWindowTreeHostX11::DelayedResize(const gfx::Size& size) { | 1896 void DesktopWindowTreeHostX11::DelayedResize() { |
1895 OnHostResized(size); | 1897 OnHostResized(window_size_); |
1896 ResetWindowRegion(); | 1898 ResetWindowRegion(); |
1897 delayed_resize_task_.Cancel(); | 1899 delayed_resize_task_.Cancel(); |
1898 } | 1900 } |
1899 | 1901 |
1900 //////////////////////////////////////////////////////////////////////////////// | 1902 //////////////////////////////////////////////////////////////////////////////// |
1901 // DesktopWindowTreeHost, public: | 1903 // DesktopWindowTreeHost, public: |
1902 | 1904 |
1903 // static | 1905 // static |
1904 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( | 1906 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( |
1905 internal::NativeWidgetDelegate* native_widget_delegate, | 1907 internal::NativeWidgetDelegate* native_widget_delegate, |
1906 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 1908 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
1907 return new DesktopWindowTreeHostX11(native_widget_delegate, | 1909 return new DesktopWindowTreeHostX11(native_widget_delegate, |
1908 desktop_native_widget_aura); | 1910 desktop_native_widget_aura); |
1909 } | 1911 } |
1910 | 1912 |
1911 // static | 1913 // static |
1912 ui::NativeTheme* DesktopWindowTreeHost::GetNativeTheme(aura::Window* window) { | 1914 ui::NativeTheme* DesktopWindowTreeHost::GetNativeTheme(aura::Window* window) { |
1913 const views::LinuxUI* linux_ui = views::LinuxUI::instance(); | 1915 const views::LinuxUI* linux_ui = views::LinuxUI::instance(); |
1914 if (linux_ui) { | 1916 if (linux_ui) { |
1915 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 1917 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
1916 if (native_theme) | 1918 if (native_theme) |
1917 return native_theme; | 1919 return native_theme; |
1918 } | 1920 } |
1919 | 1921 |
1920 return ui::NativeTheme::instance(); | 1922 return ui::NativeTheme::instance(); |
1921 } | 1923 } |
1922 | 1924 |
1923 } // namespace views | 1925 } // namespace views |
OLD | NEW |