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 the child windows of |root|. | |
73 bool EnumerateChildWindows(XID root, EnumerateWindowsDelegate* delegate); | |
74 | |
75 // Return a handle to a server side pixmap. |shared_memory_key| is a SysV | 63 // Return a handle to a server side pixmap. |shared_memory_key| is a SysV |
76 // IPC key. The shared memory region must contain 32-bit pixels. | 64 // IPC key. The shared memory region must contain 32-bit pixels. |
77 XID AttachSharedMemory(Display* display, int shared_memory_support); | 65 XID AttachSharedMemory(Display* display, int shared_memory_support); |
78 void DetachSharedMemory(Display* display, XID shmseg); | 66 void DetachSharedMemory(Display* display, XID shmseg); |
79 | 67 |
80 // Return a handle to an XRender picture where |pixmap| is a handle to a | 68 // Return a handle to an XRender picture where |pixmap| is a handle to a |
81 // pixmap containing Skia ARGB data. | 69 // pixmap containing Skia ARGB data. |
82 XID CreatePictureFromSkiaPixmap(Display* display, XID pixmap); | 70 XID CreatePictureFromSkiaPixmap(Display* display, XID pixmap); |
83 | 71 |
84 void FreePicture(Display* display, XID picture); | 72 void FreePicture(Display* display, XID picture); |
(...skipping 18 matching lines...) Expand all Loading... |
103 | 91 |
104 // Find the immediate parent of an X window. | 92 // Find the immediate parent of an X window. |
105 // | 93 // |
106 // parent_window: (output) the parent window of |window|, or 0. | 94 // parent_window: (output) the parent window of |window|, or 0. |
107 // parent_is_root: (output) true iff the parent of |window| is the root window. | 95 // parent_is_root: (output) true iff the parent of |window| is the root window. |
108 bool GetWindowParent(XID* parent_window, bool* parent_is_root, XID window); | 96 bool GetWindowParent(XID* parent_window, bool* parent_is_root, XID window); |
109 | 97 |
110 } // namespace x11_util | 98 } // namespace x11_util |
111 | 99 |
112 #endif // CHROME_COMMON_X11_UTIL_H_ | 100 #endif // CHROME_COMMON_X11_UTIL_H_ |
OLD | NEW |