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 #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> | |
8 #include <X11/extensions/XInput2.h> | |
9 #include <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
10 #include <X11/Xregion.h> | 8 #include <X11/Xregion.h> |
11 #include <X11/Xutil.h> | 9 #include <X11/Xutil.h> |
| 10 #include <X11/extensions/XInput2.h> |
| 11 #include <X11/extensions/shape.h> |
| 12 #include <utility> |
12 | 13 |
13 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
14 #include "base/command_line.h" | 15 #include "base/command_line.h" |
15 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
17 #include "base/trace_event/trace_event.h" | 18 #include "base/trace_event/trace_event.h" |
18 #include "third_party/skia/include/core/SkPath.h" | 19 #include "third_party/skia/include/core/SkPath.h" |
19 #include "ui/aura/client/cursor_client.h" | 20 #include "ui/aura/client/cursor_client.h" |
20 #include "ui/aura/client/focus_client.h" | 21 #include "ui/aura/client/focus_client.h" |
21 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 observer_list_.RemoveObserver(observer); | 252 observer_list_.RemoveObserver(observer); |
252 } | 253 } |
253 | 254 |
254 void DesktopWindowTreeHostX11::SwapNonClientEventHandler( | 255 void DesktopWindowTreeHostX11::SwapNonClientEventHandler( |
255 scoped_ptr<ui::EventHandler> handler) { | 256 scoped_ptr<ui::EventHandler> handler) { |
256 wm::CompoundEventFilter* compound_event_filter = | 257 wm::CompoundEventFilter* compound_event_filter = |
257 desktop_native_widget_aura_->root_window_event_filter(); | 258 desktop_native_widget_aura_->root_window_event_filter(); |
258 if (x11_non_client_event_filter_) | 259 if (x11_non_client_event_filter_) |
259 compound_event_filter->RemoveHandler(x11_non_client_event_filter_.get()); | 260 compound_event_filter->RemoveHandler(x11_non_client_event_filter_.get()); |
260 compound_event_filter->AddHandler(handler.get()); | 261 compound_event_filter->AddHandler(handler.get()); |
261 x11_non_client_event_filter_ = handler.Pass(); | 262 x11_non_client_event_filter_ = std::move(handler); |
262 } | 263 } |
263 | 264 |
264 void DesktopWindowTreeHostX11::CleanUpWindowList( | 265 void DesktopWindowTreeHostX11::CleanUpWindowList( |
265 void (*func)(aura::Window* window)) { | 266 void (*func)(aura::Window* window)) { |
266 if (!open_windows_) | 267 if (!open_windows_) |
267 return; | 268 return; |
268 while (!open_windows_->empty()) { | 269 while (!open_windows_->empty()) { |
269 XID xid = open_windows_->front(); | 270 XID xid = open_windows_->front(); |
270 func(GetContentWindowForXID(xid)); | 271 func(GetContentWindowForXID(xid)); |
271 if (!open_windows_->empty() && open_windows_->front() == xid) | 272 if (!open_windows_->empty() && open_windows_->front() == xid) |
(...skipping 30 matching lines...) Expand all Loading... |
302 const Widget::InitParams& params) { | 303 const Widget::InitParams& params) { |
303 window()->SetProperty(kViewsWindowForRootWindow, content_window_); | 304 window()->SetProperty(kViewsWindowForRootWindow, content_window_); |
304 window()->SetProperty(kHostForRootWindow, this); | 305 window()->SetProperty(kHostForRootWindow, this); |
305 | 306 |
306 // Ensure that the X11DesktopHandler exists so that it dispatches activation | 307 // Ensure that the X11DesktopHandler exists so that it dispatches activation |
307 // messages to us. | 308 // messages to us. |
308 X11DesktopHandler::get(); | 309 X11DesktopHandler::get(); |
309 | 310 |
310 // TODO(erg): Unify this code once the other consumer goes away. | 311 // TODO(erg): Unify this code once the other consumer goes away. |
311 SwapNonClientEventHandler( | 312 SwapNonClientEventHandler( |
312 scoped_ptr<ui::EventHandler>(new X11WindowEventFilter(this)).Pass()); | 313 scoped_ptr<ui::EventHandler>(new X11WindowEventFilter(this))); |
313 SetUseNativeFrame(params.type == Widget::InitParams::TYPE_WINDOW && | 314 SetUseNativeFrame(params.type == Widget::InitParams::TYPE_WINDOW && |
314 !params.remove_standard_frame); | 315 !params.remove_standard_frame); |
315 | 316 |
316 x11_window_move_client_.reset(new X11DesktopWindowMoveClient); | 317 x11_window_move_client_.reset(new X11DesktopWindowMoveClient); |
317 aura::client::SetWindowMoveClient(window(), x11_window_move_client_.get()); | 318 aura::client::SetWindowMoveClient(window(), x11_window_move_client_.get()); |
318 | 319 |
319 SetWindowTransparency(); | 320 SetWindowTransparency(); |
320 | 321 |
321 native_widget_delegate_->OnNativeWidgetCreated(true); | 322 native_widget_delegate_->OnNativeWidgetCreated(true); |
322 } | 323 } |
(...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2054 if (linux_ui) { | 2055 if (linux_ui) { |
2055 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 2056 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
2056 if (native_theme) | 2057 if (native_theme) |
2057 return native_theme; | 2058 return native_theme; |
2058 } | 2059 } |
2059 | 2060 |
2060 return ui::NativeThemeAura::instance(); | 2061 return ui::NativeThemeAura::instance(); |
2061 } | 2062 } |
2062 | 2063 |
2063 } // namespace views | 2064 } // namespace views |
OLD | NEW |