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 12 matching lines...) Expand all Loading... |
23 // These functions cache their results and must be called from the UI thread. | 23 // These functions cache their results and must be called from the UI thread. |
24 // Currently they don't support multiple screens/displays. | 24 // Currently they don't support multiple screens/displays. |
25 | 25 |
26 // Return an X11 connection for the current, primary display. | 26 // Return an X11 connection for the current, primary display. |
27 Display* GetXDisplay(); | 27 Display* GetXDisplay(); |
28 // Return true iff the connection supports X shared memory | 28 // Return true iff the connection supports X shared memory |
29 bool QuerySharedMemorySupport(Display* dpy); | 29 bool QuerySharedMemorySupport(Display* dpy); |
30 | 30 |
31 // These functions do not cache their results | 31 // These functions do not cache their results |
32 | 32 |
| 33 // Get the X window id for the default root window |
| 34 XID GetX11RootWindow(); |
33 // Get the X window id for the given GTK widget. | 35 // Get the X window id for the given GTK widget. |
34 XID GetX11WindowFromGtkWidget(GtkWidget*); | 36 XID GetX11WindowFromGtkWidget(GtkWidget*); |
35 // Get a Visual from the given widget. Since we don't include the Xlib | 37 // Get a Visual from the given widget. Since we don't include the Xlib |
36 // headers, this is returned as a void*. | 38 // headers, this is returned as a void*. |
37 void* GetVisualFromGtkWidget(GtkWidget*); | 39 void* GetVisualFromGtkWidget(GtkWidget*); |
38 | 40 |
39 // Return a handle to a server side pixmap. |shared_memory_key| is a SysV | 41 // Return a handle to a server side pixmap. |shared_memory_key| is a SysV |
40 // IPC key. The shared memory region must contain 32-bit pixels. | 42 // IPC key. The shared memory region must contain 32-bit pixels. |
41 XID AttachSharedMemory(Display* display, int shared_memory_support); | 43 XID AttachSharedMemory(Display* display, int shared_memory_support); |
42 void DetachSharedMemory(Display* display, XID shmseg); | 44 void DetachSharedMemory(Display* display, XID shmseg); |
43 | 45 |
44 // Return a handle to an XRender picture where |pixmap| is a handle to a | 46 // Return a handle to an XRender picture where |pixmap| is a handle to a |
45 // pixmap containing Skia ARGB data. | 47 // pixmap containing Skia ARGB data. |
46 XID CreatePictureFromSkiaPixmap(Display* display, XID pixmap); | 48 XID CreatePictureFromSkiaPixmap(Display* display, XID pixmap); |
47 | 49 |
48 void FreePicture(Display* display, XID picture); | 50 void FreePicture(Display* display, XID picture); |
49 void FreePixmap(Display* display, XID pixmap); | 51 void FreePixmap(Display* display, XID pixmap); |
50 }; | 52 }; |
51 | 53 |
52 #endif // CHROME_COMMON_X11_UTIL_H_ | 54 #endif // CHROME_COMMON_X11_UTIL_H_ |
OLD | NEW |