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 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ | 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ |
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ | 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <X11/extensions/shape.h> | 10 #include <X11/extensions/shape.h> |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 gfx::Rect GetX11RootWindowBounds() const; | 65 gfx::Rect GetX11RootWindowBounds() const; |
66 | 66 |
67 // Returns the current bounds in terms of the X11 Root Window including the | 67 // Returns the current bounds in terms of the X11 Root Window including the |
68 // borders provided by the window manager (if any). | 68 // borders provided by the window manager (if any). |
69 gfx::Rect GetX11RootWindowOuterBounds() const; | 69 gfx::Rect GetX11RootWindowOuterBounds() const; |
70 | 70 |
71 // Returns the window shape if the window is not rectangular. Returns NULL | 71 // Returns the window shape if the window is not rectangular. Returns NULL |
72 // otherwise. | 72 // otherwise. |
73 ::Region GetWindowShape() const; | 73 ::Region GetWindowShape() const; |
74 | 74 |
75 // Called by X11DesktopHandler to notify us that the native windowing system | |
76 // has changed our activation. | |
77 void HandleNativeWidgetActivationChanged(bool active); | |
78 | |
79 void AddObserver(views::DesktopWindowTreeHostObserverX11* observer); | 75 void AddObserver(views::DesktopWindowTreeHostObserverX11* observer); |
80 void RemoveObserver(views::DesktopWindowTreeHostObserverX11* observer); | 76 void RemoveObserver(views::DesktopWindowTreeHostObserverX11* observer); |
81 | 77 |
82 // Swaps the current handler for events in the non client view with |handler|. | 78 // Swaps the current handler for events in the non client view with |handler|. |
83 void SwapNonClientEventHandler(std::unique_ptr<ui::EventHandler> handler); | 79 void SwapNonClientEventHandler(std::unique_ptr<ui::EventHandler> handler); |
84 | 80 |
85 // Runs the |func| callback for each content-window, and deallocates the | 81 // Runs the |func| callback for each content-window, and deallocates the |
86 // internal list of open windows. | 82 // internal list of open windows. |
87 static void CleanUpWindowList(void (*func)(aura::Window* window)); | 83 static void CleanUpWindowList(void (*func)(aura::Window* window)); |
88 | 84 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 // window size to the monitor size causes the WM to set the EWMH for | 175 // window size to the monitor size causes the WM to set the EWMH for |
180 // fullscreen. | 176 // fullscreen. |
181 gfx::Size AdjustSize(const gfx::Size& requested_size); | 177 gfx::Size AdjustSize(const gfx::Size& requested_size); |
182 | 178 |
183 // Called when |xwindow_|'s _NET_WM_STATE property is updated. | 179 // Called when |xwindow_|'s _NET_WM_STATE property is updated. |
184 void OnWMStateUpdated(); | 180 void OnWMStateUpdated(); |
185 | 181 |
186 // Called when |xwindow_|'s _NET_FRAME_EXTENTS property is updated. | 182 // Called when |xwindow_|'s _NET_FRAME_EXTENTS property is updated. |
187 void OnFrameExtentsUpdated(); | 183 void OnFrameExtentsUpdated(); |
188 | 184 |
185 // Record the activation state. | |
186 void BeforeActivationStateChanged(); | |
187 | |
188 // Handle the state change since BeforeActivationStateChanged(). | |
189 void AfterActivationStateChanged(); | |
190 | |
191 // Called on an XEnterWindowEvent, XLeaveWindowEvent, XIEnterEvent, or an | |
192 // XILeaveEvent. | |
193 void OnCrossingEvent(bool enter, | |
194 bool focus_in_window_or_ancestor, | |
195 int mode, | |
196 int detail); | |
197 | |
198 // Called on an XFocusInEvent, XFocusOutEvent, XIFocusInEvent, or an | |
199 // XIFocusOutEvent. | |
200 void OnFocusEvent(bool focus_in, int mode, int detail); | |
201 | |
189 // Makes a round trip to the X server to get the enclosing workspace for this | 202 // Makes a round trip to the X server to get the enclosing workspace for this |
190 // window. Returns true iff |workspace_| was changed. | 203 // window. Returns true iff |workspace_| was changed. |
191 bool UpdateWorkspace(); | 204 bool UpdateWorkspace(); |
192 | 205 |
193 // Updates |xwindow_|'s minimum and maximum size. | 206 // Updates |xwindow_|'s minimum and maximum size. |
194 void UpdateMinAndMaxSize(); | 207 void UpdateMinAndMaxSize(); |
195 | 208 |
196 // Updates |xwindow_|'s _NET_WM_USER_TIME if |xwindow_| is active. | 209 // Updates |xwindow_|'s _NET_WM_USER_TIME if |xwindow_| is active. |
197 void UpdateWMUserTime(const ui::PlatformEvent& event); | 210 void UpdateWMUserTime(const ui::PlatformEvent& event); |
198 | 211 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
259 | 272 |
260 // The native root window. | 273 // The native root window. |
261 ::Window x_root_window_; | 274 ::Window x_root_window_; |
262 | 275 |
263 ui::X11AtomCache atom_cache_; | 276 ui::X11AtomCache atom_cache_; |
264 | 277 |
265 // Is the window mapped to the screen? | 278 // Is the window mapped to the screen? |
266 bool window_mapped_; | 279 bool window_mapped_; |
267 | 280 |
268 // Should we wait for an UnmapNotify before trying to remap the window? | 281 // Should we wait for an UnmapNotify before trying to remap the window? |
282 // If |wait_for_unmap_| is true, we have sent an XUnmapWindow request to the | |
283 // server and have yet to receive an UnmapNotify. | |
269 bool wait_for_unmap_; | 284 bool wait_for_unmap_; |
270 | 285 |
271 // The bounds of |xwindow_|. | 286 // The bounds of |xwindow_|. |
272 gfx::Rect bounds_in_pixels_; | 287 gfx::Rect bounds_in_pixels_; |
273 | 288 |
274 // Whenever the bounds are set, we keep the previous set of bounds around so | 289 // Whenever the bounds are set, we keep the previous set of bounds around so |
275 // we can have a better chance of getting the real | 290 // we can have a better chance of getting the real |
276 // |restored_bounds_in_pixels_|. Window managers tend to send a Configure | 291 // |restored_bounds_in_pixels_|. Window managers tend to send a Configure |
277 // message with the maximized bounds, and then set the window maximized | 292 // message with the maximized bounds, and then set the window maximized |
278 // property. (We don't rely on this for when we request that the window be | 293 // property. (We don't rely on this for when we request that the window be |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
349 static std::list<XID>* open_windows_; | 364 static std::list<XID>* open_windows_; |
350 | 365 |
351 base::string16 window_title_; | 366 base::string16 window_title_; |
352 | 367 |
353 // Whether we currently are flashing our frame. This feature is implemented | 368 // Whether we currently are flashing our frame. This feature is implemented |
354 // by setting the urgency hint with the window manager, which can draw | 369 // by setting the urgency hint with the window manager, which can draw |
355 // attention to the window or completely ignore the hint. We stop flashing | 370 // attention to the window or completely ignore the hint. We stop flashing |
356 // the frame when |xwindow_| gains focus or handles a mouse button event. | 371 // the frame when |xwindow_| gains focus or handles a mouse button event. |
357 bool urgency_hint_set_; | 372 bool urgency_hint_set_; |
358 | 373 |
374 // Does |xwindow_| have the pointer grab (XI2 or normal)? | |
375 bool has_pointer_grab_; | |
376 | |
359 bool activatable_; | 377 bool activatable_; |
360 | 378 |
379 // The focus-tracking state variables are as described in | |
380 // gtk/docs/focus_tracking.txt | |
381 // | |
382 // |xwindow_| is active iff: | |
383 // (|has_window_focus_| || |has_pointer_focus_|) && | |
384 // !|ignore_keyboard_input_| | |
385 | |
386 // Is the pointer in |xwindow_| or one of its children? | |
387 bool has_pointer_; | |
388 | |
389 // Is |xwindow_| or one of its children focused? | |
390 bool has_window_focus_; | |
391 | |
392 // (An ancestor window or the PointerRoot is focused) && |has_pointer_|. | |
393 // |has_pointer_focus_| == true is the odd case where we will receive keyboard | |
394 // input when |has_window_focus_| == false. |has_window_focus_| and | |
395 // |has_pointer_focus_| are mutually exclusive. | |
396 bool has_pointer_focus_; | |
397 | |
398 // X11 does not support defocusing windows; you can only focus a different | |
danakj
2016/08/26 19:58:43
btw I didn't want to derail this but I'll throw it
| |
399 // window. If we would like to be defocused, we just ignore keyboard input we | |
400 // no longer care about. | |
401 bool ignore_keyboard_input_; | |
402 | |
403 // Used for tracking activation state in {Before|After}ActivationStateChanged. | |
404 bool was_active_; | |
405 bool had_pointer_; | |
406 bool had_pointer_grab_; | |
407 bool had_window_focus_; | |
408 | |
361 base::CancelableCallback<void()> delayed_resize_task_; | 409 base::CancelableCallback<void()> delayed_resize_task_; |
362 | 410 |
363 base::WeakPtrFactory<DesktopWindowTreeHostX11> close_widget_factory_; | 411 base::WeakPtrFactory<DesktopWindowTreeHostX11> close_widget_factory_; |
364 | 412 |
365 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); | 413 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); |
366 }; | 414 }; |
367 | 415 |
368 } // namespace views | 416 } // namespace views |
369 | 417 |
370 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ | 418 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ |
OLD | NEW |