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 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1646 XChangeProperty(xdisplay_, | 1646 XChangeProperty(xdisplay_, |
1647 xwindow_, | 1647 xwindow_, |
1648 atom_cache_.GetAtom("_NET_WM_USER_TIME"), | 1648 atom_cache_.GetAtom("_NET_WM_USER_TIME"), |
1649 XA_CARDINAL, | 1649 XA_CARDINAL, |
1650 32, | 1650 32, |
1651 PropModeReplace, | 1651 PropModeReplace, |
1652 reinterpret_cast<const unsigned char *>(&wm_user_time_ms), | 1652 reinterpret_cast<const unsigned char *>(&wm_user_time_ms), |
1653 1); | 1653 1); |
1654 } | 1654 } |
1655 | 1655 |
| 1656 x_map_window_was_called_ = true; |
1656 XMapWindow(xdisplay_, xwindow_); | 1657 XMapWindow(xdisplay_, xwindow_); |
1657 | 1658 |
1658 // We now block until our window is mapped. Some X11 APIs will crash and | 1659 // 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 | 1660 // burn if passed |xwindow_| before the window is mapped, and XMapWindow is |
1660 // asynchronous. | 1661 // asynchronous. |
1661 if (ui::X11EventSource::GetInstance()) | 1662 if (ui::X11EventSource::GetInstance()) |
1662 ui::X11EventSource::GetInstance()->BlockUntilWindowMapped(xwindow_); | 1663 ui::X11EventSource::GetInstance()->BlockUntilWindowMapped(xwindow_); |
1663 window_mapped_ = true; | 1664 window_mapped_ = true; |
| 1665 x_map_window_was_called_ = false; |
1664 | 1666 |
1665 UpdateMinAndMaxSize(); | 1667 UpdateMinAndMaxSize(); |
1666 | 1668 |
1667 // Some WMs only respect maximize hints after the window has been mapped. | 1669 // Some WMs only respect maximize hints after the window has been mapped. |
1668 // Check whether we need to re-do a maximization. | 1670 // Check whether we need to re-do a maximization. |
1669 if (should_maximize_after_map_) { | 1671 if (should_maximize_after_map_) { |
1670 Maximize(); | 1672 Maximize(); |
1671 should_maximize_after_map_ = false; | 1673 should_maximize_after_map_ = false; |
1672 } | 1674 } |
1673 } | 1675 } |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1876 default: | 1878 default: |
1877 NOTREACHED(); | 1879 NOTREACHED(); |
1878 } | 1880 } |
1879 | 1881 |
1880 // If we coalesced an event we need to free its cookie. | 1882 // If we coalesced an event we need to free its cookie. |
1881 if (num_coalesced > 0) | 1883 if (num_coalesced > 0) |
1882 XFreeEventData(xev->xgeneric.display, &last_event.xcookie); | 1884 XFreeEventData(xev->xgeneric.display, &last_event.xcookie); |
1883 break; | 1885 break; |
1884 } | 1886 } |
1885 case MapNotify: { | 1887 case MapNotify: { |
| 1888 CHECK(x_map_window_was_called_) |
| 1889 << "Received MapNotify event despite never calling XMapWindow(). " |
| 1890 << "(This is debugging state for crbug.com/381732.)"; |
| 1891 |
1886 FOR_EACH_OBSERVER(DesktopWindowTreeHostObserverX11, | 1892 FOR_EACH_OBSERVER(DesktopWindowTreeHostObserverX11, |
1887 observer_list_, | 1893 observer_list_, |
1888 OnWindowMapped(xwindow_)); | 1894 OnWindowMapped(xwindow_)); |
1889 break; | 1895 break; |
1890 } | 1896 } |
1891 case UnmapNotify: { | 1897 case UnmapNotify: { |
1892 FOR_EACH_OBSERVER(DesktopWindowTreeHostObserverX11, | 1898 FOR_EACH_OBSERVER(DesktopWindowTreeHostObserverX11, |
1893 observer_list_, | 1899 observer_list_, |
1894 OnWindowUnmapped(xwindow_)); | 1900 OnWindowUnmapped(xwindow_)); |
1895 break; | 1901 break; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2037 if (linux_ui) { | 2043 if (linux_ui) { |
2038 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 2044 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
2039 if (native_theme) | 2045 if (native_theme) |
2040 return native_theme; | 2046 return native_theme; |
2041 } | 2047 } |
2042 | 2048 |
2043 return ui::NativeThemeAura::instance(); | 2049 return ui::NativeThemeAura::instance(); |
2044 } | 2050 } |
2045 | 2051 |
2046 } // namespace views | 2052 } // namespace views |
OLD | NEW |