| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 XSetWMProtocols(xdisplay_, xwindow_, protocols, 2); | 166 XSetWMProtocols(xdisplay_, xwindow_, protocols, 2); |
| 167 | 167 |
| 168 // We need a WM_CLIENT_MACHINE and WM_LOCALE_NAME value so we integrate with | 168 // We need a WM_CLIENT_MACHINE and WM_LOCALE_NAME value so we integrate with |
| 169 // the desktop environment. | 169 // the desktop environment. |
| 170 XSetWMProperties( | 170 XSetWMProperties( |
| 171 xdisplay_, xwindow_, NULL, NULL, NULL, 0, NULL, NULL, NULL); | 171 xdisplay_, xwindow_, NULL, NULL, NULL, 0, NULL, NULL, NULL); |
| 172 | 172 |
| 173 // Likewise, the X server needs to know this window's pid so it knows which | 173 // Likewise, the X server needs to know this window's pid so it knows which |
| 174 // program to kill if the window hangs. | 174 // program to kill if the window hangs. |
| 175 // XChangeProperty() expects "pid" to be long. | 175 // XChangeProperty() expects "pid" to be long. |
| 176 COMPILE_ASSERT(sizeof(long) >= sizeof(pid_t), pid_t_bigger_than_long); | 176 static_assert(sizeof(long) >= sizeof(pid_t), |
| 177 "pid_t should not be larger than long"); |
| 177 long pid = getpid(); | 178 long pid = getpid(); |
| 178 XChangeProperty(xdisplay_, | 179 XChangeProperty(xdisplay_, |
| 179 xwindow_, | 180 xwindow_, |
| 180 atom_cache_.GetAtom("_NET_WM_PID"), | 181 atom_cache_.GetAtom("_NET_WM_PID"), |
| 181 XA_CARDINAL, | 182 XA_CARDINAL, |
| 182 32, | 183 32, |
| 183 PropModeReplace, | 184 PropModeReplace, |
| 184 reinterpret_cast<unsigned char*>(&pid), | 185 reinterpret_cast<unsigned char*>(&pid), |
| 185 1); | 186 1); |
| 186 // Before we map the window, set size hints. Otherwise, some window managers | 187 // Before we map the window, set size hints. Otherwise, some window managers |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 | 352 |
| 352 case GenericEvent: { | 353 case GenericEvent: { |
| 353 ProcessXInput2Event(xev); | 354 ProcessXInput2Event(xev); |
| 354 break; | 355 break; |
| 355 } | 356 } |
| 356 } | 357 } |
| 357 return POST_DISPATCH_STOP_PROPAGATION; | 358 return POST_DISPATCH_STOP_PROPAGATION; |
| 358 } | 359 } |
| 359 | 360 |
| 360 } // namespace ui | 361 } // namespace ui |
| OLD | NEW |