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/window_tree_host_x11.h" | 5 #include "ui/aura/window_tree_host_x11.h" |
6 | 6 |
7 #include <strings.h> | 7 #include <strings.h> |
8 #include <X11/cursorfont.h> | 8 #include <X11/cursorfont.h> |
9 #include <X11/extensions/XInput2.h> | 9 #include <X11/extensions/XInput2.h> |
10 #include <X11/extensions/Xrandr.h> | 10 #include <X11/extensions/Xrandr.h> |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
25 #include "base/strings/stringprintf.h" | 25 #include "base/strings/stringprintf.h" |
26 #include "base/sys_info.h" | 26 #include "base/sys_info.h" |
27 #include "base/trace_event/trace_event.h" | 27 #include "base/trace_event/trace_event.h" |
28 #include "build/build_config.h" | 28 #include "build/build_config.h" |
29 #include "ui/aura/client/cursor_client.h" | 29 #include "ui/aura/client/cursor_client.h" |
30 #include "ui/aura/env.h" | 30 #include "ui/aura/env.h" |
31 #include "ui/aura/window.h" | 31 #include "ui/aura/window.h" |
32 #include "ui/aura/window_event_dispatcher.h" | 32 #include "ui/aura/window_event_dispatcher.h" |
33 #include "ui/base/cursor/cursor.h" | 33 #include "ui/base/cursor/cursor.h" |
| 34 #include "ui/base/platform_window_defaults.h" |
34 #include "ui/base/ui_base_switches.h" | 35 #include "ui/base/ui_base_switches.h" |
35 #include "ui/base/view_prop.h" | 36 #include "ui/base/view_prop.h" |
36 #include "ui/base/x/x11_util.h" | 37 #include "ui/base/x/x11_util.h" |
37 #include "ui/base/x/x11_window_event_manager.h" | 38 #include "ui/base/x/x11_window_event_manager.h" |
38 #include "ui/compositor/compositor.h" | 39 #include "ui/compositor/compositor.h" |
39 #include "ui/compositor/dip_util.h" | 40 #include "ui/compositor/dip_util.h" |
40 #include "ui/compositor/layer.h" | 41 #include "ui/compositor/layer.h" |
41 #include "ui/display/screen.h" | 42 #include "ui/display/screen.h" |
42 #include "ui/events/devices/x11/device_data_manager_x11.h" | 43 #include "ui/events/devices/x11/device_data_manager_x11.h" |
43 #include "ui/events/devices/x11/device_list_cache_x11.h" | 44 #include "ui/events/devices/x11/device_list_cache_x11.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // |mask| back to 0). | 103 // |mask| back to 0). |
103 // TODO(sad): Figure out why this happens. http://crbug.com/153976 | 104 // TODO(sad): Figure out why this happens. http://crbug.com/153976 |
104 XISetMask(mask, XI_TouchBegin); | 105 XISetMask(mask, XI_TouchBegin); |
105 XISetMask(mask, XI_TouchUpdate); | 106 XISetMask(mask, XI_TouchUpdate); |
106 XISetMask(mask, XI_TouchEnd); | 107 XISetMask(mask, XI_TouchEnd); |
107 XISelectEvents(display, root_window, &evmask, 1); | 108 XISelectEvents(display, root_window, &evmask, 1); |
108 } | 109 } |
109 #endif | 110 #endif |
110 } | 111 } |
111 | 112 |
112 bool default_override_redirect = false; | |
113 | |
114 } // namespace | 113 } // namespace |
115 | 114 |
116 //////////////////////////////////////////////////////////////////////////////// | 115 //////////////////////////////////////////////////////////////////////////////// |
117 // WindowTreeHostX11 | 116 // WindowTreeHostX11 |
118 | 117 |
119 WindowTreeHostX11::WindowTreeHostX11(const gfx::Rect& bounds) | 118 WindowTreeHostX11::WindowTreeHostX11(const gfx::Rect& bounds) |
120 : xdisplay_(gfx::GetXDisplay()), | 119 : xdisplay_(gfx::GetXDisplay()), |
121 xwindow_(0), | 120 xwindow_(0), |
122 x_root_window_(DefaultRootWindow(xdisplay_)), | 121 x_root_window_(DefaultRootWindow(xdisplay_)), |
123 current_cursor_(ui::kCursorNull), | 122 current_cursor_(ui::kCursorNull), |
124 window_mapped_(false), | 123 window_mapped_(false), |
125 bounds_(bounds), | 124 bounds_(bounds), |
126 atom_cache_(xdisplay_, kAtomsToCache) { | 125 atom_cache_(xdisplay_, kAtomsToCache) { |
127 XSetWindowAttributes swa; | 126 XSetWindowAttributes swa; |
128 memset(&swa, 0, sizeof(swa)); | 127 memset(&swa, 0, sizeof(swa)); |
129 swa.background_pixmap = None; | 128 swa.background_pixmap = None; |
130 swa.bit_gravity = NorthWestGravity; | 129 swa.bit_gravity = NorthWestGravity; |
131 swa.override_redirect = default_override_redirect; | 130 swa.override_redirect = ui::UseTestConfigForPlatformWindows(); |
132 xwindow_ = XCreateWindow( | 131 xwindow_ = XCreateWindow( |
133 xdisplay_, x_root_window_, | 132 xdisplay_, x_root_window_, |
134 bounds.x(), bounds.y(), bounds.width(), bounds.height(), | 133 bounds.x(), bounds.y(), bounds.width(), bounds.height(), |
135 0, // border width | 134 0, // border width |
136 CopyFromParent, // depth | 135 CopyFromParent, // depth |
137 InputOutput, | 136 InputOutput, |
138 CopyFromParent, // visual | 137 CopyFromParent, // visual |
139 CWBackPixmap | CWBitGravity | CWOverrideRedirect, | 138 CWBackPixmap | CWBitGravity | CWOverrideRedirect, |
140 &swa); | 139 &swa); |
141 if (ui::PlatformEventSource::GetInstance()) | 140 if (ui::PlatformEventSource::GetInstance()) |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 void WindowTreeHostX11::TranslateAndDispatchLocatedEvent( | 567 void WindowTreeHostX11::TranslateAndDispatchLocatedEvent( |
569 ui::LocatedEvent* event) { | 568 ui::LocatedEvent* event) { |
570 SendEventToProcessor(event); | 569 SendEventToProcessor(event); |
571 } | 570 } |
572 | 571 |
573 // static | 572 // static |
574 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds_in_pixels) { | 573 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds_in_pixels) { |
575 return new WindowTreeHostX11(bounds_in_pixels); | 574 return new WindowTreeHostX11(bounds_in_pixels); |
576 } | 575 } |
577 | 576 |
578 namespace test { | |
579 | |
580 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { | |
581 default_override_redirect = override_redirect; | |
582 } | |
583 | |
584 } // namespace test | |
585 } // namespace aura | 577 } // namespace aura |
OLD | NEW |