int now = get_time_in_milliseconds();
fade *f, *next;
int steps;
+ Bool need_dequeue;
#if 0
printf ("run fades\n");
printf ("opacity now %g\n", f->cur);
#endif
w->opacity = f->cur * OPAQUE;
+ need_dequeue = False;
if (f->step > 0)
{
if (f->cur >= f->finish)
{
w->opacity = f->finish*OPAQUE;
- dequeue_fade (dpy, f);
+ need_dequeue = True;
}
}
else
if (f->cur <= f->finish)
{
w->opacity = f->finish*OPAQUE;
- dequeue_fade (dpy, f);
+ need_dequeue = True;
}
}
determine_mode (dpy, w);
w->shadow = None;
w->extents = win_extents(dpy, w);
}
+ /* Must do this last as it might destroy f->w in callbacks */
+ if (need_dequeue)
+ dequeue_fade (dpy, f);
}
fade_time = now + fade_delta;
}
{
XImage *shadowImage;
Pixmap shadowPixmap;
- Pixmap finalPixmap;
Picture shadowPicture;
- Picture finalPicture;
GC gc;
shadowImage = make_shadow (dpy, opacity, width, height);
/* never painted, ignore it */
if (!w->damaged)
continue;
+ /* if invisible, ignore it */
+ if (w->a.x + w->a.width < 1 || w->a.y + w->a.height < 1
+ || w->a.x >= root_width || w->a.y >= root_height)
+ continue;
if (!w->picture)
{
XRenderPictureAttributes pa;
case CompSimple:
break;
case CompServerShadows:
+ /* dont' bother drawing shadows on desktop windows */
+ if (w->windowType == winDesktopAtom)
+ break;
set_ignore (dpy, NextRequest (dpy));
if (w->opacity != OPAQUE && !w->shadowPict)
w->shadowPict = solid_picture (dpy, True,
w->shadow_width, w->shadow_height);
break;
case CompClientShadows:
- if (w->shadow)
+ /* don't bother drawing shadows on desktop windows */
+ if (w->shadow && w->windowType != winDesktopAtom)
{
XRenderComposite (dpy, PictOpOver, blackPicture, w->shadow, rootBuffer,
0, 0, 0, 0,
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;
/* 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;
{
int mode;
XRenderPictFormat *format;
- unsigned int default_opacity;
/* if trans prop == -1 fall back on previous tests*/
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;
configure_win (Display *dpy, XConfigureEvent *ce)
{
win *w = find_win (dpy, ce->window);
- Window above;
XserverRegion damage = None;
if (!w)
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)
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 */
add_damage (dpy, region);
}
-
+#if DEBUG_EVENTS
static int
ev_serial (XEvent *ev)
{
return NextRequest (ev->xany.display);
}
-
static char *
ev_name (XEvent *ev)
{
return 0;
}
}
+#endif
void
usage (char *program)
{
- fprintf (stderr, "%s v1.0\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");
exit (1);
}
+static 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
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;
fprintf (stderr, "No XFixes extension\n");
exit (1);
}
+
+ register_cm();
+
/* get atoms */
opacityAtom = XInternAtom (dpy, OPACITY_PROP, False);
winTypeAtom = XInternAtom (dpy, "_NET_WM_WINDOW_TYPE", False);
}
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",