OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef UI_PLATFORM_WINDOW_X11_X11_WINDOW_BASE_H_ | 5 #ifndef UI_PLATFORM_WINDOW_X11_X11_WINDOW_BASE_H_ |
6 #define UI_PLATFORM_WINDOW_X11_X11_WINDOW_BASE_H_ | 6 #define UI_PLATFORM_WINDOW_X11_X11_WINDOW_BASE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
13 #include "ui/gfx/x/x11_atom_cache.h" | 13 #include "ui/gfx/x/x11_atom_cache.h" |
14 #include "ui/gfx/x/x11_types.h" | 14 #include "ui/gfx/x/x11_types.h" |
15 #include "ui/platform_window/platform_window.h" | 15 #include "ui/platform_window/platform_window.h" |
16 #include "ui/platform_window/platform_window_delegate.h" | 16 #include "ui/platform_window/platform_window_delegate.h" |
17 #include "ui/platform_window/x11/x11_window_export.h" | 17 #include "ui/platform_window/x11/x11_window_export.h" |
18 | 18 |
19 namespace ui { | 19 namespace ui { |
20 | 20 |
| 21 class XScopedEventSelector; |
| 22 |
21 // Abstract base implementation for a X11 based PlatformWindow. Methods that | 23 // Abstract base implementation for a X11 based PlatformWindow. Methods that |
22 // are platform specific are left unimplemented. | 24 // are platform specific are left unimplemented. |
23 class X11_WINDOW_EXPORT X11WindowBase : public PlatformWindow { | 25 class X11_WINDOW_EXPORT X11WindowBase : public PlatformWindow { |
24 public: | 26 public: |
25 explicit X11WindowBase(PlatformWindowDelegate* delegate); | 27 explicit X11WindowBase(PlatformWindowDelegate* delegate); |
26 ~X11WindowBase() override; | 28 ~X11WindowBase() override; |
27 | 29 |
28 // Creates new underlying XWindow. Does not map XWindow. | 30 // Creates new underlying XWindow. Does not map XWindow. |
29 void Create(); | 31 void Create(); |
30 | 32 |
(...skipping 27 matching lines...) Expand all Loading... |
58 // Processes events for this XWindow. | 60 // Processes events for this XWindow. |
59 void ProcessXWindowEvent(XEvent* xev); | 61 void ProcessXWindowEvent(XEvent* xev); |
60 | 62 |
61 private: | 63 private: |
62 PlatformWindowDelegate* delegate_; | 64 PlatformWindowDelegate* delegate_; |
63 | 65 |
64 XDisplay* xdisplay_; | 66 XDisplay* xdisplay_; |
65 XID xwindow_; | 67 XID xwindow_; |
66 XID xroot_window_; | 68 XID xroot_window_; |
67 X11AtomCache atom_cache_; | 69 X11AtomCache atom_cache_; |
| 70 std::unique_ptr<ui::XScopedEventSelector> xwindow_events_; |
68 | 71 |
69 base::string16 window_title_; | 72 base::string16 window_title_; |
70 | 73 |
71 // Setting the bounds is an asynchronous operation in X11. |requested_bounds_| | 74 // Setting the bounds is an asynchronous operation in X11. |requested_bounds_| |
72 // is the bounds requested using XConfigureWindow, and |confirmed_bounds_| is | 75 // is the bounds requested using XConfigureWindow, and |confirmed_bounds_| is |
73 // the bounds the X11 server has set on the window. | 76 // the bounds the X11 server has set on the window. |
74 gfx::Rect requested_bounds_; | 77 gfx::Rect requested_bounds_; |
75 gfx::Rect confirmed_bounds_; | 78 gfx::Rect confirmed_bounds_; |
76 | 79 |
77 bool window_mapped_ = false; | 80 bool window_mapped_ = false; |
(...skipping 10 matching lines...) Expand all Loading... |
88 // unclear why this is necessary, but might be related to calls to | 91 // unclear why this is necessary, but might be related to calls to |
89 // XInitThreads(). | 92 // XInitThreads(). |
90 X11_WINDOW_EXPORT void SetUseOverrideRedirectWindowByDefault( | 93 X11_WINDOW_EXPORT void SetUseOverrideRedirectWindowByDefault( |
91 bool override_redirect); | 94 bool override_redirect); |
92 | 95 |
93 } // namespace test | 96 } // namespace test |
94 | 97 |
95 } // namespace ui | 98 } // namespace ui |
96 | 99 |
97 #endif // UI_PLATFORM_WINDOW_X11_X11_WINDOW_BASE_H_ | 100 #endif // UI_PLATFORM_WINDOW_X11_X11_WINDOW_BASE_H_ |
OLD | NEW |