| 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> |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 internal::NativeWidgetDelegate* native_widget_delegate, | 124 internal::NativeWidgetDelegate* native_widget_delegate, |
| 125 DesktopNativeWidgetAura* desktop_native_widget_aura) | 125 DesktopNativeWidgetAura* desktop_native_widget_aura) |
| 126 : close_widget_factory_(this), | 126 : close_widget_factory_(this), |
| 127 xdisplay_(gfx::GetXDisplay()), | 127 xdisplay_(gfx::GetXDisplay()), |
| 128 xwindow_(0), | 128 xwindow_(0), |
| 129 x_root_window_(DefaultRootWindow(xdisplay_)), | 129 x_root_window_(DefaultRootWindow(xdisplay_)), |
| 130 atom_cache_(xdisplay_, kAtomsToCache), | 130 atom_cache_(xdisplay_, kAtomsToCache), |
| 131 window_mapped_(false), | 131 window_mapped_(false), |
| 132 is_fullscreen_(false), | 132 is_fullscreen_(false), |
| 133 is_always_on_top_(false), | 133 is_always_on_top_(false), |
| 134 use_native_frame_(false), |
| 134 root_window_(NULL), | 135 root_window_(NULL), |
| 135 drag_drop_client_(NULL), | 136 drag_drop_client_(NULL), |
| 136 current_cursor_(ui::kCursorNull), | 137 current_cursor_(ui::kCursorNull), |
| 137 native_widget_delegate_(native_widget_delegate), | 138 native_widget_delegate_(native_widget_delegate), |
| 138 desktop_native_widget_aura_(desktop_native_widget_aura), | 139 desktop_native_widget_aura_(desktop_native_widget_aura), |
| 139 content_window_(NULL), | 140 content_window_(NULL), |
| 140 window_parent_(NULL), | 141 window_parent_(NULL), |
| 141 custom_window_shape_(NULL) { | 142 custom_window_shape_(NULL) { |
| 142 } | 143 } |
| 143 | 144 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 if (!params.child && params.parent) { | 246 if (!params.child && params.parent) { |
| 246 corewm::AddTransientChild(parent, content_window_); | 247 corewm::AddTransientChild(parent, content_window_); |
| 247 } | 248 } |
| 248 | 249 |
| 249 // Ensure that the X11DesktopHandler exists so that it dispatches activation | 250 // Ensure that the X11DesktopHandler exists so that it dispatches activation |
| 250 // messages to us. | 251 // messages to us. |
| 251 X11DesktopHandler::get(); | 252 X11DesktopHandler::get(); |
| 252 | 253 |
| 253 // TODO(erg): Unify this code once the other consumer goes away. | 254 // TODO(erg): Unify this code once the other consumer goes away. |
| 254 x11_window_event_filter_.reset(new X11WindowEventFilter(root_window_, this)); | 255 x11_window_event_filter_.reset(new X11WindowEventFilter(root_window_, this)); |
| 255 x11_window_event_filter_->SetUseHostWindowBorders( | 256 SetUseNativeFrame(params.type == Widget::InitParams::TYPE_WINDOW && |
| 256 params.type == Widget::InitParams::TYPE_WINDOW && | 257 !params.remove_standard_frame); |
| 257 !params.remove_standard_frame); | |
| 258 desktop_native_widget_aura_->root_window_event_filter()->AddHandler( | 258 desktop_native_widget_aura_->root_window_event_filter()->AddHandler( |
| 259 x11_window_event_filter_.get()); | 259 x11_window_event_filter_.get()); |
| 260 | 260 |
| 261 x11_window_move_client_.reset(new X11DesktopWindowMoveClient); | 261 x11_window_move_client_.reset(new X11DesktopWindowMoveClient); |
| 262 aura::client::SetWindowMoveClient(root_window_->window(), | 262 aura::client::SetWindowMoveClient(root_window_->window(), |
| 263 x11_window_move_client_.get()); | 263 x11_window_move_client_.get()); |
| 264 | 264 |
| 265 native_widget_delegate_->OnNativeWidgetCreated(true); | 265 native_widget_delegate_->OnNativeWidgetCreated(true); |
| 266 } | 266 } |
| 267 | 267 |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 | 590 |
| 591 void DesktopWindowTreeHostX11::EndMoveLoop() { | 591 void DesktopWindowTreeHostX11::EndMoveLoop() { |
| 592 x11_window_move_client_->EndMoveLoop(); | 592 x11_window_move_client_->EndMoveLoop(); |
| 593 } | 593 } |
| 594 | 594 |
| 595 void DesktopWindowTreeHostX11::SetVisibilityChangedAnimationsEnabled( | 595 void DesktopWindowTreeHostX11::SetVisibilityChangedAnimationsEnabled( |
| 596 bool value) { | 596 bool value) { |
| 597 // Much like the previous NativeWidgetGtk, we don't have anything to do here. | 597 // Much like the previous NativeWidgetGtk, we don't have anything to do here. |
| 598 } | 598 } |
| 599 | 599 |
| 600 bool DesktopWindowTreeHostX11::ShouldUseNativeFrame() { | 600 bool DesktopWindowTreeHostX11::ShouldUseNativeFrame() const { |
| 601 return use_native_frame_; |
| 602 } |
| 603 |
| 604 bool DesktopWindowTreeHostX11::ShouldWindowContentsBeTransparent() const { |
| 601 return false; | 605 return false; |
| 602 } | 606 } |
| 603 | 607 |
| 604 void DesktopWindowTreeHostX11::FrameTypeChanged() { | 608 void DesktopWindowTreeHostX11::FrameTypeChanged() { |
| 605 // Replace the frame and layout the contents. Even though we don't have a | 609 // Replace the frame and layout the contents. Even though we don't have a |
| 606 // swapable glass frame like on Windows, we still replace the frame because | 610 // swapable glass frame like on Windows, we still replace the frame because |
| 607 // the button assets don't update otherwise. | 611 // the button assets don't update otherwise. |
| 608 native_widget_delegate_->AsWidget()->non_client_view()->UpdateFrame(); | 612 native_widget_delegate_->AsWidget()->non_client_view()->UpdateFrame(); |
| 609 } | 613 } |
| 610 | 614 |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 XSendEvent(xdisplay_, x_root_window_, False, | 1107 XSendEvent(xdisplay_, x_root_window_, False, |
| 1104 SubstructureRedirectMask | SubstructureNotifyMask, | 1108 SubstructureRedirectMask | SubstructureNotifyMask, |
| 1105 &xclient); | 1109 &xclient); |
| 1106 } | 1110 } |
| 1107 | 1111 |
| 1108 bool DesktopWindowTreeHostX11::HasWMSpecProperty(const char* property) const { | 1112 bool DesktopWindowTreeHostX11::HasWMSpecProperty(const char* property) const { |
| 1109 return window_properties_.find(atom_cache_.GetAtom(property)) != | 1113 return window_properties_.find(atom_cache_.GetAtom(property)) != |
| 1110 window_properties_.end(); | 1114 window_properties_.end(); |
| 1111 } | 1115 } |
| 1112 | 1116 |
| 1117 void DesktopWindowTreeHostX11::SetUseNativeFrame(bool use_native_frame) { |
| 1118 use_native_frame_ = use_native_frame; |
| 1119 x11_window_event_filter_->SetUseHostWindowBorders(use_native_frame); |
| 1120 } |
| 1121 |
| 1113 void DesktopWindowTreeHostX11::OnCaptureReleased() { | 1122 void DesktopWindowTreeHostX11::OnCaptureReleased() { |
| 1114 x11_capture_.reset(); | 1123 x11_capture_.reset(); |
| 1115 g_current_capture = NULL; | 1124 g_current_capture = NULL; |
| 1116 delegate_->OnHostLostWindowCapture(); | 1125 delegate_->OnHostLostWindowCapture(); |
| 1117 native_widget_delegate_->OnMouseCaptureLost(); | 1126 native_widget_delegate_->OnMouseCaptureLost(); |
| 1118 } | 1127 } |
| 1119 | 1128 |
| 1120 void DesktopWindowTreeHostX11::DispatchMouseEvent(ui::MouseEvent* event) { | 1129 void DesktopWindowTreeHostX11::DispatchMouseEvent(ui::MouseEvent* event) { |
| 1121 if (!g_current_capture || g_current_capture == this) { | 1130 if (!g_current_capture || g_current_capture == this) { |
| 1122 SendEventToProcessor(event); | 1131 SendEventToProcessor(event); |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1593 if (linux_ui) { | 1602 if (linux_ui) { |
| 1594 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); | 1603 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); |
| 1595 if (native_theme) | 1604 if (native_theme) |
| 1596 return native_theme; | 1605 return native_theme; |
| 1597 } | 1606 } |
| 1598 | 1607 |
| 1599 return ui::NativeTheme::instance(); | 1608 return ui::NativeTheme::instance(); |
| 1600 } | 1609 } |
| 1601 | 1610 |
| 1602 } // namespace views | 1611 } // namespace views |
| OLD | NEW |