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

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

Issue 1624793002: Make File-Picker modal on Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Can close the host window while opening the file-picker Created 4 years, 8 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
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 <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>
11 #include <X11/Xlib.h> 11 #include <X11/Xlib.h>
12 #include <X11/Xutil.h> 12 #include <X11/Xutil.h>
13 13
14 #include "base/cancelable_callback.h" 14 #include "base/cancelable_callback.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/observer_list.h" 17 #include "base/observer_list.h"
18 #include "ui/aura/scoped_window_targeter.h"
18 #include "ui/aura/window_tree_host.h" 19 #include "ui/aura/window_tree_host.h"
19 #include "ui/base/cursor/cursor_loader_x11.h" 20 #include "ui/base/cursor/cursor_loader_x11.h"
20 #include "ui/events/platform/platform_event_dispatcher.h" 21 #include "ui/events/platform/platform_event_dispatcher.h"
21 #include "ui/gfx/geometry/insets.h" 22 #include "ui/gfx/geometry/insets.h"
22 #include "ui/gfx/geometry/rect.h" 23 #include "ui/gfx/geometry/rect.h"
23 #include "ui/gfx/geometry/size.h" 24 #include "ui/gfx/geometry/size.h"
24 #include "ui/gfx/x/x11_atom_cache.h" 25 #include "ui/gfx/x/x11_atom_cache.h"
25 #include "ui/views/views_export.h" 26 #include "ui/views/views_export.h"
26 #include "ui/views/widget/desktop_aura/desktop_window_tree_host.h" 27 #include "ui/views/widget/desktop_aura/desktop_window_tree_host.h"
27 28
(...skipping 15 matching lines...) Expand all
43 class VIEWS_EXPORT DesktopWindowTreeHostX11 44 class VIEWS_EXPORT DesktopWindowTreeHostX11
44 : public DesktopWindowTreeHost, 45 : public DesktopWindowTreeHost,
45 public aura::WindowTreeHost, 46 public aura::WindowTreeHost,
46 public ui::PlatformEventDispatcher { 47 public ui::PlatformEventDispatcher {
47 public: 48 public:
48 DesktopWindowTreeHostX11( 49 DesktopWindowTreeHostX11(
49 internal::NativeWidgetDelegate* native_widget_delegate, 50 internal::NativeWidgetDelegate* native_widget_delegate,
50 DesktopNativeWidgetAura* desktop_native_widget_aura); 51 DesktopNativeWidgetAura* desktop_native_widget_aura);
51 ~DesktopWindowTreeHostX11() override; 52 ~DesktopWindowTreeHostX11() override;
52 53
54 class ScopedHandle {
55 public:
56 explicit ScopedHandle(const base::Closure& destroy_callback);
57 ~ScopedHandle();
58 void CancelCallback();
59
60 private:
61 base::Closure destroy_callback_;
62 DISALLOW_COPY_AND_ASSIGN(ScopedHandle);
63 };
64
53 // A way of converting an X11 |xid| host window into a |content_window_|. 65 // A way of converting an X11 |xid| host window into a |content_window_|.
54 static aura::Window* GetContentWindowForXID(XID xid); 66 static aura::Window* GetContentWindowForXID(XID xid);
55 67
56 // A way of converting an X11 |xid| host window into this object. 68 // A way of converting an X11 |xid| host window into this object.
57 static DesktopWindowTreeHostX11* GetHostForXID(XID xid); 69 static DesktopWindowTreeHostX11* GetHostForXID(XID xid);
58 70
59 // Get all open top-level windows. This includes windows that may not be 71 // Get all open top-level windows. This includes windows that may not be
60 // visible. This list is sorted in their stacking order, i.e. the first window 72 // visible. This list is sorted in their stacking order, i.e. the first window
61 // is the topmost window. 73 // is the topmost window.
62 static std::vector<aura::Window*> GetAllOpenWindows(); 74 static std::vector<aura::Window*> GetAllOpenWindows();
(...skipping 16 matching lines...) Expand all
79 void AddObserver(views::DesktopWindowTreeHostObserverX11* observer); 91 void AddObserver(views::DesktopWindowTreeHostObserverX11* observer);
80 void RemoveObserver(views::DesktopWindowTreeHostObserverX11* observer); 92 void RemoveObserver(views::DesktopWindowTreeHostObserverX11* observer);
81 93
82 // Swaps the current handler for events in the non client view with |handler|. 94 // Swaps the current handler for events in the non client view with |handler|.
83 void SwapNonClientEventHandler(std::unique_ptr<ui::EventHandler> handler); 95 void SwapNonClientEventHandler(std::unique_ptr<ui::EventHandler> handler);
84 96
85 // Runs the |func| callback for each content-window, and deallocates the 97 // Runs the |func| callback for each content-window, and deallocates the
86 // internal list of open windows. 98 // internal list of open windows.
87 static void CleanUpWindowList(void (*func)(aura::Window* window)); 99 static void CleanUpWindowList(void (*func)(aura::Window* window));
88 100
101 // Disables event listening to make |dialog| modal.
102 std::unique_ptr<ScopedHandle> DisableEventListening(XID dialog);
103
104 // Returns XID of dialog currently displayed. When it returns 0,
105 // there is no dialog on the host window.
106 XID GetModalDialog();
107
89 protected: 108 protected:
90 // Overridden from DesktopWindowTreeHost: 109 // Overridden from DesktopWindowTreeHost:
91 void Init(aura::Window* content_window, 110 void Init(aura::Window* content_window,
92 const Widget::InitParams& params) override; 111 const Widget::InitParams& params) override;
93 void OnNativeWidgetCreated(const Widget::InitParams& params) override; 112 void OnNativeWidgetCreated(const Widget::InitParams& params) override;
94 std::unique_ptr<corewm::Tooltip> CreateTooltip() override; 113 std::unique_ptr<corewm::Tooltip> CreateTooltip() override;
95 std::unique_ptr<aura::client::DragDropClient> CreateDragDropClient( 114 std::unique_ptr<aura::client::DragDropClient> CreateDragDropClient(
96 DesktopNativeCursorManager* cursor_manager) override; 115 DesktopNativeCursorManager* cursor_manager) override;
97 void Close() override; 116 void Close() override;
98 void CloseNow() override; 117 void CloseNow() override;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 // ui::PlatformEventDispatcher: 258 // ui::PlatformEventDispatcher:
240 bool CanDispatchEvent(const ui::PlatformEvent& event) override; 259 bool CanDispatchEvent(const ui::PlatformEvent& event) override;
241 uint32_t DispatchEvent(const ui::PlatformEvent& event) override; 260 uint32_t DispatchEvent(const ui::PlatformEvent& event) override;
242 261
243 void DelayedResize(const gfx::Size& size_in_pixels); 262 void DelayedResize(const gfx::Size& size_in_pixels);
244 263
245 gfx::Rect GetWorkAreaBoundsInPixels() const; 264 gfx::Rect GetWorkAreaBoundsInPixels() const;
246 gfx::Rect ToDIPRect(const gfx::Rect& rect_in_pixels) const; 265 gfx::Rect ToDIPRect(const gfx::Rect& rect_in_pixels) const;
247 gfx::Rect ToPixelRect(const gfx::Rect& rect_in_dip) const; 266 gfx::Rect ToPixelRect(const gfx::Rect& rect_in_dip) const;
248 267
268 // Enables event listening after closing |dialog|.
269 void EnableEventListening();
270
249 // X11 things 271 // X11 things
250 // The display and the native X window hosting the root window. 272 // The display and the native X window hosting the root window.
251 XDisplay* xdisplay_; 273 XDisplay* xdisplay_;
252 ::Window xwindow_; 274 ::Window xwindow_;
253 275
254 // The native root window. 276 // The native root window.
255 ::Window x_root_window_; 277 ::Window x_root_window_;
256 278
257 ui::X11AtomCache atom_cache_; 279 ui::X11AtomCache atom_cache_;
258 280
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 // Whether we currently are flashing our frame. This feature is implemented 363 // Whether we currently are flashing our frame. This feature is implemented
342 // by setting the urgency hint with the window manager, which can draw 364 // by setting the urgency hint with the window manager, which can draw
343 // attention to the window or completely ignore the hint. We stop flashing 365 // attention to the window or completely ignore the hint. We stop flashing
344 // the frame when |xwindow_| gains focus or handles a mouse button event. 366 // the frame when |xwindow_| gains focus or handles a mouse button event.
345 bool urgency_hint_set_; 367 bool urgency_hint_set_;
346 368
347 bool activatable_; 369 bool activatable_;
348 370
349 base::CancelableCallback<void()> delayed_resize_task_; 371 base::CancelableCallback<void()> delayed_resize_task_;
350 372
373 std::unique_ptr<aura::ScopedWindowTargeter> targeter_for_modal_;
374
375 XID modal_dialog_xid_;
376
377 ScopedHandle* scoped_handle_;
378
351 base::WeakPtrFactory<DesktopWindowTreeHostX11> close_widget_factory_; 379 base::WeakPtrFactory<DesktopWindowTreeHostX11> close_widget_factory_;
352 380
353 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); 381 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11);
354 }; 382 };
355 383
356 } // namespace views 384 } // namespace views
357 385
358 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ 386 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698