summaryrefslogtreecommitdiff
path: root/src/cairo-xlib-display.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cairo-xlib-display.c')
-rw-r--r--src/cairo-xlib-display.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/cairo-xlib-display.c b/src/cairo-xlib-display.c
index 5834cef2..fdb20bf2 100644
--- a/src/cairo-xlib-display.c
+++ b/src/cairo-xlib-display.c
@@ -272,7 +272,7 @@ static const cairo_device_backend_t _cairo_xlib_device_backend = {
* Returns: the device belonging to @dpy
**/
cairo_device_t *
-_cairo_xlib_device_create (Display *dpy)
+cairo_xlib_device_create (Display *dpy)
{
cairo_xlib_display_t *display;
cairo_xlib_display_t **prev;
@@ -451,6 +451,30 @@ UNLOCK:
return device;
}
+/**
+ * cairo_xlib_device_get_display:
+ * @device: The device
+ *
+ * Gets the #Display in use by @device. If the display has been closed
+ * already, %NULL is returned.
+ *
+ * Returns: The #Display in use by the given @device or %NULL.
+ **/
+cairo_public Display *
+cairo_xlib_device_get_display (cairo_device_t *device)
+{
+ cairo_xlib_display_t *display;
+
+ if (device->backend->type != CAIRO_DEVICE_TYPE_XLIB) {
+ _cairo_error_throw (CAIRO_STATUS_DEVICE_TYPE_MISMATCH);
+ return NULL;
+ }
+
+ display = (cairo_xlib_display_t *) device;
+
+ return display->display;
+}
+
void
_cairo_xlib_add_close_display_hook (cairo_xlib_display_t *display,
cairo_xlib_hook_t *hook)