Chromium Code Reviews| 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 | |
| 189 // Makes a round trip to the X server to get the enclosing workspace for this | 191 // Makes a round trip to the X server to get the enclosing workspace for this |
| 190 // window. Returns true iff |workspace_| was changed. | 192 // window. Returns true iff |workspace_| was changed. |
| 191 bool UpdateWorkspace(); | 193 bool UpdateWorkspace(); |
| 192 | 194 |
| 193 // Updates |xwindow_|'s minimum and maximum size. | 195 // Updates |xwindow_|'s minimum and maximum size. |
| 194 void UpdateMinAndMaxSize(); | 196 void UpdateMinAndMaxSize(); |
| 195 | 197 |
| 196 // Updates |xwindow_|'s _NET_WM_USER_TIME if |xwindow_| is active. | 198 // Updates |xwindow_|'s _NET_WM_USER_TIME if |xwindow_| is active. |
| 197 void UpdateWMUserTime(const ui::PlatformEvent& event); | 199 void UpdateWMUserTime(const ui::PlatformEvent& event); |
| 198 | 200 |
| 201 // Gets the last seen server timestamp. Avoids returning CurrentTime. | |
| 202 Time GetTimestamp(); | |
| 203 | |
| 199 // Sends a message to the x11 window manager, enabling or disabling the | 204 // Sends a message to the x11 window manager, enabling or disabling the |
| 200 // states |state1| and |state2|. | 205 // states |state1| and |state2|. |
| 201 void SetWMSpecState(bool enabled, ::Atom state1, ::Atom state2); | 206 void SetWMSpecState(bool enabled, ::Atom state1, ::Atom state2); |
| 202 | 207 |
| 203 // Checks if the window manager has set a specific state. | 208 // Checks if the window manager has set a specific state. |
| 204 bool HasWMSpecProperty(const char* property) const; | 209 bool HasWMSpecProperty(const char* property) const; |
| 205 | 210 |
| 206 // Sets whether the window's borders are provided by the window manager. | 211 // Sets whether the window's borders are provided by the window manager. |
| 207 void SetUseNativeFrame(bool use_native_frame); | 212 void SetUseNativeFrame(bool use_native_frame); |
| 208 | 213 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 base::string16 window_title_; | 356 base::string16 window_title_; |
| 352 | 357 |
| 353 // Whether we currently are flashing our frame. This feature is implemented | 358 // Whether we currently are flashing our frame. This feature is implemented |
| 354 // by setting the urgency hint with the window manager, which can draw | 359 // 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 | 360 // 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. | 361 // the frame when |xwindow_| gains focus or handles a mouse button event. |
| 357 bool urgency_hint_set_; | 362 bool urgency_hint_set_; |
| 358 | 363 |
| 359 bool activatable_; | 364 bool activatable_; |
| 360 | 365 |
| 366 // The focus-tracking state variables are as described in | |
| 367 // gtk/docs/focus_tracking.txt | |
| 368 | |
| 369 // Is the pointer in |xwindow_| or one of its children? | |
| 370 bool has_pointer_; | |
| 371 | |
| 372 // Does |xwindow_| have the pointer grab? This does not necissarily indicate | |
|
danakj
2016/08/11 21:48:20
typo
Tom (Use chromium acct)
2016/08/15 18:42:46
Done.
| |
| 373 // |xwindow_| has the keyboard grab. | |
| 374 bool has_pointer_grab_; | |
| 375 | |
| 376 // (An ancestor window is focused) && |has_pointer_| | |
| 377 bool has_pointer_focus_; | |
| 378 | |
| 379 // Is |xwindow_| or one of its children focused? | |
| 380 // |has_window_focus_| and |has_pointer_focus_| are mutually exclusive. | |
|
danakj
2016/08/11 21:48:20
nit: don't line wrap for every sentence
Tom (Use chromium acct)
2016/08/15 18:42:46
Done.
| |
| 381 // |xwindow_| will receive in put iff: | |
|
danakj
2016/08/11 21:48:20
input
Tom (Use chromium acct)
2016/08/15 18:42:46
Done.
| |
| 382 // |has_window_focus_| || |has_pointer_grab_| || |has_pointer_focus_| | |
|
danakj
2016/08/11 21:48:20
nit: indent this a bit will read easier
Tom (Use chromium acct)
2016/08/15 18:42:46
Done.
| |
| 383 bool has_window_focus_; | |
| 384 | |
| 385 // X11 does not support deactivating windows; you can only activate a | |
| 386 // different window. If we would like to be deactivated, we just ignore | |
| 387 // input we no longer care about. | |
| 388 bool ignore_input_; | |
| 389 | |
| 390 // Used for tracking activation state in {Before|After}ActivationStateChanged. | |
| 391 bool was_active_; | |
| 392 bool had_pointer_grab_; | |
| 393 bool had_window_focus_; | |
| 394 | |
| 361 base::CancelableCallback<void()> delayed_resize_task_; | 395 base::CancelableCallback<void()> delayed_resize_task_; |
| 362 | 396 |
| 363 base::WeakPtrFactory<DesktopWindowTreeHostX11> close_widget_factory_; | 397 base::WeakPtrFactory<DesktopWindowTreeHostX11> close_widget_factory_; |
| 364 | 398 |
| 365 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); | 399 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); |
| 366 }; | 400 }; |
| 367 | 401 |
| 368 } // namespace views | 402 } // namespace views |
| 369 | 403 |
| 370 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ | 404 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ |
| OLD | NEW |