OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_COMMON_X11_UTIL_H_ | 5 #ifndef CHROME_COMMON_X11_UTIL_H_ |
6 #define CHROME_COMMON_X11_UTIL_H_ | 6 #define CHROME_COMMON_X11_UTIL_H_ |
7 | 7 |
8 // This file declares utility functions for X11 (Linux only). | 8 // This file declares utility functions for X11 (Linux only). |
9 // | 9 // |
10 // These functions do not require the Xlib headers to be included (which is why | 10 // These functions do not require the Xlib headers to be included (which is why |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // Get a Visual from the given widget. Since we don't include the Xlib | 53 // Get a Visual from the given widget. Since we don't include the Xlib |
54 // headers, this is returned as a void*. | 54 // headers, this is returned as a void*. |
55 void* GetVisualFromGtkWidget(GtkWidget* widget); | 55 void* GetVisualFromGtkWidget(GtkWidget* widget); |
56 // Return the number of bits-per-pixel for a pixmap of the given depth | 56 // Return the number of bits-per-pixel for a pixmap of the given depth |
57 int BitsPerPixelForPixmapDepth(Display* display, int depth); | 57 int BitsPerPixelForPixmapDepth(Display* display, int depth); |
58 // Returns true if |window| is visible. | 58 // Returns true if |window| is visible. |
59 bool IsWindowVisible(XID window); | 59 bool IsWindowVisible(XID window); |
60 // Returns the bounds of |window|. | 60 // Returns the bounds of |window|. |
61 bool GetWindowRect(XID window, gfx::Rect* rect); | 61 bool GetWindowRect(XID window, gfx::Rect* rect); |
62 | 62 |
| 63 // Implementers of this interface receive a notification for every X window of |
| 64 // the main display. |
| 65 class EnumerateWindowsDelegate { |
| 66 public: |
| 67 // |xid| is the X Window ID of the enumerated window. Return true to stop |
| 68 // further iteration. |
| 69 virtual bool ShouldStopIterating(XID xid) = 0; |
| 70 }; |
| 71 |
| 72 // Enumerates all windows in the current display |
| 73 bool EnumerateAllWindows(EnumerateWindowsDelegate* delegate); |
| 74 |
63 // Return a handle to a server side pixmap. |shared_memory_key| is a SysV | 75 // Return a handle to a server side pixmap. |shared_memory_key| is a SysV |
64 // IPC key. The shared memory region must contain 32-bit pixels. | 76 // IPC key. The shared memory region must contain 32-bit pixels. |
65 XID AttachSharedMemory(Display* display, int shared_memory_support); | 77 XID AttachSharedMemory(Display* display, int shared_memory_support); |
66 void DetachSharedMemory(Display* display, XID shmseg); | 78 void DetachSharedMemory(Display* display, XID shmseg); |
67 | 79 |
68 // Return a handle to an XRender picture where |pixmap| is a handle to a | 80 // Return a handle to an XRender picture where |pixmap| is a handle to a |
69 // pixmap containing Skia ARGB data. | 81 // pixmap containing Skia ARGB data. |
70 XID CreatePictureFromSkiaPixmap(Display* display, XID pixmap); | 82 XID CreatePictureFromSkiaPixmap(Display* display, XID pixmap); |
71 | 83 |
72 void FreePicture(Display* display, XID picture); | 84 void FreePicture(Display* display, XID picture); |
(...skipping 18 matching lines...) Expand all Loading... |
91 | 103 |
92 // Find the immediate parent of an X window. | 104 // Find the immediate parent of an X window. |
93 // | 105 // |
94 // parent_window: (output) the parent window of |window|, or 0. | 106 // parent_window: (output) the parent window of |window|, or 0. |
95 // parent_is_root: (output) true iff the parent of |window| is the root window. | 107 // parent_is_root: (output) true iff the parent of |window| is the root window. |
96 bool GetWindowParent(XID* parent_window, bool* parent_is_root, XID window); | 108 bool GetWindowParent(XID* parent_window, bool* parent_is_root, XID window); |
97 | 109 |
98 } // namespace x11_util | 110 } // namespace x11_util |
99 | 111 |
100 #endif // CHROME_COMMON_X11_UTIL_H_ | 112 #endif // CHROME_COMMON_X11_UTIL_H_ |
OLD | NEW |