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/aura/root_window_host_linux.h" | 5 #include "ui/aura/root_window_host_linux.h" |
6 | 6 |
7 #include <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
8 #include <X11/Xcursor/Xcursor.h> | 8 #include <X11/Xcursor/Xcursor.h> |
9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
10 #include <X11/cursorfont.h> | 10 #include <X11/cursorfont.h> |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 xwindow_ = XCreateWindow( | 400 xwindow_ = XCreateWindow( |
401 xdisplay_, x_root_window_, | 401 xdisplay_, x_root_window_, |
402 bounds.x(), bounds.y(), bounds.width(), bounds.height(), | 402 bounds.x(), bounds.y(), bounds.width(), bounds.height(), |
403 0, // border width | 403 0, // border width |
404 CopyFromParent, // depth | 404 CopyFromParent, // depth |
405 InputOutput, | 405 InputOutput, |
406 CopyFromParent, // visual | 406 CopyFromParent, // visual |
407 CWBackPixmap, | 407 CWBackPixmap, |
408 &swa); | 408 &swa); |
409 static_cast<DispatcherLinux*>(Env::GetInstance()->GetDispatcher())-> | 409 static_cast<DispatcherLinux*>(Env::GetInstance()->GetDispatcher())-> |
410 WindowDispatcherCreated(xwindow_, this); | 410 AddDispatcherForWindow(this, xwindow_); |
411 | 411 |
412 prop_.reset(new ui::ViewProp(xwindow_, kRootWindowHostLinuxKey, this)); | 412 prop_.reset(new ui::ViewProp(xwindow_, kRootWindowHostLinuxKey, this)); |
413 | 413 |
414 long event_mask = ButtonPressMask | ButtonReleaseMask | FocusChangeMask | | 414 long event_mask = ButtonPressMask | ButtonReleaseMask | FocusChangeMask | |
415 KeyPressMask | KeyReleaseMask | | 415 KeyPressMask | KeyReleaseMask | |
416 EnterWindowMask | LeaveWindowMask | | 416 EnterWindowMask | LeaveWindowMask | |
417 ExposureMask | VisibilityChangeMask | | 417 ExposureMask | VisibilityChangeMask | |
418 StructureNotifyMask | PropertyChangeMask | | 418 StructureNotifyMask | PropertyChangeMask | |
419 PointerMotionMask; | 419 PointerMotionMask; |
420 XSelectInput(xdisplay_, xwindow_, event_mask); | 420 XSelectInput(xdisplay_, xwindow_, event_mask); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 // crbug.com/120229 - set the window title so gtalk can find the primary root | 463 // crbug.com/120229 - set the window title so gtalk can find the primary root |
464 // window to broadcast. | 464 // window to broadcast. |
465 // TODO(jhorwich) Remove this once Chrome supports window-based broadcasting. | 465 // TODO(jhorwich) Remove this once Chrome supports window-based broadcasting. |
466 static int root_window_number = 0; | 466 static int root_window_number = 0; |
467 std::string name = StringPrintf("aura_root_%d", root_window_number++); | 467 std::string name = StringPrintf("aura_root_%d", root_window_number++); |
468 XStoreName(xdisplay_, xwindow_, name.c_str()); | 468 XStoreName(xdisplay_, xwindow_, name.c_str()); |
469 } | 469 } |
470 | 470 |
471 RootWindowHostLinux::~RootWindowHostLinux() { | 471 RootWindowHostLinux::~RootWindowHostLinux() { |
472 static_cast<DispatcherLinux*>(Env::GetInstance()->GetDispatcher())-> | 472 static_cast<DispatcherLinux*>(Env::GetInstance()->GetDispatcher())-> |
473 WindowDispatcherDestroying(xwindow_); | 473 RemoveDispatcherForWindow(xwindow_); |
474 | 474 |
475 UnConfineCursor(); | 475 UnConfineCursor(); |
476 | 476 |
477 XDestroyWindow(xdisplay_, xwindow_); | 477 XDestroyWindow(xdisplay_, xwindow_); |
478 | 478 |
479 // Clears XCursorCache. | 479 // Clears XCursorCache. |
480 ui::GetXCursor(ui::kCursorClearXCursorCache); | 480 ui::GetXCursor(ui::kCursorClearXCursorCache); |
481 | 481 |
482 XFreeCursor(xdisplay_, invisible_cursor_); | 482 XFreeCursor(xdisplay_, invisible_cursor_); |
483 } | 483 } |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 ui::ViewProp::GetValue(accelerated_widget, kRootWindowHostLinuxKey)); | 955 ui::ViewProp::GetValue(accelerated_widget, kRootWindowHostLinuxKey)); |
956 } | 956 } |
957 | 957 |
958 // static | 958 // static |
959 gfx::Size RootWindowHost::GetNativeScreenSize() { | 959 gfx::Size RootWindowHost::GetNativeScreenSize() { |
960 ::Display* xdisplay = base::MessagePumpX::GetDefaultXDisplay(); | 960 ::Display* xdisplay = base::MessagePumpX::GetDefaultXDisplay(); |
961 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); | 961 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); |
962 } | 962 } |
963 | 963 |
964 } // namespace aura | 964 } // namespace aura |
OLD | NEW |