| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/platform_window/x11/x11_window.h" | 5 #include "ui/platform_window/x11/x11_window.h" |
| 6 | 6 |
| 7 #include <X11/extensions/XInput2.h> | 7 #include <X11/extensions/XInput2.h> |
| 8 #include <X11/Xatom.h> | 8 #include <X11/Xatom.h> |
| 9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
| 10 #include <X11/Xutil.h> | 10 #include <X11/Xutil.h> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 NULL | 31 NULL |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 XID FindXEventTarget(XEvent* xevent) { | 34 XID FindXEventTarget(XEvent* xevent) { |
| 35 XID target = xevent->xany.window; | 35 XID target = xevent->xany.window; |
| 36 if (xevent->type == GenericEvent) | 36 if (xevent->type == GenericEvent) |
| 37 target = static_cast<XIDeviceEvent*>(xevent->xcookie.data)->event; | 37 target = static_cast<XIDeviceEvent*>(xevent->xcookie.data)->event; |
| 38 return target; | 38 return target; |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool g_override_redirect = false; |
| 42 |
| 41 } // namespace | 43 } // namespace |
| 42 | 44 |
| 43 X11Window::X11Window(PlatformWindowDelegate* delegate) | 45 X11Window::X11Window(PlatformWindowDelegate* delegate) |
| 44 : delegate_(delegate), | 46 : delegate_(delegate), |
| 45 xdisplay_(gfx::GetXDisplay()), | 47 xdisplay_(gfx::GetXDisplay()), |
| 46 xwindow_(None), | 48 xwindow_(None), |
| 47 xroot_window_(DefaultRootWindow(xdisplay_)), | 49 xroot_window_(DefaultRootWindow(xdisplay_)), |
| 48 atom_cache_(xdisplay_, kAtomsToCache), | 50 atom_cache_(xdisplay_, kAtomsToCache), |
| 49 window_mapped_(false) { | 51 window_mapped_(false) { |
| 50 CHECK(delegate_); | 52 CHECK(delegate_); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 void X11Window::Show() { | 118 void X11Window::Show() { |
| 117 if (window_mapped_) | 119 if (window_mapped_) |
| 118 return; | 120 return; |
| 119 | 121 |
| 120 CHECK(PlatformEventSource::GetInstance()); | 122 CHECK(PlatformEventSource::GetInstance()); |
| 121 PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); | 123 PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); |
| 122 | 124 |
| 123 XSetWindowAttributes swa; | 125 XSetWindowAttributes swa; |
| 124 memset(&swa, 0, sizeof(swa)); | 126 memset(&swa, 0, sizeof(swa)); |
| 125 swa.background_pixmap = None; | 127 swa.background_pixmap = None; |
| 126 swa.override_redirect = False; | 128 swa.override_redirect = g_override_redirect; |
| 127 xwindow_ = XCreateWindow(xdisplay_, | 129 xwindow_ = XCreateWindow(xdisplay_, |
| 128 xroot_window_, | 130 xroot_window_, |
| 129 requested_bounds_.x(), | 131 requested_bounds_.x(), |
| 130 requested_bounds_.y(), | 132 requested_bounds_.y(), |
| 131 requested_bounds_.width(), | 133 requested_bounds_.width(), |
| 132 requested_bounds_.height(), | 134 requested_bounds_.height(), |
| 133 0, // border width | 135 0, // border width |
| 134 CopyFromParent, // depth | 136 CopyFromParent, // depth |
| 135 InputOutput, | 137 InputOutput, |
| 136 CopyFromParent, // visual | 138 CopyFromParent, // visual |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 } | 360 } |
| 359 | 361 |
| 360 case GenericEvent: { | 362 case GenericEvent: { |
| 361 ProcessXInput2Event(xev); | 363 ProcessXInput2Event(xev); |
| 362 break; | 364 break; |
| 363 } | 365 } |
| 364 } | 366 } |
| 365 return POST_DISPATCH_STOP_PROPAGATION; | 367 return POST_DISPATCH_STOP_PROPAGATION; |
| 366 } | 368 } |
| 367 | 369 |
| 370 namespace test { |
| 371 |
| 372 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { |
| 373 g_override_redirect = override_redirect; |
| 374 } |
| 375 |
| 376 } // namespace test |
| 368 } // namespace ui | 377 } // namespace ui |
| OLD | NEW |