OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/views/widget/desktop_aura/desktop_root_window_host_wayland.h" |
| 6 |
| 7 #include "base/message_pump_wayland.h" |
| 8 #include "base/stringprintf.h" |
| 9 #include "base/wayland/wayland_event.h" |
| 10 #include "base/utf_string_conversions.h" |
| 11 #include "ui/aura/client/screen_position_client.h" |
| 12 #include "ui/aura/client/user_action_client.h" |
| 13 #include "ui/aura/focus_manager.h" |
| 14 #include "ui/aura/root_window.h" |
| 15 #include "ui/aura/window_property.h" |
| 16 #include "ui/base/events/event_utils.h" |
| 17 #include "ui/gfx/insets.h" |
| 18 #include "ui/linux_ui/linux_ui.h" |
| 19 #include "ui/native_theme/native_theme.h" |
| 20 #include "ui/views/corewm/compound_event_filter.h" |
| 21 #include "ui/views/corewm/corewm_switches.h" |
| 22 #include "ui/views/corewm/cursor_manager.h" |
| 23 #include "ui/views/corewm/focus_controller.h" |
| 24 #include "ui/views/ime/input_method.h" |
| 25 #include "ui/views/widget/desktop_aura/desktop_activation_client.h" |
| 26 #include "ui/views/widget/desktop_aura/desktop_capture_client.h" |
| 27 #include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater_aurax11.h" |
| 28 #include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h" |
| 29 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h" |
| 30 #include "ui/views/widget/desktop_aura/desktop_focus_rules.h" |
| 31 #include "ui/views/widget/desktop_aura/desktop_layout_manager.h" |
| 32 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" |
| 33 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 34 #include "ui/views/widget/desktop_aura/desktop_screen_position_client.h" |
| 35 #include "ui/wayland/wayland_screen.h" |
| 36 #include "ui/wayland/wayland_window.h" |
| 37 |
| 38 namespace views { |
| 39 |
| 40 DesktopRootWindowHostWayland* DesktopRootWindowHostWayland::g_current_capture = |
| 41 NULL; |
| 42 |
| 43 DEFINE_WINDOW_PROPERTY_KEY( |
| 44 aura::Window*, kViewsWindowForRootWindow, NULL); |
| 45 |
| 46 DEFINE_WINDOW_PROPERTY_KEY( |
| 47 DesktopRootWindowHostWayland*, kHostForRootWindow, NULL); |
| 48 |
| 49 //////////////////////////////////////////////////////////////////////////////// |
| 50 // DesktopRootWindowHostWayland, public: |
| 51 |
| 52 DesktopRootWindowHostWayland::DesktopRootWindowHostWayland( |
| 53 internal::NativeWidgetDelegate* native_widget_delegate, |
| 54 DesktopNativeWidgetAura* desktop_native_widget_aura, |
| 55 const gfx::Rect& bounds) |
| 56 : close_widget_factory_(this), |
| 57 native_widget_delegate_(native_widget_delegate), |
| 58 display_(ui::WaylandDisplay::GetDisplay()), |
| 59 window_mapped_(false), |
| 60 desktop_native_widget_aura_(desktop_native_widget_aura) { |
| 61 } |
| 62 |
| 63 DesktopRootWindowHostWayland::~DesktopRootWindowHostWayland() { |
| 64 root_window_->ClearProperty(kHostForRootWindow); |
| 65 if (corewm::UseFocusControllerOnDesktop()) { |
| 66 aura::client::SetFocusClient(root_window_, NULL); |
| 67 aura::client::SetActivationClient(root_window_, NULL); |
| 68 } |
| 69 } |
| 70 |
| 71 // static |
| 72 ui::NativeTheme* DesktopRootWindowHost::GetNativeTheme(aura::Window* window) { |
| 73 const ui::LinuxUI* linux_ui = ui::LinuxUI::instance(); |
| 74 if (linux_ui) { |
| 75 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); |
| 76 if (native_theme) |
| 77 return native_theme; |
| 78 } |
| 79 |
| 80 return ui::NativeTheme::instance(); |
| 81 } |
| 82 |
| 83 //////////////////////////////////////////////////////////////////////////////// |
| 84 // DesktopRootWindowHostWayland, private: |
| 85 |
| 86 void DesktopRootWindowHostWayland::InitWaylandWindow( |
| 87 const Widget::InitParams& params) { |
| 88 window_ = new ui::WaylandWindow(NULL, display_); |
| 89 window_->SetParentWindow(NULL); |
| 90 window_->SetBounds(params.bounds); |
| 91 |
| 92 base::MessagePumpWayland::Current()->AddDispatcherForWindow(this, window_); |
| 93 } |
| 94 |
| 95 |
| 96 void DesktopRootWindowHostWayland::HandleNativeWidgetActivationChanged( |
| 97 bool active) { |
| 98 native_widget_delegate_->OnNativeWidgetActivationChanged(active); |
| 99 native_widget_delegate_->AsWidget()->GetRootView()->SchedulePaint(); |
| 100 } |
| 101 |
| 102 // TODO(erg): This method should basically be everything I need form |
| 103 // RootWindowHostWayland::RootWindowHostWayland(). |
| 104 aura::RootWindow* DesktopRootWindowHostWayland::InitRootWindow( |
| 105 const Widget::InitParams& params) { |
| 106 bounds_ = params.bounds; |
| 107 |
| 108 aura::RootWindow::CreateParams rw_params(bounds_); |
| 109 rw_params.host = this; |
| 110 root_window_ = new aura::RootWindow(rw_params); |
| 111 root_window_->Init(); |
| 112 root_window_->AddChild(content_window_); |
| 113 root_window_->SetLayoutManager(new DesktopLayoutManager(root_window_)); |
| 114 root_window_->SetProperty(kViewsWindowForRootWindow, content_window_); |
| 115 root_window_->SetProperty(kHostForRootWindow, this); |
| 116 root_window_host_delegate_ = root_window_; |
| 117 |
| 118 // If we're given a parent, we need to mark ourselves as transient to another |
| 119 // window. Otherwise activation gets screwy. |
| 120 gfx::NativeView parent = params.parent; |
| 121 if (!params.child && params.parent) |
| 122 parent->AddTransientChild(content_window_); |
| 123 |
| 124 native_widget_delegate_->OnNativeWidgetCreated(true); |
| 125 |
| 126 capture_client_.reset(new views::DesktopCaptureClient(root_window_)); |
| 127 aura::client::SetCaptureClient(root_window_, capture_client_.get()); |
| 128 |
| 129 // TODO: dispatches activation? |
| 130 //base::MessagePumpWayland::Current()->AddDispatcherForRootWindow(this); |
| 131 |
| 132 if (corewm::UseFocusControllerOnDesktop()) { |
| 133 corewm::FocusController* focus_controller = |
| 134 new corewm::FocusController(new DesktopFocusRules); |
| 135 focus_client_.reset(focus_controller); |
| 136 aura::client::SetFocusClient(root_window_, focus_controller); |
| 137 aura::client::SetActivationClient(root_window_, focus_controller); |
| 138 root_window_->AddPreTargetHandler(focus_controller); |
| 139 } else { |
| 140 focus_client_.reset(new aura::FocusManager); |
| 141 aura::client::SetFocusClient(root_window_, focus_client_.get()); |
| 142 activation_client_.reset(new DesktopActivationClient(root_window_)); |
| 143 } |
| 144 |
| 145 dispatcher_client_.reset(new DesktopDispatcherClient); |
| 146 aura::client::SetDispatcherClient(root_window_, |
| 147 dispatcher_client_.get()); |
| 148 |
| 149 // TODO: cursor_client_? |
| 150 |
| 151 desktop_native_widget_aura_->InstallInputMethodEventFilter(root_window_); |
| 152 |
| 153 // TODO: drag_drop_client? |
| 154 |
| 155 focus_client_->FocusWindow(content_window_); |
| 156 return root_window_; |
| 157 } |
| 158 bool DesktopRootWindowHostWayland::IsWindowManagerPresent() { |
| 159 return true; |
| 160 } |
| 161 |
| 162 //////////////////////////////////////////////////////////////////////////////// |
| 163 // DesktopRootWindowHostWayland, DesktopRootWindowHost implementation: |
| 164 |
| 165 aura::RootWindow* DesktopRootWindowHostWayland::Init( |
| 166 aura::Window* content_window, |
| 167 const Widget::InitParams& params) { |
| 168 content_window_ = content_window; |
| 169 |
| 170 // TODO(erg): Check whether we *should* be building a RootWindowHost here, or |
| 171 // whether we should be proxying requests to another DRWHL. |
| 172 |
| 173 // In some situations, views tries to make a zero sized window, and that |
| 174 // makes us crash. Make sure we have valid sizes. |
| 175 Widget::InitParams sanitized_params = params; |
| 176 if (sanitized_params.bounds.width() == 0) |
| 177 sanitized_params.bounds.set_width(100); |
| 178 if (sanitized_params.bounds.height() == 0) |
| 179 sanitized_params.bounds.set_height(100); |
| 180 |
| 181 InitWaylandWindow(sanitized_params); |
| 182 return InitRootWindow(sanitized_params); |
| 183 } |
| 184 |
| 185 void DesktopRootWindowHostWayland::InitFocus(aura::Window* window) { |
| 186 } |
| 187 |
| 188 void DesktopRootWindowHostWayland::Close() { |
| 189 // TODO(erg): Might need to do additional hiding tasks here. |
| 190 |
| 191 if (!close_widget_factory_.HasWeakPtrs()) { |
| 192 // And we delay the close so that if we are called from an ATL callback, |
| 193 // we don't destroy the window before the callback returned (as the caller |
| 194 // may delete ourselves on destroy and the ATL callback would still |
| 195 // dereference us when the callback returns). |
| 196 // base::MessageLoop::current()->PostTask( |
| 197 // FROM_HERE, |
| 198 // base::Bind(&DesktopRootWindowHostWayland::CloseNow, |
| 199 // close_widget_factory_.GetWeakPtr())); |
| 200 } |
| 201 } |
| 202 |
| 203 void DesktopRootWindowHostWayland::CloseNow() { |
| 204 native_widget_delegate_->OnNativeWidgetDestroying(); |
| 205 |
| 206 // Actually free our native resources. |
| 207 base::MessagePumpWayland::Current()->RemoveDispatcherForWindow(window_); |
| 208 delete window_; |
| 209 |
| 210 desktop_native_widget_aura_->OnHostClosed(); |
| 211 } |
| 212 |
| 213 aura::RootWindowHost* DesktopRootWindowHostWayland::AsRootWindowHost() { |
| 214 return this; |
| 215 } |
| 216 |
| 217 void DesktopRootWindowHostWayland::ShowWindowWithState( |
| 218 ui::WindowShowState show_state) { |
| 219 if (show_state != ui::SHOW_STATE_DEFAULT && |
| 220 show_state != ui::SHOW_STATE_NORMAL) { |
| 221 // Only forwarding to Show(). |
| 222 NOTIMPLEMENTED(); |
| 223 } |
| 224 |
| 225 Show(); |
| 226 } |
| 227 |
| 228 void DesktopRootWindowHostWayland::ShowMaximizedWithBounds( |
| 229 const gfx::Rect& restored_bounds) { |
| 230 // TODO(erg): |
| 231 NOTIMPLEMENTED(); |
| 232 |
| 233 // TODO(erg): We shouldn't completely fall down here. |
| 234 Show(); |
| 235 } |
| 236 |
| 237 bool DesktopRootWindowHostWayland::IsVisible() const { |
| 238 return window_mapped_; |
| 239 } |
| 240 |
| 241 void DesktopRootWindowHostWayland::SetSize(const gfx::Size& size) { |
| 242 // TODO(erg): |
| 243 NOTIMPLEMENTED(); |
| 244 } |
| 245 |
| 246 void DesktopRootWindowHostWayland::CenterWindow(const gfx::Size& size) { |
| 247 gfx::Rect parent_bounds = GetWorkAreaBoundsInScreen(); |
| 248 |
| 249 // If |window_|'s transient parent bounds are big enough to contain |size|, |
| 250 // use them instead. |
| 251 if (content_window_->transient_parent()) { |
| 252 gfx::Rect transient_parent_rect = |
| 253 content_window_->transient_parent()->GetBoundsInScreen(); |
| 254 if (transient_parent_rect.height() >= size.height() && |
| 255 transient_parent_rect.width() >= size.width()) { |
| 256 parent_bounds = transient_parent_rect; |
| 257 } |
| 258 } |
| 259 |
| 260 gfx::Rect window_bounds( |
| 261 parent_bounds.x() + (parent_bounds.width() - size.width()) / 2, |
| 262 parent_bounds.y() + (parent_bounds.height() - size.height()) / 2, |
| 263 size.width(), |
| 264 size.height()); |
| 265 // Don't size the window bigger than the parent, otherwise the user may not be |
| 266 // able to close or move it. |
| 267 window_bounds.AdjustToFit(parent_bounds); |
| 268 |
| 269 SetBounds(window_bounds); |
| 270 } |
| 271 |
| 272 void DesktopRootWindowHostWayland::GetWindowPlacement( |
| 273 gfx::Rect* bounds, |
| 274 ui::WindowShowState* show_state) const { |
| 275 *bounds = bounds_; |
| 276 |
| 277 // TODO(erg): This needs a better implementation. For now, we're just pass |
| 278 // back the normal state until we keep track of this. |
| 279 *show_state = ui::SHOW_STATE_NORMAL; |
| 280 } |
| 281 |
| 282 gfx::Rect DesktopRootWindowHostWayland::GetWindowBoundsInScreen() const { |
| 283 return bounds_; |
| 284 } |
| 285 |
| 286 gfx::Rect DesktopRootWindowHostWayland::GetClientAreaBoundsInScreen() const { |
| 287 // TODO(erg): The NativeWidgetAura version returns |bounds_|, claiming its |
| 288 // needed for View::ConvertPointToScreen() to work |
| 289 // correctly. DesktopRootWindowHostWin::GetClientAreaBoundsInScreen() just |
| 290 // asks windows what it thinks the client rect is. |
| 291 // |
| 292 // Attempts to calculate the rect by asking the NonClientFrameView what it |
| 293 // thought its GetBoundsForClientView() were broke combobox drop down |
| 294 // placement. |
| 295 return bounds_; |
| 296 } |
| 297 |
| 298 gfx::Rect DesktopRootWindowHostWayland::GetRestoredBounds() const { |
| 299 // TODO(erg): |
| 300 NOTIMPLEMENTED(); |
| 301 return gfx::Rect(); |
| 302 } |
| 303 |
| 304 gfx::Rect DesktopRootWindowHostWayland::GetWorkAreaBoundsInScreen() const { |
| 305 NOTIMPLEMENTED(); |
| 306 return gfx::Rect(0, 0, 10, 10); |
| 307 } |
| 308 |
| 309 void DesktopRootWindowHostWayland::SetShape(gfx::NativeRegion native_region) { |
| 310 // TODO(erg): |
| 311 NOTIMPLEMENTED(); |
| 312 } |
| 313 |
| 314 void DesktopRootWindowHostWayland::Activate() { |
| 315 NOTIMPLEMENTED(); |
| 316 } |
| 317 |
| 318 void DesktopRootWindowHostWayland::Deactivate() { |
| 319 NOTIMPLEMENTED(); |
| 320 } |
| 321 |
| 322 bool DesktopRootWindowHostWayland::IsActive() const { |
| 323 return false; |
| 324 } |
| 325 |
| 326 void DesktopRootWindowHostWayland::Maximize() { |
| 327 NOTIMPLEMENTED(); |
| 328 } |
| 329 |
| 330 void DesktopRootWindowHostWayland::Minimize() { |
| 331 NOTIMPLEMENTED(); |
| 332 } |
| 333 |
| 334 void DesktopRootWindowHostWayland::Restore() { |
| 335 NOTIMPLEMENTED(); |
| 336 } |
| 337 |
| 338 bool DesktopRootWindowHostWayland::IsMaximized() const { |
| 339 return true; |
| 340 } |
| 341 |
| 342 bool DesktopRootWindowHostWayland::IsMinimized() const { |
| 343 return false; |
| 344 } |
| 345 |
| 346 void DesktopRootWindowHostWayland::OnCaptureReleased() { |
| 347 native_widget_delegate_->OnMouseCaptureLost(); |
| 348 g_current_capture = NULL; |
| 349 } |
| 350 |
| 351 void DesktopRootWindowHostWayland::DispatchMouseEvent(ui::MouseEvent* event) { |
| 352 if (!g_current_capture || g_current_capture == this) { |
| 353 root_window_host_delegate_->OnHostMouseEvent(event); |
| 354 } else { |
| 355 // Another DesktopRootWindowHostX11 has installed itself as |
| 356 // capture. Translate the event's location and dispatch to the other. |
| 357 event->ConvertLocationToTarget(root_window_, |
| 358 g_current_capture->root_window_); |
| 359 g_current_capture->root_window_host_delegate_->OnHostMouseEvent(event); |
| 360 } |
| 361 } |
| 362 |
| 363 bool DesktopRootWindowHostWayland::HasCapture() const { |
| 364 return g_current_capture == this; |
| 365 } |
| 366 |
| 367 void DesktopRootWindowHostWayland::SetAlwaysOnTop(bool always_on_top) { |
| 368 // TODO(erg): |
| 369 NOTIMPLEMENTED(); |
| 370 } |
| 371 |
| 372 void DesktopRootWindowHostWayland::SetWindowTitle(const string16& title) { |
| 373 NOTIMPLEMENTED(); |
| 374 |
| 375 window_->ScheduleRedraw(); |
| 376 } |
| 377 |
| 378 void DesktopRootWindowHostWayland::ClearNativeFocus() { |
| 379 // This method is weird and misnamed. Instead of clearing the native focus, |
| 380 // it sets the focus to our |content_window_|, which will trigger a cascade |
| 381 // of focus changes into views. |
| 382 if (content_window_ && aura::client::GetFocusClient(content_window_) && |
| 383 content_window_->Contains( |
| 384 aura::client::GetFocusClient(content_window_)->GetFocusedWindow())) { |
| 385 aura::client::GetFocusClient(content_window_)->FocusWindow(content_window_); |
| 386 } |
| 387 } |
| 388 |
| 389 Widget::MoveLoopResult DesktopRootWindowHostWayland::RunMoveLoop( |
| 390 const gfx::Vector2d& drag_offset, |
| 391 Widget::MoveLoopSource source) { |
| 392 NOTIMPLEMENTED(); |
| 393 return Widget::MOVE_LOOP_SUCCESSFUL; |
| 394 } |
| 395 |
| 396 void DesktopRootWindowHostWayland::EndMoveLoop() { |
| 397 NOTIMPLEMENTED(); |
| 398 } |
| 399 |
| 400 void DesktopRootWindowHostWayland::SetVisibilityChangedAnimationsEnabled( |
| 401 bool value) { |
| 402 // Much like the previous NativeWidgetGtk, we don't have anything to do here. |
| 403 } |
| 404 |
| 405 bool DesktopRootWindowHostWayland::ShouldUseNativeFrame() { |
| 406 return false; |
| 407 } |
| 408 |
| 409 void DesktopRootWindowHostWayland::FrameTypeChanged() { |
| 410 } |
| 411 |
| 412 NonClientFrameView* DesktopRootWindowHostWayland::CreateNonClientFrameView() { |
| 413 return NULL; |
| 414 } |
| 415 |
| 416 void DesktopRootWindowHostWayland::SetFullscreen(bool fullscreen) { |
| 417 NOTIMPLEMENTED(); |
| 418 } |
| 419 |
| 420 bool DesktopRootWindowHostWayland::IsFullscreen() const { |
| 421 NOTIMPLEMENTED(); |
| 422 return false; |
| 423 } |
| 424 |
| 425 void DesktopRootWindowHostWayland::SetOpacity(unsigned char opacity) { |
| 426 // TODO(erg): |
| 427 NOTIMPLEMENTED(); |
| 428 } |
| 429 |
| 430 void DesktopRootWindowHostWayland::SetWindowIcons( |
| 431 const gfx::ImageSkia& window_icon, const gfx::ImageSkia& app_icon) { |
| 432 // TODO(erg): |
| 433 NOTIMPLEMENTED(); |
| 434 } |
| 435 |
| 436 void DesktopRootWindowHostWayland::InitModalType(ui::ModalType modal_type) { |
| 437 // TODO(erg): |
| 438 NOTIMPLEMENTED(); |
| 439 } |
| 440 |
| 441 void DesktopRootWindowHostWayland::FlashFrame(bool flash_frame) { |
| 442 // TODO(erg): |
| 443 NOTIMPLEMENTED(); |
| 444 } |
| 445 |
| 446 void DesktopRootWindowHostWayland::OnNativeWidgetFocus() { |
| 447 native_widget_delegate_->AsWidget()->GetInputMethod()->OnFocus(); |
| 448 } |
| 449 |
| 450 void DesktopRootWindowHostWayland::OnNativeWidgetBlur() { |
| 451 if (window_) |
| 452 native_widget_delegate_->AsWidget()->GetInputMethod()->OnBlur(); |
| 453 } |
| 454 |
| 455 void DesktopRootWindowHostWayland::SetInactiveRenderingDisabled( |
| 456 bool disable_inactive) { |
| 457 } |
| 458 |
| 459 //////////////////////////////////////////////////////////////////////////////// |
| 460 // DesktopRootWindowHostWayland, aura::RootWindowHost implementation: |
| 461 |
| 462 void DesktopRootWindowHostWayland::SetDelegate( |
| 463 aura::RootWindowHostDelegate* delegate) { |
| 464 root_window_host_delegate_ = delegate; |
| 465 } |
| 466 |
| 467 aura::RootWindow* DesktopRootWindowHostWayland::GetRootWindow() { |
| 468 return root_window_; |
| 469 } |
| 470 |
| 471 gfx::AcceleratedWidget DesktopRootWindowHostWayland::GetAcceleratedWidget() { |
| 472 return window_; |
| 473 } |
| 474 |
| 475 void DesktopRootWindowHostWayland::Show() { |
| 476 NOTIMPLEMENTED(); |
| 477 |
| 478 window_mapped_ = true; |
| 479 window_->ScheduleRedraw(); |
| 480 } |
| 481 |
| 482 void DesktopRootWindowHostWayland::Hide() { |
| 483 NOTIMPLEMENTED(); |
| 484 |
| 485 window_mapped_ = false; |
| 486 } |
| 487 |
| 488 void DesktopRootWindowHostWayland::ToggleFullScreen() { |
| 489 NOTIMPLEMENTED(); |
| 490 } |
| 491 |
| 492 gfx::Rect DesktopRootWindowHostWayland::GetBounds() const { |
| 493 return bounds_; |
| 494 } |
| 495 |
| 496 void DesktopRootWindowHostWayland::SetBounds(const gfx::Rect& bounds) { |
| 497 bool origin_changed = bounds_.origin() != bounds.origin(); |
| 498 bool size_changed = bounds_.size() != bounds.size(); |
| 499 |
| 500 bounds_ = bounds; |
| 501 |
| 502 if (origin_changed) |
| 503 native_widget_delegate_->AsWidget()->OnNativeWidgetMove(); |
| 504 if (size_changed) |
| 505 root_window_host_delegate_->OnHostResized(bounds.size()); |
| 506 else |
| 507 root_window_host_delegate_->OnHostPaint(gfx::Rect(bounds.size())); |
| 508 } |
| 509 |
| 510 gfx::Insets DesktopRootWindowHostWayland::GetInsets() const { |
| 511 return gfx::Insets(); |
| 512 } |
| 513 |
| 514 void DesktopRootWindowHostWayland::SetInsets(const gfx::Insets& insets) { |
| 515 } |
| 516 |
| 517 gfx::Point DesktopRootWindowHostWayland::GetLocationOnNativeScreen() const { |
| 518 return bounds_.origin(); |
| 519 } |
| 520 |
| 521 void DesktopRootWindowHostWayland::SetCapture() { |
| 522 // This is vaguely based on the old NativeWidgetGtk implementation. |
| 523 // |
| 524 // X11's XPointerGrab() shouldn't be used for everything; it doesn't map |
| 525 // cleanly to Windows' SetCapture(). GTK only provides a separate concept of |
| 526 // a grab that wasn't the X11 pointer grab, but was instead a manual |
| 527 // redirection of the event. (You need to drop into GDK if you want to |
| 528 // perform a raw X11 grab). |
| 529 |
| 530 if (g_current_capture) |
| 531 g_current_capture->OnCaptureReleased(); |
| 532 |
| 533 g_current_capture = this; |
| 534 |
| 535 // TODO(erg): In addition to the above, NativeWidgetGtk performs a full X |
| 536 // pointer grab when our NativeWidget is of type Menu. However, things work |
| 537 // without it. Clicking inside a chrome window causes a release capture, and |
| 538 // clicking outside causes an activation change. Since previous attempts at |
| 539 // using XPointerGrab() to implement this have locked my X server, I'm going |
| 540 // to skip this for now. |
| 541 } |
| 542 |
| 543 void DesktopRootWindowHostWayland::ReleaseCapture() { |
| 544 if (g_current_capture) |
| 545 g_current_capture->OnCaptureReleased(); |
| 546 } |
| 547 |
| 548 void DesktopRootWindowHostWayland::SetCursor(gfx::NativeCursor cursor) { |
| 549 NOTIMPLEMENTED(); |
| 550 } |
| 551 |
| 552 bool DesktopRootWindowHostWayland::QueryMouseLocation( |
| 553 gfx::Point* location_return) { |
| 554 NOTIMPLEMENTED(); |
| 555 return false; |
| 556 } |
| 557 |
| 558 bool DesktopRootWindowHostWayland::ConfineCursorToRootWindow() { |
| 559 NOTIMPLEMENTED(); |
| 560 return false; |
| 561 } |
| 562 |
| 563 void DesktopRootWindowHostWayland::UnConfineCursor() { |
| 564 NOTIMPLEMENTED(); |
| 565 } |
| 566 |
| 567 void DesktopRootWindowHostWayland::OnCursorVisibilityChanged(bool show) { |
| 568 // TODO(erg): Conditional on us enabling touch on desktop linux builds, do |
| 569 // the same tap-to-click disabling here that chromeos does. |
| 570 } |
| 571 |
| 572 void DesktopRootWindowHostWayland::MoveCursorTo(const gfx::Point& location) { |
| 573 NOTIMPLEMENTED(); |
| 574 } |
| 575 |
| 576 void DesktopRootWindowHostWayland::SetFocusWhenShown(bool focus_when_shown) { |
| 577 NOTIMPLEMENTED(); |
| 578 } |
| 579 |
| 580 bool DesktopRootWindowHostWayland::CopyAreaToSkCanvas( |
| 581 const gfx::Rect& source_bounds, |
| 582 const gfx::Point& dest_offset, |
| 583 SkCanvas* canvas) { |
| 584 NOTIMPLEMENTED(); |
| 585 return false; |
| 586 } |
| 587 |
| 588 bool DesktopRootWindowHostWayland::GrabSnapshot( |
| 589 const gfx::Rect& snapshot_bounds, |
| 590 std::vector<unsigned char>* png_representation) { |
| 591 NOTIMPLEMENTED(); |
| 592 return false; |
| 593 } |
| 594 |
| 595 void DesktopRootWindowHostWayland::PostNativeEvent( |
| 596 const base::NativeEvent& native_event) { |
| 597 NOTIMPLEMENTED(); |
| 598 } |
| 599 |
| 600 void DesktopRootWindowHostWayland::OnDeviceScaleFactorChanged( |
| 601 float device_scale_factor) { |
| 602 } |
| 603 |
| 604 void DesktopRootWindowHostWayland::PrepareForShutdown() { |
| 605 } |
| 606 |
| 607 #if 0 |
| 608 //////////////////////////////////////////////////////////////////////////////// |
| 609 // DesktopRootWindowHostWayland, ui::DesktopSelectionProviderAuraWayland impleme
ntation: |
| 610 void DesktopRootWindowHostWayland::SetDropHandler( |
| 611 ui::OSExchangeDataProviderAuraWayland* handler) { |
| 612 if (handler) { |
| 613 DCHECK(!drop_handler_); |
| 614 drop_handler_ = handler; |
| 615 } else { |
| 616 DCHECK(drop_handler_); |
| 617 drop_handler_ = NULL; |
| 618 } |
| 619 } |
| 620 #endif |
| 621 //////////////////////////////////////////////////////////////////////////////// |
| 622 // DesktopRootWindowHostWayland, MessageLoop::Dispatcher implementation: |
| 623 |
| 624 bool DesktopRootWindowHostWayland::Dispatch(const base::NativeEvent& event) { |
| 625 NOTIMPLEMENTED(); |
| 626 return false; |
| 627 } |
| 628 |
| 629 //////////////////////////////////////////////////////////////////////////////// |
| 630 // DesktopRootWindowHost, public: |
| 631 |
| 632 // static |
| 633 DesktopRootWindowHost* DesktopRootWindowHost::Create( |
| 634 internal::NativeWidgetDelegate* native_widget_delegate, |
| 635 DesktopNativeWidgetAura* desktop_native_widget_aura, |
| 636 const gfx::Rect& initial_bounds) { |
| 637 return new DesktopRootWindowHostWayland(native_widget_delegate, |
| 638 desktop_native_widget_aura, |
| 639 initial_bounds); |
| 640 } |
| 641 |
| 642 } // namespace views |
OLD | NEW |