| 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> | 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 dispatcher_->window()->ClearProperty(kHostForRootWindow); | 147 dispatcher_->window()->ClearProperty(kHostForRootWindow); |
| 148 aura::client::SetWindowMoveClient(dispatcher_->window(), NULL); | 148 aura::client::SetWindowMoveClient(dispatcher_->window(), NULL); |
| 149 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(dispatcher_); | 149 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(dispatcher_); |
| 150 if (custom_window_shape_) | 150 if (custom_window_shape_) |
| 151 XDestroyRegion(custom_window_shape_); | 151 XDestroyRegion(custom_window_shape_); |
| 152 DestroyDispatcher(); | 152 DestroyDispatcher(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 // static | 155 // static |
| 156 aura::Window* DesktopWindowTreeHostX11::GetContentWindowForXID(XID xid) { | 156 aura::Window* DesktopWindowTreeHostX11::GetContentWindowForXID(XID xid) { |
| 157 aura::WindowEventDispatcher* dispatcher = | 157 aura::WindowTreeHost* host = |
| 158 aura::WindowEventDispatcher::GetForAcceleratedWidget(xid); | 158 aura::WindowTreeHost::GetForAcceleratedWidget(xid); |
| 159 return dispatcher ? | 159 return host ? host->window()->GetProperty(kViewsWindowForRootWindow) : NULL; |
| 160 dispatcher->window()->GetProperty(kViewsWindowForRootWindow) : NULL; | |
| 161 } | 160 } |
| 162 | 161 |
| 163 // static | 162 // static |
| 164 DesktopWindowTreeHostX11* DesktopWindowTreeHostX11::GetHostForXID(XID xid) { | 163 DesktopWindowTreeHostX11* DesktopWindowTreeHostX11::GetHostForXID(XID xid) { |
| 165 aura::WindowEventDispatcher* dispatcher = | 164 aura::WindowTreeHost* host = |
| 166 aura::WindowEventDispatcher::GetForAcceleratedWidget(xid); | 165 aura::WindowTreeHost::GetForAcceleratedWidget(xid); |
| 167 return dispatcher ? | 166 return host ? host->window()->GetProperty(kHostForRootWindow) : NULL; |
| 168 dispatcher->window()->GetProperty(kHostForRootWindow) : NULL; | |
| 169 } | 167 } |
| 170 | 168 |
| 171 // static | 169 // static |
| 172 std::vector<aura::Window*> DesktopWindowTreeHostX11::GetAllOpenWindows() { | 170 std::vector<aura::Window*> DesktopWindowTreeHostX11::GetAllOpenWindows() { |
| 173 std::vector<aura::Window*> windows(open_windows().size()); | 171 std::vector<aura::Window*> windows(open_windows().size()); |
| 174 std::transform(open_windows().begin(), | 172 std::transform(open_windows().begin(), |
| 175 open_windows().end(), | 173 open_windows().end(), |
| 176 windows.begin(), | 174 windows.begin(), |
| 177 GetContentWindowForXID); | 175 GetContentWindowForXID); |
| 178 return windows; | 176 return windows; |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 } | 830 } |
| 833 | 831 |
| 834 void DesktopWindowTreeHostX11::ReleaseCapture() { | 832 void DesktopWindowTreeHostX11::ReleaseCapture() { |
| 835 if (g_current_capture == this) | 833 if (g_current_capture == this) |
| 836 g_current_capture->OnCaptureReleased(); | 834 g_current_capture->OnCaptureReleased(); |
| 837 } | 835 } |
| 838 | 836 |
| 839 bool DesktopWindowTreeHostX11::QueryMouseLocation( | 837 bool DesktopWindowTreeHostX11::QueryMouseLocation( |
| 840 gfx::Point* location_return) { | 838 gfx::Point* location_return) { |
| 841 aura::client::CursorClient* cursor_client = | 839 aura::client::CursorClient* cursor_client = |
| 842 aura::client::GetCursorClient(GetDispatcher()->window()); | 840 aura::client::GetCursorClient(window()); |
| 843 if (cursor_client && !cursor_client->IsMouseEventsEnabled()) { | 841 if (cursor_client && !cursor_client->IsMouseEventsEnabled()) { |
| 844 *location_return = gfx::Point(0, 0); | 842 *location_return = gfx::Point(0, 0); |
| 845 return false; | 843 return false; |
| 846 } | 844 } |
| 847 | 845 |
| 848 ::Window root_return, child_return; | 846 ::Window root_return, child_return; |
| 849 int root_x_return, root_y_return, win_x_return, win_y_return; | 847 int root_x_return, root_y_return, win_x_return, win_y_return; |
| 850 unsigned int mask_return; | 848 unsigned int mask_return; |
| 851 XQueryPointer(xdisplay_, | 849 XQueryPointer(xdisplay_, |
| 852 xwindow_, | 850 xwindow_, |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 if (params.remove_standard_frame) { | 1069 if (params.remove_standard_frame) { |
| 1072 // Setting _GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED tells gnome-shell to not force | 1070 // Setting _GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED tells gnome-shell to not force |
| 1073 // fullscreen on the window when it matches the desktop size. | 1071 // fullscreen on the window when it matches the desktop size. |
| 1074 ui::SetHideTitlebarWhenMaximizedProperty(xwindow_, | 1072 ui::SetHideTitlebarWhenMaximizedProperty(xwindow_, |
| 1075 ui::HIDE_TITLEBAR_WHEN_MAXIMIZED); | 1073 ui::HIDE_TITLEBAR_WHEN_MAXIMIZED); |
| 1076 } | 1074 } |
| 1077 | 1075 |
| 1078 // If we have a parent, record the parent/child relationship. We use this | 1076 // If we have a parent, record the parent/child relationship. We use this |
| 1079 // data during destruction to make sure that when we try to close a parent | 1077 // data during destruction to make sure that when we try to close a parent |
| 1080 // window, we also destroy all child windows. | 1078 // window, we also destroy all child windows. |
| 1081 if (params.parent && params.parent->GetDispatcher()) { | 1079 if (params.parent && params.parent->GetHost()) { |
| 1082 XID parent_xid = | 1080 XID parent_xid = |
| 1083 params.parent->GetDispatcher()->host()->GetAcceleratedWidget(); | 1081 params.parent->GetHost()->GetAcceleratedWidget(); |
| 1084 window_parent_ = GetHostForXID(parent_xid); | 1082 window_parent_ = GetHostForXID(parent_xid); |
| 1085 DCHECK(window_parent_); | 1083 DCHECK(window_parent_); |
| 1086 window_parent_->window_children_.insert(this); | 1084 window_parent_->window_children_.insert(this); |
| 1087 } | 1085 } |
| 1088 | 1086 |
| 1089 // If we have a delegate which is providing a default window icon, use that | 1087 // If we have a delegate which is providing a default window icon, use that |
| 1090 // icon. | 1088 // icon. |
| 1091 gfx::ImageSkia* window_icon = ViewsDelegate::views_delegate ? | 1089 gfx::ImageSkia* window_icon = ViewsDelegate::views_delegate ? |
| 1092 ViewsDelegate::views_delegate->GetDefaultWindowIcon() : NULL; | 1090 ViewsDelegate::views_delegate->GetDefaultWindowIcon() : NULL; |
| 1093 if (window_icon) { | 1091 if (window_icon) { |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1630 if (linux_ui) { | 1628 if (linux_ui) { |
| 1631 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); | 1629 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); |
| 1632 if (native_theme) | 1630 if (native_theme) |
| 1633 return native_theme; | 1631 return native_theme; |
| 1634 } | 1632 } |
| 1635 | 1633 |
| 1636 return ui::NativeTheme::instance(); | 1634 return ui::NativeTheme::instance(); |
| 1637 } | 1635 } |
| 1638 | 1636 |
| 1639 } // namespace views | 1637 } // namespace views |
| OLD | NEW |