OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file defines utility functions for X11 (Linux only). This code has been | 5 // This file defines utility functions for X11 (Linux only). This code has been |
6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support | 6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support |
7 // remains woefully incomplete. | 7 // remains woefully incomplete. |
8 | 8 |
9 #include "ui/base/x/x11_util.h" | 9 #include "ui/base/x/x11_util.h" |
10 | 10 |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 return EnumerateChildren(delegate, root, max_depth, 0); | 434 return EnumerateChildren(delegate, root, max_depth, 0); |
435 } | 435 } |
436 | 436 |
437 bool GetXWindowStack(Window window, std::vector<XID>* windows) { | 437 bool GetXWindowStack(Window window, std::vector<XID>* windows) { |
438 windows->clear(); | 438 windows->clear(); |
439 | 439 |
440 Atom type; | 440 Atom type; |
441 int format; | 441 int format; |
442 unsigned long count; | 442 unsigned long count; |
443 unsigned char *data = NULL; | 443 unsigned char *data = NULL; |
444 if (!GetProperty(window, | 444 if (GetProperty(window, |
445 "_NET_CLIENT_LIST_STACKING", | 445 "_NET_CLIENT_LIST_STACKING", |
446 ~0L, | 446 ~0L, |
447 &type, | 447 &type, |
448 &format, | 448 &format, |
449 &count, | 449 &count, |
450 &data)) { | 450 &data) != Success) { |
451 return false; | 451 return false; |
452 } | 452 } |
453 | 453 |
454 bool result = false; | 454 bool result = false; |
455 if (type == XA_WINDOW && format == 32 && data && count > 0) { | 455 if (type == XA_WINDOW && format == 32 && data && count > 0) { |
456 result = true; | 456 result = true; |
457 XID* stack = reinterpret_cast<XID*>(data); | 457 XID* stack = reinterpret_cast<XID*>(data); |
458 for (long i = static_cast<long>(count) - 1; i >= 0; i--) | 458 for (long i = static_cast<long>(count) - 1; i >= 0; i--) |
459 windows->push_back(stack[i]); | 459 windows->push_back(stack[i]); |
460 } | 460 } |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 "X Error detected: serial %lu, error_code %u (%s), " | 915 "X Error detected: serial %lu, error_code %u (%s), " |
916 "request_code %u minor_code %u (%s)", | 916 "request_code %u minor_code %u (%s)", |
917 error_event->serial, error_event->error_code, error_str, | 917 error_event->serial, error_event->error_code, error_str, |
918 error_event->request_code, error_event->minor_code, request_str); | 918 error_event->request_code, error_event->minor_code, request_str); |
919 } | 919 } |
920 // ---------------------------------------------------------------------------- | 920 // ---------------------------------------------------------------------------- |
921 // End of x11_util_internal.h | 921 // End of x11_util_internal.h |
922 | 922 |
923 | 923 |
924 } // namespace ui | 924 } // namespace ui |
OLD | NEW |