e2350967d0
them out as we'll go with the defaults for now. Also, add a patch from GIT to fix a resource leak. Bump rev.
275 lines
6.9 KiB
Text
275 lines
6.9 KiB
Text
--- xcompmgr.c.orig 2005-10-06 20:08:02.000000000 -0400
|
|
+++ xcompmgr.c 2008-02-16 02:10:37.000000000 -0500
|
|
--- xcompmgr.c.orig 2005-10-06 20:08:02.000000000 -0400
|
|
+++ xcompmgr.c
|
|
@@ -36,6 +36,13 @@
|
|
#include <sys/time.h>
|
|
#include <time.h>
|
|
#include <unistd.h>
|
|
+#if defined(HAVE_NBCOMPAT_H)
|
|
+#include <nbcompat/config.h>
|
|
+#include <nbcompat/cdefs.h>
|
|
+#include <nbcompat/getopt.h>
|
|
+#else
|
|
+#include <getopt.h>
|
|
+#endif
|
|
#include <X11/Xlib.h>
|
|
#include <X11/Xutil.h>
|
|
#include <X11/Xatom.h>
|
|
@@ -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",
|