| 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/XInput2.h> | 7 #include <X11/extensions/XInput2.h> |
| 8 #include <X11/Xatom.h> | 8 #include <X11/Xatom.h> |
| 9 #include <X11/Xutil.h> | 9 #include <X11/Xutil.h> |
| 10 | 10 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 const gfx::Rect& initial_bounds) | 104 const gfx::Rect& initial_bounds) |
| 105 : close_widget_factory_(this), | 105 : close_widget_factory_(this), |
| 106 xdisplay_(base::MessagePumpAuraX11::GetDefaultXDisplay()), | 106 xdisplay_(base::MessagePumpAuraX11::GetDefaultXDisplay()), |
| 107 xwindow_(0), | 107 xwindow_(0), |
| 108 x_root_window_(DefaultRootWindow(xdisplay_)), | 108 x_root_window_(DefaultRootWindow(xdisplay_)), |
| 109 atom_cache_(xdisplay_, kAtomsToCache), | 109 atom_cache_(xdisplay_, kAtomsToCache), |
| 110 window_mapped_(false), | 110 window_mapped_(false), |
| 111 focus_when_shown_(false), | 111 focus_when_shown_(false), |
| 112 current_cursor_(ui::kCursorNull), | 112 current_cursor_(ui::kCursorNull), |
| 113 native_widget_delegate_(native_widget_delegate), | 113 native_widget_delegate_(native_widget_delegate), |
| 114 desktop_native_widget_aura_(desktop_native_widget_aura), | 114 desktop_native_widget_aura_(desktop_native_widget_aura) { |
| 115 drop_handler_(NULL) { | |
| 116 } | 115 } |
| 117 | 116 |
| 118 DesktopRootWindowHostX11::~DesktopRootWindowHostX11() { | 117 DesktopRootWindowHostX11::~DesktopRootWindowHostX11() { |
| 119 root_window_->ClearProperty(kHostForRootWindow); | 118 root_window_->ClearProperty(kHostForRootWindow); |
| 120 if (corewm::UseFocusControllerOnDesktop()) { | 119 if (corewm::UseFocusControllerOnDesktop()) { |
| 121 aura::client::SetFocusClient(root_window_, NULL); | 120 aura::client::SetFocusClient(root_window_, NULL); |
| 122 aura::client::SetActivationClient(root_window_, NULL); | 121 aura::client::SetActivationClient(root_window_, NULL); |
| 123 } | 122 } |
| 124 } | 123 } |
| 125 | 124 |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 } | 899 } |
| 901 | 900 |
| 902 void DesktopRootWindowHostX11::OnDeviceScaleFactorChanged( | 901 void DesktopRootWindowHostX11::OnDeviceScaleFactorChanged( |
| 903 float device_scale_factor) { | 902 float device_scale_factor) { |
| 904 } | 903 } |
| 905 | 904 |
| 906 void DesktopRootWindowHostX11::PrepareForShutdown() { | 905 void DesktopRootWindowHostX11::PrepareForShutdown() { |
| 907 } | 906 } |
| 908 | 907 |
| 909 //////////////////////////////////////////////////////////////////////////////// | 908 //////////////////////////////////////////////////////////////////////////////// |
| 910 // DesktopRootWindowHostX11, ui::DesktopSelectionProviderAuraX11 implementation: | |
| 911 | |
| 912 void DesktopRootWindowHostX11::SetDropHandler( | |
| 913 ui::OSExchangeDataProviderAuraX11* handler) { | |
| 914 if (handler) { | |
| 915 DCHECK(!drop_handler_); | |
| 916 drop_handler_ = handler; | |
| 917 } else { | |
| 918 DCHECK(drop_handler_); | |
| 919 drop_handler_ = NULL; | |
| 920 } | |
| 921 } | |
| 922 | |
| 923 //////////////////////////////////////////////////////////////////////////////// | |
| 924 // DesktopRootWindowHostX11, MessageLoop::Dispatcher implementation: | 909 // DesktopRootWindowHostX11, MessageLoop::Dispatcher implementation: |
| 925 | 910 |
| 926 bool DesktopRootWindowHostX11::Dispatch(const base::NativeEvent& event) { | 911 bool DesktopRootWindowHostX11::Dispatch(const base::NativeEvent& event) { |
| 927 XEvent* xev = event; | 912 XEvent* xev = event; |
| 928 | 913 |
| 929 // May want to factor CheckXEventForConsistency(xev); into a common location | 914 // May want to factor CheckXEventForConsistency(xev); into a common location |
| 930 // since it is called here. | 915 // since it is called here. |
| 931 switch (xev->type) { | 916 switch (xev->type) { |
| 932 case Expose: { | 917 case Expose: { |
| 933 gfx::Rect damage_rect(xev->xexpose.x, xev->xexpose.y, | 918 gfx::Rect damage_rect(xev->xexpose.x, xev->xexpose.y, |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 // non_client_view may be NULL, especially during creation. | 1172 // non_client_view may be NULL, especially during creation. |
| 1188 if (non_client_view) { | 1173 if (non_client_view) { |
| 1189 non_client_view->client_view()->InvalidateLayout(); | 1174 non_client_view->client_view()->InvalidateLayout(); |
| 1190 non_client_view->InvalidateLayout(); | 1175 non_client_view->InvalidateLayout(); |
| 1191 } | 1176 } |
| 1192 widget->GetRootView()->Layout(); | 1177 widget->GetRootView()->Layout(); |
| 1193 } | 1178 } |
| 1194 break; | 1179 break; |
| 1195 } | 1180 } |
| 1196 case SelectionNotify: { | 1181 case SelectionNotify: { |
| 1197 if (drop_handler_) | 1182 drag_drop_client_->OnSelectionNotify(xev->xselection); |
| 1198 drop_handler_->OnSelectionNotify(xev->xselection); | |
| 1199 break; | 1183 break; |
| 1200 } | 1184 } |
| 1201 } | 1185 } |
| 1202 return true; | 1186 return true; |
| 1203 } | 1187 } |
| 1204 | 1188 |
| 1205 //////////////////////////////////////////////////////////////////////////////// | 1189 //////////////////////////////////////////////////////////////////////////////// |
| 1206 // DesktopRootWindowHost, public: | 1190 // DesktopRootWindowHost, public: |
| 1207 | 1191 |
| 1208 // static | 1192 // static |
| 1209 DesktopRootWindowHost* DesktopRootWindowHost::Create( | 1193 DesktopRootWindowHost* DesktopRootWindowHost::Create( |
| 1210 internal::NativeWidgetDelegate* native_widget_delegate, | 1194 internal::NativeWidgetDelegate* native_widget_delegate, |
| 1211 DesktopNativeWidgetAura* desktop_native_widget_aura, | 1195 DesktopNativeWidgetAura* desktop_native_widget_aura, |
| 1212 const gfx::Rect& initial_bounds) { | 1196 const gfx::Rect& initial_bounds) { |
| 1213 return new DesktopRootWindowHostX11(native_widget_delegate, | 1197 return new DesktopRootWindowHostX11(native_widget_delegate, |
| 1214 desktop_native_widget_aura, | 1198 desktop_native_widget_aura, |
| 1215 initial_bounds); | 1199 initial_bounds); |
| 1216 } | 1200 } |
| 1217 | 1201 |
| 1218 } // namespace views | 1202 } // namespace views |
| OLD | NEW |