| 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_root_window_host_x11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_root_window_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> |
| 11 #include <X11/Xutil.h> | 11 #include <X11/Xutil.h> |
| 12 | 12 |
| 13 #include "base/message_loop/message_pump_aurax11.h" | 13 #include "base/message_loop/message_pump_x11.h" |
| 14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "third_party/skia/include/core/SkPath.h" | 16 #include "third_party/skia/include/core/SkPath.h" |
| 17 #include "ui/aura/client/screen_position_client.h" | 17 #include "ui/aura/client/screen_position_client.h" |
| 18 #include "ui/aura/client/user_action_client.h" | 18 #include "ui/aura/client/user_action_client.h" |
| 19 #include "ui/aura/focus_manager.h" | 19 #include "ui/aura/focus_manager.h" |
| 20 #include "ui/aura/root_window.h" | 20 #include "ui/aura/root_window.h" |
| 21 #include "ui/aura/window_property.h" | 21 #include "ui/aura/window_property.h" |
| 22 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h" | 22 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h" |
| 23 #include "ui/base/events/event_utils.h" | 23 #include "ui/base/events/event_utils.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 } // namespace | 107 } // namespace |
| 108 | 108 |
| 109 //////////////////////////////////////////////////////////////////////////////// | 109 //////////////////////////////////////////////////////////////////////////////// |
| 110 // DesktopRootWindowHostX11, public: | 110 // DesktopRootWindowHostX11, public: |
| 111 | 111 |
| 112 DesktopRootWindowHostX11::DesktopRootWindowHostX11( | 112 DesktopRootWindowHostX11::DesktopRootWindowHostX11( |
| 113 internal::NativeWidgetDelegate* native_widget_delegate, | 113 internal::NativeWidgetDelegate* native_widget_delegate, |
| 114 DesktopNativeWidgetAura* desktop_native_widget_aura, | 114 DesktopNativeWidgetAura* desktop_native_widget_aura, |
| 115 const gfx::Rect& initial_bounds) | 115 const gfx::Rect& initial_bounds) |
| 116 : close_widget_factory_(this), | 116 : close_widget_factory_(this), |
| 117 xdisplay_(base::MessagePumpAuraX11::GetDefaultXDisplay()), | 117 xdisplay_(base::MessagePumpX11::GetDefaultXDisplay()), |
| 118 xwindow_(0), | 118 xwindow_(0), |
| 119 x_root_window_(DefaultRootWindow(xdisplay_)), | 119 x_root_window_(DefaultRootWindow(xdisplay_)), |
| 120 atom_cache_(xdisplay_, kAtomsToCache), | 120 atom_cache_(xdisplay_, kAtomsToCache), |
| 121 window_mapped_(false), | 121 window_mapped_(false), |
| 122 focus_when_shown_(false), | 122 focus_when_shown_(false), |
| 123 current_cursor_(ui::kCursorNull), | 123 current_cursor_(ui::kCursorNull), |
| 124 native_widget_delegate_(native_widget_delegate), | 124 native_widget_delegate_(native_widget_delegate), |
| 125 desktop_native_widget_aura_(desktop_native_widget_aura) { | 125 desktop_native_widget_aura_(desktop_native_widget_aura) { |
| 126 } | 126 } |
| 127 | 127 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 225 |
| 226 native_widget_delegate_->OnNativeWidgetDestroying(); | 226 native_widget_delegate_->OnNativeWidgetDestroying(); |
| 227 | 227 |
| 228 // Remove the event listeners we've installed. We need to remove these | 228 // Remove the event listeners we've installed. We need to remove these |
| 229 // because otherwise we get assert during ~RootWindow(). | 229 // because otherwise we get assert during ~RootWindow(). |
| 230 desktop_native_widget_aura_->root_window_event_filter()->RemoveHandler( | 230 desktop_native_widget_aura_->root_window_event_filter()->RemoveHandler( |
| 231 x11_window_event_filter_.get()); | 231 x11_window_event_filter_.get()); |
| 232 | 232 |
| 233 open_windows().remove(xwindow_); | 233 open_windows().remove(xwindow_); |
| 234 // Actually free our native resources. | 234 // Actually free our native resources. |
| 235 base::MessagePumpAuraX11::Current()->RemoveDispatcherForWindow(xwindow_); | 235 base::MessagePumpX11::Current()->RemoveDispatcherForWindow(xwindow_); |
| 236 XDestroyWindow(xdisplay_, xwindow_); | 236 XDestroyWindow(xdisplay_, xwindow_); |
| 237 xwindow_ = None; | 237 xwindow_ = None; |
| 238 | 238 |
| 239 desktop_native_widget_aura_->OnHostClosed(); | 239 desktop_native_widget_aura_->OnHostClosed(); |
| 240 } | 240 } |
| 241 | 241 |
| 242 aura::RootWindowHost* DesktopRootWindowHostX11::AsRootWindowHost() { | 242 aura::RootWindowHost* DesktopRootWindowHostX11::AsRootWindowHost() { |
| 243 return this; | 243 return this; |
| 244 } | 244 } |
| 245 | 245 |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 size_hints.flags = PPosition; | 554 size_hints.flags = PPosition; |
| 555 size_hints.x = bounds_.x(); | 555 size_hints.x = bounds_.x(); |
| 556 size_hints.y = bounds_.y(); | 556 size_hints.y = bounds_.y(); |
| 557 XSetWMNormalHints(xdisplay_, xwindow_, &size_hints); | 557 XSetWMNormalHints(xdisplay_, xwindow_, &size_hints); |
| 558 | 558 |
| 559 XMapWindow(xdisplay_, xwindow_); | 559 XMapWindow(xdisplay_, xwindow_); |
| 560 | 560 |
| 561 // We now block until our window is mapped. Some X11 APIs will crash and | 561 // We now block until our window is mapped. Some X11 APIs will crash and |
| 562 // burn if passed |xwindow_| before the window is mapped, and XMapWindow is | 562 // burn if passed |xwindow_| before the window is mapped, and XMapWindow is |
| 563 // asynchronous. | 563 // asynchronous. |
| 564 base::MessagePumpAuraX11::Current()->BlockUntilWindowMapped(xwindow_); | 564 base::MessagePumpX11::Current()->BlockUntilWindowMapped(xwindow_); |
| 565 window_mapped_ = true; | 565 window_mapped_ = true; |
| 566 } | 566 } |
| 567 } | 567 } |
| 568 | 568 |
| 569 void DesktopRootWindowHostX11::Hide() { | 569 void DesktopRootWindowHostX11::Hide() { |
| 570 if (window_mapped_) { | 570 if (window_mapped_) { |
| 571 XWithdrawWindow(xdisplay_, xwindow_, 0); | 571 XWithdrawWindow(xdisplay_, xwindow_, 0); |
| 572 window_mapped_ = false; | 572 window_mapped_ = false; |
| 573 } | 573 } |
| 574 } | 574 } |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 xwindow_ = XCreateWindow( | 786 xwindow_ = XCreateWindow( |
| 787 xdisplay_, x_root_window_, | 787 xdisplay_, x_root_window_, |
| 788 params.bounds.x(), params.bounds.y(), | 788 params.bounds.x(), params.bounds.y(), |
| 789 params.bounds.width(), params.bounds.height(), | 789 params.bounds.width(), params.bounds.height(), |
| 790 0, // border width | 790 0, // border width |
| 791 CopyFromParent, // depth | 791 CopyFromParent, // depth |
| 792 InputOutput, | 792 InputOutput, |
| 793 CopyFromParent, // visual | 793 CopyFromParent, // visual |
| 794 attribute_mask, | 794 attribute_mask, |
| 795 &swa); | 795 &swa); |
| 796 base::MessagePumpAuraX11::Current()->AddDispatcherForWindow(this, xwindow_); | 796 base::MessagePumpX11::Current()->AddDispatcherForWindow(this, xwindow_); |
| 797 | 797 |
| 798 // TODO(erg): Maybe need to set a ViewProp here like in RWHL::RWHL(). | 798 // TODO(erg): Maybe need to set a ViewProp here like in RWHL::RWHL(). |
| 799 | 799 |
| 800 long event_mask = ButtonPressMask | ButtonReleaseMask | FocusChangeMask | | 800 long event_mask = ButtonPressMask | ButtonReleaseMask | FocusChangeMask | |
| 801 KeyPressMask | KeyReleaseMask | | 801 KeyPressMask | KeyReleaseMask | |
| 802 EnterWindowMask | LeaveWindowMask | | 802 EnterWindowMask | LeaveWindowMask | |
| 803 ExposureMask | VisibilityChangeMask | | 803 ExposureMask | VisibilityChangeMask | |
| 804 StructureNotifyMask | PropertyChangeMask | | 804 StructureNotifyMask | PropertyChangeMask | |
| 805 PointerMotionMask; | 805 PointerMotionMask; |
| 806 XSelectInput(xdisplay_, xwindow_, event_mask); | 806 XSelectInput(xdisplay_, xwindow_, event_mask); |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1326 if (linux_ui) { | 1326 if (linux_ui) { |
| 1327 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); | 1327 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); |
| 1328 if (native_theme) | 1328 if (native_theme) |
| 1329 return native_theme; | 1329 return native_theme; |
| 1330 } | 1330 } |
| 1331 | 1331 |
| 1332 return ui::NativeTheme::instance(); | 1332 return ui::NativeTheme::instance(); |
| 1333 } | 1333 } |
| 1334 | 1334 |
| 1335 } // namespace views | 1335 } // namespace views |
| OLD | NEW |