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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 xwindow_ = XCreateWindow( | 354 xwindow_ = XCreateWindow( |
355 xdisplay_, x_root_window_, | 355 xdisplay_, x_root_window_, |
356 bounds.x(), bounds.y(), bounds.width(), bounds.height(), | 356 bounds.x(), bounds.y(), bounds.width(), bounds.height(), |
357 0, // border width | 357 0, // border width |
358 CopyFromParent, // depth | 358 CopyFromParent, // depth |
359 InputOutput, | 359 InputOutput, |
360 CopyFromParent, // visual | 360 CopyFromParent, // visual |
361 CWBackPixmap, | 361 CWBackPixmap, |
362 &swa); | 362 &swa); |
363 static_cast<DispatcherLinux*>(Env::GetInstance()->GetDispatcher())-> | 363 static_cast<DispatcherLinux*>(Env::GetInstance()->GetDispatcher())-> |
364 WindowDispatcherCreated(xwindow_, this); | 364 RegisterDispatcher(xwindow_, this); |
365 | 365 |
366 prop_.reset(new ui::ViewProp(xwindow_, kRootWindowHostLinuxKey, this)); | 366 prop_.reset(new ui::ViewProp(xwindow_, kRootWindowHostLinuxKey, this)); |
367 | 367 |
368 long event_mask = ButtonPressMask | ButtonReleaseMask | FocusChangeMask | | 368 long event_mask = ButtonPressMask | ButtonReleaseMask | FocusChangeMask | |
369 KeyPressMask | KeyReleaseMask | | 369 KeyPressMask | KeyReleaseMask | |
370 EnterWindowMask | LeaveWindowMask | | 370 EnterWindowMask | LeaveWindowMask | |
371 ExposureMask | VisibilityChangeMask | | 371 ExposureMask | VisibilityChangeMask | |
372 StructureNotifyMask | PropertyChangeMask | | 372 StructureNotifyMask | PropertyChangeMask | |
373 PointerMotionMask; | 373 PointerMotionMask; |
374 XSelectInput(xdisplay_, xwindow_, event_mask); | 374 XSelectInput(xdisplay_, xwindow_, event_mask); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 // crbug.com/120229 - set the window title so gtalk can find the primary root | 417 // crbug.com/120229 - set the window title so gtalk can find the primary root |
418 // window to broadcast. | 418 // window to broadcast. |
419 // TODO(jhorwich) Remove this once Chrome supports window-based broadcasting. | 419 // TODO(jhorwich) Remove this once Chrome supports window-based broadcasting. |
420 static int root_window_number = 0; | 420 static int root_window_number = 0; |
421 std::string name = StringPrintf("aura_root_%d", root_window_number++); | 421 std::string name = StringPrintf("aura_root_%d", root_window_number++); |
422 XStoreName(xdisplay_, xwindow_, name.c_str()); | 422 XStoreName(xdisplay_, xwindow_, name.c_str()); |
423 } | 423 } |
424 | 424 |
425 RootWindowHostLinux::~RootWindowHostLinux() { | 425 RootWindowHostLinux::~RootWindowHostLinux() { |
426 static_cast<DispatcherLinux*>(Env::GetInstance()->GetDispatcher())-> | 426 static_cast<DispatcherLinux*>(Env::GetInstance()->GetDispatcher())-> |
427 WindowDispatcherDestroying(xwindow_); | 427 UnregisterDispatcher(xwindow_); |
428 | 428 |
429 UnConfineCursor(); | 429 UnConfineCursor(); |
430 | 430 |
431 XDestroyWindow(xdisplay_, xwindow_); | 431 XDestroyWindow(xdisplay_, xwindow_); |
432 | 432 |
433 // Clears XCursorCache. | 433 // Clears XCursorCache. |
434 ui::GetXCursor(ui::kCursorClearXCursorCache); | 434 ui::GetXCursor(ui::kCursorClearXCursorCache); |
435 | 435 |
436 XFreeCursor(xdisplay_, invisible_cursor_); | 436 XFreeCursor(xdisplay_, invisible_cursor_); |
437 } | 437 } |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 ui::ViewProp::GetValue(accelerated_widget, kRootWindowHostLinuxKey)); | 904 ui::ViewProp::GetValue(accelerated_widget, kRootWindowHostLinuxKey)); |
905 } | 905 } |
906 | 906 |
907 // static | 907 // static |
908 gfx::Size RootWindowHost::GetNativeScreenSize() { | 908 gfx::Size RootWindowHost::GetNativeScreenSize() { |
909 ::Display* xdisplay = base::MessagePumpX::GetDefaultXDisplay(); | 909 ::Display* xdisplay = base::MessagePumpX::GetDefaultXDisplay(); |
910 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); | 910 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); |
911 } | 911 } |
912 | 912 |
913 } // namespace aura | 913 } // namespace aura |
OLD | NEW |