| 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/Xatom.h> | 7 #include <X11/Xatom.h> |
| 8 #include <X11/Xregion.h> | 8 #include <X11/Xregion.h> |
| 9 #include <X11/Xutil.h> | 9 #include <X11/Xutil.h> |
| 10 #include <X11/extensions/XInput2.h> | 10 #include <X11/extensions/XInput2.h> |
| (...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1653 1); | 1653 1); |
| 1654 } | 1654 } |
| 1655 | 1655 |
| 1656 XMapWindow(xdisplay_, xwindow_); | 1656 XMapWindow(xdisplay_, xwindow_); |
| 1657 | 1657 |
| 1658 // We now block until our window is mapped. Some X11 APIs will crash and | 1658 // We now block until our window is mapped. Some X11 APIs will crash and |
| 1659 // burn if passed |xwindow_| before the window is mapped, and XMapWindow is | 1659 // burn if passed |xwindow_| before the window is mapped, and XMapWindow is |
| 1660 // asynchronous. | 1660 // asynchronous. |
| 1661 if (ui::X11EventSource::GetInstance()) | 1661 if (ui::X11EventSource::GetInstance()) |
| 1662 ui::X11EventSource::GetInstance()->BlockUntilWindowMapped(xwindow_); | 1662 ui::X11EventSource::GetInstance()->BlockUntilWindowMapped(xwindow_); |
| 1663 window_mapped_ = true; | |
| 1664 | |
| 1665 UpdateMinAndMaxSize(); | |
| 1666 | |
| 1667 // Some WMs only respect maximize hints after the window has been mapped. | |
| 1668 // Check whether we need to re-do a maximization. | |
| 1669 if (should_maximize_after_map_) { | |
| 1670 Maximize(); | |
| 1671 should_maximize_after_map_ = false; | |
| 1672 } | |
| 1673 } | 1663 } |
| 1674 | 1664 |
| 1675 void DesktopWindowTreeHostX11::SetWindowTransparency() { | 1665 void DesktopWindowTreeHostX11::SetWindowTransparency() { |
| 1676 compositor()->SetHostHasTransparentBackground(use_argb_visual_); | 1666 compositor()->SetHostHasTransparentBackground(use_argb_visual_); |
| 1677 window()->SetTransparent(use_argb_visual_); | 1667 window()->SetTransparent(use_argb_visual_); |
| 1678 content_window_->SetTransparent(use_argb_visual_); | 1668 content_window_->SetTransparent(use_argb_visual_); |
| 1679 } | 1669 } |
| 1680 | 1670 |
| 1681 void DesktopWindowTreeHostX11::Relayout() { | 1671 void DesktopWindowTreeHostX11::Relayout() { |
| 1682 Widget* widget = native_widget_delegate_->AsWidget(); | 1672 Widget* widget = native_widget_delegate_->AsWidget(); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1876 default: | 1866 default: |
| 1877 NOTREACHED(); | 1867 NOTREACHED(); |
| 1878 } | 1868 } |
| 1879 | 1869 |
| 1880 // If we coalesced an event we need to free its cookie. | 1870 // If we coalesced an event we need to free its cookie. |
| 1881 if (num_coalesced > 0) | 1871 if (num_coalesced > 0) |
| 1882 XFreeEventData(xev->xgeneric.display, &last_event.xcookie); | 1872 XFreeEventData(xev->xgeneric.display, &last_event.xcookie); |
| 1883 break; | 1873 break; |
| 1884 } | 1874 } |
| 1885 case MapNotify: { | 1875 case MapNotify: { |
| 1876 window_mapped_ = true; |
| 1877 |
| 1886 FOR_EACH_OBSERVER(DesktopWindowTreeHostObserverX11, | 1878 FOR_EACH_OBSERVER(DesktopWindowTreeHostObserverX11, |
| 1887 observer_list_, | 1879 observer_list_, |
| 1888 OnWindowMapped(xwindow_)); | 1880 OnWindowMapped(xwindow_)); |
| 1881 |
| 1882 UpdateMinAndMaxSize(); |
| 1883 |
| 1884 // Some WMs only respect maximize hints after the window has been mapped. |
| 1885 // Check whether we need to re-do a maximization. |
| 1886 if (should_maximize_after_map_) { |
| 1887 Maximize(); |
| 1888 should_maximize_after_map_ = false; |
| 1889 } |
| 1890 |
| 1889 break; | 1891 break; |
| 1890 } | 1892 } |
| 1891 case UnmapNotify: { | 1893 case UnmapNotify: { |
| 1892 FOR_EACH_OBSERVER(DesktopWindowTreeHostObserverX11, | 1894 FOR_EACH_OBSERVER(DesktopWindowTreeHostObserverX11, |
| 1893 observer_list_, | 1895 observer_list_, |
| 1894 OnWindowUnmapped(xwindow_)); | 1896 OnWindowUnmapped(xwindow_)); |
| 1895 break; | 1897 break; |
| 1896 } | 1898 } |
| 1897 case ClientMessage: { | 1899 case ClientMessage: { |
| 1898 Atom message_type = xev->xclient.message_type; | 1900 Atom message_type = xev->xclient.message_type; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2037 if (linux_ui) { | 2039 if (linux_ui) { |
| 2038 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 2040 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
| 2039 if (native_theme) | 2041 if (native_theme) |
| 2040 return native_theme; | 2042 return native_theme; |
| 2041 } | 2043 } |
| 2042 | 2044 |
| 2043 return ui::NativeThemeAura::instance(); | 2045 return ui::NativeThemeAura::instance(); |
| 2044 } | 2046 } |
| 2045 | 2047 |
| 2046 } // namespace views | 2048 } // namespace views |
| OLD | NEW |