diff options
author | Keith Packard <keithp@neko.keithp.com> | 2007-02-08 00:50:41 -0800 |
---|---|---|
committer | Keith Packard <keithp@neko.keithp.com> | 2007-02-08 00:50:41 -0800 |
commit | b54d8d406e8dc3d062ec18efb155d136401d4717 (patch) | |
tree | d8181f8e089e682a5f5f5ca6b5b647ed2de7e751 | |
parent | 7c3bd23a9276882ed2ef83a293ac1796a6a374fe (diff) |
-rw-r--r-- | Makefile.am | 14 | ||||
-rw-r--r-- | lightpipe.c | 2 | ||||
-rw-r--r-- | lightpipe.h | 21 | ||||
-rw-r--r-- | lpapi.c | 6 | ||||
-rw-r--r-- | lpdamage.c | 18 | ||||
-rw-r--r-- | lpinit.c | 10 | ||||
-rw-r--r-- | lpint.h | 2 | ||||
-rw-r--r-- | lptable.c | 8 |
8 files changed, 70 insertions, 11 deletions
diff --git a/Makefile.am b/Makefile.am index 77b0a2d..69adcbc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ # # $Id$ # -# Copyright © 2004 @AUTHORS@ +# Copyright © 2004 Keith Packard # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that @@ -44,7 +44,19 @@ liblightpipe_la_SOURCES = \ lpint.h \ lptable.c +# +# Library version info. Check the libtool docs for +# instructions on when and how to change this value +# +# bump when the ABI changes +LIGHTPIPE_CURRENT=1 +# bump for non-ABI changes, reset to zero when CURRENT changes +LIGHTPIPE_REVISION=0 +# bump when the ABI changes in backward-compatible fashion +LIGHTPIPE_AGE=0 + liblightpipe_la_LIBADD = $(LIGHTPIPE_LIBS) +liblightpipe_la_LDFLAGS = -version-info ${LIGHTPIPE_CURRENT}:${LIGHTPIPE_REVISION}:${LIGHTPIPE_AGE} -no-undefined liblightpipeincludedir = $(includedir)/X11/extensions liblightpipeinclude_HEADERS = lightpipe.h diff --git a/lightpipe.c b/lightpipe.c index d7ad270..8215e3b 100644 --- a/lightpipe.c +++ b/lightpipe.c @@ -64,7 +64,7 @@ main (int argc, char **argv) else window = strtol (argv[2], 0, 0); XLightPipeInit (); - XLightPipeAttendWindow (display, window); + XLightPipeAttendWindow (display, window, False); for (;;) { if (new && XPending (new_display)) diff --git a/lightpipe.h b/lightpipe.h index de12b42..8ea4095 100644 --- a/lightpipe.h +++ b/lightpipe.h @@ -23,12 +23,29 @@ */ #include <X11/Xlib.h> +#include <X11/Xutil.h> + +/* + * This definition comes from region.h which is not installed by + * the monolithic Xlib build system + */ +typedef struct { + short x1, x2, y1, y2; +} Box, BOX, BoxRec, *BoxPtr; + +typedef struct _XRegion { + long size; + long numRects; + BOX *rects; + BOX extents; +} REGION; typedef struct { XRectangle geometry; /* in screen space, read-only */ int border_width; /* read-only */ XRectangle damage; /* in window space, client may modify */ XImage *image; /* read-only */ + Region damage_region; /* in window space, client may modify */ } XLightPipeWindow; /* @@ -43,7 +60,7 @@ XLightPipeInit (void); */ Bool -XLightPipeAttendWindow (Display *display, Window window); +XLightPipeAttendWindow (Display *display, Window window, Bool provide_region); /* * Start monitoring all sub windows; create/destroy handled @@ -51,7 +68,7 @@ XLightPipeAttendWindow (Display *display, Window window); */ Bool -XLightPipeAttendSubwindows (Display *display, Window window); +XLightPipeAttendSubwindows (Display *display, Window window, Bool provide_region); /* * Stop monitoring window. Note that monitoring is automatically @@ -38,9 +38,9 @@ XLightPipeInit (void) */ Bool -XLightPipeAttendWindow (Display *display, Window window) +XLightPipeAttendWindow (Display *display, Window window, Bool provide_region) { - return _xlightpipe_add_window (display, window) ? True : False; + return _xlightpipe_add_window (display, window, provide_region) ? True : False; } /* @@ -49,7 +49,7 @@ XLightPipeAttendWindow (Display *display, Window window) */ Bool -XLightPipeAttendSubwindows (Display *display, Window window) +XLightPipeAttendSubwindows (Display *display, Window window, Bool provide_region) { return False; } @@ -84,6 +84,17 @@ _xlightpipe_damage_window (light_pipe_window *lpw, int x, int y, int width, int old_y2 = new_y2; lpw->public.damage.height = old_y2 - lpw->public.damage.y; } + if (lpw->public.damage_region) + { + XRectangle r; + + r.x = x; + r.y = y; + r.width = width; + r.height = height; + XUnionRectWithRegion (&r, lpw->public.damage_region, + lpw->public.damage_region); + } } void @@ -114,6 +125,13 @@ _xlightpipe_undamage_window (light_pipe_window *lpw) remove_damage (lpw); lpw->public.damage.x = lpw->public.damage.y = 0; lpw->public.damage.width = lpw->public.damage.height = 0; + if (lpw->public.damage_region) + { + Region empty = XCreateRegion (); + XIntersectRegion (lpw->public.damage_region, empty, + lpw->public.damage_region); + XDestroyRegion (empty); + } } light_pipe_window * @@ -40,6 +40,7 @@ _xlightpipe_init_window (Display *display, Window window, light_pipe_window *lpw { XWindowAttributes attr; light_pipe_display *lpd = _xlightpipe_find_display (display); + int level; if (!lpd) return False; @@ -68,7 +69,11 @@ _xlightpipe_init_window (Display *display, Window window, light_pipe_window *lpw lpw->visual = attr.visual; lpw->depth = attr.depth; - lpw->damage = XDamageCreate (display, window, XDamageReportBoundingBox); + if (lpw->public.damage_region) + level = XDamageReportDeltaRectangles; + else + level = XDamageReportBoundingBox; + lpw->damage = XDamageCreate (display, window, level); lpw->repair = XFixesCreateRegion (display, 0, 0); @@ -96,7 +101,8 @@ _xlightpipe_fini_window (Display *display, Window window, light_pipe_window *lpw { XSelectInput (display, window, 0); _xlightpipe_undamage_window (lpw); - XCompositeUnredirectWindow (display, window, CompositeRedirectAutomatic); + if (!is_root (display, window)) + XCompositeUnredirectWindow (display, window, CompositeRedirectAutomatic); XDamageDestroy (display, lpw->damage); _xlightpipe_destroy_window_image (lpw); } @@ -102,7 +102,7 @@ light_pipe_window * _xlightpipe_find_window (Display *display, Window window); light_pipe_window * -_xlightpipe_add_window (Display *display, Window window); +_xlightpipe_add_window (Display *display, Window window, Bool provide_region); void _xlightpipe_remove_window (Display *display, Window window); @@ -45,7 +45,7 @@ _xlightpipe_find_window (Display *display, Window window) } light_pipe_window * -_xlightpipe_add_window (Display *display, Window window) +_xlightpipe_add_window (Display *display, Window window, Bool provide_region) { light_pipe_window *lpw; @@ -59,6 +59,10 @@ _xlightpipe_add_window (Display *display, Window window) free (lpw); return 0; } + if (provide_region) + lpw->public.damage_region = XCreateRegion (); + else + lpw->public.damage_region = NULL; if (!_xlightpipe_init_window (display, window, lpw)) { XDeleteContext (display, window, _xlightpipe_lp_context()); @@ -77,5 +81,7 @@ _xlightpipe_remove_window (Display *display, Window window) return; (void) XDeleteContext (display, window, _xlightpipe_lp_context ()); _xlightpipe_fini_window (display, window, lpw); + if (lpw->public.damage_region) + XDestroyRegion (lpw->public.damage_region); free (lpw); } |