| 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, bool focus, int detail); |
| 194 |
| 195 // Called on an XFocusInEvent, XFocusOutEvent, XIFocusInEvent, or an |
| 196 // XIFocusOutEvent. |
| 197 void OnFocusEvent(bool focus_in, int mode, int detail); |
| 198 |
| 189 // Makes a round trip to the X server to get the enclosing workspace for this | 199 // Makes a round trip to the X server to get the enclosing workspace for this |
| 190 // window. Returns true iff |workspace_| was changed. | 200 // window. Returns true iff |workspace_| was changed. |
| 191 bool UpdateWorkspace(); | 201 bool UpdateWorkspace(); |
| 192 | 202 |
| 193 // Updates |xwindow_|'s minimum and maximum size. | 203 // Updates |xwindow_|'s minimum and maximum size. |
| 194 void UpdateMinAndMaxSize(); | 204 void UpdateMinAndMaxSize(); |
| 195 | 205 |
| 196 // Updates |xwindow_|'s _NET_WM_USER_TIME if |xwindow_| is active. | 206 // Updates |xwindow_|'s _NET_WM_USER_TIME if |xwindow_| is active. |
| 197 void UpdateWMUserTime(const ui::PlatformEvent& event); | 207 void UpdateWMUserTime(const ui::PlatformEvent& event); |
| 198 | 208 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 269 |
| 260 // The native root window. | 270 // The native root window. |
| 261 ::Window x_root_window_; | 271 ::Window x_root_window_; |
| 262 | 272 |
| 263 ui::X11AtomCache atom_cache_; | 273 ui::X11AtomCache atom_cache_; |
| 264 | 274 |
| 265 // Is the window mapped to the screen? | 275 // Is the window mapped to the screen? |
| 266 bool window_mapped_; | 276 bool window_mapped_; |
| 267 | 277 |
| 268 // Should we wait for an UnmapNotify before trying to remap the window? | 278 // Should we wait for an UnmapNotify before trying to remap the window? |
| 279 // If |wait_for_unmap_| is true, we have sent an XUnmapWindow request to the |
| 280 // server and have yet to receive an UnmapNotify. |
| 269 bool wait_for_unmap_; | 281 bool wait_for_unmap_; |
| 270 | 282 |
| 271 // The bounds of |xwindow_|. | 283 // The bounds of |xwindow_|. |
| 272 gfx::Rect bounds_in_pixels_; | 284 gfx::Rect bounds_in_pixels_; |
| 273 | 285 |
| 274 // Whenever the bounds are set, we keep the previous set of bounds around so | 286 // 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 | 287 // we can have a better chance of getting the real |
| 276 // |restored_bounds_in_pixels_|. Window managers tend to send a Configure | 288 // |restored_bounds_in_pixels_|. Window managers tend to send a Configure |
| 277 // message with the maximized bounds, and then set the window maximized | 289 // 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 | 290 // property. (We don't rely on this for when we request that the window be |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 base::string16 window_title_; | 363 base::string16 window_title_; |
| 352 | 364 |
| 353 // Whether we currently are flashing our frame. This feature is implemented | 365 // Whether we currently are flashing our frame. This feature is implemented |
| 354 // by setting the urgency hint with the window manager, which can draw | 366 // 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 | 367 // 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. | 368 // the frame when |xwindow_| gains focus or handles a mouse button event. |
| 357 bool urgency_hint_set_; | 369 bool urgency_hint_set_; |
| 358 | 370 |
| 359 bool activatable_; | 371 bool activatable_; |
| 360 | 372 |
| 373 // The focus-tracking state variables are as described in |
| 374 // gtk/docs/focus_tracking.txt |
| 375 // |
| 376 // |xwindow_| will receive input iff: |
| 377 // |has_focus_| || |has_pointer_focus_| |
| 378 |
| 379 // Is the pointer in |xwindow_| or one of its children? |
| 380 bool has_pointer_; |
| 381 |
| 382 // Does |xwindow_| have the pointer grab? This does not necessarily indicate |
| 383 // |xwindow_| has the keyboard grab. This is not part of the focus-tracking |
| 384 // state, but is only used to figure out when to call OnHostLostMouseGrab. |
| 385 bool has_pointer_grab_; |
| 386 |
| 387 // (An ancestor window or the PointerRoot is focused) && |has_pointer_| |
| 388 bool has_pointer_focus_; |
| 389 |
| 390 // Is |xwindow_| or one of its children focused? |has_window_focus_| and |
| 391 // |has_pointer_focus_| are mutually exclusive. |
| 392 bool has_window_focus_; |
| 393 |
| 394 // |has_window_focus_| || (|xwindow_| has some sort of grab) |
| 395 bool has_focus_; |
| 396 |
| 397 // X11 does not support deactivating windows; you can only activate a |
| 398 // different window. If we would like to be deactivated, we just ignore |
| 399 // input we no longer care about. |
| 400 bool ignore_input_; |
| 401 |
| 402 // Used for tracking activation state in {Before|After}ActivationStateChanged. |
| 403 bool was_active_; |
| 404 bool had_pointer_grab_; |
| 405 bool had_window_focus_; |
| 406 |
| 361 base::CancelableCallback<void()> delayed_resize_task_; | 407 base::CancelableCallback<void()> delayed_resize_task_; |
| 362 | 408 |
| 363 base::WeakPtrFactory<DesktopWindowTreeHostX11> close_widget_factory_; | 409 base::WeakPtrFactory<DesktopWindowTreeHostX11> close_widget_factory_; |
| 364 | 410 |
| 365 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); | 411 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); |
| 366 }; | 412 }; |
| 367 | 413 |
| 368 } // namespace views | 414 } // namespace views |
| 369 | 415 |
| 370 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ | 416 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ |
| OLD | NEW |