Composite manager - Prepare for handling unredirected windows, cleanups.

SVN revision: 16096
This commit is contained in:
Kim Woelders 2005-08-10 19:23:58 +00:00
parent 3eedd13ae5
commit d7a6b8fdcf
6 changed files with 48 additions and 38 deletions

View File

@ -37,9 +37,6 @@
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <sys/poll.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@ -83,7 +80,6 @@ typedef struct
struct
{
int class; /* FIXME - Remove? */
int map_state; /* FIXME - Remove? */
int depth; /* FIXME - Remove? */
Visual *visual; /* FIXME - Remove? */
int border_width;
@ -168,9 +164,10 @@ static XserverRegion allDamage;
#define OPAQUE 0xffffffff
#define WINDOW_SOLID 0
#define WINDOW_TRANS 1
#define WINDOW_ARGB 2
#define WINDOW_UNREDIR 0
#define WINDOW_SOLID 1
#define WINDOW_TRANS 2
#define WINDOW_ARGB 3
static void ECompMgrWinSetPicts(EObj * eo);
static void ECompMgrDamageAll(void);
@ -972,7 +969,9 @@ ECompMgrWinChangeOpacity(EObj * eo, unsigned int opacity)
/* Invalidate stuff changed by opacity */
ECompMgrWinInvalidate(eo, INV_OPACITY);
if (EVisualIsARGB(cw->a.visual))
if (eo->noredir)
mode = WINDOW_UNREDIR;
else if (EVisualIsARGB(cw->a.visual))
mode = WINDOW_ARGB;
else if (cw->opacity != OPAQUE)
mode = WINDOW_TRANS;
@ -996,9 +995,6 @@ ECompMgrWinMap(EObj * eo)
D1printf("ECompMgrWinMap %#lx\n", eo->win);
cw->a.map_state = IsViewable;
cw->visible = 1;
#if CAN_DO_USABLE
cw->damage_bounds.x = cw->damage_bounds.y = 0;
cw->damage_bounds.width = cw->damage_bounds.height = 0;
@ -1017,8 +1013,6 @@ ECompMgrWinUnmap(EObj * eo)
D1printf("ECompMgrWinUnmap %#lx\n", eo->win);
cw->visible = 0;
if (cw->extents != None)
ECompMgrDamageMergeObject(eo, cw->extents, 0);
@ -1090,12 +1084,14 @@ ECompMgrWinNew(EObj * eo)
#endif
cw->a.class = attr.class; /* FIXME - remove */
cw->a.map_state = attr.map_state; /* FIXME - remove */
cw->a.depth = attr.depth;
cw->a.visual = attr.visual;
cw->a.border_width = attr.border_width;
if (eo->type != EOBJ_TYPE_DESK)
if (eo->type == EOBJ_TYPE_DESK)
eo->noredir = 1;
if (!eo->noredir)
{
if (Conf_compmgr.mode == ECM_MODE_WINDOW)
XCompositeRedirectWindow(disp, eo->win, CompositeRedirectManual);
@ -1292,21 +1288,22 @@ ECompMgrWinDel(EObj * eo)
DeskBackgroundPictureFree((Desk *) eo);
cw->pixmap = None;
}
else
if (!eo->noredir)
{
if (!eo->gone && Conf_compmgr.mode == ECM_MODE_WINDOW)
XCompositeUnredirectWindow(disp, eo->win, CompositeRedirectManual);
}
ECompMgrWinInvalidate(eo, INV_ALL);
ECompMgrWinInvalidate(eo, INV_ALL);
if (!eo->gone)
{
if (cw->picture != None)
XRenderFreePicture(disp, cw->picture);
if (!eo->gone)
{
if (cw->picture != None)
XRenderFreePicture(disp, cw->picture);
if (cw->damage != None)
XDamageDestroy(disp, cw->damage);
}
if (cw->damage != None)
XDamageDestroy(disp, cw->damage);
}
_EFREE(eo->cmhook);
@ -1465,12 +1462,9 @@ ECompMgrRepaintDetermineOrder(EObj * const *lst, int num, EObj ** first,
if (!cw)
continue;
D4printf(" - %#lx desk=%d shown=%d vis=%d dam=%d pict=%#lx\n",
eo->win, eo->desk, eo->shown, cw->visible, cw->damaged,
cw->picture);
D4printf(" - %#lx desk=%d shown=%d dam=%d pict=%#lx\n",
eo->win, eo->desk, eo->shown, cw->damaged, cw->picture);
if (!cw->visible)
continue;
#if CAN_DO_USABLE
if (!cw->usable)
continue;
@ -1569,6 +1563,7 @@ ECompMgrRepaintObj(Picture pbuf, XserverRegion region, EObj * eo, int mode)
switch (cw->mode)
{
case WINDOW_UNREDIR:
case WINDOW_SOLID:
D2printf(" * solid pict=%#lx d=%d l=%d\n",
cw->picture, eo->desk, eo->ilayer);

View File

@ -41,6 +41,7 @@ struct _eobj
char gone;
#if USE_COMPOSITE
char shadow; /* Enable shadows */
char noredir; /* Do not redirect */
unsigned int opacity;
void *cmhook;
#endif
@ -80,11 +81,12 @@ struct _eobj
#define EoChangeOpacity(eo, _o) EobjChangeOpacity(EoObj(eo), _o)
#define EoSetShadow(eo, _x) (eo)->o.shadow = (_x)
#define EoGetShadow(eo) ((eo)->o.shadow)
#define EoSetNoRedirect(eo, _x) (eo)->o.noredir = (_x)
#define EoGetNoRedirect(eo) ((eo)->o.noredir)
#else
#define EoSetOpacity(eo, _o)
#define EoChangeOpacity(eo, _o)
#define EoSetShadow(eo, _x)
#define EoGetShadow(eo) 0
#endif
#define EoMap(eo, raise) EobjMap(EoObj(eo), raise)

View File

@ -68,6 +68,7 @@ static const WinOp winops[] = {
{"skiplists", 4, 1, 1, EWIN_OP_SKIP_LISTS},
{"zoom", 2, 1, 0, EWIN_OP_ZOOM},
{"snap", 0, 1, 0, EWIN_OP_SNAP},
{"noredir", 4, 1, 1, EWIN_OP_NO_REDIRECT},
{NULL, 0, 0, 0, EWIN_OP_INVALID} /* Terminator */
};

View File

@ -57,6 +57,7 @@ typedef enum
EWIN_OP_SKIP_LISTS,
EWIN_OP_ZOOM,
EWIN_OP_SNAP,
EWIN_OP_NO_REDIRECT,
} winop_e;
typedef struct

View File

@ -465,6 +465,13 @@ IPC_WinOps(const char *params, Client * c __UNUSED__)
if (SetEwinBoolean("shadow", &on, param1, 0))
EoSetShadow(ewin, !on);
break;
case EWIN_OP_NO_REDIRECT:
on = EoGetNoRedirect(ewin);
on = ewin->o.noredir;
if (SetEwinBoolean("noredir", &on, param1, 0))
EoSetNoRedirect(ewin, !on);
break;
#endif
case EWIN_OP_SHADE:
@ -1087,7 +1094,7 @@ EwinShowInfo2(const EWin * ewin)
"State %i Shown %i Visibility %i Active %i\n"
"Member of groups %i\n"
#if USE_COMPOSITE
"Opacity %3i(%x) Shadow %i\n"
"Opacity %3i(%x) Shadow %i NoRedirect %i\n"
#else
"Opacity %3i\n"
#endif
@ -1131,9 +1138,9 @@ EwinShowInfo2(const EWin * ewin)
ewin->state.iconified, EoIsSticky(ewin), ewin->state.shaded,
ewin->state.docked, ewin->state.state, EoIsShown(ewin),
ewin->state.visibility, ewin->state.active, ewin->num_groups,
ewin->ewmh.opacity
ewin->ewmh.opacity >> 24
#if USE_COMPOSITE
, EoGetOpacity(ewin), EoGetShadow(ewin)
, EoGetOpacity(ewin), EoGetShadow(ewin), EoGetNoRedirect(ewin)
#endif
);
}
@ -1208,19 +1215,19 @@ IPC_ObjInfo(const char *params __UNUSED__, Client * c __UNUSED__)
lst = EobjListStackGet(&num);
IpcPrintf("Num window T V D L pos size S F C Name\n");
IpcPrintf("Num window T V D S F L pos size C R Name\n");
for (i = 0; i < num; i++)
{
eo = lst[i];
IpcPrintf(" %2d %#lx %d %d %2d %3d %5d,%5d %4dx%4d %d %d %d %s\n", i,
eo->win, eo->type, eo->shown, eo->desk, eo->ilayer,
eo->x, eo->y, eo->w, eo->h, eo->sticky, eo->floating,
IpcPrintf(" %2d %#lx %d %d %2d %d %d %3d %5d,%5d %4dx%4d %d %d %s\n",
i, eo->win, eo->type, eo->shown, eo->desk, eo->sticky,
eo->floating, eo->ilayer, eo->x, eo->y, eo->w, eo->h,
#if USE_COMPOSITE
(eo->cmhook) ? 1 : 0,
#else
0,
#endif
eo->name);
!eo->noredir, eo->name);
}
}

View File

@ -717,6 +717,10 @@ WindowMatchEwinOpsAction(EWin * ewin, int op, const char *args)
case EWIN_OP_SHADOW:
WINOP_GET_BOOL(ewin->o.shadow, args);
break;
case EWIN_OP_NO_REDIRECT:
WINOP_GET_BOOL(ewin->o.noredir, args);
break;
#endif
case EWIN_OP_TITLE: