Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(541)

Side by Side Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h

Issue 380943003: Do not release capture when transferring capture between Chrome windows on Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <X11/extensions/shape.h> 8 #include <X11/extensions/shape.h>
9 #include <X11/Xlib.h> 9 #include <X11/Xlib.h>
10 10
(...skipping 19 matching lines...) Expand all
30 30
31 namespace ui { 31 namespace ui {
32 class EventHandler; 32 class EventHandler;
33 } 33 }
34 34
35 namespace views { 35 namespace views {
36 class DesktopDragDropClientAuraX11; 36 class DesktopDragDropClientAuraX11;
37 class DesktopDispatcherClient; 37 class DesktopDispatcherClient;
38 class DesktopWindowTreeHostObserverX11; 38 class DesktopWindowTreeHostObserverX11;
39 class X11DesktopWindowMoveClient; 39 class X11DesktopWindowMoveClient;
40 class X11ScopedCapture; 40 class X11CaptureWindow;
41 class X11WindowEventFilter; 41 class X11WindowEventFilter;
42 42
43 class VIEWS_EXPORT DesktopWindowTreeHostX11 43 class VIEWS_EXPORT DesktopWindowTreeHostX11
44 : public DesktopWindowTreeHost, 44 : public DesktopWindowTreeHost,
45 public aura::WindowTreeHost, 45 public aura::WindowTreeHost,
46 public ui::EventSource, 46 public ui::EventSource,
47 public ui::PlatformEventDispatcher { 47 public ui::PlatformEventDispatcher {
48 public: 48 public:
49 DesktopWindowTreeHostX11( 49 DesktopWindowTreeHostX11(
50 internal::NativeWidgetDelegate* native_widget_delegate, 50 internal::NativeWidgetDelegate* native_widget_delegate,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 virtual void ReleaseCapture() OVERRIDE; 160 virtual void ReleaseCapture() OVERRIDE;
161 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; 161 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE;
162 virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE; 162 virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE;
163 virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; 163 virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE;
164 virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; 164 virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE;
165 165
166 // Overridden frm ui::EventSource 166 // Overridden frm ui::EventSource
167 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; 167 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE;
168 168
169 private: 169 private:
170 FRIEND_TEST_ALL_PREFIXES(DesktopWindowTreeHostX11InteractiveUITest,
171 SynchronousCapture);
172
170 // Initializes our X11 surface to draw on. This method performs all 173 // Initializes our X11 surface to draw on. This method performs all
171 // initialization related to talking to the X11 server. 174 // initialization related to talking to the X11 server.
172 void InitX11Window(const Widget::InitParams& params); 175 void InitX11Window(const Widget::InitParams& params);
173 176
174 // Creates an aura::WindowEventDispatcher to contain the |content_window|, 177 // Creates an aura::WindowEventDispatcher to contain the |content_window|,
175 // along with all aura client objects that direct behavior. 178 // along with all aura client objects that direct behavior.
176 aura::WindowEventDispatcher* InitDispatcher(const Widget::InitParams& params); 179 aura::WindowEventDispatcher* InitDispatcher(const Widget::InitParams& params);
177 180
178 // Called when |xwindow_|'s _NET_WM_STATE property is updated. 181 // Called when |xwindow_|'s _NET_WM_STATE property is updated.
179 void OnWMStateUpdated(); 182 void OnWMStateUpdated();
(...skipping 10 matching lines...) Expand all
190 // Sends a message to the x11 window manager, enabling or disabling the 193 // Sends a message to the x11 window manager, enabling or disabling the
191 // states |state1| and |state2|. 194 // states |state1| and |state2|.
192 void SetWMSpecState(bool enabled, ::Atom state1, ::Atom state2); 195 void SetWMSpecState(bool enabled, ::Atom state1, ::Atom state2);
193 196
194 // Checks if the window manager has set a specific state. 197 // Checks if the window manager has set a specific state.
195 bool HasWMSpecProperty(const char* property) const; 198 bool HasWMSpecProperty(const char* property) const;
196 199
197 // Sets whether the window's borders are provided by the window manager. 200 // Sets whether the window's borders are provided by the window manager.
198 void SetUseNativeFrame(bool use_native_frame); 201 void SetUseNativeFrame(bool use_native_frame);
199 202
200 // Called when another DRWHL takes capture, or when capture is released 203 // Releases |capture_window_| so that it can be used by another
201 // entirely. 204 // DesktopWindowTreeHostX11.
202 void OnCaptureReleased(); 205 scoped_ptr<X11CaptureWindow> ReleaseCaptureWindow();
203 206
204 // Dispatches a mouse event, taking mouse capture into account. If a 207 // Dispatches a mouse event, taking mouse capture into account. If a
205 // different host has capture, we translate the event to its coordinate space 208 // different host has capture, we translate the event to its coordinate space
206 // and dispatch it to that host instead. 209 // and dispatch it to that host instead.
207 void DispatchMouseEvent(ui::MouseEvent* event); 210 void DispatchMouseEvent(ui::MouseEvent* event);
208 211
209 // Dispatches a touch event, taking capture into account. If a different host 212 // Dispatches a touch event, taking capture into account. If a different host
210 // has capture, then touch-press events are translated to its coordinate space 213 // has capture, then touch-press events are translated to its coordinate space
211 // and dispatched to that host instead. 214 // and dispatched to that host instead.
212 void DispatchTouchEvent(ui::TouchEvent* event); 215 void DispatchTouchEvent(ui::TouchEvent* event);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 314
312 // The window shape if the window is non-rectangular. 315 // The window shape if the window is non-rectangular.
313 ::Region window_shape_; 316 ::Region window_shape_;
314 317
315 // Whether |window_shape_| was set via SetShape(). 318 // Whether |window_shape_| was set via SetShape().
316 bool custom_window_shape_; 319 bool custom_window_shape_;
317 320
318 // The size of the window manager provided borders (if any). 321 // The size of the window manager provided borders (if any).
319 gfx::Insets native_window_frame_borders_; 322 gfx::Insets native_window_frame_borders_;
320 323
321 // The current root window host that has capture. While X11 has something 324 // The current DesktopWindowTreeHostX11 which has capture. Set synchronously
322 // like Windows SetCapture()/ReleaseCapture(), it is entirely implicit and 325 // when capture is requested via SetCapture().
323 // there are no notifications when this changes. We need to track this so we
324 // can notify widgets when they have lost capture, which controls a bunch of
325 // things in views like hiding menus.
326 static DesktopWindowTreeHostX11* g_current_capture; 326 static DesktopWindowTreeHostX11* g_current_capture;
327 327
328 // A list of all (top-level) windows that have been created but not yet 328 // A list of all (top-level) windows that have been created but not yet
329 // destroyed. 329 // destroyed.
330 static std::list<XID>* open_windows_; 330 static std::list<XID>* open_windows_;
331 331
332 scoped_ptr<X11ScopedCapture> x11_capture_; 332 scoped_ptr<X11CaptureWindow> capture_window_;
333 333
334 base::string16 window_title_; 334 base::string16 window_title_;
335 335
336 // Whether we currently are flashing our frame. This feature is implemented 336 // Whether we currently are flashing our frame. This feature is implemented
337 // by setting the urgency hint with the window manager, which can draw 337 // by setting the urgency hint with the window manager, which can draw
338 // attention to the window or completely ignore the hint. We stop flashing 338 // attention to the window or completely ignore the hint. We stop flashing
339 // the frame when |xwindow_| gains focus or handles a mouse button event. 339 // the frame when |xwindow_| gains focus or handles a mouse button event.
340 bool urgency_hint_set_; 340 bool urgency_hint_set_;
341 341
342 base::CancelableCallback<void()> delayed_resize_task_; 342 base::CancelableCallback<void()> delayed_resize_task_;
343 343
344 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); 344 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11);
345 }; 345 };
346 346
347 } // namespace views 347 } // namespace views
348 348
349 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ 349 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698