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

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

Issue 1045443002: Make File-Picker modal on Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 5 years, 6 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 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
6 6
7 #include <X11/extensions/shape.h> 7 #include <X11/extensions/shape.h>
8 #include <X11/extensions/XInput2.h> 8 #include <X11/extensions/XInput2.h>
9 #include <X11/Xatom.h> 9 #include <X11/Xatom.h>
10 #include <X11/Xregion.h> 10 #include <X11/Xregion.h>
(...skipping 10 matching lines...) Expand all
21 #include "ui/aura/window.h" 21 #include "ui/aura/window.h"
22 #include "ui/aura/window_event_dispatcher.h" 22 #include "ui/aura/window_event_dispatcher.h"
23 #include "ui/aura/window_property.h" 23 #include "ui/aura/window_property.h"
24 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h" 24 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h"
25 #include "ui/base/hit_test.h" 25 #include "ui/base/hit_test.h"
26 #include "ui/base/x/x11_util.h" 26 #include "ui/base/x/x11_util.h"
27 #include "ui/events/devices/x11/device_data_manager_x11.h" 27 #include "ui/events/devices/x11/device_data_manager_x11.h"
28 #include "ui/events/devices/x11/device_list_cache_x11.h" 28 #include "ui/events/devices/x11/device_list_cache_x11.h"
29 #include "ui/events/devices/x11/touch_factory_x11.h" 29 #include "ui/events/devices/x11/touch_factory_x11.h"
30 #include "ui/events/event_utils.h" 30 #include "ui/events/event_utils.h"
31 #include "ui/events/null_event_targeter.h"
31 #include "ui/events/platform/platform_event_source.h" 32 #include "ui/events/platform/platform_event_source.h"
32 #include "ui/events/platform/x11/x11_event_source.h" 33 #include "ui/events/platform/x11/x11_event_source.h"
33 #include "ui/gfx/display.h" 34 #include "ui/gfx/display.h"
34 #include "ui/gfx/geometry/insets.h" 35 #include "ui/gfx/geometry/insets.h"
35 #include "ui/gfx/geometry/size_conversions.h" 36 #include "ui/gfx/geometry/size_conversions.h"
36 #include "ui/gfx/image/image_skia.h" 37 #include "ui/gfx/image/image_skia.h"
37 #include "ui/gfx/image/image_skia_rep.h" 38 #include "ui/gfx/image/image_skia_rep.h"
38 #include "ui/gfx/path.h" 39 #include "ui/gfx/path.h"
39 #include "ui/gfx/path_x11.h" 40 #include "ui/gfx/path_x11.h"
40 #include "ui/gfx/screen.h" 41 #include "ui/gfx/screen.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 use_native_frame_(false), 166 use_native_frame_(false),
166 should_maximize_after_map_(false), 167 should_maximize_after_map_(false),
167 use_argb_visual_(false), 168 use_argb_visual_(false),
168 drag_drop_client_(NULL), 169 drag_drop_client_(NULL),
169 native_widget_delegate_(native_widget_delegate), 170 native_widget_delegate_(native_widget_delegate),
170 desktop_native_widget_aura_(desktop_native_widget_aura), 171 desktop_native_widget_aura_(desktop_native_widget_aura),
171 content_window_(NULL), 172 content_window_(NULL),
172 window_parent_(NULL), 173 window_parent_(NULL),
173 custom_window_shape_(false), 174 custom_window_shape_(false),
174 urgency_hint_set_(false), 175 urgency_hint_set_(false),
175 close_widget_factory_(this) { 176 close_widget_factory_(this),
177 modal_dialog_xid_(0) {
176 } 178 }
177 179
178 DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() { 180 DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() {
179 window()->ClearProperty(kHostForRootWindow); 181 window()->ClearProperty(kHostForRootWindow);
180 aura::client::SetWindowMoveClient(window(), NULL); 182 aura::client::SetWindowMoveClient(window(), NULL);
181 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this); 183 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this);
182 DestroyDispatcher(); 184 DestroyDispatcher();
183 } 185 }
184 186
185 // static 187 // static
(...skipping 1834 matching lines...) Expand 10 before | Expand all | Expand 10 after
2020 return gfx::ToEnclosingRect(rect_in_dip); 2022 return gfx::ToEnclosingRect(rect_in_dip);
2021 } 2023 }
2022 2024
2023 gfx::Rect DesktopWindowTreeHostX11::ToPixelRect( 2025 gfx::Rect DesktopWindowTreeHostX11::ToPixelRect(
2024 const gfx::Rect& rect_in_dip) const { 2026 const gfx::Rect& rect_in_dip) const {
2025 gfx::RectF rect_in_pixels = rect_in_dip; 2027 gfx::RectF rect_in_pixels = rect_in_dip;
2026 GetRootTransform().TransformRect(&rect_in_pixels); 2028 GetRootTransform().TransformRect(&rect_in_pixels);
2027 return gfx::ToEnclosingRect(rect_in_pixels); 2029 return gfx::ToEnclosingRect(rect_in_pixels);
2028 } 2030 }
2029 2031
2032 XID DesktopWindowTreeHostX11::GetModalDialog() {
2033 return modal_dialog_xid_;
2034 }
2035
2036 void DesktopWindowTreeHostX11::DisableEventListening(XID dialog) {
2037 modal_dialog_xid_ = dialog;
sadrul 2015/06/30 17:30:56 DCHECK here that modal_dialog_xid_ is None.
joone 2015/07/01 03:16:06 Done.
2038 // ScopedWindowTargeter is used to temporarily replace the event-targeter
2039 // with NullEventTargeter to make the dialog modal.
2040 scoped_targeter_.reset(new aura::ScopedWindowTargeter(window(),
2041 scoped_ptr<ui::EventTargeter>(new ui::NullEventTargeter)));
2042 }
2043
2044 void DesktopWindowTreeHostX11::EnableEventListening() {
2045 modal_dialog_xid_ = 0;
sadrul 2015/06/30 17:30:56 DCHECK here that modal_dialog_xid_ != None
joone 2015/07/01 03:16:06 Done.
2046 scoped_targeter_.reset();
2047 }
2048
2030 //////////////////////////////////////////////////////////////////////////////// 2049 ////////////////////////////////////////////////////////////////////////////////
2031 // DesktopWindowTreeHost, public: 2050 // DesktopWindowTreeHost, public:
2032 2051
2033 // static 2052 // static
2034 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( 2053 DesktopWindowTreeHost* DesktopWindowTreeHost::Create(
2035 internal::NativeWidgetDelegate* native_widget_delegate, 2054 internal::NativeWidgetDelegate* native_widget_delegate,
2036 DesktopNativeWidgetAura* desktop_native_widget_aura) { 2055 DesktopNativeWidgetAura* desktop_native_widget_aura) {
2037 return new DesktopWindowTreeHostX11(native_widget_delegate, 2056 return new DesktopWindowTreeHostX11(native_widget_delegate,
2038 desktop_native_widget_aura); 2057 desktop_native_widget_aura);
2039 } 2058 }
2040 2059
2041 // static 2060 // static
2042 ui::NativeTheme* DesktopWindowTreeHost::GetNativeTheme(aura::Window* window) { 2061 ui::NativeTheme* DesktopWindowTreeHost::GetNativeTheme(aura::Window* window) {
2043 const views::LinuxUI* linux_ui = views::LinuxUI::instance(); 2062 const views::LinuxUI* linux_ui = views::LinuxUI::instance();
2044 if (linux_ui) { 2063 if (linux_ui) {
2045 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); 2064 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window);
2046 if (native_theme) 2065 if (native_theme)
2047 return native_theme; 2066 return native_theme;
2048 } 2067 }
2049 2068
2050 return ui::NativeTheme::instance(); 2069 return ui::NativeTheme::instance();
2051 } 2070 }
2052 2071
2053 } // namespace views 2072 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698