summaryrefslogtreecommitdiff
path: root/src/cairo-xlib-private.h
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-04-18 23:20:02 +0200
committerBenjamin Otte <otte@redhat.com>2010-04-18 23:20:02 +0200
commitf74ad37e66bbdcc4d727ed6d931dde870d84c2f4 (patch)
tree0d98ce93eb5e38dcf55e230e40d877c7fe3fbd03 /src/cairo-xlib-private.h
parent2bffa2467ed67517419e425fc34fb5b8294a9e96 (diff)
xlib: Make display a cairo_device_t
The code now uses the locking of the cairo_device_t instead of its own mutexes. The code was modified so that cairo_surface_t does no longer reference the display directly. Instead, it calls _cairo_xlib_display_acquire(). If a function assumes an already acquired display, it now requires the caller to provide a cairo_xlib_display_t parameter. Functions that do not require an acquired display will not require the display parameter or they will take the cairo_device_t instead.
Diffstat (limited to 'src/cairo-xlib-private.h')
-rw-r--r--src/cairo-xlib-private.h66
1 files changed, 39 insertions, 27 deletions
diff --git a/src/cairo-xlib-private.h b/src/cairo-xlib-private.h
index afdf6a6b..550520da 100644
--- a/src/cairo-xlib-private.h
+++ b/src/cairo-xlib-private.h
@@ -41,7 +41,8 @@
#include "cairo-xlib-xrender-private.h"
#include "cairo-compiler-private.h"
-#include "cairo-mutex-private.h"
+#include "cairo-device-private.h"
+#include "cairo-freelist-private.h"
#include "cairo-reference-count-private.h"
#include "cairo-types-private.h"
@@ -63,6 +64,28 @@ struct _cairo_xlib_hook {
/* size of gray ramp */
#define RAMP_SIZE 16
+struct _cairo_xlib_display {
+ cairo_device_t base;
+
+ cairo_xlib_display_t *next;
+
+ Display *display;
+ cairo_xlib_screen_t *screens;
+
+ int render_major;
+ int render_minor;
+ XRenderPictFormat *cached_xrender_formats[CAIRO_FORMAT_RGB16_565 + 1];
+
+ cairo_xlib_job_t *workqueue;
+ cairo_freelist_t wq_freelist;
+
+ cairo_xlib_hook_t *close_display_hooks;
+ unsigned int buggy_gradients :1;
+ unsigned int buggy_pad_reflect :1;
+ unsigned int buggy_repeat :1;
+ unsigned int closed :1;
+};
+
typedef struct _cairo_xlib_visual_info {
VisualID visualid;
struct { uint8_t a, r, g, b; } colors[256];
@@ -75,9 +98,8 @@ typedef struct _cairo_xlib_visual_info {
struct _cairo_xlib_screen {
cairo_xlib_screen_t *next;
cairo_reference_count_t ref_count;
- cairo_mutex_t mutex;
- cairo_xlib_display_t *display;
+ cairo_device_t *device;
Screen *screen;
cairo_bool_t has_render;
@@ -93,21 +115,6 @@ struct _cairo_xlib_screen {
cairo_private cairo_status_t
_cairo_xlib_display_get (Display *display, cairo_xlib_display_t **out);
-cairo_private cairo_xlib_display_t *
-_cairo_xlib_display_reference (cairo_xlib_display_t *info);
-
-cairo_private void
-_cairo_xlib_display_destroy (cairo_xlib_display_t *info);
-
-cairo_private void
-_cairo_xlib_display_lock (cairo_xlib_display_t *display);
-
-cairo_private void
-_cairo_xlib_display_unlock (cairo_xlib_display_t *display);
-
-cairo_private Display *
-_cairo_xlib_display_get_dpy (cairo_xlib_display_t *info);
-
cairo_private void
_cairo_xlib_display_add_screen (cairo_xlib_display_t *display,
cairo_xlib_screen_t *screen);
@@ -136,21 +143,22 @@ cairo_private cairo_status_t
_cairo_xlib_display_queue_resource (cairo_xlib_display_t *display,
cairo_xlib_notify_resource_func notify,
XID resource);
-cairo_private void
-_cairo_xlib_display_notify (cairo_xlib_display_t *display);
+cairo_private cairo_status_t
+_cairo_xlib_display_acquire (cairo_device_t *device,
+ cairo_xlib_display_t **display);
cairo_private void
_cairo_xlib_display_get_xrender_version (cairo_xlib_display_t *display,
int *major, int *minor);
cairo_private cairo_bool_t
-_cairo_xlib_display_has_repeat (cairo_xlib_display_t *display);
+_cairo_xlib_display_has_repeat (cairo_device_t *device);
cairo_private cairo_bool_t
-_cairo_xlib_display_has_reflect (cairo_xlib_display_t *display);
+_cairo_xlib_display_has_reflect (cairo_device_t *device);
cairo_private cairo_bool_t
-_cairo_xlib_display_has_gradients (cairo_xlib_display_t *display);
+_cairo_xlib_display_has_gradients (cairo_device_t *device);
cairo_private XRenderPictFormat *
_cairo_xlib_display_get_xrender_format (cairo_xlib_display_t *display,
@@ -167,15 +175,18 @@ cairo_private void
_cairo_xlib_screen_destroy (cairo_xlib_screen_t *info);
cairo_private void
-_cairo_xlib_screen_close_display (cairo_xlib_screen_t *info);
+_cairo_xlib_screen_close_display (cairo_xlib_display_t *display,
+ cairo_xlib_screen_t *info);
cairo_private GC
-_cairo_xlib_screen_get_gc (cairo_xlib_screen_t *info,
+_cairo_xlib_screen_get_gc (cairo_xlib_display_t *display,
+ cairo_xlib_screen_t *info,
int depth,
Drawable drawable);
cairo_private void
-_cairo_xlib_screen_put_gc (cairo_xlib_screen_t *info,
+_cairo_xlib_screen_put_gc (cairo_xlib_display_t *display,
+ cairo_xlib_screen_t *info,
int depth,
GC gc);
@@ -183,7 +194,8 @@ cairo_private cairo_font_options_t *
_cairo_xlib_screen_get_font_options (cairo_xlib_screen_t *info);
cairo_private cairo_status_t
-_cairo_xlib_screen_get_visual_info (cairo_xlib_screen_t *info,
+_cairo_xlib_screen_get_visual_info (cairo_xlib_display_t *display,
+ cairo_xlib_screen_t *info,
Visual *visual,
cairo_xlib_visual_info_t **out);