Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: ui/aura/root_window_host_linux.cc

Issue 10895020: Merge aura::DispatcherLinux into base::MessagePumpAuraX11. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes for sadrul Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/env.cc ('k') | ui/views/widget/x11_desktop_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 #include <X11/extensions/XInput2.h> 11 #include <X11/extensions/XInput2.h>
12 #include <X11/extensions/Xfixes.h> 12 #include <X11/extensions/Xfixes.h>
13 #include <X11/extensions/Xrandr.h> 13 #include <X11/extensions/Xrandr.h>
14 #include <algorithm> 14 #include <algorithm>
15 15
16 #include "base/command_line.h" 16 #include "base/command_line.h"
17 #include "base/message_pump_aurax11.h" 17 #include "base/message_pump_aurax11.h"
18 #include "base/stl_util.h" 18 #include "base/stl_util.h"
19 #include "base/stringprintf.h" 19 #include "base/stringprintf.h"
20 #include "grit/ui_resources.h" 20 #include "grit/ui_resources.h"
21 #include "ui/aura/client/capture_client.h" 21 #include "ui/aura/client/capture_client.h"
22 #include "ui/aura/client/user_action_client.h" 22 #include "ui/aura/client/user_action_client.h"
23 #include "ui/aura/dispatcher_linux.h"
24 #include "ui/aura/env.h" 23 #include "ui/aura/env.h"
25 #include "ui/aura/root_window.h" 24 #include "ui/aura/root_window.h"
26 #include "ui/base/cursor/cursor.h" 25 #include "ui/base/cursor/cursor.h"
27 #include "ui/base/event.h" 26 #include "ui/base/event.h"
28 #include "ui/base/keycodes/keyboard_codes.h" 27 #include "ui/base/keycodes/keyboard_codes.h"
29 #include "ui/base/resource/resource_bundle.h" 28 #include "ui/base/resource/resource_bundle.h"
30 #include "ui/base/touch/touch_factory.h" 29 #include "ui/base/touch/touch_factory.h"
31 #include "ui/base/ui_base_switches.h" 30 #include "ui/base/ui_base_switches.h"
32 #include "ui/base/view_prop.h" 31 #include "ui/base/view_prop.h"
33 #include "ui/base/x/x11_util.h" 32 #include "ui/base/x/x11_util.h"
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 swa.background_pixmap = None; 465 swa.background_pixmap = None;
467 xwindow_ = XCreateWindow( 466 xwindow_ = XCreateWindow(
468 xdisplay_, x_root_window_, 467 xdisplay_, x_root_window_,
469 bounds.x(), bounds.y(), bounds.width(), bounds.height(), 468 bounds.x(), bounds.y(), bounds.width(), bounds.height(),
470 0, // border width 469 0, // border width
471 CopyFromParent, // depth 470 CopyFromParent, // depth
472 InputOutput, 471 InputOutput,
473 CopyFromParent, // visual 472 CopyFromParent, // visual
474 CWBackPixmap, 473 CWBackPixmap,
475 &swa); 474 &swa);
476 static_cast<DispatcherLinux*>(Env::GetInstance()->GetDispatcher())-> 475 base::MessagePumpAuraX11::Current()->AddDispatcherForWindow(this, xwindow_);
477 AddDispatcherForWindow(this, xwindow_);
478 476
479 prop_.reset(new ui::ViewProp(xwindow_, kRootWindowHostLinuxKey, this)); 477 prop_.reset(new ui::ViewProp(xwindow_, kRootWindowHostLinuxKey, this));
480 478
481 long event_mask = ButtonPressMask | ButtonReleaseMask | FocusChangeMask | 479 long event_mask = ButtonPressMask | ButtonReleaseMask | FocusChangeMask |
482 KeyPressMask | KeyReleaseMask | 480 KeyPressMask | KeyReleaseMask |
483 EnterWindowMask | LeaveWindowMask | 481 EnterWindowMask | LeaveWindowMask |
484 ExposureMask | VisibilityChangeMask | 482 ExposureMask | VisibilityChangeMask |
485 StructureNotifyMask | PropertyChangeMask | 483 StructureNotifyMask | PropertyChangeMask |
486 PointerMotionMask; 484 PointerMotionMask;
487 XSelectInput(xdisplay_, xwindow_, event_mask); 485 XSelectInput(xdisplay_, xwindow_, event_mask);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 // window to broadcast. 528 // window to broadcast.
531 // TODO(jhorwich) Remove this once Chrome supports window-based broadcasting. 529 // TODO(jhorwich) Remove this once Chrome supports window-based broadcasting.
532 static int root_window_number = 0; 530 static int root_window_number = 0;
533 std::string name = StringPrintf("aura_root_%d", root_window_number++); 531 std::string name = StringPrintf("aura_root_%d", root_window_number++);
534 XStoreName(xdisplay_, xwindow_, name.c_str()); 532 XStoreName(xdisplay_, xwindow_, name.c_str());
535 XRRSelectInput(xdisplay_, x_root_window_, 533 XRRSelectInput(xdisplay_, x_root_window_,
536 RRScreenChangeNotifyMask | RROutputChangeNotifyMask); 534 RRScreenChangeNotifyMask | RROutputChangeNotifyMask);
537 } 535 }
538 536
539 RootWindowHostLinux::~RootWindowHostLinux() { 537 RootWindowHostLinux::~RootWindowHostLinux() {
540 static_cast<DispatcherLinux*>(Env::GetInstance()->GetDispatcher())-> 538 base::MessagePumpAuraX11::Current()->RemoveDispatcherForWindow(xwindow_);
541 RemoveDispatcherForWindow(xwindow_);
542 539
543 UnConfineCursor(); 540 UnConfineCursor();
544 541
545 XDestroyWindow(xdisplay_, xwindow_); 542 XDestroyWindow(xdisplay_, xwindow_);
546 543
547 // Clears XCursorCache. 544 // Clears XCursorCache.
548 ui::GetXCursor(ui::kCursorClearXCursorCache); 545 ui::GetXCursor(ui::kCursorClearXCursorCache);
549 546
550 XFreeCursor(xdisplay_, invisible_cursor_); 547 XFreeCursor(xdisplay_, invisible_cursor_);
551 } 548 }
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 ui::ViewProp::GetValue(accelerated_widget, kRootWindowHostLinuxKey)); 1064 ui::ViewProp::GetValue(accelerated_widget, kRootWindowHostLinuxKey));
1068 } 1065 }
1069 1066
1070 // static 1067 // static
1071 gfx::Size RootWindowHost::GetNativeScreenSize() { 1068 gfx::Size RootWindowHost::GetNativeScreenSize() {
1072 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay(); 1069 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay();
1073 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); 1070 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0));
1074 } 1071 }
1075 1072
1076 } // namespace aura 1073 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/env.cc ('k') | ui/views/widget/x11_desktop_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698