head 1.4; access; symbols pkgsrc-2013Q2:1.4.0.18 pkgsrc-2013Q2-base:1.4 pkgsrc-2012Q4:1.4.0.16 pkgsrc-2012Q4-base:1.4 pkgsrc-2011Q4:1.4.0.14 pkgsrc-2011Q4-base:1.4 pkgsrc-2011Q2:1.4.0.12 pkgsrc-2011Q2-base:1.4 pkgsrc-2009Q4:1.4.0.10 pkgsrc-2009Q4-base:1.4 pkgsrc-2008Q4:1.4.0.8 pkgsrc-2008Q4-base:1.4 pkgsrc-2008Q3:1.4.0.6 pkgsrc-2008Q3-base:1.4 cube-native-xorg:1.4.0.4 cube-native-xorg-base:1.4 pkgsrc-2008Q2:1.4.0.2 pkgsrc-2008Q2-base:1.4 pkgsrc-2008Q1:1.3.0.2 pkgsrc-2008Q1-base:1.3 pkgsrc-2007Q4:1.1.0.2 pkgsrc-2007Q4-base:1.1; locks; strict; comment @# @; 1.4 date 2008.04.22.19.40.28; author wiz; state dead; branches; next 1.3; 1.3 date 2008.02.28.11.36.17; author rillig; state Exp; branches; next 1.2; 1.2 date 2008.02.16.07.18.45; author bjs; state Exp; branches; next 1.1; 1.1 date 2007.12.19.05.43.30; author bjs; state Exp; branches; next ; desc @@ 1.4 log @Update to 1.1.4: iAdam Jackson (1): xcompmgr 1.1.4 Dana Jansens (1): Fix a server resource leak on destroying windows. James Cloos (2): Remove deprecated .cvsignore Add *~ to .gitignore to skip patch/emacs droppings Jamey Sharp (1): Bug #13073: Fix broken word-wrapping in ChangeLog generation. Mark Tiefenbruck (1): Bug #9762: Fix opacity changes on unmapped windows. Tilman Sauerbeck (5): Fixed a bunch of warnings. Added .gitignore. Include getopt.h for getopt(). Constified some variables. Make this loop slightly easier to read. @ text @$NetBSD: patch-aa,v 1.3 2008/02/28 11:36:17 rillig Exp $ --- xcompmgr.c.orig 2005-10-06 20:08:02.000000000 -0400 +++ xcompmgr.c 2008-02-16 02:10:37.000000000 -0500 @@@@ -36,6 +36,13 @@@@ #include #include #include +#if defined(HAVE_NBCOMPAT_H) +#include +#include +#include +#else +#include +#endif #include #include #include @@@@ -47,7 +54,9 @@@@ #define HAS_NAME_WINDOW_PIXMAP 1 #endif +#ifndef CAN_DO_USABLE #define CAN_DO_USABLE 0 +#endif typedef struct _ignore { struct _ignore *next; @@@@ -153,12 +162,22 @@@@ conv *gaussianMap; #define TRANS_OPACITY 0.75 +#ifndef DEBUG_REPAINT #define DEBUG_REPAINT 0 +#endif +#ifndef DEBUG_EVENTS #define DEBUG_EVENTS 0 +#endif +#ifndef MONITOR_REPAINT #define MONITOR_REPAINT 0 +#endif +#ifndef SHADOWS #define SHADOWS 1 +#endif +#ifndef SHARP_SHADOW #define SHARP_SHADOW 0 +#endif typedef enum _compMode { CompSimple, /* looks like a regular X server */ @@@@ -320,7 +339,7 @@@@ void run_fades (Display *dpy) { int now = get_time_in_milliseconds(); - fade *f, *next; + fade *next = fades; int steps; Bool need_dequeue; @@@@ -330,8 +349,10 @@@@ run_fades (Display *dpy) if (fade_time - now > 0) return; steps = 1 + (now - fade_time) / fade_delta; - for (next = fades; f = next; ) + + while (next) { + fade *f = next; win *w = f->w; next = f->next; f->cur += f->step * steps; @@@@ -625,9 +646,7 @@@@ shadow_picture (Display *dpy, double opa { XImage *shadowImage; Pixmap shadowPixmap; - Pixmap finalPixmap; Picture shadowPicture; - Picture finalPicture; GC gc; shadowImage = make_shadow (dpy, opacity, width, height); @@@@ -753,7 +772,7 @@@@ find_win (Display *dpy, Window id) return 0; } -static char *backgroundProps[] = { +static const char *backgroundProps[] = { "_XROOTPMAP_ID", "_XSETROOT_ID", 0, @@@@ -1165,11 +1184,13 @@@@ repair_win (Display *dpy, win *w) w->damaged = 1; } +static unsigned int +get_opacity_prop (Display *dpy, win *w, unsigned int def); + static void map_win (Display *dpy, Window id, unsigned long sequence, Bool fade) { win *w = find_win (dpy, id); - Drawable back; if (!w) return; @@@@ -1179,6 +1200,10 @@@@ map_win (Display *dpy, Window id, unsign /* This needs to be here or else we lose transparency messages */ XSelectInput (dpy, id, PropertyChangeMask); + /* This needs to be here since we don't get PropertyNotify when unmapped */ + w->opacity = get_opacity_prop (dpy, w, OPAQUE); + determine_mode (dpy, w); + #if CAN_DO_USABLE w->damage_bounds.x = w->damage_bounds.y = 0; w->damage_bounds.width = w->damage_bounds.height = 0; @@@@ -1332,7 +1357,6 @@@@ determine_mode(Display *dpy, win *w) { int mode; XRenderPictFormat *format; - unsigned int default_opacity; /* if trans prop == -1 fall back on previous tests*/ @@@@ -1467,10 +1491,7 @@@@ add_win (Display *dpy, Window id, Window new->borderClip = None; new->prev_trans = 0; - /* moved mode setting to one place */ - new->opacity = get_opacity_prop (dpy, new, OPAQUE); new->windowType = determine_wintype (dpy, new->id); - determine_mode (dpy, new); new->next = *p; *p = new; @@@@ -1512,7 +1533,6 @@@@ static void configure_win (Display *dpy, XConfigureEvent *ce) { win *w = find_win (dpy, ce->window); - Window above; XserverRegion damage = None; if (!w) @@@@ -1599,7 +1619,7 @@@@ finish_destroy_win (Display *dpy, Window for (prev = &list; (w = *prev); prev = &w->next) if (w->id == id) { - if (!gone) + if (gone) finish_unmap_win (dpy, w); *prev = w->next; if (w->picture) @@@@ -1618,6 +1638,11 @@@@ finish_destroy_win (Display *dpy, Window XRenderFreePicture (dpy, w->shadowPict); w->shadowPict = None; } + if (w->shadow) + { + XRenderFreePicture (dpy, w->shadow); + w->shadow = None; + } if (w->damage != None) { set_ignore (dpy, NextRequest (dpy)); @@@@ -1734,7 +1759,7 @@@@ static int error (Display *dpy, XErrorEvent *ev) { int o; - char *name = 0; + const char *name = 0; if (should_ignore (dpy, ev->serial)) return 0; @@@@ -1766,7 +1791,7 @@@@ error (Display *dpy, XErrorEvent *ev) default: break; } - printf ("error %d request %d minor %d serial %d\n", + printf ("error %d request %d minor %d serial %lu\n", ev->error_code, ev->request_code, ev->minor_code, ev->serial); /* abort (); this is just annoying to most people */ @@@@ -1781,7 +1806,7 @@@@ expose_root (Display *dpy, Window root, add_damage (dpy, region); } - +#if DEBUG_EVENTS static int ev_serial (XEvent *ev) { @@@@ -1790,7 +1815,6 @@@@ ev_serial (XEvent *ev) return NextRequest (ev->xany.display); } - static char * ev_name (XEvent *ev) { @@@@ -1834,11 +1858,12 @@@@ ev_window (XEvent *ev) return 0; } } +#endif void usage (char *program) { - fprintf (stderr, "%s v1.1.2\n", program); + fprintf (stderr, "%s v1.1.3\n", program); fprintf (stderr, "usage: %s [options]\n", program); fprintf (stderr, "Options\n"); fprintf (stderr, " -d display\n Specifies which display should be managed.\n"); @@@@ -1861,15 +1886,21 @@@@ usage (char *program) } static void -give_me_a_name (void) +register_cm (void) { Window w; + Atom a; w = XCreateSimpleWindow (dpy, RootWindow (dpy, 0), 0, 0, 1, 1, 0, None, None); Xutf8SetWMProperties (dpy, w, "xcompmgr", "xcompmgr", NULL, 0, NULL, NULL, NULL); + + /* FIXME: Don't hard code the screen number */ + a = XInternAtom (dpy, "_NET_WM_CM_S0", False); + + XSetSelectionOwner (dpy, a, w, 0); } int @@@@ -1878,19 +1909,13 @@@@ main (int argc, char **argv) XEvent ev; Window root_return, parent_return; Window *children; - Pixmap transPixmap; - Pixmap blackPixmap; unsigned int nchildren; int i; XRenderPictureAttributes pa; - XRenderColor c; XRectangle *expose_rects = 0; int size_expose = 0; int n_expose = 0; struct pollfd ufd; - int n; - int last_update; - int now; int p; int composite_major, composite_minor; char *display = 0; @@@@ -1999,7 +2024,7 @@@@ main (int argc, char **argv) exit (1); } - give_me_a_name(); + register_cm(); /* get atoms */ opacityAtom = XInternAtom (dpy, OPACITY_PROP, False); @@@@ -2071,7 +2096,7 @@@@ main (int argc, char **argv) } XNextEvent (dpy, &ev); - if (ev.type & 0x7f != KeymapNotify) + if ((ev.type & 0x7f) != KeymapNotify) discard_ignore (dpy, ev.xany.serial); #if DEBUG_EVENTS printf ("event %10.10s serial 0x%08x window 0x%08x\n", @ 1.3 log @Fixed pkglint warnings. @ text @d1 1 a1 1 $NetBSD$ @ 1.2 log @ Correct XCOMPMGR_DEFS defines in Makefile to reflect reality, and comment them out as we'll go with the defaults for now. Also, add a patch from GIT to fix a resource leak. Bump rev. @ text @d1 2 a4 2 --- xcompmgr.c.orig 2005-10-06 20:08:02.000000000 -0400 +++ xcompmgr.c @ 1.1 log @ Add some fixes from GIT and bump revision. Tested with xorg-server-1.4.0.90 + Mesa-7.0.2 by me. Mesa's coming, I promise. ;) While here, PKG_SKIP_REASON -> PKG_FAIL_REASON, add various preprocessor definitions to XCOMPMGR_DEFS for the user to play with (sane defaults have been tested). Changes include: Constified some variables. Include getopt.h for getopt(). (in pkgsrc, this uses USE_FEATURES) Fixed a bunch of warnings. Bug #9762: Fix opacity changes on unmapped windows. @ text @d1 2 a2 2 $NetBSD$ d69 1 a69 1 + fade *f = next; d150 1 a150 1 + if (gone) d154 13 a166 1 @@@@ -1734,7 +1754,7 @@@@ static int d175 1 a175 1 @@@@ -1766,7 +1786,7 @@@@ error (Display *dpy, XErrorEvent *ev) d184 1 a184 1 @@@@ -1781,7 +1801,7 @@@@ expose_root (Display *dpy, Window root, d193 1 a193 1 @@@@ -1790,7 +1810,6 @@@@ ev_serial (XEvent *ev) d201 1 a201 1 @@@@ -1834,11 +1853,12 @@@@ ev_window (XEvent *ev) d215 1 a215 1 @@@@ -1861,15 +1881,21 @@@@ usage (char *program) d238 1 a238 1 @@@@ -1878,19 +1904,13 @@@@ main (int argc, char **argv) d258 1 a258 1 @@@@ -1999,7 +2019,7 @@@@ main (int argc, char **argv) d267 1 a267 1 @@@@ -2071,7 +2091,7 @@@@ main (int argc, char **argv) d272 1 a272 1 + if ((ev.type & 0x7f) != KeymapNotify) @