2004-12-28 15:46:49 -08:00
|
|
|
/*
|
2006-01-06 23:20:58 -08:00
|
|
|
* Copyright (C) 2004-2006 Kim Woelders
|
2004-12-28 15:46:49 -08:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to
|
|
|
|
* deal in the Software without restriction, including without limitation the
|
|
|
|
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
|
* sell copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies of the Software, its documentation and marketing & publicity
|
|
|
|
* materials, and acknowledgment shall be given in the documentation, materials
|
|
|
|
* and software packages that this Software was used.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
|
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
/*
|
2005-04-22 00:10:18 -07:00
|
|
|
* This code was originally derived from xcompmgr.c, see original copyright
|
|
|
|
* notice at end.
|
|
|
|
* It has been mostly rewritten since, only the shadow code is more or less
|
|
|
|
* intact.
|
2004-12-28 15:46:49 -08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "E.h"
|
|
|
|
#if USE_COMPOSITE
|
2005-09-04 00:27:20 -07:00
|
|
|
#include "desktops.h"
|
2004-12-28 15:46:49 -08:00
|
|
|
#include "ecompmgr.h"
|
2005-07-16 09:57:45 -07:00
|
|
|
#include "emodule.h"
|
2005-09-17 23:35:38 -07:00
|
|
|
#include "eobj.h"
|
2005-07-16 09:57:45 -07:00
|
|
|
#include "xwin.h"
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/Xutil.h>
|
|
|
|
#include <X11/extensions/Xcomposite.h>
|
|
|
|
#include <X11/extensions/Xdamage.h>
|
|
|
|
#include <X11/extensions/Xrender.h>
|
|
|
|
|
2006-01-14 06:30:51 -08:00
|
|
|
#define ENABLE_SHADOWS 1
|
|
|
|
|
|
|
|
#define USE_DESK_EXPOSE 0
|
|
|
|
#define USE_DESK_VISIBILITY 1
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2006-03-12 11:20:22 -08:00
|
|
|
#define USE_CLIP_RELATIVE_TO_DESK 1
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
#define ENABLE_DEBUG 1
|
|
|
|
#if ENABLE_DEBUG
|
|
|
|
#define EDBUG_TYPE_COMPMGR 161
|
|
|
|
#define EDBUG_TYPE_COMPMGR2 162
|
|
|
|
#define EDBUG_TYPE_COMPMGR3 163
|
2005-04-20 15:49:16 -07:00
|
|
|
#define EDBUG_TYPE_COMPMGR4 164
|
2004-12-28 15:46:49 -08:00
|
|
|
#define D1printf(fmt...) if(EventDebug(EDBUG_TYPE_COMPMGR))Eprintf(fmt)
|
|
|
|
#define D2printf(fmt...) if(EventDebug(EDBUG_TYPE_COMPMGR2))Eprintf(fmt)
|
2005-04-20 15:49:16 -07:00
|
|
|
#define D3printf(fmt...) if(EventDebug(EDBUG_TYPE_COMPMGR3))Eprintf(fmt)
|
|
|
|
#define D4printf(fmt...) if(EventDebug(EDBUG_TYPE_COMPMGR4))Eprintf(fmt)
|
2004-12-28 15:46:49 -08:00
|
|
|
#else
|
|
|
|
#define D1printf(fmt...)
|
|
|
|
#define D2printf(fmt...)
|
|
|
|
#endif /* ENABLE_DEBUG */
|
|
|
|
|
2005-09-17 11:55:17 -07:00
|
|
|
#define DEBUG_OPACITY 0
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
#define INV_POS 0x01
|
|
|
|
#define INV_SIZE 0x02
|
2005-09-30 11:56:45 -07:00
|
|
|
#define INV_CLIP 0x04
|
|
|
|
#define INV_OPACITY 0x08
|
|
|
|
#define INV_SHADOW 0x10
|
|
|
|
#define INV_PIXMAP 0x20
|
|
|
|
#define INV_PICTURE 0x40
|
2004-12-28 15:46:49 -08:00
|
|
|
#define INV_GEOM (INV_POS | INV_SIZE)
|
2005-09-30 11:56:45 -07:00
|
|
|
#define INV_ALL (INV_POS | INV_SIZE | INV_CLIP | INV_OPACITY | INV_SHADOW | INV_PIXMAP)
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-03-30 14:51:02 -08:00
|
|
|
typedef struct
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-01-11 14:58:39 -08:00
|
|
|
EObj *next; /* Paint order */
|
|
|
|
EObj *prev; /* Paint order */
|
2004-12-28 15:46:49 -08:00
|
|
|
Pixmap pixmap;
|
2005-05-01 15:26:03 -07:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
int depth; /* FIXME - Remove? */
|
|
|
|
Visual *visual; /* FIXME - Remove? */
|
|
|
|
int border_width;
|
|
|
|
} a;
|
2004-12-28 15:46:49 -08:00
|
|
|
int rcx, rcy, rcw, rch;
|
|
|
|
int mode;
|
2005-09-11 03:39:16 -07:00
|
|
|
unsigned damaged:1;
|
|
|
|
unsigned fading:1;
|
2005-09-17 11:55:17 -07:00
|
|
|
unsigned fadeout:1;
|
2004-12-28 15:46:49 -08:00
|
|
|
Damage damage;
|
|
|
|
Picture picture;
|
2006-03-04 05:56:18 -08:00
|
|
|
Picture pict_alpha; /* Solid, current opacity */
|
2005-09-30 11:56:45 -07:00
|
|
|
XserverRegion shape;
|
2004-12-28 15:46:49 -08:00
|
|
|
XserverRegion extents;
|
2005-01-11 14:58:39 -08:00
|
|
|
XserverRegion clip;
|
2004-12-28 15:46:49 -08:00
|
|
|
#if ENABLE_SHADOWS
|
2006-03-04 05:56:18 -08:00
|
|
|
Picture shadow_alpha; /* Solid, sharp * current opacity */
|
|
|
|
Picture shadow_pict; /* Blurred shaped shadow */
|
2004-12-28 15:46:49 -08:00
|
|
|
int shadow_dx;
|
|
|
|
int shadow_dy;
|
|
|
|
int shadow_width;
|
|
|
|
int shadow_height;
|
|
|
|
#endif
|
|
|
|
unsigned int opacity;
|
|
|
|
|
|
|
|
unsigned long damage_sequence; /* sequence when damage was created */
|
2005-03-30 14:51:02 -08:00
|
|
|
} ECmWinInfo;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Configuration
|
|
|
|
*/
|
2004-12-28 15:46:49 -08:00
|
|
|
#if ENABLE_SHADOWS
|
|
|
|
#define ECM_SHADOWS_OFF 0
|
|
|
|
#define ECM_SHADOWS_SHARP 1 /* use window alpha for shadow; sharp, but precise */
|
2006-03-08 12:10:27 -08:00
|
|
|
#define ECM_SHADOWS_ECHO 3 /* use window for shadow; sharp, but precise */
|
2004-12-28 15:46:49 -08:00
|
|
|
#define ECM_SHADOWS_BLURRED 2 /* use window extents for shadow, blurred */
|
|
|
|
#endif
|
|
|
|
|
2006-03-13 14:46:14 -08:00
|
|
|
#define ECM_OR_UNREDIRECTED 0
|
2005-08-07 03:51:07 -07:00
|
|
|
#define ECM_OR_ON_MAP 1
|
|
|
|
#define ECM_OR_ON_MAPUNMAP 2
|
|
|
|
#define ECM_OR_ON_CREATE 3
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
static struct
|
|
|
|
{
|
|
|
|
char enable;
|
|
|
|
char resize_fix_enable;
|
2005-02-06 04:54:09 -08:00
|
|
|
char use_name_pixmap;
|
2004-12-28 15:46:49 -08:00
|
|
|
int mode;
|
2005-08-07 03:51:07 -07:00
|
|
|
struct
|
|
|
|
{
|
2005-09-06 15:36:26 -07:00
|
|
|
int mode;
|
2006-01-12 13:37:33 -08:00
|
|
|
int offset_x, offset_y;
|
2005-09-06 15:36:26 -07:00
|
|
|
struct
|
|
|
|
{
|
2006-04-02 01:45:40 -08:00
|
|
|
int opacity;
|
2005-09-06 15:36:26 -07:00
|
|
|
int radius;
|
|
|
|
} blur;
|
2006-03-04 05:56:18 -08:00
|
|
|
struct
|
|
|
|
{
|
2006-04-02 01:45:40 -08:00
|
|
|
int opacity;
|
2006-03-04 05:56:18 -08:00
|
|
|
} sharp;
|
2005-09-06 15:36:26 -07:00
|
|
|
} shadows;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
char enable;
|
2005-09-04 14:17:32 -07:00
|
|
|
int dt_us; /* us between updates */
|
|
|
|
unsigned int step;
|
|
|
|
} fading;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
int mode;
|
2006-04-02 01:45:40 -08:00
|
|
|
int opacity;
|
2005-08-07 03:51:07 -07:00
|
|
|
} override_redirect;
|
2004-12-28 15:46:49 -08:00
|
|
|
} Conf_compmgr;
|
|
|
|
|
2005-03-30 14:51:02 -08:00
|
|
|
/*
|
|
|
|
* State
|
|
|
|
*/
|
2004-12-28 15:46:49 -08:00
|
|
|
#define ECM_MODE_OFF 0
|
|
|
|
#define ECM_MODE_ROOT 1
|
|
|
|
#define ECM_MODE_WINDOW 2
|
|
|
|
#define ECM_MODE_AUTO 3
|
|
|
|
|
|
|
|
static struct
|
|
|
|
{
|
|
|
|
char active;
|
2005-02-06 04:54:09 -08:00
|
|
|
char use_pixmap;
|
2005-09-17 11:55:17 -07:00
|
|
|
char reorder;
|
2005-01-11 14:58:39 -08:00
|
|
|
EObj *eo_first;
|
|
|
|
EObj *eo_last;
|
2005-07-24 13:00:27 -07:00
|
|
|
XserverRegion rgn_screen;
|
2006-03-04 05:56:18 -08:00
|
|
|
int shadow_mode;
|
|
|
|
unsigned int opac_or; /* 0 -> 0xffffffff */
|
|
|
|
float opac_blur; /* 0. -> 1. */
|
|
|
|
float opac_sharp; /* 0. -> 1. */
|
2004-12-28 15:46:49 -08:00
|
|
|
} Mode_compmgr;
|
|
|
|
|
2005-10-04 15:08:13 -07:00
|
|
|
#define _ECM_SET_CLIP_CHANGED() Mode_compmgr.reorder = 1
|
|
|
|
#define _ECM_SET_STACK_CHANGED() Mode_compmgr.reorder = 1
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
static Picture rootPicture;
|
|
|
|
static Picture rootBuffer;
|
|
|
|
|
|
|
|
static XserverRegion allDamage;
|
|
|
|
|
|
|
|
#define OPAQUE 0xffffffff
|
2006-03-04 05:56:18 -08:00
|
|
|
#define OP32(op) ((double)(op)/OPAQUE)
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-08-10 12:23:58 -07:00
|
|
|
#define WINDOW_UNREDIR 0
|
|
|
|
#define WINDOW_SOLID 1
|
|
|
|
#define WINDOW_TRANS 2
|
|
|
|
#define WINDOW_ARGB 3
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
static void ECompMgrDamageAll(void);
|
|
|
|
static void ECompMgrHandleRootEvent(XEvent * ev, void *prm);
|
|
|
|
static void ECompMgrHandleWindowEvent(XEvent * ev, void *prm);
|
2005-09-06 16:44:18 -07:00
|
|
|
static void doECompMgrWinFade(int val, void *data);
|
2005-12-04 01:38:28 -08:00
|
|
|
static void ECompMgrWinInvalidate(EObj * eo, int what);
|
2005-10-04 15:08:13 -07:00
|
|
|
static void ECompMgrWinSetPicts(EObj * eo);
|
2005-09-18 11:04:28 -07:00
|
|
|
static void ECompMgrWinFadeOutEnd(EObj * eo);
|
2005-10-04 15:08:13 -07:00
|
|
|
static int ECompMgrDetermineOrder(EObj * const *lst, int num,
|
|
|
|
EObj ** first, EObj ** last,
|
|
|
|
Desk * dsk, XserverRegion clip);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-05-03 11:21:40 -07:00
|
|
|
/*
|
|
|
|
* Visuals
|
|
|
|
*/
|
|
|
|
|
|
|
|
int
|
|
|
|
EVisualIsARGB(Visual * vis)
|
|
|
|
{
|
|
|
|
XRenderPictFormat *pictfmt;
|
|
|
|
|
2005-07-09 03:27:39 -07:00
|
|
|
if (!Mode_compmgr.active)
|
|
|
|
return 0;
|
|
|
|
|
2005-05-03 11:21:40 -07:00
|
|
|
pictfmt = XRenderFindVisualFormat(disp, vis);
|
|
|
|
if (!pictfmt)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
Eprintf("Visual ID=%#lx Type=%d, alphamask=%d\n", vis->visualid,
|
|
|
|
pictfmt->type, pictfmt->direct.alphaMask);
|
|
|
|
#endif
|
|
|
|
return pictfmt->type == PictTypeDirect && pictfmt->direct.alphaMask;
|
|
|
|
}
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
/*
|
|
|
|
* Regions
|
|
|
|
*/
|
|
|
|
|
|
|
|
static XserverRegion
|
2005-10-04 09:42:01 -07:00
|
|
|
ERegionCreate(void)
|
|
|
|
{
|
|
|
|
return XFixesCreateRegion(disp, NULL, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static XserverRegion
|
|
|
|
ERegionCreateRect(int x, int y, int w, int h)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
|
|
|
XserverRegion rgn;
|
|
|
|
XRectangle rct;
|
|
|
|
|
|
|
|
rct.x = x;
|
|
|
|
rct.y = y;
|
|
|
|
rct.width = w;
|
|
|
|
rct.height = h;
|
|
|
|
rgn = XFixesCreateRegion(disp, &rct, 1);
|
|
|
|
|
|
|
|
return rgn;
|
|
|
|
}
|
|
|
|
|
2006-01-14 06:30:51 -08:00
|
|
|
#if USE_DESK_EXPOSE
|
2005-10-04 09:42:01 -07:00
|
|
|
static XserverRegion
|
|
|
|
ERegionCreateFromRects(XRectangle * rectangles, int nrectangles)
|
|
|
|
{
|
|
|
|
return XFixesCreateRegion(disp, rectangles, nrectangles);
|
|
|
|
}
|
2005-12-04 15:53:20 -08:00
|
|
|
#endif
|
2005-10-04 09:42:01 -07:00
|
|
|
|
|
|
|
static XserverRegion
|
|
|
|
ERegionCreateFromWindow(Window win)
|
|
|
|
{
|
|
|
|
return XFixesCreateRegionFromWindow(disp, win, WindowRegionBounding);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ERegionCopy(XserverRegion rgn, XserverRegion src)
|
|
|
|
{
|
|
|
|
XFixesCopyRegion(disp, rgn, src);
|
|
|
|
}
|
|
|
|
|
2005-09-17 08:39:05 -07:00
|
|
|
static XserverRegion
|
|
|
|
ERegionClone(XserverRegion src)
|
|
|
|
{
|
|
|
|
XserverRegion rgn;
|
|
|
|
|
2005-10-04 09:42:01 -07:00
|
|
|
rgn = ERegionCreate();
|
|
|
|
ERegionCopy(rgn, src);
|
2005-09-17 08:39:05 -07:00
|
|
|
|
|
|
|
return rgn;
|
|
|
|
}
|
|
|
|
|
2005-10-04 09:42:01 -07:00
|
|
|
static void
|
|
|
|
ERegionDestroy(XserverRegion rgn)
|
|
|
|
{
|
|
|
|
XFixesDestroyRegion(disp, rgn);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ERegionTranslate(XserverRegion rgn, int dx, int dy)
|
|
|
|
{
|
2006-03-12 11:20:22 -08:00
|
|
|
if (dx == 0 && dy == 0)
|
|
|
|
return;
|
2005-10-04 09:42:01 -07:00
|
|
|
XFixesTranslateRegion(disp, rgn, dx, dy);
|
|
|
|
}
|
|
|
|
|
2005-10-04 15:08:13 -07:00
|
|
|
static void
|
|
|
|
ERegionIntersect(XserverRegion dst, XserverRegion src)
|
|
|
|
{
|
|
|
|
XFixesIntersectRegion(disp, dst, dst, src);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ERegionUnion(XserverRegion dst, XserverRegion src)
|
|
|
|
{
|
|
|
|
XFixesUnionRegion(disp, dst, dst, src);
|
|
|
|
}
|
|
|
|
|
2006-03-12 11:20:22 -08:00
|
|
|
static void
|
|
|
|
ERegionSubtract(XserverRegion dst, XserverRegion src)
|
|
|
|
{
|
|
|
|
XFixesSubtractRegion(disp, dst, dst, src);
|
|
|
|
}
|
|
|
|
|
2005-07-24 13:00:27 -07:00
|
|
|
static void
|
|
|
|
ERegionLimit(XserverRegion rgn)
|
|
|
|
{
|
|
|
|
XserverRegion screen;
|
|
|
|
|
|
|
|
screen = Mode_compmgr.rgn_screen;
|
|
|
|
if (screen == None)
|
2005-10-04 09:42:01 -07:00
|
|
|
Mode_compmgr.rgn_screen = screen =
|
|
|
|
ERegionCreateRect(0, 0, VRoot.w, VRoot.h);
|
2005-07-24 13:00:27 -07:00
|
|
|
|
2005-10-04 15:08:13 -07:00
|
|
|
ERegionIntersect(rgn, screen);
|
2005-10-04 09:42:01 -07:00
|
|
|
}
|
|
|
|
|
2005-09-17 08:39:05 -07:00
|
|
|
static void
|
|
|
|
ERegionSubtractOffset(XserverRegion dst, int dx, int dy, XserverRegion src)
|
|
|
|
{
|
|
|
|
Display *dpy = disp;
|
2005-09-30 11:56:45 -07:00
|
|
|
XserverRegion rgn;
|
2005-09-17 08:39:05 -07:00
|
|
|
|
2005-09-30 11:56:45 -07:00
|
|
|
rgn = src;
|
2005-09-17 08:39:05 -07:00
|
|
|
if (dx != 0 || dy != 0)
|
|
|
|
{
|
2005-09-30 11:56:45 -07:00
|
|
|
rgn = ERegionClone(src);
|
|
|
|
XFixesTranslateRegion(dpy, rgn, dx, dy);
|
2005-09-17 08:39:05 -07:00
|
|
|
}
|
2005-09-30 11:56:45 -07:00
|
|
|
XFixesSubtractRegion(dpy, dst, dst, rgn);
|
|
|
|
if (rgn != src)
|
2005-10-04 09:42:01 -07:00
|
|
|
ERegionDestroy(rgn);
|
2005-09-17 08:39:05 -07:00
|
|
|
}
|
|
|
|
|
2006-03-12 11:20:22 -08:00
|
|
|
static void
|
|
|
|
ERegionUnionOffset(XserverRegion dst, int dx, int dy, XserverRegion src)
|
|
|
|
{
|
|
|
|
Display *dpy = disp;
|
|
|
|
XserverRegion rgn;
|
|
|
|
|
|
|
|
rgn = src;
|
|
|
|
if (dx != 0 || dy != 0)
|
|
|
|
{
|
|
|
|
rgn = ERegionClone(src);
|
|
|
|
XFixesTranslateRegion(dpy, rgn, dx, dy);
|
|
|
|
}
|
|
|
|
XFixesUnionRegion(dpy, dst, dst, rgn);
|
|
|
|
if (rgn != src)
|
|
|
|
ERegionDestroy(rgn);
|
|
|
|
}
|
|
|
|
|
2005-09-17 08:39:05 -07:00
|
|
|
#if 0 /* Unused (for debug) */
|
|
|
|
static int
|
|
|
|
ERegionIsEmpty(XserverRegion rgn)
|
|
|
|
{
|
|
|
|
int nr;
|
|
|
|
XRectangle *pr;
|
|
|
|
|
|
|
|
pr = XFixesFetchRegion(disp, rgn, &nr);
|
|
|
|
if (pr)
|
|
|
|
XFree(pr);
|
|
|
|
return nr == 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
static void
|
|
|
|
ERegionShow(const char *txt, XserverRegion rgn)
|
|
|
|
{
|
|
|
|
int i, nr;
|
|
|
|
XRectangle *pr;
|
|
|
|
|
2005-10-04 15:08:13 -07:00
|
|
|
if (rgn == None)
|
|
|
|
{
|
|
|
|
Eprintf(" - region: %s %#lx is None\n", txt, rgn);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
pr = XFixesFetchRegion(disp, rgn, &nr);
|
2005-04-25 15:07:37 -07:00
|
|
|
if (!pr || nr <= 0)
|
|
|
|
{
|
|
|
|
Eprintf(" - region: %s %#lx is empty\n", txt, rgn);
|
|
|
|
goto done;
|
|
|
|
}
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-04-25 15:07:37 -07:00
|
|
|
Eprintf(" - region: %s %#lx:\n", txt, rgn);
|
2004-12-28 15:46:49 -08:00
|
|
|
for (i = 0; i < nr; i++)
|
|
|
|
Eprintf("%4d: %4d+%4d %4dx%4d\n", i, pr[i].x, pr[i].y, pr[i].width,
|
|
|
|
pr[i].height);
|
|
|
|
|
2005-04-25 15:07:37 -07:00
|
|
|
done:
|
|
|
|
if (pr)
|
|
|
|
XFree(pr);
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Pictures
|
|
|
|
*/
|
|
|
|
|
|
|
|
static Picture
|
|
|
|
EPictureCreateSolid(Bool argb, double a, double r, double g, double b)
|
|
|
|
{
|
|
|
|
Display *dpy = disp;
|
|
|
|
Pixmap pmap;
|
|
|
|
Picture pict;
|
|
|
|
XRenderPictFormat *pictfmt;
|
|
|
|
XRenderPictureAttributes pa;
|
|
|
|
XRenderColor c;
|
|
|
|
|
|
|
|
pmap = XCreatePixmap(dpy, VRoot.win, 1, 1, argb ? 32 : 8);
|
|
|
|
pictfmt = XRenderFindStandardFormat(dpy,
|
|
|
|
argb ? PictStandardARGB32 :
|
|
|
|
PictStandardA8);
|
|
|
|
pa.repeat = True;
|
|
|
|
pict = XRenderCreatePicture(dpy, pmap, pictfmt, CPRepeat, &pa);
|
|
|
|
|
|
|
|
c.alpha = a * 0xffff;
|
|
|
|
c.red = r * 0xffff;
|
|
|
|
c.green = g * 0xffff;
|
|
|
|
c.blue = b * 0xffff;
|
|
|
|
XRenderFillRectangle(dpy, PictOpSrc, pict, &c, 0, 0, 1, 1);
|
|
|
|
|
|
|
|
XFreePixmap(dpy, pmap);
|
|
|
|
|
|
|
|
return pict;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Picture
|
|
|
|
EPictureCreateBuffer(Window win, int w, int h, int depth, Visual * vis)
|
|
|
|
{
|
|
|
|
Picture pict;
|
|
|
|
Pixmap pmap;
|
|
|
|
XRenderPictFormat *pictfmt;
|
|
|
|
|
|
|
|
pmap = XCreatePixmap(disp, win, w, h, depth);
|
|
|
|
pictfmt = XRenderFindVisualFormat(disp, vis);
|
|
|
|
pict = XRenderCreatePicture(disp, pmap, pictfmt, 0, 0);
|
|
|
|
XFreePixmap(disp, pmap);
|
|
|
|
|
|
|
|
return pict;
|
|
|
|
}
|
|
|
|
|
2005-04-20 15:49:16 -07:00
|
|
|
#if 0
|
|
|
|
static Picture
|
|
|
|
EPictureCreate(Window win, int depth, Visual * vis)
|
|
|
|
{
|
|
|
|
Picture pict;
|
|
|
|
XRenderPictFormat *pictfmt;
|
|
|
|
|
|
|
|
pictfmt = XRenderFindVisualFormat(disp, vis);
|
|
|
|
pict = XRenderCreatePicture(disp, win, pictfmt, 0, 0);
|
|
|
|
|
|
|
|
return pict;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
/* Hack to fix redirected window resize bug(?) */
|
|
|
|
void
|
|
|
|
ECompMgrMoveResizeFix(EObj * eo, int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
Picture pict;
|
|
|
|
int wo, ho;
|
2005-04-22 00:10:18 -07:00
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-04-22 00:10:18 -07:00
|
|
|
if (!cw || !Conf_compmgr.resize_fix_enable)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-02-02 09:12:07 -08:00
|
|
|
EMoveResizeWindow(eo->win, x, y, w, h);
|
2004-12-28 15:46:49 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
wo = ho = 0;
|
2005-03-06 13:29:46 -08:00
|
|
|
EGetGeometry(eo->win, NULL, NULL, NULL, &wo, &ho, NULL, NULL);
|
2004-12-28 15:46:49 -08:00
|
|
|
if (wo <= 0 || ho <= 0 || (wo == w && ho == h))
|
|
|
|
{
|
2005-02-02 09:12:07 -08:00
|
|
|
EMoveResizeWindow(eo->win, x, y, w, h);
|
2004-12-28 15:46:49 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Resizing - grab old contents */
|
2005-04-22 00:10:18 -07:00
|
|
|
pict = EPictureCreateBuffer(eo->win, wo, ho, cw->a.depth, cw->a.visual);
|
|
|
|
XRenderComposite(disp, PictOpSrc, cw->picture, None, pict,
|
2004-12-28 15:46:49 -08:00
|
|
|
0, 0, 0, 0, 0, 0, wo, ho);
|
|
|
|
|
|
|
|
/* Resize (+move) */
|
2005-02-02 09:12:07 -08:00
|
|
|
EMoveResizeWindow(eo->win, x, y, w, h);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
/* Paste old contents back in */
|
|
|
|
if (w < wo)
|
|
|
|
w = wo;
|
|
|
|
if (h < ho)
|
|
|
|
h = ho;
|
2005-04-22 00:10:18 -07:00
|
|
|
XRenderComposite(disp, PictOpSrc, pict, None, cw->picture,
|
2004-12-28 15:46:49 -08:00
|
|
|
0, 0, 0, 0, 0, 0, w, h);
|
|
|
|
XRenderFreePicture(disp, pict);
|
|
|
|
}
|
|
|
|
|
2006-01-08 15:44:14 -08:00
|
|
|
#if !USE_BG_WIN_ON_ALL_DESKS
|
2004-12-28 15:46:49 -08:00
|
|
|
/*
|
2005-12-04 10:19:58 -08:00
|
|
|
* Desk background
|
2004-12-28 15:46:49 -08:00
|
|
|
*/
|
|
|
|
|
2005-11-29 10:04:01 -08:00
|
|
|
int
|
2005-12-01 13:25:42 -08:00
|
|
|
ECompMgrDeskConfigure(Desk * dsk)
|
2005-11-29 10:04:01 -08:00
|
|
|
{
|
2005-12-04 01:38:28 -08:00
|
|
|
EObj *eo;
|
|
|
|
ECmWinInfo *cw;
|
2004-12-28 15:46:49 -08:00
|
|
|
Picture pict;
|
|
|
|
XRenderPictFormat *pictfmt;
|
|
|
|
XRenderPictureAttributes pa;
|
2005-12-04 01:38:28 -08:00
|
|
|
Pixmap pmap;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-12-04 01:38:28 -08:00
|
|
|
if (!Mode_compmgr.active)
|
|
|
|
return 0;
|
|
|
|
|
2005-12-04 15:53:20 -08:00
|
|
|
eo = dsk->bg.o;
|
2005-12-04 01:38:28 -08:00
|
|
|
if (!eo)
|
|
|
|
return 1;
|
|
|
|
|
2006-02-27 11:14:25 -08:00
|
|
|
ECompMgrWinInvalidate(eo, INV_PICTURE);
|
|
|
|
|
|
|
|
if (!dsk->viewable && dsk->bg.bg)
|
|
|
|
return 1;
|
2005-12-04 01:38:28 -08:00
|
|
|
|
|
|
|
if (dsk->bg.pmap == None)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-12-04 10:19:58 -08:00
|
|
|
GC gc;
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
pmap = XCreatePixmap(disp, VRoot.win, 1, 1, VRoot.depth);
|
2005-12-04 10:19:58 -08:00
|
|
|
gc = ECreateGC(pmap, 0, NULL);
|
|
|
|
XSetClipMask(disp, gc, 0);
|
|
|
|
XSetFillStyle(disp, gc, FillSolid);
|
|
|
|
XSetForeground(disp, gc, dsk->bg.pixel);
|
|
|
|
XFillRectangle(disp, pmap, gc, 0, 0, 1, 1);
|
|
|
|
EFreeGC(gc);
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
2005-12-04 01:38:28 -08:00
|
|
|
else
|
2005-07-11 11:02:56 -07:00
|
|
|
{
|
2005-12-04 01:38:28 -08:00
|
|
|
pmap = dsk->bg.pmap;
|
2005-07-11 11:02:56 -07:00
|
|
|
}
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
pa.repeat = True;
|
|
|
|
pictfmt = XRenderFindVisualFormat(disp, VRoot.vis);
|
|
|
|
pict = XRenderCreatePicture(disp, pmap, pictfmt, CPRepeat, &pa);
|
|
|
|
|
2005-12-04 10:19:58 -08:00
|
|
|
if (pmap != dsk->bg.pmap)
|
|
|
|
XFreePixmap(disp, pmap);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
/* New background, all must be repainted */
|
|
|
|
ECompMgrDamageAll();
|
|
|
|
|
2006-02-27 11:14:25 -08:00
|
|
|
cw = eo->cmhook;
|
2005-04-20 15:49:16 -07:00
|
|
|
cw->picture = pict;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-12-04 01:38:28 -08:00
|
|
|
D1printf
|
|
|
|
("ECompMgrDeskConfigure: Desk %d: using pixmap %#lx picture=%#lx\n",
|
|
|
|
dsk->num, pmap, cw->picture);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-12-04 01:38:28 -08:00
|
|
|
return 1;
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
2005-12-06 11:09:48 -08:00
|
|
|
#endif
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2006-01-14 06:30:51 -08:00
|
|
|
#if USE_DESK_VISIBILITY
|
|
|
|
static void
|
|
|
|
ECompMgrDeskVisibility(EObj * eo, XEvent * ev)
|
|
|
|
{
|
|
|
|
Desk *dsk;
|
|
|
|
int visible;
|
|
|
|
|
|
|
|
switch (eo->type)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
case EOBJ_TYPE_DESK:
|
|
|
|
dsk = (Desk *) eo;
|
|
|
|
break;
|
|
|
|
case EOBJ_TYPE_ROOT_BG:
|
|
|
|
dsk = DeskGet(0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
visible = dsk->viewable && ev->xvisibility.state != VisibilityFullyObscured;
|
|
|
|
if (dsk->visible == visible)
|
|
|
|
return;
|
|
|
|
dsk->visible = visible;
|
|
|
|
if (!visible)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A viewable desk is no longer fully obscured. Assume this happened due
|
|
|
|
* to a VT switch to our display and repaint all. This may happen in other
|
|
|
|
* situations as well, but most likely when we must repaint everything
|
|
|
|
* anyway.
|
|
|
|
*/
|
|
|
|
ECompMgrDamageAll();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
/*
|
|
|
|
* Root (?)
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
2005-08-06 03:31:35 -07:00
|
|
|
ECompMgrDamageMerge(XserverRegion damage, int destroy)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-08-06 03:31:35 -07:00
|
|
|
if (allDamage != None)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
|
|
|
if (EventDebug(EDBUG_TYPE_COMPMGR3))
|
|
|
|
ERegionShow("ECompMgrDamageMerge add:", damage);
|
|
|
|
|
2005-10-04 09:42:01 -07:00
|
|
|
ERegionUnion(allDamage, damage);
|
2004-12-28 15:46:49 -08:00
|
|
|
if (destroy)
|
2005-10-04 09:42:01 -07:00
|
|
|
ERegionDestroy(damage);
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
else if (!destroy)
|
|
|
|
{
|
2005-09-17 08:39:05 -07:00
|
|
|
allDamage = ERegionClone(damage);
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
allDamage = damage;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (EventDebug(EDBUG_TYPE_COMPMGR3))
|
|
|
|
ERegionShow("ECompMgrDamageMerge all:", allDamage);
|
|
|
|
}
|
|
|
|
|
2005-08-06 03:31:35 -07:00
|
|
|
static void
|
|
|
|
ECompMgrDamageMergeObject(EObj * eo, XserverRegion damage, int destroy)
|
|
|
|
{
|
2005-10-04 15:08:13 -07:00
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
2005-09-04 00:27:20 -07:00
|
|
|
Desk *dsk = eo->desk;
|
2005-08-06 03:31:35 -07:00
|
|
|
|
2005-10-19 12:32:00 -07:00
|
|
|
if (!Mode_compmgr.active || damage == None)
|
2005-09-18 11:04:28 -07:00
|
|
|
return;
|
|
|
|
|
2005-09-04 00:27:20 -07:00
|
|
|
if (dsk->num > 0 && !dsk->viewable && eo->ilayer < 512)
|
2005-08-06 03:31:35 -07:00
|
|
|
{
|
|
|
|
if (destroy)
|
2005-10-04 09:42:01 -07:00
|
|
|
ERegionDestroy(damage);
|
2005-08-06 03:31:35 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-10-04 15:08:13 -07:00
|
|
|
if (Mode_compmgr.reorder)
|
|
|
|
ECompMgrDetermineOrder(NULL, 0, &Mode_compmgr.eo_first,
|
|
|
|
&Mode_compmgr.eo_last, DeskGet(0), None);
|
|
|
|
|
2006-03-12 11:20:22 -08:00
|
|
|
#if 0 /* FIXME - Remove? */
|
2005-10-04 15:08:13 -07:00
|
|
|
if (cw->clip == None)
|
2005-08-06 03:31:35 -07:00
|
|
|
{
|
2005-10-04 15:08:13 -07:00
|
|
|
/* Clip may be None if window is not in paint list */
|
|
|
|
if (destroy)
|
|
|
|
ERegionDestroy(damage);
|
|
|
|
return;
|
2005-08-06 03:31:35 -07:00
|
|
|
}
|
2006-03-12 11:20:22 -08:00
|
|
|
#endif
|
2005-08-06 03:31:35 -07:00
|
|
|
|
2005-10-04 15:08:13 -07:00
|
|
|
if (!destroy)
|
|
|
|
damage = ERegionClone(damage);
|
2006-03-12 11:20:22 -08:00
|
|
|
|
|
|
|
#if USE_CLIP_RELATIVE_TO_DESK
|
|
|
|
if (cw->clip != None && eo->type != EOBJ_TYPE_DESK)
|
|
|
|
ERegionSubtract(damage, cw->clip);
|
2005-10-04 15:08:13 -07:00
|
|
|
#endif
|
|
|
|
|
2006-03-12 11:20:22 -08:00
|
|
|
if (EoGetX(dsk) != 0 || EoGetY(dsk) != 0)
|
2005-10-04 15:08:13 -07:00
|
|
|
ERegionTranslate(damage, EoGetX(dsk), EoGetY(dsk));
|
|
|
|
|
2006-03-12 11:20:22 -08:00
|
|
|
#if !USE_CLIP_RELATIVE_TO_DESK
|
|
|
|
if (cw->clip != None && eo->type != EOBJ_TYPE_DESK)
|
|
|
|
ERegionSubtract(damage, cw->clip);
|
|
|
|
#endif
|
|
|
|
|
2005-10-04 15:08:13 -07:00
|
|
|
ECompMgrDamageMerge(damage, 1);
|
2005-08-06 03:31:35 -07:00
|
|
|
}
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
static void
|
|
|
|
ECompMgrDamageAll(void)
|
|
|
|
{
|
2005-10-04 09:42:01 -07:00
|
|
|
ECompMgrDamageMerge(ERegionCreateRect(0, 0, VRoot.w, VRoot.h), 1);
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
#if ENABLE_SHADOWS
|
|
|
|
|
|
|
|
static Picture transBlackPicture;
|
|
|
|
|
2006-04-06 14:20:16 -07:00
|
|
|
typedef struct
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
|
|
|
int size;
|
|
|
|
double *data;
|
|
|
|
} conv;
|
|
|
|
|
2006-03-08 12:10:27 -08:00
|
|
|
static conv *gaussianMap = NULL;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
static double
|
|
|
|
gaussian(double r, double x, double y)
|
|
|
|
{
|
|
|
|
return ((1 / (sqrt(2 * M_PI * r))) * exp((-(x * x + y * y)) / (2 * r * r)));
|
|
|
|
}
|
|
|
|
|
|
|
|
static conv *
|
2005-09-28 12:10:57 -07:00
|
|
|
make_gaussian_map(double r)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
|
|
|
conv *c;
|
|
|
|
int size = ((int)ceil((r * 3)) + 1) & ~1;
|
|
|
|
int center = size / 2;
|
|
|
|
int x, y;
|
|
|
|
double t;
|
|
|
|
double g;
|
|
|
|
|
|
|
|
c = malloc(sizeof(conv) + size * size * sizeof(double));
|
|
|
|
c->size = size;
|
|
|
|
c->data = (double *)(c + 1);
|
|
|
|
t = 0.0;
|
|
|
|
for (y = 0; y < size; y++)
|
|
|
|
for (x = 0; x < size; x++)
|
|
|
|
{
|
|
|
|
g = gaussian(r, (double)(x - center), (double)(y - center));
|
|
|
|
t += g;
|
|
|
|
c->data[y * size + x] = g;
|
|
|
|
}
|
|
|
|
/* printf ("gaussian total %f\n", t); */
|
|
|
|
for (y = 0; y < size; y++)
|
|
|
|
for (x = 0; x < size; x++)
|
|
|
|
{
|
|
|
|
c->data[y * size + x] /= t;
|
|
|
|
}
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A picture will help
|
|
|
|
*
|
2006-02-12 09:01:32 -08:00
|
|
|
* -center 0 width width+center
|
2004-12-28 15:46:49 -08:00
|
|
|
* -center +-----+-------------------+-----+
|
2006-02-12 09:01:32 -08:00
|
|
|
* | | | |
|
|
|
|
* | | | |
|
2004-12-28 15:46:49 -08:00
|
|
|
* 0 +-----+-------------------+-----+
|
2006-02-12 09:01:32 -08:00
|
|
|
* | | | |
|
|
|
|
* | | | |
|
|
|
|
* | | | |
|
2004-12-28 15:46:49 -08:00
|
|
|
* height +-----+-------------------+-----+
|
2006-02-12 09:01:32 -08:00
|
|
|
* | | | |
|
2004-12-28 15:46:49 -08:00
|
|
|
* height+ | | | |
|
|
|
|
* center +-----+-------------------+-----+
|
|
|
|
*/
|
|
|
|
|
|
|
|
static unsigned char
|
|
|
|
sum_gaussian(conv * map, double opacity, int x, int y, int width, int height)
|
|
|
|
{
|
|
|
|
int fx, fy;
|
|
|
|
double *g_data;
|
|
|
|
double *g_line = map->data;
|
|
|
|
int g_size = map->size;
|
|
|
|
int center = g_size / 2;
|
|
|
|
int fx_start, fx_end;
|
|
|
|
int fy_start, fy_end;
|
|
|
|
double v;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Compute set of filter values which are "in range",
|
|
|
|
* that's the set with:
|
|
|
|
* 0 <= x + (fx-center) && x + (fx-center) < width &&
|
|
|
|
* 0 <= y + (fy-center) && y + (fy-center) < height
|
|
|
|
*
|
|
|
|
* 0 <= x + (fx - center) x + fx - center < width
|
|
|
|
* center - x <= fx fx < width + center - x
|
|
|
|
*/
|
|
|
|
|
|
|
|
fx_start = center - x;
|
|
|
|
if (fx_start < 0)
|
|
|
|
fx_start = 0;
|
|
|
|
fx_end = width + center - x;
|
|
|
|
if (fx_end > g_size)
|
|
|
|
fx_end = g_size;
|
|
|
|
|
|
|
|
fy_start = center - y;
|
|
|
|
if (fy_start < 0)
|
|
|
|
fy_start = 0;
|
|
|
|
fy_end = height + center - y;
|
|
|
|
if (fy_end > g_size)
|
|
|
|
fy_end = g_size;
|
|
|
|
|
|
|
|
g_line = g_line + fy_start * g_size + fx_start;
|
|
|
|
|
|
|
|
v = 0;
|
|
|
|
for (fy = fy_start; fy < fy_end; fy++)
|
|
|
|
{
|
|
|
|
g_data = g_line;
|
|
|
|
g_line += g_size;
|
|
|
|
|
|
|
|
for (fx = fx_start; fx < fx_end; fx++)
|
|
|
|
v += *g_data++;
|
|
|
|
}
|
|
|
|
if (v > 1)
|
|
|
|
v = 1;
|
|
|
|
|
|
|
|
return ((unsigned char)(v * opacity * 255.0));
|
|
|
|
}
|
|
|
|
|
|
|
|
static XImage *
|
2005-09-28 12:10:57 -07:00
|
|
|
make_shadow(double opacity, int width, int height)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-09-28 12:10:57 -07:00
|
|
|
Display *dpy = disp;
|
2004-12-28 15:46:49 -08:00
|
|
|
XImage *ximage;
|
|
|
|
unsigned char *data;
|
|
|
|
int gsize = gaussianMap->size;
|
|
|
|
int ylimit, xlimit;
|
|
|
|
int swidth = width + gsize;
|
|
|
|
int sheight = height + gsize;
|
|
|
|
int center = gsize / 2;
|
|
|
|
int x, y;
|
|
|
|
unsigned char d;
|
|
|
|
int x_diff;
|
|
|
|
|
2005-01-11 14:58:39 -08:00
|
|
|
data = calloc(swidth * sheight, sizeof(unsigned char));
|
2004-12-28 15:46:49 -08:00
|
|
|
if (!data)
|
2005-01-11 14:58:39 -08:00
|
|
|
return NULL;
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
ximage = XCreateImage(dpy, DefaultVisual(dpy, DefaultScreen(dpy)),
|
|
|
|
8, ZPixmap, 0,
|
|
|
|
(char *)data,
|
|
|
|
swidth, sheight, 8, swidth * sizeof(unsigned char));
|
|
|
|
if (!ximage)
|
|
|
|
{
|
|
|
|
free(data);
|
2005-01-11 14:58:39 -08:00
|
|
|
return NULL;
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
2005-01-11 14:58:39 -08:00
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
/*
|
|
|
|
* Build the gaussian in sections
|
|
|
|
*/
|
|
|
|
|
2005-09-06 15:36:26 -07:00
|
|
|
#if 1
|
|
|
|
/* FIXME - Handle properly - shaped/non-shaped/offset */
|
2004-12-28 15:46:49 -08:00
|
|
|
/*
|
|
|
|
* center (fill the complete data array)
|
|
|
|
*/
|
|
|
|
d = sum_gaussian(gaussianMap, opacity, center, center, width, height);
|
|
|
|
memset(data, d, sheight * swidth);
|
2005-01-11 14:58:39 -08:00
|
|
|
#endif
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* corners
|
|
|
|
*/
|
|
|
|
ylimit = gsize;
|
|
|
|
if (ylimit > sheight / 2)
|
|
|
|
ylimit = (sheight + 1) / 2;
|
|
|
|
xlimit = gsize;
|
|
|
|
if (xlimit > swidth / 2)
|
|
|
|
xlimit = (swidth + 1) / 2;
|
|
|
|
|
|
|
|
for (y = 0; y < ylimit; y++)
|
|
|
|
for (x = 0; x < xlimit; x++)
|
|
|
|
{
|
|
|
|
d = sum_gaussian(gaussianMap, opacity, x - center, y - center, width,
|
|
|
|
height);
|
|
|
|
data[y * swidth + x] = d;
|
|
|
|
data[(sheight - y - 1) * swidth + x] = d;
|
|
|
|
data[(sheight - y - 1) * swidth + (swidth - x - 1)] = d;
|
|
|
|
data[y * swidth + (swidth - x - 1)] = d;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* top/bottom
|
|
|
|
*/
|
|
|
|
x_diff = swidth - (gsize * 2);
|
|
|
|
if (x_diff > 0 && ylimit > 0)
|
|
|
|
{
|
|
|
|
for (y = 0; y < ylimit; y++)
|
|
|
|
{
|
|
|
|
d = sum_gaussian(gaussianMap, opacity, center, y - center, width,
|
|
|
|
height);
|
|
|
|
memset(&data[y * swidth + gsize], d, x_diff);
|
|
|
|
memset(&data[(sheight - y - 1) * swidth + gsize], d, x_diff);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sides
|
|
|
|
*/
|
|
|
|
|
|
|
|
for (x = 0; x < xlimit; x++)
|
|
|
|
{
|
|
|
|
d = sum_gaussian(gaussianMap, opacity, x - center, center, width,
|
|
|
|
height);
|
|
|
|
for (y = gsize; y < sheight - gsize; y++)
|
|
|
|
{
|
|
|
|
data[y * swidth + x] = d;
|
|
|
|
data[y * swidth + (swidth - x - 1)] = d;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ximage;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Picture
|
2005-09-28 12:10:57 -07:00
|
|
|
shadow_picture(double opacity, int width, int height, int *wp, int *hp)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-09-28 12:10:57 -07:00
|
|
|
Display *dpy = disp;
|
2004-12-28 15:46:49 -08:00
|
|
|
XImage *shadowImage;
|
|
|
|
Pixmap shadowPixmap;
|
|
|
|
Picture shadowPicture;
|
|
|
|
GC gc;
|
|
|
|
|
2005-09-28 12:10:57 -07:00
|
|
|
shadowImage = make_shadow(opacity, width, height);
|
2004-12-28 15:46:49 -08:00
|
|
|
if (!shadowImage)
|
|
|
|
return None;
|
|
|
|
|
|
|
|
shadowPixmap = XCreatePixmap(dpy, VRoot.win,
|
|
|
|
shadowImage->width, shadowImage->height, 8);
|
|
|
|
shadowPicture = XRenderCreatePicture(dpy, shadowPixmap,
|
|
|
|
XRenderFindStandardFormat(dpy,
|
|
|
|
PictStandardA8),
|
|
|
|
0, 0);
|
|
|
|
gc = XCreateGC(dpy, shadowPixmap, 0, 0);
|
|
|
|
|
|
|
|
XPutImage(dpy, shadowPixmap, gc, shadowImage, 0, 0, 0, 0,
|
|
|
|
shadowImage->width, shadowImage->height);
|
|
|
|
*wp = shadowImage->width;
|
|
|
|
*hp = shadowImage->height;
|
|
|
|
XFreeGC(dpy, gc);
|
|
|
|
XDestroyImage(shadowImage);
|
|
|
|
XFreePixmap(dpy, shadowPixmap);
|
|
|
|
|
|
|
|
return shadowPicture;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* ENABLE_SHADOWS */
|
|
|
|
|
2005-09-30 11:56:45 -07:00
|
|
|
/* Region of window in screen coordinates, including shadows */
|
2004-12-28 15:46:49 -08:00
|
|
|
static XserverRegion
|
2005-09-28 12:10:57 -07:00
|
|
|
win_extents(EObj * eo)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-04-22 00:10:18 -07:00
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
2006-03-08 12:10:27 -08:00
|
|
|
XRectangle r, sr;
|
2005-09-30 11:56:45 -07:00
|
|
|
XserverRegion rgn;
|
2006-03-13 14:46:14 -08:00
|
|
|
unsigned int bw;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2006-03-13 14:46:14 -08:00
|
|
|
/* FIXME - Get this right */
|
|
|
|
bw = cw->a.border_width;
|
2005-05-01 15:26:03 -07:00
|
|
|
if (Mode_compmgr.use_pixmap)
|
|
|
|
{
|
|
|
|
cw->rcx = eo->x;
|
|
|
|
cw->rcy = eo->y;
|
2006-03-13 14:46:14 -08:00
|
|
|
cw->rcw = eo->w + 2 * bw;
|
|
|
|
cw->rch = eo->h + 2 * bw;
|
2005-05-01 15:26:03 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-13 14:46:14 -08:00
|
|
|
cw->rcx = eo->x + bw;
|
|
|
|
cw->rcy = eo->y + bw;
|
2005-05-01 15:26:03 -07:00
|
|
|
cw->rcw = eo->w;
|
|
|
|
cw->rch = eo->h;
|
|
|
|
}
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2006-03-13 14:46:14 -08:00
|
|
|
if (eo->noredir && bw)
|
|
|
|
{
|
|
|
|
r.x = eo->x;
|
|
|
|
r.y = eo->y;
|
|
|
|
r.width = eo->w + 2 * bw;
|
|
|
|
r.height = eo->h + 2 * bw;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
r.x = cw->rcx;
|
|
|
|
r.y = cw->rcy;
|
|
|
|
r.width = cw->rcw;
|
|
|
|
r.height = cw->rch;
|
|
|
|
}
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
#if ENABLE_SHADOWS
|
2006-03-08 12:10:27 -08:00
|
|
|
if (!eo->shadow || Mode_compmgr.shadow_mode == ECM_SHADOWS_OFF)
|
|
|
|
goto skip_shadow;
|
|
|
|
|
|
|
|
switch (Mode_compmgr.shadow_mode)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2006-03-08 12:10:27 -08:00
|
|
|
default:
|
|
|
|
goto skip_shadow;
|
|
|
|
|
|
|
|
case ECM_SHADOWS_SHARP:
|
|
|
|
case ECM_SHADOWS_ECHO:
|
|
|
|
cw->shadow_dx = Conf_compmgr.shadows.offset_x;
|
|
|
|
cw->shadow_dy = Conf_compmgr.shadows.offset_y;
|
|
|
|
cw->shadow_width = cw->rcw;
|
|
|
|
cw->shadow_height = cw->rch;
|
|
|
|
break;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2006-03-08 12:10:27 -08:00
|
|
|
case ECM_SHADOWS_BLURRED:
|
|
|
|
if (EobjIsShaped(eo) /* || cw->mode == WINDOW_ARGB */ )
|
|
|
|
goto skip_shadow;
|
|
|
|
|
|
|
|
if (!gaussianMap)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2006-03-08 12:10:27 -08:00
|
|
|
gaussianMap =
|
|
|
|
make_gaussian_map((double)Conf_compmgr.shadows.blur.radius);
|
|
|
|
if (!gaussianMap)
|
|
|
|
goto skip_shadow;
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
2006-03-08 12:10:27 -08:00
|
|
|
|
|
|
|
cw->shadow_dx = Conf_compmgr.shadows.offset_x - gaussianMap->size / 2;
|
|
|
|
cw->shadow_dy = Conf_compmgr.shadows.offset_y - gaussianMap->size / 2;
|
|
|
|
if (!cw->shadow_pict)
|
|
|
|
cw->shadow_pict = shadow_picture(Mode_compmgr.opac_blur,
|
|
|
|
cw->rcw, cw->rch,
|
|
|
|
&cw->shadow_width,
|
|
|
|
&cw->shadow_height);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
sr.x = cw->rcx + cw->shadow_dx;
|
|
|
|
sr.y = cw->rcy + cw->shadow_dy;
|
|
|
|
sr.width = cw->shadow_width;
|
|
|
|
sr.height = cw->shadow_height;
|
|
|
|
if (sr.x < r.x)
|
|
|
|
{
|
|
|
|
r.width = (r.x + r.width) - sr.x;
|
|
|
|
r.x = sr.x;
|
|
|
|
}
|
|
|
|
if (sr.y < r.y)
|
|
|
|
{
|
|
|
|
r.height = (r.y + r.height) - sr.y;
|
|
|
|
r.y = sr.y;
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
2006-03-08 12:10:27 -08:00
|
|
|
if (sr.x + sr.width > r.x + r.width)
|
|
|
|
r.width = sr.x + sr.width - r.x;
|
|
|
|
if (sr.y + sr.height > r.y + r.height)
|
|
|
|
r.height = sr.y + sr.height - r.y;
|
|
|
|
|
|
|
|
skip_shadow:
|
2004-12-28 15:46:49 -08:00
|
|
|
#endif
|
|
|
|
|
2005-09-30 11:56:45 -07:00
|
|
|
D2printf("extents %#lx %d %d %d %d\n", eo->win, r.x, r.y, r.width, r.height);
|
|
|
|
|
2005-10-04 09:42:01 -07:00
|
|
|
rgn = ERegionCreateRect(r.x, r.y, r.width, r.height);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-09-30 11:56:45 -07:00
|
|
|
if (EventDebug(EDBUG_TYPE_COMPMGR3))
|
|
|
|
ERegionShow("extents", rgn);
|
|
|
|
|
2005-10-04 15:08:13 -07:00
|
|
|
#if 0 /* FIXME - Set picture clip region */
|
2006-03-04 05:56:18 -08:00
|
|
|
if (cw->shadow_pict)
|
2005-10-04 15:08:13 -07:00
|
|
|
{
|
|
|
|
XserverRegion clip;
|
|
|
|
|
|
|
|
clip = ERegionClone(cw->extents);
|
|
|
|
ERegionSubtractOffset(clip, 0, 0, cw->shape);
|
2006-03-04 05:56:18 -08:00
|
|
|
XFixesSetPictureClipRegion(disp, cw->shadow_pict, 0, 0, clip);
|
2005-10-04 15:08:13 -07:00
|
|
|
ERegionDestroy(clip);
|
|
|
|
}
|
|
|
|
#endif
|
2005-09-30 11:56:45 -07:00
|
|
|
return rgn;
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
2005-09-30 11:56:45 -07:00
|
|
|
/* Region of shaped window in screen coordinates */
|
2004-12-28 15:46:49 -08:00
|
|
|
static XserverRegion
|
2005-09-30 11:56:45 -07:00
|
|
|
win_shape(EObj * eo)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-04-22 00:10:18 -07:00
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
2004-12-28 15:46:49 -08:00
|
|
|
XserverRegion border;
|
2005-04-20 15:49:16 -07:00
|
|
|
int x, y;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-10-04 09:42:01 -07:00
|
|
|
border = ERegionCreateFromWindow(eo->win);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2006-01-10 15:03:31 -08:00
|
|
|
if (1 /* eo->shaped */ ) /* FIXME - Track shaped state */
|
|
|
|
{
|
|
|
|
XserverRegion rgn;
|
|
|
|
|
|
|
|
/* Intersect with window size to get effective bounding region */
|
|
|
|
rgn = ERegionCreateRect(0, 0, eo->w, eo->h);
|
|
|
|
ERegionIntersect(border, rgn);
|
|
|
|
ERegionDestroy(rgn);
|
|
|
|
}
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
/* translate this */
|
2005-04-22 00:10:18 -07:00
|
|
|
x = eo->x + cw->a.border_width;
|
|
|
|
y = eo->y + cw->a.border_width;
|
2005-10-04 09:42:01 -07:00
|
|
|
ERegionTranslate(border, x, y);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-09-30 11:56:45 -07:00
|
|
|
D2printf("shape %#lx: %d %d\n", eo->win, x, y);
|
2005-04-25 15:07:37 -07:00
|
|
|
if (EventDebug(EDBUG_TYPE_COMPMGR3))
|
2005-09-30 11:56:45 -07:00
|
|
|
ERegionShow("shape", border);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
return border;
|
|
|
|
}
|
|
|
|
|
|
|
|
Pixmap
|
|
|
|
ECompMgrWinGetPixmap(const EObj * eo)
|
|
|
|
{
|
2005-04-22 00:10:18 -07:00
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-07-10 13:16:47 -07:00
|
|
|
if (!cw)
|
|
|
|
return None;
|
|
|
|
|
|
|
|
if (cw->pixmap != None)
|
|
|
|
return cw->pixmap;
|
|
|
|
|
2006-03-13 14:46:14 -08:00
|
|
|
if (eo->noredir)
|
|
|
|
return None;
|
|
|
|
|
2005-07-10 13:16:47 -07:00
|
|
|
cw->pixmap = XCompositeNameWindowPixmap(disp, eo->win);
|
|
|
|
|
|
|
|
return cw->pixmap;
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ECompMgrWinInvalidate(EObj * eo, int what)
|
|
|
|
{
|
2005-04-22 00:10:18 -07:00
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
2004-12-28 15:46:49 -08:00
|
|
|
Display *dpy = disp;
|
|
|
|
|
2005-04-22 00:10:18 -07:00
|
|
|
if (!cw)
|
2004-12-28 15:46:49 -08:00
|
|
|
return;
|
|
|
|
|
2005-09-18 11:04:28 -07:00
|
|
|
D2printf("ECompMgrWinInvalidate %#lx: %#x\n", eo->win, what);
|
|
|
|
|
2005-08-07 03:51:07 -07:00
|
|
|
if ((what & (INV_SIZE | INV_PIXMAP)) && cw->pixmap != None)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-04-22 00:10:18 -07:00
|
|
|
XFreePixmap(dpy, cw->pixmap);
|
|
|
|
cw->pixmap = None;
|
2005-09-17 11:55:17 -07:00
|
|
|
if (Mode_compmgr.use_pixmap)
|
|
|
|
what |= INV_PICTURE;
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
2005-09-30 11:56:45 -07:00
|
|
|
if ((what & INV_GEOM) && cw->shape != None)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-10-04 09:42:01 -07:00
|
|
|
ERegionDestroy(cw->shape);
|
2005-09-30 11:56:45 -07:00
|
|
|
cw->shape = None;
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
2005-09-17 11:55:17 -07:00
|
|
|
if ((what & INV_PICTURE) && cw->picture != None)
|
|
|
|
{
|
|
|
|
XRenderFreePicture(dpy, cw->picture);
|
|
|
|
cw->picture = None;
|
|
|
|
}
|
|
|
|
|
2006-03-04 05:56:18 -08:00
|
|
|
if ((what & INV_OPACITY) && cw->pict_alpha != None)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2006-03-04 05:56:18 -08:00
|
|
|
XRenderFreePicture(dpy, cw->pict_alpha);
|
|
|
|
cw->pict_alpha = None;
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
2005-09-30 11:56:45 -07:00
|
|
|
if ((what & (INV_CLIP | INV_GEOM)) && cw->clip != None)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-10-04 09:42:01 -07:00
|
|
|
ERegionDestroy(cw->clip);
|
2005-04-22 00:10:18 -07:00
|
|
|
cw->clip = None;
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
#if ENABLE_SHADOWS
|
2006-03-08 12:10:27 -08:00
|
|
|
if ((what & (INV_SIZE | INV_SHADOW)) && cw->shadow_pict != None)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2006-03-04 05:56:18 -08:00
|
|
|
XRenderFreePicture(dpy, cw->shadow_pict);
|
|
|
|
cw->shadow_pict = None;
|
2005-01-04 11:20:09 -08:00
|
|
|
what |= INV_GEOM;
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
2006-03-04 05:56:18 -08:00
|
|
|
if ((what & (INV_OPACITY | INV_SHADOW)) && cw->shadow_alpha != None)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2006-03-04 05:56:18 -08:00
|
|
|
XRenderFreePicture(dpy, cw->shadow_alpha);
|
|
|
|
cw->shadow_alpha = None;
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
#endif
|
2005-01-04 11:20:09 -08:00
|
|
|
|
2005-04-22 00:10:18 -07:00
|
|
|
if ((what & (INV_GEOM | INV_SHADOW)) && cw->extents != None)
|
2005-01-04 11:20:09 -08:00
|
|
|
{
|
2005-10-04 09:42:01 -07:00
|
|
|
ERegionDestroy(cw->extents);
|
2005-04-22 00:10:18 -07:00
|
|
|
cw->extents = None;
|
2005-01-04 11:20:09 -08:00
|
|
|
}
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
2005-09-11 03:39:16 -07:00
|
|
|
static void
|
|
|
|
ECompMgrWinSetOpacity(EObj * eo, unsigned int opacity)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-04-22 00:10:18 -07:00
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
2004-12-28 15:46:49 -08:00
|
|
|
int mode;
|
|
|
|
|
2005-04-22 00:10:18 -07:00
|
|
|
if (!cw || cw->opacity == opacity)
|
2004-12-28 15:46:49 -08:00
|
|
|
return;
|
|
|
|
|
2005-04-22 00:10:18 -07:00
|
|
|
cw->opacity = opacity;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-09-11 03:39:16 -07:00
|
|
|
D1printf("ECompMgrWinSetOpacity: %#lx opacity=%#x\n", eo->win, cw->opacity);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-10-04 15:08:13 -07:00
|
|
|
if (eo->shown || cw->fadeout)
|
2005-09-18 11:04:28 -07:00
|
|
|
ECompMgrDamageMergeObject(eo, cw->extents, 0);
|
2005-01-04 11:20:09 -08:00
|
|
|
|
2005-05-01 15:26:03 -07:00
|
|
|
/* Invalidate stuff changed by opacity */
|
|
|
|
ECompMgrWinInvalidate(eo, INV_OPACITY);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-08-10 12:23:58 -07:00
|
|
|
if (eo->noredir)
|
|
|
|
mode = WINDOW_UNREDIR;
|
|
|
|
else if (EVisualIsARGB(cw->a.visual))
|
2004-12-28 15:46:49 -08:00
|
|
|
mode = WINDOW_ARGB;
|
2005-04-22 00:10:18 -07:00
|
|
|
else if (cw->opacity != OPAQUE)
|
2004-12-28 15:46:49 -08:00
|
|
|
mode = WINDOW_TRANS;
|
|
|
|
else
|
|
|
|
mode = WINDOW_SOLID;
|
2005-10-04 15:08:13 -07:00
|
|
|
|
|
|
|
if (mode != cw->mode)
|
|
|
|
_ECM_SET_CLIP_CHANGED();
|
|
|
|
|
2005-04-22 00:10:18 -07:00
|
|
|
cw->mode = mode;
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
2005-09-06 16:44:18 -07:00
|
|
|
static void
|
|
|
|
ECompMgrWinFadeDoIn(EObj * eo, unsigned int op)
|
|
|
|
{
|
|
|
|
char s[128];
|
|
|
|
|
|
|
|
Esnprintf(s, sizeof(s), "Fade-%#lx", eo->win);
|
|
|
|
DoIn(s, 1e-6 * Conf_compmgr.fading.dt_us, doECompMgrWinFade, op, eo);
|
|
|
|
}
|
|
|
|
|
2005-09-30 11:56:45 -07:00
|
|
|
static void
|
|
|
|
ECompMgrWinFadeCancel(EObj * eo)
|
|
|
|
{
|
|
|
|
char s[128];
|
|
|
|
|
|
|
|
Esnprintf(s, sizeof(s), "Fade-%#lx", eo->win);
|
|
|
|
RemoveTimerEvent(s);
|
|
|
|
}
|
|
|
|
|
2005-09-04 14:17:32 -07:00
|
|
|
static void
|
|
|
|
doECompMgrWinFade(int val, void *data)
|
|
|
|
{
|
|
|
|
EObj *eo = data;
|
|
|
|
ECmWinInfo *cw;
|
|
|
|
unsigned int op = (unsigned int)val;
|
|
|
|
|
|
|
|
/* May be gone */
|
2005-09-21 14:13:45 -07:00
|
|
|
if (EobjListStackCheck(eo) < 0)
|
2005-09-04 14:17:32 -07:00
|
|
|
return;
|
|
|
|
|
|
|
|
cw = eo->cmhook;
|
|
|
|
|
2005-09-18 11:04:28 -07:00
|
|
|
#if DEBUG_OPACITY
|
|
|
|
Eprintf("doECompMgrWinFade %#lx, %d/%d, %#x->%#x\n", eo->win,
|
|
|
|
cw->fading, cw->fadeout, cw->opacity, op);
|
|
|
|
#endif
|
|
|
|
if (!cw->fading)
|
|
|
|
return;
|
|
|
|
|
|
|
|
cw->fading = cw->fadeout;
|
2005-09-17 11:55:17 -07:00
|
|
|
|
|
|
|
if (op == cw->opacity)
|
|
|
|
{
|
|
|
|
op = eo->opacity;
|
2005-09-18 11:04:28 -07:00
|
|
|
if (cw->fadeout)
|
|
|
|
ECompMgrWinFadeOutEnd(eo);
|
|
|
|
cw->fading = 0;
|
2005-09-17 11:55:17 -07:00
|
|
|
}
|
|
|
|
else if (op > cw->opacity)
|
2005-09-04 14:17:32 -07:00
|
|
|
{
|
|
|
|
if (op - cw->opacity > Conf_compmgr.fading.step)
|
|
|
|
{
|
|
|
|
op = cw->opacity + Conf_compmgr.fading.step;
|
2005-09-11 03:39:16 -07:00
|
|
|
cw->fading = 1;
|
2005-09-04 14:17:32 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (cw->opacity - op > Conf_compmgr.fading.step)
|
|
|
|
{
|
|
|
|
op = cw->opacity - Conf_compmgr.fading.step;
|
2005-09-11 03:39:16 -07:00
|
|
|
cw->fading = 1;
|
2005-09-04 14:17:32 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-17 11:55:17 -07:00
|
|
|
#if DEBUG_OPACITY
|
2005-09-06 16:44:18 -07:00
|
|
|
Eprintf("doECompMgrWinFade %#lx, %#x\n", eo->win, op);
|
2005-09-04 14:17:32 -07:00
|
|
|
#endif
|
2005-09-18 11:04:28 -07:00
|
|
|
if (cw->fading)
|
2005-09-17 11:55:17 -07:00
|
|
|
ECompMgrWinFadeDoIn(eo, (unsigned int)val);
|
2006-03-06 14:38:05 -08:00
|
|
|
else if (eo->type == EOBJ_TYPE_EWIN)
|
|
|
|
ModulesSignal(eo->shown ? ESIGNAL_EWIN_CHANGE : ESIGNAL_EWIN_UNMAP, eo);
|
2005-09-11 03:39:16 -07:00
|
|
|
ECompMgrWinSetOpacity(eo, op);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ECompMgrWinFade(EObj * eo, unsigned int op_from, unsigned int op_to)
|
|
|
|
{
|
2005-09-18 11:04:28 -07:00
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
|
|
|
|
|
|
|
cw->fading = 1;
|
2005-09-11 03:39:16 -07:00
|
|
|
ECompMgrWinFadeDoIn(eo, op_to);
|
|
|
|
ECompMgrWinSetOpacity(eo, op_from);
|
2005-09-04 14:17:32 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ECompMgrWinFadeIn(EObj * eo)
|
|
|
|
{
|
2005-09-18 11:04:28 -07:00
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
|
|
|
|
2005-09-17 11:55:17 -07:00
|
|
|
#if DEBUG_OPACITY
|
|
|
|
Eprintf("ECompMgrWinFadeIn %#lx %#x -> %#x\n", eo->win, 0x10000000,
|
|
|
|
eo->opacity);
|
|
|
|
#endif
|
2005-09-18 11:04:28 -07:00
|
|
|
if (cw->fadeout)
|
|
|
|
ECompMgrWinFadeOutEnd(eo);
|
2005-09-11 03:39:16 -07:00
|
|
|
ECompMgrWinFade(eo, 0x10000000, eo->opacity);
|
2005-09-04 14:17:32 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ECompMgrWinFadeOut(EObj * eo)
|
|
|
|
{
|
2005-09-17 11:55:17 -07:00
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
|
|
|
|
|
|
|
#if DEBUG_OPACITY
|
|
|
|
Eprintf("ECompMgrWinFadeOut %#lx %#x -> %#x\n", eo->win, cw->opacity,
|
|
|
|
0x10000000);
|
|
|
|
#endif
|
|
|
|
cw->fadeout = 1;
|
2005-09-18 11:04:28 -07:00
|
|
|
ECompMgrWinInvalidate(eo, INV_PICTURE);
|
2005-10-04 15:08:13 -07:00
|
|
|
ECompMgrWinSetPicts(eo);
|
2005-10-19 12:32:00 -07:00
|
|
|
ECompMgrDamageMergeObject(eo, cw->extents, 0);
|
2005-09-17 11:55:17 -07:00
|
|
|
ECompMgrWinFade(eo, cw->opacity, 0x10000000);
|
2005-09-11 03:39:16 -07:00
|
|
|
}
|
|
|
|
|
2005-09-18 11:04:28 -07:00
|
|
|
static void
|
|
|
|
ECompMgrWinFadeOutEnd(EObj * eo)
|
|
|
|
{
|
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
|
|
|
|
|
|
|
#if DEBUG_OPACITY
|
|
|
|
Eprintf("ECompMgrWinFadeOutEnd %#lx\n", eo->win);
|
|
|
|
#endif
|
|
|
|
cw->fadeout = 0;
|
|
|
|
ECompMgrWinInvalidate(eo, INV_PIXMAP | INV_PICTURE);
|
|
|
|
ECompMgrDamageMergeObject(eo, cw->extents, 0);
|
2005-10-04 15:08:13 -07:00
|
|
|
_ECM_SET_CLIP_CHANGED();
|
2005-09-18 11:04:28 -07:00
|
|
|
}
|
|
|
|
|
2005-09-11 03:39:16 -07:00
|
|
|
void
|
|
|
|
ECompMgrWinChangeOpacity(EObj * eo, unsigned int opacity)
|
|
|
|
{
|
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
|
|
|
|
2005-09-11 04:29:29 -07:00
|
|
|
if (!cw)
|
|
|
|
return;
|
|
|
|
|
2005-10-04 15:08:13 -07:00
|
|
|
if (eo->shown && Conf_compmgr.fading.enable && eo->fade)
|
2005-09-11 03:39:16 -07:00
|
|
|
ECompMgrWinFade(eo, cw->opacity, opacity);
|
|
|
|
else
|
|
|
|
ECompMgrWinSetOpacity(eo, opacity);
|
2005-09-04 14:17:32 -07:00
|
|
|
}
|
|
|
|
|
2005-04-20 15:49:16 -07:00
|
|
|
void
|
|
|
|
ECompMgrWinMap(EObj * eo)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-04-22 00:10:18 -07:00
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-04-22 00:10:18 -07:00
|
|
|
if (!cw)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
|
|
|
ECompMgrWinNew(eo);
|
2005-04-22 00:10:18 -07:00
|
|
|
cw = eo->cmhook;
|
|
|
|
if (!cw)
|
2004-12-28 15:46:49 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-04-25 15:07:37 -07:00
|
|
|
D1printf("ECompMgrWinMap %#lx\n", eo->win);
|
|
|
|
|
|
|
|
if (cw->extents == None)
|
2005-09-28 12:10:57 -07:00
|
|
|
cw->extents = win_extents(eo);
|
2005-10-04 15:08:13 -07:00
|
|
|
|
|
|
|
_ECM_SET_STACK_CHANGED();
|
2005-08-06 03:31:35 -07:00
|
|
|
ECompMgrDamageMergeObject(eo, cw->extents, 0);
|
2005-05-01 15:26:03 -07:00
|
|
|
|
2005-09-04 14:17:32 -07:00
|
|
|
if (Conf_compmgr.fading.enable && eo->fade)
|
|
|
|
ECompMgrWinFadeIn(eo);
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
2005-06-05 08:15:59 -07:00
|
|
|
void
|
|
|
|
ECompMgrWinUnmap(EObj * eo)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-04-22 00:10:18 -07:00
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-12-04 10:30:22 -08:00
|
|
|
D1printf("ECompMgrWinUnmap %#lx shown=%d\n", eo->win, eo->shown);
|
|
|
|
if (!eo->shown) /* Sometimes we get a synthetic one too */
|
|
|
|
return;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-10-21 16:16:26 -07:00
|
|
|
if (Conf_compmgr.fading.enable && eo->fade && !eo->gone)
|
2005-09-04 14:17:32 -07:00
|
|
|
ECompMgrWinFadeOut(eo);
|
|
|
|
else
|
2005-10-04 15:08:13 -07:00
|
|
|
{
|
2005-10-19 12:32:00 -07:00
|
|
|
ECompMgrDamageMergeObject(eo, cw->extents, 0);
|
2005-10-04 15:08:13 -07:00
|
|
|
_ECM_SET_STACK_CHANGED();
|
|
|
|
ECompMgrWinInvalidate(eo, INV_PIXMAP);
|
|
|
|
}
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ECompMgrWinSetPicts(EObj * eo)
|
|
|
|
{
|
2005-04-22 00:10:18 -07:00
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2006-03-13 14:46:14 -08:00
|
|
|
if (cw->pixmap == None && eo->shown && !eo->noredir &&
|
2005-12-01 15:28:13 -08:00
|
|
|
(Mode_compmgr.use_pixmap || (eo->fade && Conf_compmgr.fading.enable)))
|
2005-09-18 11:04:28 -07:00
|
|
|
{
|
|
|
|
cw->pixmap = XCompositeNameWindowPixmap(disp, eo->win);
|
|
|
|
D2printf("ECompMgrWinSetPicts %#lx: Pmap=%#lx\n", eo->win, cw->pixmap);
|
|
|
|
}
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-04-22 00:10:18 -07:00
|
|
|
if (cw->picture == None)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-05-01 15:26:03 -07:00
|
|
|
XRenderPictFormat *pictfmt;
|
|
|
|
XRenderPictureAttributes pa;
|
|
|
|
Drawable draw = eo->win;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-09-18 11:04:28 -07:00
|
|
|
if ((cw->pixmap && Mode_compmgr.use_pixmap) || (cw->fadeout))
|
2005-05-01 15:26:03 -07:00
|
|
|
draw = cw->pixmap;
|
2005-10-04 15:08:13 -07:00
|
|
|
if (draw == None)
|
|
|
|
return;
|
2005-07-10 13:16:47 -07:00
|
|
|
|
2005-05-01 15:26:03 -07:00
|
|
|
pictfmt = XRenderFindVisualFormat(disp, cw->a.visual);
|
|
|
|
pa.subwindow_mode = IncludeInferiors;
|
|
|
|
cw->picture = XRenderCreatePicture(disp, draw,
|
|
|
|
pictfmt, CPSubwindowMode, &pa);
|
2005-09-18 11:04:28 -07:00
|
|
|
D2printf("ECompMgrWinSetPicts %#lx: Pict=%#lx (drawable=%#lx)\n",
|
|
|
|
eo->win, cw->picture, draw);
|
2005-10-04 15:08:13 -07:00
|
|
|
|
|
|
|
if (draw == cw->pixmap)
|
|
|
|
{
|
|
|
|
XserverRegion clip;
|
|
|
|
|
|
|
|
clip = ERegionCreateFromWindow(eo->win);
|
|
|
|
XFixesSetPictureClipRegion(disp, cw->picture, 0, 0, clip);
|
|
|
|
ERegionDestroy(clip);
|
|
|
|
}
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ECompMgrWinNew(EObj * eo)
|
|
|
|
{
|
2005-04-22 00:10:18 -07:00
|
|
|
ECmWinInfo *cw;
|
2005-05-01 15:26:03 -07:00
|
|
|
XWindowAttributes attr;
|
2005-04-20 15:49:16 -07:00
|
|
|
|
2005-06-11 04:45:55 -07:00
|
|
|
if (!Mode_compmgr.active) /* FIXME - Here? */
|
2005-04-20 15:49:16 -07:00
|
|
|
return;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-12-12 12:49:02 -08:00
|
|
|
if (eo->inputonly || eo->win == VRoot.win)
|
2005-05-01 15:26:03 -07:00
|
|
|
return;
|
2005-10-24 10:35:09 -07:00
|
|
|
|
|
|
|
if (!XGetWindowAttributes(disp, eo->win, &attr))
|
2005-05-01 15:26:03 -07:00
|
|
|
return;
|
|
|
|
|
2005-04-22 00:10:18 -07:00
|
|
|
cw = Ecalloc(1, sizeof(ECmWinInfo));
|
|
|
|
if (!cw)
|
2004-12-28 15:46:49 -08:00
|
|
|
return;
|
|
|
|
|
|
|
|
D1printf("ECompMgrWinNew %#lx\n", eo->win);
|
|
|
|
|
2005-04-22 00:10:18 -07:00
|
|
|
eo->cmhook = cw;
|
2005-04-20 15:49:16 -07:00
|
|
|
|
2005-04-22 00:10:18 -07:00
|
|
|
cw->damaged = 0;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-05-01 15:26:03 -07:00
|
|
|
cw->a.depth = attr.depth;
|
|
|
|
cw->a.visual = attr.visual;
|
|
|
|
cw->a.border_width = attr.border_width;
|
2005-04-20 15:49:16 -07:00
|
|
|
|
2006-03-13 14:46:14 -08:00
|
|
|
if (eo->type == EOBJ_TYPE_EXT &&
|
|
|
|
Conf_compmgr.override_redirect.mode == ECM_OR_UNREDIRECTED)
|
|
|
|
{
|
|
|
|
eo->noredir = 1;
|
|
|
|
eo->fade = 0;
|
|
|
|
eo->shadow = 0;
|
|
|
|
}
|
|
|
|
|
2005-08-10 12:23:58 -07:00
|
|
|
if (!eo->noredir)
|
2005-04-20 15:49:16 -07:00
|
|
|
{
|
|
|
|
if (Conf_compmgr.mode == ECM_MODE_WINDOW)
|
|
|
|
XCompositeRedirectWindow(disp, eo->win, CompositeRedirectManual);
|
2005-04-22 00:10:18 -07:00
|
|
|
cw->damage_sequence = NextRequest(disp);
|
|
|
|
cw->damage = XDamageCreate(disp, eo->win, XDamageReportNonEmpty);
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
2005-07-24 08:26:35 -07:00
|
|
|
if (eo->type == EOBJ_TYPE_EXT)
|
2006-03-04 05:56:18 -08:00
|
|
|
eo->opacity = Mode_compmgr.opac_or;
|
2005-07-24 08:26:35 -07:00
|
|
|
if (eo->opacity == 0)
|
|
|
|
eo->opacity = 0xFFFFFFFF;
|
|
|
|
|
2006-01-14 06:30:51 -08:00
|
|
|
if (eo->type == EOBJ_TYPE_DESK || eo->type == EOBJ_TYPE_ROOT_BG)
|
|
|
|
{
|
|
|
|
ESelectInputAdd(eo->win, VisibilityChangeMask);
|
|
|
|
}
|
|
|
|
|
2005-04-22 00:10:18 -07:00
|
|
|
cw->opacity = 0xdeadbeef;
|
2005-09-11 03:39:16 -07:00
|
|
|
ECompMgrWinSetOpacity(eo, eo->opacity);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
EventCallbackRegister(eo->win, 0, ECompMgrHandleWindowEvent, eo);
|
|
|
|
}
|
|
|
|
|
2005-04-20 15:49:16 -07:00
|
|
|
void
|
2005-05-01 15:26:03 -07:00
|
|
|
ECompMgrWinMoveResize(EObj * eo, int change_xy, int change_wh, int change_bw)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-04-20 15:49:16 -07:00
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
2005-10-04 15:08:13 -07:00
|
|
|
XserverRegion damage;
|
2005-05-01 15:26:03 -07:00
|
|
|
int invalidate;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-05-01 15:26:03 -07:00
|
|
|
D1printf("ECompMgrWinMoveResize %#lx xy=%d wh=%d bw=%d\n",
|
|
|
|
eo->win, change_xy, change_wh, change_bw);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
invalidate = 0;
|
|
|
|
if (change_xy || change_bw)
|
|
|
|
invalidate |= INV_POS;
|
|
|
|
if (change_wh || change_bw)
|
|
|
|
invalidate |= INV_SIZE;
|
|
|
|
|
2005-05-01 15:26:03 -07:00
|
|
|
if (!invalidate)
|
|
|
|
return;
|
|
|
|
|
2005-09-18 11:04:28 -07:00
|
|
|
if (cw->fadeout)
|
2005-12-04 10:30:22 -08:00
|
|
|
{
|
|
|
|
ECompMgrWinFadeCancel(eo);
|
|
|
|
ECompMgrWinFadeOutEnd(eo);
|
|
|
|
cw->fading = 0;
|
|
|
|
}
|
2005-09-18 11:04:28 -07:00
|
|
|
|
2005-05-01 15:26:03 -07:00
|
|
|
if (!eo->shown)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
|
|
|
ECompMgrWinInvalidate(eo, invalidate);
|
2005-05-01 15:26:03 -07:00
|
|
|
return;
|
|
|
|
}
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-05-01 15:26:03 -07:00
|
|
|
/* Invalidate old window region */
|
2005-10-04 15:08:13 -07:00
|
|
|
damage = cw->extents;
|
|
|
|
cw->extents = None;
|
2005-05-01 15:26:03 -07:00
|
|
|
if (EventDebug(EDBUG_TYPE_COMPMGR3))
|
|
|
|
ERegionShow("old-extents:", damage);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-10-04 15:08:13 -07:00
|
|
|
#if 0 /* FIXME - We shouldn't have to update clip if transparent */
|
|
|
|
if (cw->mode == WINDOW_UNREDIR || cw->mode == WINDOW_SOLID)
|
|
|
|
#endif
|
|
|
|
_ECM_SET_CLIP_CHANGED();
|
2005-05-01 15:26:03 -07:00
|
|
|
ECompMgrWinInvalidate(eo, invalidate);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-05-01 15:26:03 -07:00
|
|
|
/* Invalidate new window region */
|
2005-10-04 15:08:13 -07:00
|
|
|
cw->extents = win_extents(eo);
|
|
|
|
if (damage != None)
|
|
|
|
{
|
|
|
|
ERegionUnion(damage, cw->extents);
|
|
|
|
ECompMgrDamageMergeObject(eo, damage, 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ECompMgrDamageMergeObject(eo, cw->extents, 0);
|
|
|
|
}
|
2005-04-20 15:49:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ECompMgrWinConfigure(EObj * eo, XEvent * ev)
|
|
|
|
{
|
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
2005-04-25 15:07:37 -07:00
|
|
|
int x, y, w, h, bw;
|
2005-05-01 15:26:03 -07:00
|
|
|
int change_xy, change_wh, change_bw;
|
2005-04-20 15:49:16 -07:00
|
|
|
|
2005-05-01 15:26:03 -07:00
|
|
|
x = ev->xconfigure.x;
|
|
|
|
y = ev->xconfigure.y;
|
|
|
|
w = ev->xconfigure.width;
|
|
|
|
h = ev->xconfigure.height;
|
2005-04-25 15:07:37 -07:00
|
|
|
bw = ev->xconfigure.border_width;
|
|
|
|
|
2005-05-01 15:26:03 -07:00
|
|
|
change_xy = eo->x != x || eo->y != y;
|
|
|
|
change_wh = eo->w != w || eo->h != h;
|
|
|
|
change_bw = cw->a.border_width != bw;
|
|
|
|
|
|
|
|
eo->x = x;
|
|
|
|
eo->y = y;
|
|
|
|
eo->w = w;
|
|
|
|
eo->h = h;
|
|
|
|
cw->a.border_width = bw;
|
|
|
|
|
|
|
|
ECompMgrWinMoveResize(eo, change_xy, change_wh, change_bw);
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
2005-05-01 04:27:43 -07:00
|
|
|
void
|
2005-09-17 07:22:05 -07:00
|
|
|
ECompMgrWinReparent(EObj * eo, Desk * dsk, int change_xy)
|
2005-05-01 04:27:43 -07:00
|
|
|
{
|
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
|
|
|
|
2005-05-01 15:26:03 -07:00
|
|
|
D1printf("ECompMgrWinReparent %#lx %#lx d=%d->%d x,y=%d,%d %d\n",
|
2005-09-17 07:22:05 -07:00
|
|
|
eo->win, cw->extents, eo->desk->num, dsk->num, eo->x, eo->y,
|
|
|
|
change_xy);
|
2005-05-01 04:27:43 -07:00
|
|
|
|
|
|
|
/* Invalidate old window region */
|
2005-05-01 15:26:03 -07:00
|
|
|
if (EventDebug(EDBUG_TYPE_COMPMGR3))
|
|
|
|
ERegionShow("old-extents:", cw->extents);
|
2005-08-06 03:31:35 -07:00
|
|
|
ECompMgrDamageMergeObject(eo, cw->extents, change_xy);
|
2005-05-01 15:26:03 -07:00
|
|
|
if (change_xy)
|
2005-05-01 04:27:43 -07:00
|
|
|
{
|
2005-05-01 15:26:03 -07:00
|
|
|
cw->extents = None;
|
2005-05-01 04:27:43 -07:00
|
|
|
ECompMgrWinInvalidate(eo, INV_POS);
|
|
|
|
|
|
|
|
/* Find new window region */
|
2005-09-28 12:10:57 -07:00
|
|
|
cw->extents = win_extents(eo);
|
2005-05-01 04:27:43 -07:00
|
|
|
}
|
2005-10-20 11:20:13 -07:00
|
|
|
eo->desk = dsk;
|
2005-10-04 15:08:13 -07:00
|
|
|
_ECM_SET_STACK_CHANGED();
|
|
|
|
ECompMgrDamageMergeObject(eo, cw->extents, 0);
|
2005-05-01 04:27:43 -07:00
|
|
|
}
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
static void
|
|
|
|
ECompMgrWinCirculate(EObj * eo, XEvent * ev)
|
|
|
|
{
|
|
|
|
D1printf("ECompMgrWinCirculate %#lx %#lx\n", ev->xany.window, eo->win);
|
|
|
|
|
2005-10-04 15:08:13 -07:00
|
|
|
_ECM_SET_STACK_CHANGED();
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
2005-05-02 15:11:01 -07:00
|
|
|
void
|
|
|
|
ECompMgrWinChangeShape(EObj * eo)
|
|
|
|
{
|
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
|
|
|
|
2005-09-18 11:04:28 -07:00
|
|
|
D1printf("ECompMgrWinChangeShape %#lx\n", eo->win);
|
|
|
|
|
|
|
|
ECompMgrDamageMergeObject(eo, cw->extents, 1);
|
|
|
|
cw->extents = None;
|
2005-05-02 15:11:01 -07:00
|
|
|
|
2005-10-04 15:08:13 -07:00
|
|
|
_ECM_SET_CLIP_CHANGED();
|
2005-05-02 15:11:01 -07:00
|
|
|
ECompMgrWinInvalidate(eo, INV_SIZE);
|
|
|
|
}
|
|
|
|
|
2005-05-08 02:52:26 -07:00
|
|
|
void
|
2005-10-04 15:08:13 -07:00
|
|
|
ECompMgrWinRaise(EObj * eo)
|
2005-05-08 02:52:26 -07:00
|
|
|
{
|
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
|
|
|
|
2005-10-04 15:08:13 -07:00
|
|
|
D1printf("ECompMgrWinRaise %#lx\n", eo->win);
|
2005-09-30 11:56:45 -07:00
|
|
|
|
2005-10-04 15:08:13 -07:00
|
|
|
_ECM_SET_STACK_CHANGED();
|
|
|
|
ECompMgrDamageMergeObject(eo, cw->extents, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ECompMgrWinLower(EObj * eo)
|
|
|
|
{
|
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
|
|
|
|
|
|
|
D1printf("ECompMgrWinLower %#lx\n", eo->win);
|
2005-05-08 02:52:26 -07:00
|
|
|
|
2005-09-18 11:04:28 -07:00
|
|
|
ECompMgrDamageMergeObject(eo, cw->extents, 0);
|
2005-10-04 15:08:13 -07:00
|
|
|
_ECM_SET_STACK_CHANGED();
|
2005-05-08 02:52:26 -07:00
|
|
|
}
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
void
|
2005-06-05 08:15:59 -07:00
|
|
|
ECompMgrWinDel(EObj * eo)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-04-22 00:10:18 -07:00
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-04-22 00:10:18 -07:00
|
|
|
if (!cw)
|
2004-12-28 15:46:49 -08:00
|
|
|
return;
|
|
|
|
|
|
|
|
D1printf("ECompMgrWinDel %#lx\n", eo->win);
|
|
|
|
|
2005-09-30 11:56:45 -07:00
|
|
|
if (cw->fading)
|
2005-10-19 12:32:00 -07:00
|
|
|
{
|
|
|
|
ECompMgrWinFadeCancel(eo);
|
|
|
|
if (cw->fadeout)
|
|
|
|
ECompMgrWinFadeOutEnd(eo);
|
|
|
|
}
|
2005-09-30 11:56:45 -07:00
|
|
|
|
2005-05-28 07:07:09 -07:00
|
|
|
EventCallbackUnregister(eo->win, 0, ECompMgrHandleWindowEvent, eo);
|
|
|
|
|
2005-08-10 12:23:58 -07:00
|
|
|
if (!eo->gone)
|
2006-01-08 15:44:14 -08:00
|
|
|
ECompMgrWinInvalidate(eo, INV_PICTURE);
|
2005-06-05 08:15:59 -07:00
|
|
|
|
2006-01-08 15:44:14 -08:00
|
|
|
if (!eo->noredir && !eo->gone)
|
|
|
|
{
|
2005-08-10 12:23:58 -07:00
|
|
|
if (cw->damage != None)
|
|
|
|
XDamageDestroy(disp, cw->damage);
|
2006-01-08 15:44:14 -08:00
|
|
|
|
|
|
|
if (Conf_compmgr.mode == ECM_MODE_WINDOW)
|
|
|
|
XCompositeUnredirectWindow(disp, eo->win, CompositeRedirectManual);
|
2005-06-05 08:15:59 -07:00
|
|
|
}
|
2005-06-14 16:06:15 -07:00
|
|
|
|
2006-01-08 15:44:14 -08:00
|
|
|
ECompMgrWinInvalidate(eo, INV_ALL);
|
|
|
|
|
2005-06-14 16:06:15 -07:00
|
|
|
_EFREE(eo->cmhook);
|
2005-10-16 08:51:59 -07:00
|
|
|
|
|
|
|
_ECM_SET_STACK_CHANGED();
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ECompMgrWinDamage(EObj * eo, XEvent * ev __UNUSED__)
|
|
|
|
{
|
2005-04-22 00:10:18 -07:00
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
2004-12-28 15:46:49 -08:00
|
|
|
Display *dpy = disp;
|
|
|
|
XDamageNotifyEvent *de = (XDamageNotifyEvent *) ev;
|
|
|
|
XserverRegion parts;
|
|
|
|
|
|
|
|
D1printf("ECompMgrWinDamage %#lx %#lx damaged=%d %d,%d %dx%d\n",
|
2005-04-22 00:10:18 -07:00
|
|
|
ev->xany.window, eo->win, cw->damaged,
|
2004-12-28 15:46:49 -08:00
|
|
|
de->area.x, de->area.y, de->area.width, de->area.height);
|
|
|
|
|
2005-04-22 00:10:18 -07:00
|
|
|
if (!cw->damaged)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-09-28 12:10:57 -07:00
|
|
|
parts = win_extents(eo);
|
2005-04-22 00:10:18 -07:00
|
|
|
XDamageSubtract(dpy, cw->damage, None, None);
|
|
|
|
cw->damaged = 1;
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-10-04 09:42:01 -07:00
|
|
|
parts = ERegionCreate();
|
2005-04-22 00:10:18 -07:00
|
|
|
XDamageSubtract(dpy, cw->damage, None, parts);
|
2005-10-04 09:42:01 -07:00
|
|
|
ERegionTranslate(parts,
|
|
|
|
eo->x + cw->a.border_width,
|
|
|
|
eo->y + cw->a.border_width);
|
2005-12-07 15:16:30 -08:00
|
|
|
#if 0 /* ENABLE_SHADOWS - FIXME - This is not right, remove? */
|
2006-03-04 05:56:18 -08:00
|
|
|
if (Mode_compmgr.shadow_mode == ECM_SHADOWS_SHARP)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
|
|
|
XserverRegion o;
|
|
|
|
|
2005-09-17 08:39:05 -07:00
|
|
|
o = ERegionClone(parts);
|
2005-10-04 09:42:01 -07:00
|
|
|
ERegionTranslate(o, cw->shadow_dx, cw->shadow_dy);
|
|
|
|
ERegionUnion(parts, o);
|
|
|
|
ERegionDestroy(o);
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
2005-08-06 03:31:35 -07:00
|
|
|
ECompMgrDamageMergeObject(eo, parts, 1);
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
2005-10-04 15:08:13 -07:00
|
|
|
static void
|
|
|
|
ECompMgrWinDumpInfo(const char *txt, EObj * eo, XserverRegion rgn, int force)
|
|
|
|
{
|
|
|
|
ECmWinInfo *cw = eo->cmhook;
|
|
|
|
|
|
|
|
Eprintf("%s %#lx: %d,%d %dx%d: %s\n", txt, eo->win, eo->x, eo->y,
|
|
|
|
eo->w, eo->h, eo->name);
|
|
|
|
if (!cw)
|
|
|
|
{
|
|
|
|
Eprintf("Not managed\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (force || EventDebug(EDBUG_TYPE_COMPMGR3))
|
|
|
|
{
|
|
|
|
Eprintf(" - pict=%#lx pmap=%#lx\n", cw->picture, cw->pixmap);
|
|
|
|
|
|
|
|
ERegionShow("win extents", cw->extents);
|
|
|
|
ERegionShow("win shape ", cw->shape);
|
|
|
|
ERegionShow("win clip ", cw->clip);
|
2006-03-12 11:20:22 -08:00
|
|
|
if (rgn != None)
|
|
|
|
ERegionShow("region", rgn);
|
2005-10-04 15:08:13 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ECompMgrDestroyClip(void)
|
|
|
|
{
|
|
|
|
EObj *eo, *const *lst;
|
|
|
|
ECmWinInfo *cw;
|
|
|
|
int i, num;
|
|
|
|
|
|
|
|
lst = EobjListStackGet(&num);
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
|
|
|
eo = lst[i];
|
|
|
|
cw = eo->cmhook;
|
|
|
|
if (!cw)
|
|
|
|
continue;
|
|
|
|
if (cw->clip != None)
|
|
|
|
ERegionDestroy(cw->clip);
|
|
|
|
cw->clip = None;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-20 15:49:16 -07:00
|
|
|
static int
|
2005-10-04 15:08:13 -07:00
|
|
|
ECompMgrDetermineOrder(EObj * const *lst, int num, EObj ** first,
|
|
|
|
EObj ** last, Desk * dsk, XserverRegion clip)
|
2005-01-01 09:58:46 -08:00
|
|
|
{
|
2005-04-20 15:49:16 -07:00
|
|
|
EObj *eo, *eo_prev, *eo_first;
|
2006-03-12 11:20:22 -08:00
|
|
|
int i, stop, destroy_clip;
|
2005-04-22 00:10:18 -07:00
|
|
|
ECmWinInfo *cw;
|
2005-01-01 09:58:46 -08:00
|
|
|
|
2005-10-04 15:08:13 -07:00
|
|
|
D1printf("ECompMgrDetermineOrder %d\n", dsk->num);
|
2005-04-20 15:49:16 -07:00
|
|
|
if (!lst)
|
|
|
|
lst = EobjListStackGet(&num);
|
2005-10-04 15:08:13 -07:00
|
|
|
if (clip == None)
|
|
|
|
{
|
2006-03-12 11:20:22 -08:00
|
|
|
destroy_clip = 1;
|
2005-10-04 15:08:13 -07:00
|
|
|
ECompMgrDestroyClip();
|
2006-03-12 11:20:22 -08:00
|
|
|
clip = ERegionCreate();
|
2005-10-04 15:08:13 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-12 11:20:22 -08:00
|
|
|
destroy_clip = 0;
|
2005-10-04 15:08:13 -07:00
|
|
|
}
|
2005-01-01 09:58:46 -08:00
|
|
|
|
2005-01-11 14:58:39 -08:00
|
|
|
/* Determine overall paint order, top to bottom */
|
2005-04-20 15:49:16 -07:00
|
|
|
stop = 0;
|
2005-01-11 14:58:39 -08:00
|
|
|
eo_first = eo_prev = NULL;
|
|
|
|
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
|
|
|
eo = lst[i];
|
2005-04-20 15:49:16 -07:00
|
|
|
|
2005-09-11 03:39:16 -07:00
|
|
|
cw = eo->cmhook;
|
|
|
|
|
|
|
|
if (!cw)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((!eo->shown && !cw->fading) || eo->desk != dsk)
|
2005-01-11 14:58:39 -08:00
|
|
|
continue;
|
2005-04-20 15:49:16 -07:00
|
|
|
|
2005-10-04 15:08:13 -07:00
|
|
|
/* Region of shaped window in screen coordinates */
|
|
|
|
if (cw->shape == None)
|
|
|
|
cw->shape = win_shape(eo);
|
|
|
|
|
|
|
|
/* Region of window in screen coordinates, including shadows */
|
|
|
|
if (cw->extents == None)
|
|
|
|
cw->extents = win_extents(eo);
|
|
|
|
|
|
|
|
D4printf(" - %#lx desk=%d shown=%d fading=%d fadeout=%d\n", eo->win,
|
|
|
|
eo->desk->num, eo->shown, cw->fading, cw->fadeout);
|
2005-04-20 15:49:16 -07:00
|
|
|
|
|
|
|
if (eo->type == EOBJ_TYPE_DESK)
|
|
|
|
{
|
|
|
|
EObj *eo1, *eo2;
|
|
|
|
Desk *d = (Desk *) eo;
|
|
|
|
|
|
|
|
if (!d->viewable)
|
|
|
|
continue;
|
|
|
|
|
2006-03-12 11:20:22 -08:00
|
|
|
#if USE_CLIP_RELATIVE_TO_DESK
|
|
|
|
ERegionTranslate(clip, -EoGetX(d), -EoGetY(d));
|
|
|
|
#endif
|
2005-10-04 15:08:13 -07:00
|
|
|
stop = ECompMgrDetermineOrder(lst, num, &eo1, &eo2, d, clip);
|
2006-03-12 11:20:22 -08:00
|
|
|
#if USE_CLIP_RELATIVE_TO_DESK
|
|
|
|
ERegionTranslate(clip, EoGetX(d), EoGetY(d));
|
|
|
|
#endif
|
2005-04-20 15:49:16 -07:00
|
|
|
if (eo1)
|
|
|
|
{
|
|
|
|
if (!eo_first)
|
|
|
|
eo_first = eo1;
|
|
|
|
if (eo_prev)
|
|
|
|
((ECmWinInfo *) (eo_prev->cmhook))->next = eo1;
|
|
|
|
((ECmWinInfo *) (eo1->cmhook))->prev = eo_prev;
|
|
|
|
eo_prev = eo2;
|
|
|
|
}
|
2005-12-04 15:53:20 -08:00
|
|
|
|
2006-01-08 15:44:14 -08:00
|
|
|
#if USE_BG_WIN_ON_ALL_DESKS /* Only if using per desk bg overlay */
|
2005-12-04 15:53:20 -08:00
|
|
|
/* FIXME - We should break when the clip region becomes empty */
|
|
|
|
if (eo->x == 0 && eo->y == 0)
|
|
|
|
stop = 1;
|
|
|
|
if (stop)
|
|
|
|
break;
|
|
|
|
#endif
|
2005-04-20 15:49:16 -07:00
|
|
|
}
|
|
|
|
|
2006-03-12 11:20:22 -08:00
|
|
|
cw->clip = ERegionClone(clip);
|
|
|
|
|
2005-09-18 11:04:28 -07:00
|
|
|
ECompMgrWinSetPicts(eo);
|
|
|
|
|
2005-08-10 12:23:58 -07:00
|
|
|
D4printf(" - %#lx desk=%d shown=%d dam=%d pict=%#lx\n",
|
2005-09-04 00:27:20 -07:00
|
|
|
eo->win, eo->desk->num, eo->shown, cw->damaged, cw->picture);
|
2005-04-20 15:49:16 -07:00
|
|
|
|
2005-06-11 01:43:11 -07:00
|
|
|
#if 0 /* FIXME - Need this? */
|
2005-04-22 00:10:18 -07:00
|
|
|
if (!cw->damaged)
|
2005-01-11 14:58:39 -08:00
|
|
|
continue;
|
2005-06-11 01:43:11 -07:00
|
|
|
#endif
|
2006-03-13 14:46:14 -08:00
|
|
|
if (cw->picture == None && !eo->noredir)
|
2005-01-11 14:58:39 -08:00
|
|
|
continue;
|
|
|
|
|
2005-04-20 15:49:16 -07:00
|
|
|
D4printf
|
2005-10-04 15:08:13 -07:00
|
|
|
("ECompMgrDetermineOrder hook in %d - %#lx desk=%d shown=%d\n",
|
2005-09-04 00:27:20 -07:00
|
|
|
dsk->num, eo->win, eo->desk->num, eo->shown);
|
2005-04-20 15:49:16 -07:00
|
|
|
|
2005-01-11 14:58:39 -08:00
|
|
|
if (!eo_first)
|
|
|
|
eo_first = eo;
|
2005-04-22 00:10:18 -07:00
|
|
|
cw->prev = eo_prev;
|
2005-01-11 14:58:39 -08:00
|
|
|
if (eo_prev)
|
|
|
|
((ECmWinInfo *) (eo_prev->cmhook))->next = eo;
|
|
|
|
eo_prev = eo;
|
|
|
|
|
2005-10-04 15:08:13 -07:00
|
|
|
switch (cw->mode)
|
|
|
|
{
|
|
|
|
case WINDOW_UNREDIR:
|
|
|
|
case WINDOW_SOLID:
|
|
|
|
D4printf("- clip %#lx %#lx %d,%d %dx%d: %s\n", eo->win, cw->clip,
|
|
|
|
eo->x, eo->y, eo->w, eo->h, eo->name);
|
2006-03-12 11:20:22 -08:00
|
|
|
#if USE_CLIP_RELATIVE_TO_DESK
|
|
|
|
ERegionUnionOffset(clip, 0, 0, cw->shape);
|
|
|
|
#else
|
|
|
|
ERegionUnionOffset(clip, EoGetX(dsk), EoGetY(dsk), cw->shape);
|
|
|
|
#endif
|
2005-10-04 15:08:13 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
D4printf("- noclip %#lx %#lx %d,%d %dx%d: %s\n", eo->win, cw->clip,
|
|
|
|
eo->x, eo->y, eo->w, eo->h, eo->name);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2006-01-08 15:44:14 -08:00
|
|
|
#if !USE_BG_WIN_ON_ALL_DESKS /* Not if using per desk bg overlay */
|
2005-12-04 15:53:20 -08:00
|
|
|
/* FIXME - We should break when the clip region becomes empty */
|
2005-01-11 14:58:39 -08:00
|
|
|
if (eo->type == EOBJ_TYPE_DESK && eo->x == 0 && eo->y == 0)
|
2005-04-20 15:49:16 -07:00
|
|
|
stop = 1;
|
|
|
|
if (stop)
|
2005-01-11 14:58:39 -08:00
|
|
|
break;
|
2005-12-04 15:53:20 -08:00
|
|
|
#endif
|
2005-01-11 14:58:39 -08:00
|
|
|
}
|
|
|
|
if (eo_prev)
|
|
|
|
((ECmWinInfo *) (eo_prev->cmhook))->next = NULL;
|
|
|
|
|
2005-04-20 15:49:16 -07:00
|
|
|
*first = eo_first;
|
|
|
|
*last = eo_prev;
|
|
|
|
|
2006-03-12 11:20:22 -08:00
|
|
|
if (destroy_clip)
|
|
|
|
ERegionDestroy(clip);
|
2005-10-04 15:08:13 -07:00
|
|
|
Mode_compmgr.reorder = 0;
|
2005-04-20 15:49:16 -07:00
|
|
|
return stop;
|
2005-01-11 14:58:39 -08:00
|
|
|
}
|
|
|
|
|
2006-03-12 11:20:22 -08:00
|
|
|
static XserverRegion
|
|
|
|
ECompMgrRepaintObjSetClip(XserverRegion rgn, XserverRegion damage,
|
|
|
|
XserverRegion clip, int x, int y)
|
|
|
|
{
|
|
|
|
ERegionCopy(rgn, damage);
|
|
|
|
#if USE_CLIP_RELATIVE_TO_DESK
|
|
|
|
ERegionSubtractOffset(rgn, x, y, clip);
|
|
|
|
#else
|
|
|
|
ERegionSubtractOffset(rgn, 0, 0, clip);
|
|
|
|
x = y = 0;
|
|
|
|
#endif
|
|
|
|
return rgn;
|
|
|
|
}
|
|
|
|
|
2005-01-11 14:58:39 -08:00
|
|
|
static void
|
|
|
|
ECompMgrRepaintObj(Picture pbuf, XserverRegion region, EObj * eo, int mode)
|
|
|
|
{
|
2006-03-12 11:20:22 -08:00
|
|
|
static XserverRegion rgn_clip = None;
|
2005-01-11 14:58:39 -08:00
|
|
|
Display *dpy = disp;
|
2005-04-22 00:10:18 -07:00
|
|
|
ECmWinInfo *cw;
|
2005-09-04 00:27:20 -07:00
|
|
|
Desk *dsk = eo->desk;
|
2005-04-20 15:49:16 -07:00
|
|
|
int x, y;
|
2006-03-12 11:20:22 -08:00
|
|
|
XserverRegion clip;
|
2006-03-04 05:56:18 -08:00
|
|
|
Picture alpha;
|
2005-01-11 14:58:39 -08:00
|
|
|
|
2005-04-22 00:10:18 -07:00
|
|
|
cw = eo->cmhook;
|
2005-01-01 09:58:46 -08:00
|
|
|
|
2006-03-12 11:20:22 -08:00
|
|
|
#if 0 /* FIXME - Remove? */
|
2005-09-30 11:56:45 -07:00
|
|
|
if (!cw->shape)
|
|
|
|
cw->shape = win_shape(eo);
|
2005-04-22 00:10:18 -07:00
|
|
|
if (!cw->extents)
|
2005-09-28 12:10:57 -07:00
|
|
|
cw->extents = win_extents(eo);
|
2005-10-04 15:08:13 -07:00
|
|
|
#endif
|
|
|
|
|
2006-03-12 11:20:22 -08:00
|
|
|
if (rgn_clip == None)
|
|
|
|
rgn_clip = ERegionCreate();
|
2005-01-01 09:58:46 -08:00
|
|
|
|
2005-09-04 00:27:20 -07:00
|
|
|
x = EoGetX(dsk);
|
|
|
|
y = EoGetY(dsk);
|
2005-04-20 15:49:16 -07:00
|
|
|
|
2005-01-11 14:58:39 -08:00
|
|
|
if (mode == 0)
|
2005-01-01 09:58:46 -08:00
|
|
|
{
|
2005-10-04 15:08:13 -07:00
|
|
|
/* Painting opaque windows top down. */
|
|
|
|
#if 0
|
|
|
|
if (ERegionIsEmpty(clip))
|
|
|
|
{
|
|
|
|
D2printf(" - Quit - repaint region is empty\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
2005-01-11 14:58:39 -08:00
|
|
|
|
2005-04-22 00:10:18 -07:00
|
|
|
switch (cw->mode)
|
2005-01-11 14:58:39 -08:00
|
|
|
{
|
2005-08-10 12:23:58 -07:00
|
|
|
case WINDOW_UNREDIR:
|
2005-01-11 14:58:39 -08:00
|
|
|
case WINDOW_SOLID:
|
2006-03-12 11:20:22 -08:00
|
|
|
clip = ECompMgrRepaintObjSetClip(rgn_clip, region, cw->clip, x, y);
|
2005-10-04 15:08:13 -07:00
|
|
|
if (EventDebug(EDBUG_TYPE_COMPMGR2))
|
|
|
|
ECompMgrWinDumpInfo("ECompMgrRepaintObj solid", eo, clip, 0);
|
|
|
|
XFixesSetPictureClipRegion(dpy, pbuf, 0, 0, clip);
|
2005-04-22 00:10:18 -07:00
|
|
|
XRenderComposite(dpy, PictOpSrc, cw->picture, None, pbuf,
|
|
|
|
0, 0, 0, 0, x + cw->rcx, y + cw->rcy, cw->rcw,
|
|
|
|
cw->rch);
|
2005-01-11 14:58:39 -08:00
|
|
|
break;
|
|
|
|
}
|
2005-01-01 09:58:46 -08:00
|
|
|
}
|
2005-01-11 14:58:39 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Painting trans stuff bottom up. */
|
|
|
|
|
2005-04-22 00:10:18 -07:00
|
|
|
switch (cw->mode)
|
2005-01-11 14:58:39 -08:00
|
|
|
{
|
2006-03-12 11:20:22 -08:00
|
|
|
default:
|
|
|
|
clip = None;
|
|
|
|
break;
|
|
|
|
|
2005-01-11 14:58:39 -08:00
|
|
|
case WINDOW_TRANS:
|
|
|
|
case WINDOW_ARGB:
|
2006-03-12 11:20:22 -08:00
|
|
|
clip = ECompMgrRepaintObjSetClip(rgn_clip, region, cw->clip, x, y);
|
2005-10-04 15:08:13 -07:00
|
|
|
if (EventDebug(EDBUG_TYPE_COMPMGR2))
|
|
|
|
ECompMgrWinDumpInfo("ECompMgrRepaintObj trans", eo, clip, 0);
|
|
|
|
XFixesSetPictureClipRegion(dpy, pbuf, 0, 0, clip);
|
2006-03-04 05:56:18 -08:00
|
|
|
if (cw->opacity != OPAQUE && !cw->pict_alpha)
|
|
|
|
cw->pict_alpha =
|
2006-03-08 12:10:27 -08:00
|
|
|
EPictureCreateSolid(True, OP32(cw->opacity), 0., 0., 0.);
|
2006-03-04 05:56:18 -08:00
|
|
|
XRenderComposite(dpy, PictOpOver, cw->picture, cw->pict_alpha,
|
|
|
|
pbuf, 0, 0, 0, 0, x + cw->rcx, y + cw->rcy,
|
|
|
|
cw->rcw, cw->rch);
|
2005-01-11 14:58:39 -08:00
|
|
|
break;
|
|
|
|
}
|
2005-01-01 09:58:46 -08:00
|
|
|
|
|
|
|
#if ENABLE_SHADOWS
|
2006-03-12 11:20:22 -08:00
|
|
|
if (!eo->shadow || Mode_compmgr.shadow_mode == ECM_SHADOWS_OFF)
|
2005-10-04 15:08:13 -07:00
|
|
|
return;
|
|
|
|
|
2006-03-12 11:20:22 -08:00
|
|
|
if (clip == None)
|
|
|
|
clip = ECompMgrRepaintObjSetClip(rgn_clip, region, cw->clip, x, y);
|
|
|
|
ERegionSubtractOffset(clip, x, y, cw->shape);
|
|
|
|
XFixesSetPictureClipRegion(dpy, pbuf, 0, 0, clip);
|
|
|
|
|
2006-03-04 05:56:18 -08:00
|
|
|
switch (Mode_compmgr.shadow_mode)
|
2005-01-01 09:58:46 -08:00
|
|
|
{
|
2005-01-11 14:58:39 -08:00
|
|
|
case ECM_SHADOWS_SHARP:
|
2006-03-08 12:10:27 -08:00
|
|
|
case ECM_SHADOWS_ECHO:
|
2006-03-04 05:56:18 -08:00
|
|
|
if (cw->opacity != OPAQUE && !cw->shadow_alpha)
|
|
|
|
cw->shadow_alpha =
|
|
|
|
EPictureCreateSolid(True,
|
|
|
|
OP32(cw->opacity) *
|
|
|
|
Mode_compmgr.opac_sharp, 0., 0., 0.);
|
|
|
|
alpha = cw->shadow_alpha ? cw->shadow_alpha : transBlackPicture;
|
2006-03-08 12:10:27 -08:00
|
|
|
if (Mode_compmgr.shadow_mode == ECM_SHADOWS_SHARP)
|
|
|
|
XRenderComposite(dpy, PictOpOver, alpha, cw->picture, pbuf,
|
|
|
|
0, 0, 0, 0,
|
|
|
|
x + cw->rcx + cw->shadow_dx,
|
|
|
|
y + cw->rcy + cw->shadow_dy,
|
|
|
|
cw->shadow_width, cw->shadow_height);
|
|
|
|
else
|
|
|
|
XRenderComposite(dpy, PictOpOver, cw->picture, alpha, pbuf,
|
|
|
|
0, 0, 0, 0,
|
|
|
|
x + cw->rcx + cw->shadow_dx,
|
|
|
|
y + cw->rcy + cw->shadow_dy,
|
|
|
|
cw->shadow_width, cw->shadow_height);
|
2005-01-11 14:58:39 -08:00
|
|
|
break;
|
2005-10-04 15:08:13 -07:00
|
|
|
|
2005-01-11 14:58:39 -08:00
|
|
|
case ECM_SHADOWS_BLURRED:
|
2006-03-04 05:56:18 -08:00
|
|
|
if (cw->shadow_pict == None)
|
2005-04-25 15:07:37 -07:00
|
|
|
break;
|
|
|
|
|
2006-03-08 12:10:27 -08:00
|
|
|
if (cw->opacity != OPAQUE && !cw->pict_alpha)
|
|
|
|
cw->pict_alpha =
|
|
|
|
EPictureCreateSolid(True, OP32(cw->opacity), 0., 0., 0.);
|
|
|
|
alpha = (cw->pict_alpha) ? cw->pict_alpha : transBlackPicture;
|
|
|
|
XRenderComposite(dpy, PictOpOver, alpha, cw->shadow_pict, pbuf,
|
|
|
|
0, 0, 0, 0,
|
2005-04-25 15:07:37 -07:00
|
|
|
x + cw->rcx + cw->shadow_dx,
|
2005-05-01 15:26:03 -07:00
|
|
|
y + cw->rcy + cw->shadow_dy,
|
|
|
|
cw->shadow_width, cw->shadow_height);
|
2005-01-11 14:58:39 -08:00
|
|
|
break;
|
2005-01-01 09:58:46 -08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-05-14 02:19:54 -07:00
|
|
|
void
|
2004-12-28 15:46:49 -08:00
|
|
|
ECompMgrRepaint(void)
|
|
|
|
{
|
|
|
|
Display *dpy = disp;
|
2005-01-11 14:58:39 -08:00
|
|
|
EObj *eo;
|
2005-12-04 01:38:28 -08:00
|
|
|
Picture pbuf;
|
2005-09-04 00:27:20 -07:00
|
|
|
Desk *dsk = DeskGet(0);
|
2005-03-31 15:22:02 -08:00
|
|
|
|
2005-06-11 04:45:55 -07:00
|
|
|
if (!Mode_compmgr.active || allDamage == None)
|
2005-05-14 03:04:01 -07:00
|
|
|
return;
|
|
|
|
|
2005-10-21 16:16:26 -07:00
|
|
|
ERegionLimit(allDamage);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
D2printf("ECompMgrRepaint rootBuffer=%#lx rootPicture=%#lx\n",
|
|
|
|
rootBuffer, rootPicture);
|
2006-01-08 15:44:14 -08:00
|
|
|
if (EventDebug(EDBUG_TYPE_COMPMGR))
|
2006-03-12 11:20:22 -08:00
|
|
|
ERegionShow("allDamage", allDamage);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
if (!rootBuffer)
|
|
|
|
rootBuffer = EPictureCreateBuffer(VRoot.win, VRoot.w, VRoot.h,
|
|
|
|
VRoot.depth, VRoot.vis);
|
|
|
|
pbuf = rootBuffer;
|
|
|
|
|
2005-09-04 00:27:20 -07:00
|
|
|
if (!dsk)
|
2005-03-31 15:22:02 -08:00
|
|
|
return;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-01-11 14:58:39 -08:00
|
|
|
/* Do paint order list linking */
|
2005-09-17 11:55:17 -07:00
|
|
|
if (Mode_compmgr.reorder)
|
2005-10-04 15:08:13 -07:00
|
|
|
ECompMgrDetermineOrder(NULL, 0, &Mode_compmgr.eo_first,
|
|
|
|
&Mode_compmgr.eo_last, dsk, None);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2006-03-12 11:20:22 -08:00
|
|
|
/* Paint opaque windows top down */
|
2005-01-11 14:58:39 -08:00
|
|
|
for (eo = Mode_compmgr.eo_first; eo;
|
|
|
|
eo = ((ECmWinInfo *) (eo->cmhook))->next)
|
2006-03-12 11:20:22 -08:00
|
|
|
ECompMgrRepaintObj(pbuf, allDamage, eo, 0);
|
2005-04-20 15:49:16 -07:00
|
|
|
|
2005-12-04 01:38:28 -08:00
|
|
|
#if 0 /* FIXME - NoBg? */
|
|
|
|
Picture pict;
|
|
|
|
|
2006-03-12 11:20:22 -08:00
|
|
|
if (EventDebug(EDBUG_TYPE_COMPMGR2))
|
|
|
|
ERegionShow("after opaque", region);
|
|
|
|
|
2005-03-31 15:22:02 -08:00
|
|
|
/* Repaint background, clipped by damage region and opaque windows */
|
2005-12-04 01:38:28 -08:00
|
|
|
pict = ((ECmWinInfo *) (dsk->o.cmhook))->picture;
|
2005-03-31 15:22:02 -08:00
|
|
|
D1printf("ECompMgrRepaint desk picture=%#lx\n", pict);
|
|
|
|
XFixesSetPictureClipRegion(dpy, pbuf, 0, 0, region);
|
|
|
|
XRenderComposite(dpy, PictOpSrc, pict, None, pbuf,
|
|
|
|
0, 0, 0, 0, 0, 0, VRoot.w, VRoot.h);
|
2005-12-04 01:38:28 -08:00
|
|
|
#endif
|
2005-03-31 15:22:02 -08:00
|
|
|
|
2005-01-11 14:58:39 -08:00
|
|
|
/* Paint trans windows and shadows bottom up */
|
|
|
|
for (eo = Mode_compmgr.eo_last; eo; eo = ((ECmWinInfo *) (eo->cmhook))->prev)
|
2005-10-04 15:08:13 -07:00
|
|
|
ECompMgrRepaintObj(pbuf, allDamage, eo, 1);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
if (pbuf != rootPicture)
|
|
|
|
{
|
2005-03-31 15:22:02 -08:00
|
|
|
XFixesSetPictureClipRegion(dpy, pbuf, 0, 0, allDamage);
|
2004-12-28 15:46:49 -08:00
|
|
|
XRenderComposite(dpy, PictOpSrc, pbuf, None, rootPicture,
|
|
|
|
0, 0, 0, 0, 0, 0, VRoot.w, VRoot.h);
|
|
|
|
}
|
|
|
|
|
2005-10-04 09:42:01 -07:00
|
|
|
ERegionDestroy(allDamage);
|
2004-12-28 15:46:49 -08:00
|
|
|
allDamage = None;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ECompMgrRootConfigure(void *prm __UNUSED__, XEvent * ev)
|
|
|
|
{
|
|
|
|
Display *dpy = disp;
|
|
|
|
|
|
|
|
D1printf("ECompMgrRootConfigure root\n");
|
|
|
|
if (ev->xconfigure.window == VRoot.win)
|
|
|
|
{
|
2005-07-24 13:00:27 -07:00
|
|
|
if (rootBuffer != None)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
|
|
|
XRenderFreePicture(dpy, rootBuffer);
|
|
|
|
rootBuffer = None;
|
|
|
|
}
|
2005-07-24 13:00:27 -07:00
|
|
|
|
|
|
|
if (Mode_compmgr.rgn_screen != None)
|
2005-10-04 09:42:01 -07:00
|
|
|
ERegionDestroy(Mode_compmgr.rgn_screen);
|
2005-07-24 13:00:27 -07:00
|
|
|
Mode_compmgr.rgn_screen = None;
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-01-14 06:30:51 -08:00
|
|
|
#if USE_DESK_EXPOSE /* FIXME - Remove? */
|
2004-12-28 15:46:49 -08:00
|
|
|
static void
|
|
|
|
ECompMgrRootExpose(void *prm __UNUSED__, XEvent * ev)
|
|
|
|
{
|
|
|
|
static XRectangle *expose_rects = 0;
|
|
|
|
static int size_expose = 0;
|
|
|
|
static int n_expose = 0;
|
|
|
|
int more = ev->xexpose.count + 1;
|
|
|
|
|
|
|
|
if (ev->xexpose.window != VRoot.win)
|
|
|
|
return;
|
|
|
|
|
|
|
|
D1printf("ECompMgrRootExpose %d %d %d\n", n_expose, size_expose,
|
|
|
|
ev->xexpose.count);
|
|
|
|
|
|
|
|
if (n_expose == size_expose)
|
|
|
|
{
|
|
|
|
if (expose_rects)
|
|
|
|
{
|
|
|
|
expose_rects = realloc(expose_rects,
|
|
|
|
(size_expose + more) * sizeof(XRectangle));
|
|
|
|
size_expose += more;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
expose_rects = malloc(more * sizeof(XRectangle));
|
|
|
|
size_expose = more;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
expose_rects[n_expose].x = ev->xexpose.x;
|
|
|
|
expose_rects[n_expose].y = ev->xexpose.y;
|
|
|
|
expose_rects[n_expose].width = ev->xexpose.width;
|
|
|
|
expose_rects[n_expose].height = ev->xexpose.height;
|
|
|
|
n_expose++;
|
|
|
|
if (ev->xexpose.count == 0)
|
|
|
|
{
|
|
|
|
XserverRegion region;
|
|
|
|
|
2005-10-04 09:42:01 -07:00
|
|
|
region = ERegionCreateFromRects(expose_rects, n_expose);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-08-06 03:31:35 -07:00
|
|
|
ECompMgrDamageMerge(region, 1);
|
2004-12-28 15:46:49 -08:00
|
|
|
n_expose = 0;
|
|
|
|
}
|
|
|
|
}
|
2005-04-25 15:07:37 -07:00
|
|
|
#endif
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
#if ENABLE_SHADOWS
|
|
|
|
static void
|
|
|
|
ECompMgrShadowsInit(int mode, int cleanup)
|
|
|
|
{
|
2006-03-04 05:56:18 -08:00
|
|
|
Mode_compmgr.shadow_mode = mode;
|
|
|
|
|
2006-04-02 01:45:40 -08:00
|
|
|
Conf_compmgr.shadows.blur.opacity =
|
|
|
|
OpacityFix(Conf_compmgr.shadows.blur.opacity);
|
2006-03-04 05:56:18 -08:00
|
|
|
Mode_compmgr.opac_blur = .01 * Conf_compmgr.shadows.blur.opacity;
|
2006-04-02 01:45:40 -08:00
|
|
|
Conf_compmgr.shadows.sharp.opacity =
|
|
|
|
OpacityFix(Conf_compmgr.shadows.sharp.opacity);
|
2006-03-04 05:56:18 -08:00
|
|
|
Mode_compmgr.opac_sharp = .01 * Conf_compmgr.shadows.sharp.opacity;
|
|
|
|
|
2006-03-08 12:10:27 -08:00
|
|
|
if (gaussianMap)
|
|
|
|
free(gaussianMap);
|
|
|
|
gaussianMap = NULL;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
if (mode != ECM_SHADOWS_OFF)
|
2006-03-04 05:56:18 -08:00
|
|
|
{
|
2006-03-08 12:10:27 -08:00
|
|
|
if (mode == ECM_SHADOWS_BLURRED)
|
|
|
|
transBlackPicture = EPictureCreateSolid(True, 1., 0., 0., 0.);
|
|
|
|
else
|
2006-03-04 05:56:18 -08:00
|
|
|
transBlackPicture =
|
|
|
|
EPictureCreateSolid(True, Mode_compmgr.opac_sharp, 0., 0., 0.);
|
|
|
|
}
|
2004-12-28 15:46:49 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (transBlackPicture)
|
|
|
|
XRenderFreePicture(disp, transBlackPicture);
|
|
|
|
transBlackPicture = None;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cleanup)
|
|
|
|
{
|
|
|
|
EObj *const *lst;
|
|
|
|
int i, num;
|
|
|
|
|
|
|
|
lst = EobjListStackGet(&num);
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
ECompMgrWinInvalidate(lst[i], INV_SHADOW);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define ECompMgrShadowsInit(mode, cleanup)
|
|
|
|
#endif
|
|
|
|
|
2006-02-27 11:14:25 -08:00
|
|
|
int
|
|
|
|
ECompMgrIsActive(void)
|
|
|
|
{
|
|
|
|
return Mode_compmgr.active;
|
|
|
|
}
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
static void
|
|
|
|
ECompMgrStart(void)
|
|
|
|
{
|
2005-04-20 15:49:16 -07:00
|
|
|
EObj *const *lst;
|
|
|
|
int i, num;
|
2004-12-28 15:46:49 -08:00
|
|
|
XRenderPictFormat *pictfmt;
|
|
|
|
XRenderPictureAttributes pa;
|
|
|
|
|
2005-06-11 04:45:55 -07:00
|
|
|
if (Mode_compmgr.active || Conf_compmgr.mode == ECM_MODE_OFF)
|
2004-12-28 15:46:49 -08:00
|
|
|
return;
|
2005-06-11 04:45:55 -07:00
|
|
|
Conf_compmgr.enable = Mode_compmgr.active = 1;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2006-04-02 01:45:40 -08:00
|
|
|
Conf_compmgr.override_redirect.opacity =
|
|
|
|
OpacityFix(Conf_compmgr.override_redirect.opacity);
|
2006-03-04 05:56:18 -08:00
|
|
|
Mode_compmgr.opac_or =
|
2006-04-02 01:45:40 -08:00
|
|
|
OpacityFromPercent(Conf_compmgr.override_redirect.opacity);
|
2006-01-08 15:44:14 -08:00
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
pa.subwindow_mode = IncludeInferiors;
|
|
|
|
pictfmt = XRenderFindVisualFormat(disp, VRoot.vis);
|
|
|
|
rootPicture =
|
|
|
|
XRenderCreatePicture(disp, VRoot.win, pictfmt, CPSubwindowMode, &pa);
|
|
|
|
|
2005-09-06 15:36:26 -07:00
|
|
|
ECompMgrShadowsInit(Conf_compmgr.shadows.mode, 0);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2006-03-04 05:56:18 -08:00
|
|
|
EGrabServer();
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
switch (Conf_compmgr.mode)
|
|
|
|
{
|
|
|
|
case ECM_MODE_ROOT:
|
|
|
|
XCompositeRedirectSubwindows(disp, VRoot.win, CompositeRedirectManual);
|
2006-01-14 06:30:51 -08:00
|
|
|
#if USE_DESK_EXPOSE /* FIXME - Remove? */
|
|
|
|
ESelectInputAdd(VRoot.win, ExposureMask);
|
|
|
|
#endif
|
2004-12-28 15:46:49 -08:00
|
|
|
break;
|
2005-04-20 15:49:16 -07:00
|
|
|
case ECM_MODE_WINDOW:
|
2006-01-14 06:30:51 -08:00
|
|
|
#if USE_DESK_EXPOSE /* FIXME - Remove? */
|
|
|
|
ESelectInputAdd(VRoot.win, ExposureMask);
|
|
|
|
#endif
|
2005-04-20 15:49:16 -07:00
|
|
|
break;
|
2004-12-28 15:46:49 -08:00
|
|
|
case ECM_MODE_AUTO:
|
|
|
|
XCompositeRedirectSubwindows(disp, VRoot.win,
|
|
|
|
CompositeRedirectAutomatic);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
allDamage = None;
|
|
|
|
|
|
|
|
EventCallbackRegister(VRoot.win, 0, ECompMgrHandleRootEvent, NULL);
|
2005-04-20 15:49:16 -07:00
|
|
|
|
|
|
|
lst = EobjListStackGet(&num);
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
|
|
|
ECompMgrWinNew(lst[i]);
|
|
|
|
if (lst[i]->shown)
|
|
|
|
ECompMgrWinMap(lst[i]);
|
|
|
|
}
|
2005-12-04 01:38:28 -08:00
|
|
|
|
2006-01-08 15:44:14 -08:00
|
|
|
#if !USE_BG_WIN_ON_ALL_DESKS
|
2006-02-27 11:14:25 -08:00
|
|
|
DesksBackgroundRefresh(NULL, DESK_BG_RECONFIGURE_ALL);
|
2005-12-12 12:49:02 -08:00
|
|
|
#endif
|
2006-01-08 15:44:14 -08:00
|
|
|
_ECM_SET_CLIP_CHANGED();
|
|
|
|
EUngrabServer();
|
|
|
|
ESync();
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ECompMgrStop(void)
|
|
|
|
{
|
2005-05-28 07:07:09 -07:00
|
|
|
EObj *const *lst1, **lst;
|
2004-12-28 15:46:49 -08:00
|
|
|
int i, num;
|
|
|
|
|
|
|
|
if (!Mode_compmgr.active)
|
|
|
|
return;
|
2005-06-11 04:45:55 -07:00
|
|
|
Conf_compmgr.enable = Mode_compmgr.active = 0;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2006-01-08 15:44:14 -08:00
|
|
|
EGrabServer();
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
if (rootPicture)
|
|
|
|
XRenderFreePicture(disp, rootPicture);
|
|
|
|
rootPicture = None;
|
|
|
|
|
|
|
|
if (rootBuffer)
|
|
|
|
XRenderFreePicture(disp, rootBuffer);
|
|
|
|
rootBuffer = None;
|
|
|
|
|
|
|
|
ECompMgrShadowsInit(ECM_SHADOWS_OFF, 0);
|
|
|
|
|
2005-05-28 07:07:09 -07:00
|
|
|
lst1 = EobjListStackGet(&num);
|
|
|
|
if (num > 0)
|
|
|
|
{
|
|
|
|
lst = Emalloc(num * sizeof(EObj *));
|
2005-10-30 11:40:49 -08:00
|
|
|
if (lst)
|
2005-05-28 07:07:09 -07:00
|
|
|
{
|
2005-10-30 11:40:49 -08:00
|
|
|
memcpy(lst, lst1, num * sizeof(EObj *));
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
|
|
|
if (lst[i]->type == EOBJ_TYPE_EXT)
|
|
|
|
EobjUnregister(lst[i]); /* Modifies the object stack! */
|
|
|
|
else
|
|
|
|
ECompMgrWinDel(lst[i]);
|
|
|
|
}
|
|
|
|
Efree(lst);
|
2005-05-28 07:07:09 -07:00
|
|
|
}
|
|
|
|
}
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-07-24 13:00:27 -07:00
|
|
|
if (allDamage != None)
|
2005-10-04 09:42:01 -07:00
|
|
|
ERegionDestroy(allDamage);
|
2005-04-20 15:49:16 -07:00
|
|
|
allDamage = None;
|
|
|
|
|
2005-07-24 13:00:27 -07:00
|
|
|
if (Mode_compmgr.rgn_screen != None)
|
2005-10-04 09:42:01 -07:00
|
|
|
ERegionDestroy(Mode_compmgr.rgn_screen);
|
2005-07-24 13:00:27 -07:00
|
|
|
Mode_compmgr.rgn_screen = None;
|
|
|
|
|
2005-04-20 15:49:16 -07:00
|
|
|
if (Conf_compmgr.mode == ECM_MODE_ROOT)
|
|
|
|
XCompositeUnredirectSubwindows(disp, VRoot.win, CompositeRedirectManual);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
EventCallbackUnregister(VRoot.win, 0, ECompMgrHandleRootEvent, NULL);
|
2005-08-13 09:23:59 -07:00
|
|
|
|
2006-01-08 15:44:14 -08:00
|
|
|
#if !USE_BG_WIN_ON_ALL_DESKS
|
2006-02-27 11:14:25 -08:00
|
|
|
DesksBackgroundRefresh(NULL, DESK_BG_RECONFIGURE_ALL);
|
2005-12-12 12:49:02 -08:00
|
|
|
#endif
|
2006-01-08 15:44:14 -08:00
|
|
|
EUngrabServer();
|
|
|
|
ESync();
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ECompMgrConfigGet(cfg_composite * cfg)
|
|
|
|
{
|
|
|
|
cfg->enable = Conf_compmgr.enable;
|
2005-09-06 15:36:26 -07:00
|
|
|
cfg->shadow = Conf_compmgr.shadows.mode;
|
2005-10-19 12:32:00 -07:00
|
|
|
cfg->fading = Conf_compmgr.fading.enable;
|
|
|
|
cfg->fade_speed = 100 - (Conf_compmgr.fading.dt_us / 1000);
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ECompMgrConfigSet(const cfg_composite * cfg)
|
|
|
|
{
|
2005-01-01 09:58:46 -08:00
|
|
|
if (Conf_compmgr.mode == ECM_MODE_OFF)
|
2005-03-30 10:12:56 -08:00
|
|
|
{
|
|
|
|
if (cfg->enable)
|
|
|
|
DialogOK("Enable Composite Error",
|
|
|
|
_("Cannot enable Composite Manager.\n"
|
|
|
|
"Use xdpyinfo to check that\n"
|
|
|
|
"Composite, Damage, Fixes, and Render\n"
|
|
|
|
"extensions are loaded."));
|
|
|
|
return;
|
|
|
|
}
|
2005-01-01 09:58:46 -08:00
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
if (cfg->enable != Conf_compmgr.enable)
|
|
|
|
{
|
|
|
|
Conf_compmgr.enable = cfg->enable;
|
2005-09-06 15:36:26 -07:00
|
|
|
Conf_compmgr.shadows.mode = cfg->shadow;
|
2004-12-28 15:46:49 -08:00
|
|
|
if (cfg->enable)
|
|
|
|
ECompMgrStart();
|
|
|
|
else
|
|
|
|
ECompMgrStop();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-09-06 15:36:26 -07:00
|
|
|
if (cfg->shadow != Conf_compmgr.shadows.mode)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
2005-09-06 15:36:26 -07:00
|
|
|
Conf_compmgr.shadows.mode = cfg->shadow;
|
2004-12-28 15:46:49 -08:00
|
|
|
if (Conf_compmgr.enable)
|
|
|
|
{
|
2005-09-06 15:36:26 -07:00
|
|
|
ECompMgrShadowsInit(Conf_compmgr.shadows.mode, 1);
|
2004-12-28 15:46:49 -08:00
|
|
|
ECompMgrDamageAll();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-11 03:39:16 -07:00
|
|
|
Conf_compmgr.fading.enable = cfg->fading;
|
2005-10-19 12:32:00 -07:00
|
|
|
Conf_compmgr.fading.dt_us = (100 - cfg->fade_speed) * 1000;
|
2005-09-11 03:39:16 -07:00
|
|
|
|
2005-06-11 04:45:55 -07:00
|
|
|
autosave();
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Event handlers
|
|
|
|
*/
|
2005-04-20 15:49:16 -07:00
|
|
|
#define USE_WINDOW_EVENTS 0
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
static void
|
|
|
|
ECompMgrHandleWindowEvent(XEvent * ev, void *prm)
|
|
|
|
{
|
|
|
|
EObj *eo = prm;
|
|
|
|
|
2005-04-20 15:49:16 -07:00
|
|
|
D2printf("ECompMgrHandleWindowEvent: type=%d\n", ev->type);
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
switch (ev->type)
|
|
|
|
{
|
2005-04-20 15:49:16 -07:00
|
|
|
#if USE_WINDOW_EVENTS
|
2004-12-28 15:46:49 -08:00
|
|
|
case ConfigureNotify:
|
|
|
|
ECompMgrWinConfigure(eo, ev);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MapNotify:
|
2005-04-20 15:49:16 -07:00
|
|
|
ECompMgrWinMap(eo);
|
2004-12-28 15:46:49 -08:00
|
|
|
break;
|
|
|
|
case UnmapNotify:
|
2005-04-25 15:07:37 -07:00
|
|
|
if (eo->type == EOBJ_TYPE_EXT && eo->cmhook)
|
|
|
|
{
|
|
|
|
ECompMgrWinUnmap(eo);
|
|
|
|
eo->shown = 0;
|
|
|
|
}
|
2004-12-28 15:46:49 -08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CirculateNotify:
|
|
|
|
ECompMgrWinCirculate(eo, ev);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2006-01-14 06:30:51 -08:00
|
|
|
#if USE_DESK_VISIBILITY
|
|
|
|
case VisibilityNotify:
|
|
|
|
ECompMgrDeskVisibility(eo, ev);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
case EX_EVENT_DAMAGE_NOTIFY:
|
|
|
|
ECompMgrWinDamage(eo, ev);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ECompMgrHandleRootEvent(XEvent * ev, void *prm)
|
|
|
|
{
|
2005-08-07 03:51:07 -07:00
|
|
|
Window xwin;
|
2004-12-28 15:46:49 -08:00
|
|
|
EObj *eo;
|
|
|
|
|
2005-04-20 15:49:16 -07:00
|
|
|
D2printf("ECompMgrHandleRootEvent: type=%d\n", ev->type);
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
switch (ev->type)
|
|
|
|
{
|
|
|
|
case CreateNotify:
|
2005-08-07 03:51:07 -07:00
|
|
|
xwin = ev->xcreatewindow.window;
|
2004-12-28 15:46:49 -08:00
|
|
|
case_CreateNotify:
|
2005-10-30 11:40:49 -08:00
|
|
|
if (Conf_compmgr.override_redirect.mode != ECM_OR_ON_CREATE)
|
2005-08-07 03:51:07 -07:00
|
|
|
break;
|
|
|
|
eo = EobjListStackFind(xwin);
|
|
|
|
if (!eo)
|
|
|
|
EobjRegister(xwin, EOBJ_TYPE_EXT);
|
2004-12-28 15:46:49 -08:00
|
|
|
break;
|
2005-08-07 03:51:07 -07:00
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
case DestroyNotify:
|
2005-08-07 03:51:07 -07:00
|
|
|
xwin = ev->xdestroywindow.window;
|
|
|
|
case_DestroyNotify:
|
|
|
|
eo = EobjListStackFind(xwin);
|
2005-05-15 13:01:30 -07:00
|
|
|
if (eo && eo->type == EOBJ_TYPE_EXT)
|
2005-09-21 11:54:15 -07:00
|
|
|
{
|
|
|
|
if (ev->type == DestroyNotify)
|
|
|
|
eo->gone = 1;
|
|
|
|
EobjUnregister(eo);
|
|
|
|
}
|
2004-12-28 15:46:49 -08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ReparentNotify:
|
2005-10-23 08:02:51 -07:00
|
|
|
case EX_EVENT_REPARENT_GONE:
|
2005-08-07 03:51:07 -07:00
|
|
|
xwin = ev->xreparent.window;
|
2004-12-28 15:46:49 -08:00
|
|
|
if (ev->xreparent.parent == VRoot.win)
|
|
|
|
goto case_CreateNotify;
|
2005-08-07 03:51:07 -07:00
|
|
|
else
|
|
|
|
goto case_DestroyNotify;
|
2004-12-28 15:46:49 -08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ConfigureNotify:
|
|
|
|
if (ev->xconfigure.window == VRoot.win)
|
|
|
|
{
|
|
|
|
ECompMgrRootConfigure(prm, ev);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
eo = EobjListStackFind(ev->xconfigure.window);
|
2005-04-25 15:07:37 -07:00
|
|
|
if (eo && eo->type == EOBJ_TYPE_EXT && eo->cmhook)
|
|
|
|
{
|
|
|
|
ECompMgrWinConfigure(eo, ev);
|
|
|
|
}
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MapNotify:
|
|
|
|
eo = EobjListStackFind(ev->xmap.window);
|
2006-03-13 14:46:14 -08:00
|
|
|
if (!eo)
|
2005-04-12 09:43:39 -07:00
|
|
|
eo = EobjRegister(ev->xmap.window, EOBJ_TYPE_EXT);
|
2005-04-25 15:07:37 -07:00
|
|
|
if (eo && eo->type == EOBJ_TYPE_EXT && eo->cmhook)
|
|
|
|
{
|
|
|
|
eo->shown = 1;
|
2005-09-04 14:17:32 -07:00
|
|
|
EobjListStackRaise(eo);
|
2005-04-25 15:07:37 -07:00
|
|
|
ECompMgrWinMap(eo);
|
|
|
|
}
|
2004-12-28 15:46:49 -08:00
|
|
|
break;
|
2005-08-07 03:51:07 -07:00
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
case UnmapNotify:
|
2005-10-23 08:02:51 -07:00
|
|
|
case EX_EVENT_UNMAP_GONE:
|
2004-12-28 15:46:49 -08:00
|
|
|
eo = EobjListStackFind(ev->xunmap.window);
|
2005-04-25 15:07:37 -07:00
|
|
|
if (eo && eo->type == EOBJ_TYPE_EXT && eo->cmhook)
|
|
|
|
{
|
2005-10-23 08:02:51 -07:00
|
|
|
if (ev->type == EX_EVENT_UNMAP_GONE)
|
|
|
|
eo->gone = 1;
|
2005-08-07 03:51:07 -07:00
|
|
|
#if 0
|
|
|
|
/* No. Unredirection seems to cause map/unmap => loop */
|
|
|
|
if (Conf_compmgr.override_redirect.mode == ECM_OR_ON_MAPUNMAP)
|
|
|
|
{
|
|
|
|
EobjUnregister(eo);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
ECompMgrWinUnmap(eo);
|
|
|
|
eo->shown = 0;
|
|
|
|
}
|
2005-04-25 15:07:37 -07:00
|
|
|
}
|
2004-12-28 15:46:49 -08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CirculateNotify:
|
|
|
|
eo = EobjListStackFind(ev->xcirculate.window);
|
|
|
|
if (eo && eo->cmhook)
|
|
|
|
ECompMgrWinCirculate(eo, ev);
|
|
|
|
break;
|
|
|
|
|
2006-01-14 06:30:51 -08:00
|
|
|
#if USE_DESK_EXPOSE /* FIXME - Remove? */
|
2004-12-28 15:46:49 -08:00
|
|
|
case Expose:
|
2006-03-04 05:56:18 -08:00
|
|
|
if (Mode_compmgr.shadow_mode != ECM_SHADOWS_OFF)
|
2005-05-02 15:11:01 -07:00
|
|
|
ECompMgrRootExpose(prm, ev);
|
2004-12-28 15:46:49 -08:00
|
|
|
break;
|
2005-12-04 15:53:20 -08:00
|
|
|
#endif
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Module functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
ECompMgrInit(void)
|
|
|
|
{
|
2006-03-19 07:33:38 -08:00
|
|
|
if (!XEXT_AVAILABLE(XEXT_CM_ALL))
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
|
|
|
Conf_compmgr.mode = ECM_MODE_OFF;
|
|
|
|
goto done;
|
|
|
|
}
|
2005-07-10 13:16:47 -07:00
|
|
|
|
|
|
|
Mode_compmgr.use_pixmap = Conf_compmgr.use_name_pixmap;
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2005-02-06 03:50:19 -08:00
|
|
|
if (Conf_compmgr.mode == ECM_MODE_OFF)
|
|
|
|
Conf_compmgr.mode = ECM_MODE_ROOT;
|
|
|
|
|
2005-04-20 15:49:16 -07:00
|
|
|
/* FIXME - Hardcode for now. */
|
|
|
|
Conf_compmgr.mode = ECM_MODE_WINDOW;
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
done:
|
|
|
|
if (Conf_compmgr.mode == ECM_MODE_OFF)
|
|
|
|
Conf_compmgr.enable = 0;
|
|
|
|
D1printf("ECompMgrInit: enable=%d mode=%d\n", Conf_compmgr.enable,
|
|
|
|
Conf_compmgr.mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-12-04 01:38:28 -08:00
|
|
|
ECompMgrSighan(int sig, void *prm __UNUSED__)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
|
|
|
if (sig != ESIGNAL_INIT && Conf_compmgr.mode == ECM_MODE_OFF)
|
|
|
|
return;
|
|
|
|
|
|
|
|
switch (sig)
|
|
|
|
{
|
|
|
|
case ESIGNAL_INIT:
|
|
|
|
ECompMgrInit();
|
2005-06-11 04:45:55 -07:00
|
|
|
if (Conf_compmgr.enable)
|
|
|
|
ECompMgrStart();
|
2004-12-28 15:46:49 -08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ESIGNAL_IDLE:
|
|
|
|
/* Do we get here on auto? */
|
|
|
|
if (!allDamage /* || Conf_compmgr.mode == ECM_MODE_AUTO */ )
|
|
|
|
return;
|
|
|
|
ECompMgrRepaint();
|
|
|
|
XSync(disp, False);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
CompMgrIpc(const char *params, Client * c __UNUSED__)
|
|
|
|
{
|
|
|
|
const char *p;
|
|
|
|
char cmd[128], prm[4096];
|
|
|
|
int len;
|
|
|
|
|
|
|
|
cmd[0] = prm[0] = '\0';
|
|
|
|
p = params;
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
len = 0;
|
|
|
|
sscanf(p, "%100s %4000s %n", cmd, prm, &len);
|
|
|
|
p += len;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!p || cmd[0] == '?')
|
|
|
|
{
|
|
|
|
IpcPrintf("CompMgr - on=%d\n", Mode_compmgr.active);
|
|
|
|
}
|
|
|
|
else if (!strcmp(cmd, "cfg"))
|
|
|
|
{
|
|
|
|
SettingsComposite();
|
|
|
|
}
|
|
|
|
else if (!strcmp(cmd, "start"))
|
|
|
|
{
|
|
|
|
ECompMgrStart();
|
2005-06-11 04:45:55 -07:00
|
|
|
autosave();
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
else if (!strcmp(cmd, "stop"))
|
|
|
|
{
|
|
|
|
ECompMgrStop();
|
2005-06-11 04:45:55 -07:00
|
|
|
autosave();
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
else if (!strncmp(cmd, "list", 2))
|
|
|
|
{
|
|
|
|
/* TBD */
|
|
|
|
}
|
2005-10-04 15:08:13 -07:00
|
|
|
else if (!strncmp(cmd, "oi", 2))
|
|
|
|
{
|
|
|
|
Window win;
|
|
|
|
EObj *eo;
|
|
|
|
|
|
|
|
win = None;
|
|
|
|
sscanf(prm, "%lx", &win);
|
|
|
|
eo = EobjListStackFind(win);
|
|
|
|
if (eo)
|
|
|
|
ECompMgrWinDumpInfo("EObj", eo, None, 1);
|
|
|
|
}
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
|
|
|
|
2005-10-30 11:40:49 -08:00
|
|
|
static const IpcItem CompMgrIpcArray[] = {
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
|
|
|
CompMgrIpc,
|
|
|
|
"compmgr", "cm",
|
|
|
|
"Composite manager functions",
|
|
|
|
" cm ? Show info\n"
|
|
|
|
" cm cfg Configure\n"
|
|
|
|
" cm start Start composite manager\n"
|
|
|
|
" cm stop Stop composite manager\n"}
|
|
|
|
,
|
|
|
|
};
|
|
|
|
#define N_IPC_FUNCS (sizeof(CompMgrIpcArray)/sizeof(IpcItem))
|
|
|
|
|
|
|
|
static const CfgItem CompMgrCfgItems[] = {
|
|
|
|
CFG_ITEM_BOOL(Conf_compmgr, enable, 0),
|
|
|
|
CFG_ITEM_INT(Conf_compmgr, mode, 1),
|
2005-09-06 15:36:26 -07:00
|
|
|
CFG_ITEM_INT(Conf_compmgr, shadows.mode, 0),
|
2006-01-12 13:37:33 -08:00
|
|
|
CFG_ITEM_INT(Conf_compmgr, shadows.offset_x, 3),
|
|
|
|
CFG_ITEM_INT(Conf_compmgr, shadows.offset_y, 5),
|
|
|
|
CFG_ITEM_INT(Conf_compmgr, shadows.blur.radius, 5),
|
2006-03-04 05:56:18 -08:00
|
|
|
CFG_ITEM_INT(Conf_compmgr, shadows.blur.opacity, 75),
|
|
|
|
CFG_ITEM_INT(Conf_compmgr, shadows.sharp.opacity, 30),
|
2004-12-28 15:46:49 -08:00
|
|
|
CFG_ITEM_BOOL(Conf_compmgr, resize_fix_enable, 0),
|
2005-02-06 04:54:09 -08:00
|
|
|
CFG_ITEM_BOOL(Conf_compmgr, use_name_pixmap, 0),
|
2005-09-06 15:36:26 -07:00
|
|
|
CFG_ITEM_BOOL(Conf_compmgr, fading.enable, 1),
|
2005-09-04 14:17:32 -07:00
|
|
|
CFG_ITEM_INT(Conf_compmgr, fading.dt_us, 10000),
|
|
|
|
CFG_ITEM_INT(Conf_compmgr, fading.step, 0x10000000),
|
|
|
|
CFG_ITEM_INT(Conf_compmgr, override_redirect.mode, 1),
|
2006-03-04 05:56:18 -08:00
|
|
|
CFG_ITEM_INT(Conf_compmgr, override_redirect.opacity, 90),
|
2004-12-28 15:46:49 -08:00
|
|
|
};
|
|
|
|
#define N_CFG_ITEMS (sizeof(CompMgrCfgItems)/sizeof(CfgItem))
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Module descriptor
|
|
|
|
*/
|
|
|
|
EModule ModCompMgr = {
|
|
|
|
"compmgr", "cm",
|
|
|
|
ECompMgrSighan,
|
|
|
|
{N_IPC_FUNCS, CompMgrIpcArray},
|
|
|
|
{N_CFG_ITEMS, CompMgrCfgItems}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* USE_COMPOSITE */
|
2005-04-22 00:10:18 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* $Id: xcompmgr.c,v 1.26 2004/08/14 21:39:51 keithp Exp $
|
|
|
|
*
|
|
|
|
* Copyright © 2003 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
|
|
|
|
* the above copyright notice appear in all copies and that both that
|
|
|
|
* copyright notice and this permission notice appear in supporting
|
|
|
|
* documentation, and that the name of Keith Packard not be used in
|
|
|
|
* advertising or publicity pertaining to distribution of the software without
|
|
|
|
* specific, written prior permission. Keith Packard makes no
|
|
|
|
* representations about the suitability of this software for any purpose. It
|
|
|
|
* is provided "as is" without express or implied warranty.
|
|
|
|
*
|
|
|
|
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
|
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
|
|
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
|
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
|
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
|
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Modified by Matthew Hawn. I don't know what to say here so follow what it
|
|
|
|
* says above. Not that I can really do anything about it
|
|
|
|
*/
|