OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_COMMON_X11_UTIL_H_ |
| 6 #define CHROME_COMMON_X11_UTIL_H_ |
| 7 |
| 8 // This file declares utility functions for X11 (Linux only). |
| 9 // |
| 10 // These functions do not require the Xlib headers to be included (which is why |
| 11 // we use a void* for Visual*). The Xlib headers are highly polluting so we try |
| 12 // hard to limit their spread into the rest of the code. |
| 13 |
| 14 typedef struct _GtkWidget GtkWidget; |
| 15 typedef unsigned long XID; |
| 16 typedef struct _XDisplay Display; |
| 17 |
| 18 namespace gfx { |
| 19 class Size; |
| 20 } |
| 21 |
| 22 namespace x11_util { |
| 23 // These functions cache their results and must be called from the UI thread. |
| 24 // Currently they don't support multiple screens/displays. |
| 25 |
| 26 // Return an X11 connection for the current, primary display. |
| 27 Display* GetXDisplay(); |
| 28 // Return true iff the connection supports X shared memory |
| 29 bool QuerySharedMemorySupport(Display* dpy); |
| 30 |
| 31 // These functions do not cache their results |
| 32 |
| 33 // Get the X window id for the given GTK widget. |
| 34 XID GetX11WindowFromGtkWidget(GtkWidget*); |
| 35 // Get a Visual from the given widget. Since we don't include the Xlib |
| 36 // headers, this is returned as a void*. |
| 37 void* GetVisualFromGtkWidget(GtkWidget*); |
| 38 |
| 39 // 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. |
| 41 XID AttachSharedMemory(Display* display, int shared_memory_support); |
| 42 void DetachSharedMemory(Display* display, XID shmseg); |
| 43 |
| 44 // Return a handle to an XRender picture where |pixmap| is a handle to a |
| 45 // pixmap containing Skia ARGB data. |
| 46 XID CreatePictureFromSkiaPixmap(Display* display, XID pixmap); |
| 47 |
| 48 void FreePicture(Display* display, XID picture); |
| 49 void FreePixmap(Display* display, XID pixmap); |
| 50 }; |
| 51 |
| 52 #endif // CHROME_COMMON_X11_UTIL_H_ |
OLD | NEW |