| 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 // 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 |
| 11 #include <ctype.h> | 11 #include <ctype.h> |
| 12 #include <sys/ipc.h> | 12 #include <sys/ipc.h> |
| 13 #include <sys/shm.h> | 13 #include <sys/shm.h> |
| 14 | 14 |
| 15 #include <list> | 15 #include <list> |
| 16 #include <map> | 16 #include <map> |
| 17 #include <utility> | 17 #include <utility> |
| 18 #include <vector> | 18 #include <vector> |
| 19 | 19 |
| 20 #include <X11/extensions/shape.h> | 20 #include <X11/extensions/shape.h> |
| 21 #include <X11/extensions/XInput2.h> | 21 #include <X11/extensions/XInput2.h> |
| 22 #include <X11/Xcursor/Xcursor.h> | 22 #include <X11/Xcursor/Xcursor.h> |
| 23 | 23 |
| 24 #include "base/bind.h" | 24 #include "base/bind.h" |
| 25 #include "base/logging.h" | 25 #include "base/logging.h" |
| 26 #include "base/memory/scoped_ptr.h" | 26 #include "base/memory/scoped_ptr.h" |
| 27 #include "base/memory/singleton.h" | 27 #include "base/memory/singleton.h" |
| 28 #include "base/message_loop/message_loop.h" | 28 #include "base/message_loop/message_loop.h" |
| 29 #include "base/metrics/histogram.h" | 29 #include "base/metrics/histogram.h" |
| 30 #include "base/stl_util.h" |
| 30 #include "base/strings/string_number_conversions.h" | 31 #include "base/strings/string_number_conversions.h" |
| 31 #include "base/strings/string_util.h" | 32 #include "base/strings/string_util.h" |
| 32 #include "base/strings/stringprintf.h" | 33 #include "base/strings/stringprintf.h" |
| 33 #include "base/sys_byteorder.h" | 34 #include "base/sys_byteorder.h" |
| 34 #include "base/threading/thread.h" | 35 #include "base/threading/thread.h" |
| 35 #include "base/trace_event/trace_event.h" | 36 #include "base/trace_event/trace_event.h" |
| 36 #include "skia/ext/image_operations.h" | 37 #include "skia/ext/image_operations.h" |
| 37 #include "third_party/skia/include/core/SkBitmap.h" | 38 #include "third_party/skia/include/core/SkBitmap.h" |
| 38 #include "third_party/skia/include/core/SkPostConfig.h" | 39 #include "third_party/skia/include/core/SkPostConfig.h" |
| 39 #include "ui/base/x/x11_menu_list.h" | 40 #include "ui/base/x/x11_menu_list.h" |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 XWindowAttributes win_attributes; | 552 XWindowAttributes win_attributes; |
| 552 if (!XGetWindowAttributes(gfx::GetXDisplay(), window, &win_attributes)) | 553 if (!XGetWindowAttributes(gfx::GetXDisplay(), window, &win_attributes)) |
| 553 return false; | 554 return false; |
| 554 if (win_attributes.map_state != IsViewable) | 555 if (win_attributes.map_state != IsViewable) |
| 555 return false; | 556 return false; |
| 556 | 557 |
| 557 // Minimized windows are not visible. | 558 // Minimized windows are not visible. |
| 558 std::vector<XAtom> wm_states; | 559 std::vector<XAtom> wm_states; |
| 559 if (GetAtomArrayProperty(window, "_NET_WM_STATE", &wm_states)) { | 560 if (GetAtomArrayProperty(window, "_NET_WM_STATE", &wm_states)) { |
| 560 XAtom hidden_atom = GetAtom("_NET_WM_STATE_HIDDEN"); | 561 XAtom hidden_atom = GetAtom("_NET_WM_STATE_HIDDEN"); |
| 561 if (std::find(wm_states.begin(), wm_states.end(), hidden_atom) != | 562 if (ContainsValue(wm_states, hidden_atom)) |
| 562 wm_states.end()) { | |
| 563 return false; | 563 return false; |
| 564 } | |
| 565 } | 564 } |
| 566 | 565 |
| 567 // Some compositing window managers (notably kwin) do not actually unmap | 566 // Some compositing window managers (notably kwin) do not actually unmap |
| 568 // windows on desktop switch, so we also must check the current desktop. | 567 // windows on desktop switch, so we also must check the current desktop. |
| 569 int window_desktop, current_desktop; | 568 int window_desktop, current_desktop; |
| 570 return (!GetWindowDesktop(window, &window_desktop) || | 569 return (!GetWindowDesktop(window, &window_desktop) || |
| 571 !GetCurrentDesktop(¤t_desktop) || | 570 !GetCurrentDesktop(¤t_desktop) || |
| 572 window_desktop == kAllDesktops || | 571 window_desktop == kAllDesktops || |
| 573 window_desktop == current_desktop); | 572 window_desktop == current_desktop); |
| 574 } | 573 } |
| (...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 if (depth) | 1469 if (depth) |
| 1471 *depth = s_depth; | 1470 *depth = s_depth; |
| 1472 } | 1471 } |
| 1473 #endif | 1472 #endif |
| 1474 | 1473 |
| 1475 // ---------------------------------------------------------------------------- | 1474 // ---------------------------------------------------------------------------- |
| 1476 // End of x11_util_internal.h | 1475 // End of x11_util_internal.h |
| 1477 | 1476 |
| 1478 | 1477 |
| 1479 } // namespace ui | 1478 } // namespace ui |
| OLD | NEW |