| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 use_argb_visual_(false), | 176 use_argb_visual_(false), |
| 177 drag_drop_client_(NULL), | 177 drag_drop_client_(NULL), |
| 178 native_widget_delegate_(native_widget_delegate), | 178 native_widget_delegate_(native_widget_delegate), |
| 179 desktop_native_widget_aura_(desktop_native_widget_aura), | 179 desktop_native_widget_aura_(desktop_native_widget_aura), |
| 180 content_window_(NULL), | 180 content_window_(NULL), |
| 181 window_parent_(NULL), | 181 window_parent_(NULL), |
| 182 custom_window_shape_(false), | 182 custom_window_shape_(false), |
| 183 urgency_hint_set_(false), | 183 urgency_hint_set_(false), |
| 184 activatable_(true), | 184 activatable_(true), |
| 185 close_widget_factory_(this) { | 185 close_widget_factory_(this) { |
| 186 display::Screen::GetScreen()->AddObserver(this); |
| 186 } | 187 } |
| 187 | 188 |
| 188 DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() { | 189 DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() { |
| 190 display::Screen::GetScreen()->RemoveObserver(this); |
| 189 window()->ClearProperty(kHostForRootWindow); | 191 window()->ClearProperty(kHostForRootWindow); |
| 190 aura::client::SetWindowMoveClient(window(), NULL); | 192 aura::client::SetWindowMoveClient(window(), NULL); |
| 191 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this); | 193 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this); |
| 192 DestroyDispatcher(); | 194 DestroyDispatcher(); |
| 193 } | 195 } |
| 194 | 196 |
| 195 // static | 197 // static |
| 196 aura::Window* DesktopWindowTreeHostX11::GetContentWindowForXID(XID xid) { | 198 aura::Window* DesktopWindowTreeHostX11::GetContentWindowForXID(XID xid) { |
| 197 aura::WindowTreeHost* host = | 199 aura::WindowTreeHost* host = |
| 198 aura::WindowTreeHost::GetForAcceleratedWidget(xid); | 200 aura::WindowTreeHost::GetForAcceleratedWidget(xid); |
| (...skipping 1830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2029 break; | 2031 break; |
| 2030 } | 2032 } |
| 2031 case SelectionNotify: { | 2033 case SelectionNotify: { |
| 2032 drag_drop_client_->OnSelectionNotify(xev->xselection); | 2034 drag_drop_client_->OnSelectionNotify(xev->xselection); |
| 2033 break; | 2035 break; |
| 2034 } | 2036 } |
| 2035 } | 2037 } |
| 2036 return ui::POST_DISPATCH_STOP_PROPAGATION; | 2038 return ui::POST_DISPATCH_STOP_PROPAGATION; |
| 2037 } | 2039 } |
| 2038 | 2040 |
| 2041 void DesktopWindowTreeHostX11::OnDisplayMetricsChanged( |
| 2042 const display::Display& display, |
| 2043 uint32_t changed_metrics) { |
| 2044 display::Screen* screen = display::Screen::GetScreen(); |
| 2045 if ((changed_metrics & DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR) && |
| 2046 screen->GetDisplayNearestWindow(window()).id() == display.id()) { |
| 2047 OnHostResized(bounds_in_pixels_.size()); |
| 2048 ResetWindowRegion(); |
| 2049 } |
| 2050 } |
| 2051 |
| 2039 void DesktopWindowTreeHostX11::DelayedResize(const gfx::Size& size_in_pixels) { | 2052 void DesktopWindowTreeHostX11::DelayedResize(const gfx::Size& size_in_pixels) { |
| 2040 OnHostResized(size_in_pixels); | 2053 OnHostResized(size_in_pixels); |
| 2041 ResetWindowRegion(); | 2054 ResetWindowRegion(); |
| 2042 delayed_resize_task_.Cancel(); | 2055 delayed_resize_task_.Cancel(); |
| 2043 } | 2056 } |
| 2044 | 2057 |
| 2045 gfx::Rect DesktopWindowTreeHostX11::GetWorkAreaBoundsInPixels() const { | 2058 gfx::Rect DesktopWindowTreeHostX11::GetWorkAreaBoundsInPixels() const { |
| 2046 std::vector<int> value; | 2059 std::vector<int> value; |
| 2047 if (ui::GetIntArrayProperty(x_root_window_, "_NET_WORKAREA", &value) && | 2060 if (ui::GetIntArrayProperty(x_root_window_, "_NET_WORKAREA", &value) && |
| 2048 value.size() >= 4) { | 2061 value.size() >= 4) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2094 if (linux_ui) { | 2107 if (linux_ui) { |
| 2095 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 2108 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
| 2096 if (native_theme) | 2109 if (native_theme) |
| 2097 return native_theme; | 2110 return native_theme; |
| 2098 } | 2111 } |
| 2099 | 2112 |
| 2100 return ui::NativeThemeAura::instance(); | 2113 return ui::NativeThemeAura::instance(); |
| 2101 } | 2114 } |
| 2102 | 2115 |
| 2103 } // namespace views | 2116 } // namespace views |
| OLD | NEW |