ARGB window tweaks and testing stuff.

SVN revision: 23145
This commit is contained in:
Kim Woelders 2006-06-03 14:11:34 +00:00
parent 10cac01945
commit aee9424bc1
11 changed files with 127 additions and 54 deletions

View File

@ -383,6 +383,13 @@ typedef struct
char warp_on_select;
int icon_mode;
} warplist;
struct
{
char argb_internal_objects;
char argb_internal_clients;
char argb_clients;
char argb_clients_inherit_attr;
} testing;
int deskmode;
char animate_shading;
int shadespeed;

View File

@ -251,7 +251,7 @@ DialogCreate(const char *name)
ecore_list_append(dialog_list, d);
d->name = Estrdup(name);
d->win = ECreateWindow(VRoot.win, -20, -20, 2, 2, 0);
d->win = ECreateClientWindow(VRoot.win, -20, -20, 2, 2);
EventCallbackRegister(d->win, 0, DialogHandleEvents, d);
d->tclass = TextclassFind("DIALOG", 1);

View File

@ -158,9 +158,12 @@ void
EobjInit(EObj * eo, int type, Win win, int x, int y, int w, int h,
int su, const char *name)
{
char argb;
if (!eo->desk)
eo->desk = DeskGet(0);
if (win == None)
if (!win)
{
if (type == EOBJ_TYPE_EVENT)
{
@ -169,7 +172,9 @@ EobjInit(EObj * eo, int type, Win win, int x, int y, int w, int h,
}
else
{
win = ECreateWindow(EoGetWin(eo->desk), x, y, w, h, su);
win = ECreateObjectWindow(EoGetWin(eo->desk), x, y, w, h, su, 0,
NULL, &argb);
eo->argb = argb;
}
}
eo->type = type;

View File

@ -181,6 +181,7 @@ EwinManage(EWin * ewin)
{
XSetWindowAttributes att;
Win frame;
char argb;
if (ewin->client.w <= 0)
ewin->client.w = 100;
@ -190,30 +191,13 @@ EwinManage(EWin * ewin)
if (ewin->state.docked)
ewin->inh_wm.b.border = 1;
#if USE_COMPOSITE
if (EVisualIsARGB(WinGetVisual(_EwinGetClientWin(ewin))))
{
XWindowAttributes win_attr;
ewin->o.argb = 1;
EGetWindowAttributes(_EwinGetClientWin(ewin), &win_attr);
frame =
ECreateVisualWindow(VRoot.win, ewin->client.x, ewin->client.y,
ewin->client.w, ewin->client.h, 1, &win_attr);
ewin->win_container =
ECreateVisualWindow(frame, 0, 0, ewin->client.w, ewin->client.h,
0, &win_attr);
}
else
#endif
{
frame =
ECreateWindow(VRoot.win, ewin->client.x, ewin->client.y,
ewin->client.w, ewin->client.h, 1);
ewin->win_container =
ECreateWindow(frame, 0, 0, ewin->client.w, ewin->client.h, 0);
}
frame =
ECreateObjectWindow(VRoot.win, ewin->client.x, ewin->client.y,
ewin->client.w, ewin->client.h, 0, 1,
_EwinGetClientWin(ewin), &argb);
ewin->o.argb = argb;
ewin->win_container =
ECreateWindow(frame, 0, 0, ewin->client.w, ewin->client.h, 0);
EoInit(ewin, EOBJ_TYPE_EWIN, frame, ewin->client.x, ewin->client.y,
ewin->client.w, ewin->client.h, 1, ewin->icccm.wm_name);

View File

@ -372,7 +372,7 @@ IconboxCreate(const char *name)
ib->scrollbar_clicked = 0;
ib->scrollbox_clicked = 0;
ib->win = ECreateWindow(VRoot.win, 0, 0, 1, 1, 0);
ib->win = ECreateClientWindow(VRoot.win, 0, 0, 1, 1);
ib->icon_win = ECreateWindow(ib->win, 0, 0, 128, 26, 0);
EventCallbackRegister(ib->icon_win, 0, IboxEventIconWin, ib);
ib->cover_win = ECreateWindow(ib->win, 0, 0, 128, 26, 0);

View File

@ -1218,14 +1218,15 @@ IPC_ObjInfo(const char *params __UNUSED__, Client * c __UNUSED__)
lst = EobjListStackGet(&num);
IpcPrintf
("Num window T V Sh Dsk S F L pos size C R Name\n");
("Num window De T V Sh Dsk S F L pos size C R Name\n");
for (i = 0; i < num; i++)
{
eo = lst[i];
IpcPrintf
(" %2d %#9lx %d %d %2d %3d %d %d %3d %5d,%5d %4dx%4d %d %d %s\n",
i, EobjGetXwin(eo), eo->type, eo->shown, eo->shaped, eo->desk->num,
eo->sticky, eo->floating, eo->ilayer, eo->x, eo->y, eo->w, eo->h,
(" %2d %#9lx %2d %d %d %2d %3d %d %d %3d %5d,%5d %4dx%4d %d %d %s\n",
i, WinGetXwin(eo->win), WinGetDepth(eo->win), eo->type, eo->shown,
eo->shaped, eo->desk->num, eo->sticky, eo->floating, eo->ilayer,
eo->x, eo->y, eo->w, eo->h,
#if USE_COMPOSITE
(eo->cmhook) ? 1 : 0, !eo->noredir
#else

View File

@ -663,7 +663,7 @@ MenuRealize(Menu * m)
if (!m->win)
{
m->win = ECreateWindow(VRoot.win, 0, 0, 1, 1, 0);
m->win = ECreateClientWindow(VRoot.win, 0, 0, 1, 1);
EventCallbackRegister(m->win, 0, MenuHandleEvents, m);
if (m->title)
HintsSetWindowName(m->win, _(m->title));

View File

@ -151,6 +151,11 @@ static const CfgItem MiscCfgItems[] = {
CFG_ITEM_BOOL(Conf, startup.firsttime, 1),
CFG_ITEM_BOOL(Conf, startup.animate, 1),
CFG_ITEM_BOOL(Conf, testing.argb_internal_objects, 0),
CFG_ITEM_BOOL(Conf, testing.argb_internal_clients, 0),
CFG_ITEM_BOOL(Conf, testing.argb_clients, 0),
CFG_ITEM_BOOL(Conf, testing.argb_clients_inherit_attr, 0),
CFG_ITEM_INT(Conf, deskmode, MODE_NONE),
CFG_ITEM_BOOL(Conf, animate_shading, 1),
CFG_ITEM_INT(Conf, shadespeed, 8000),

View File

@ -120,7 +120,7 @@ PagerCreate(void)
ecore_list_append(pager_list, p);
p->name = NULL;
p->win = ECreateWindow(VRoot.win, 0, 0, 1, 1, 0);
p->win = ECreateClientWindow(VRoot.win, 0, 0, 1, 1);
EventCallbackRegister(p->win, 0, PagerEvent, p);
p->sel_win = ECreateWindow(p->win, 0, 0, 1, 1, 0);

102
src/x.c
View File

@ -35,6 +35,11 @@
#define DEBUG_XWIN 0
#if USE_COMPOSITE
static Visual *argb_visual = NULL;
static Colormap argb_cmap = None;
#endif
typedef struct
{
EventCallbackFunc *func;
@ -350,37 +355,100 @@ ECreateWindow(Win parent, int x, int y, int w, int h, int saveunder)
return win;
}
/* Creates a window, but takes the visual, depth and the colormap from c_attr. */
#if USE_COMPOSITE
Win
ECreateVisualWindow(Win parent, int x, int y, int w, int h, int saveunder,
XWindowAttributes * c_attr)
ECreateArgbWindow(Win parent, int x, int y, int w, int h, Win cwin)
{
EXID *win;
Window xwin;
XSetWindowAttributes attr;
int depth;
Visual *vis;
Colormap cmap;
attr.backing_store = NotUseful;
attr.override_redirect = False;
attr.border_pixel = 0;
attr.colormap = c_attr->colormap;
/* attr.background_pixel = 0; */
attr.background_pixmap = None;
if ((saveunder == 1) && (Conf.save_under))
attr.save_under = True;
else if (saveunder == 2)
attr.save_under = True;
if (cwin && Conf.testing.argb_clients_inherit_attr)
{
depth = cwin->depth;
vis = cwin->visual;
cmap = cwin->cmap;
}
else
attr.save_under = False;
{
if (!argb_visual)
{
argb_visual = EVisualFindARGB();
argb_cmap =
XCreateColormap(disp, VRoot.xwin, argb_visual, AllocNone);
}
depth = 32;
vis = argb_visual;
cmap = argb_cmap;
}
attr.background_pixmap = None;
attr.border_pixel = 0;
attr.backing_store = NotUseful;
attr.save_under = False;
attr.override_redirect = False;
attr.colormap = cmap;
xwin = XCreateWindow(disp, parent->xwin, x, y, w, h, 0,
c_attr->depth, InputOutput, c_attr->visual,
depth, InputOutput, vis,
CWOverrideRedirect | CWSaveUnder | CWBackingStore |
CWColormap | CWBackPixmap | CWBorderPixel, &attr);
win = EXidSet(xwin, parent, x, y, w, h, c_attr->depth, c_attr->visual,
c_attr->colormap);
win = EXidSet(xwin, parent, x, y, w, h, depth, vis, cmap);
return win;
}
#endif
Win
ECreateObjectWindow(Win parent, int x, int y, int w, int h, int saveunder,
int type, Win cwin, char *argb_ret)
{
EXID *win;
int argb = 0;
#if USE_COMPOSITE
switch (type)
{
default:
case 0: /* Internal */
if (Conf.testing.argb_internal_objects)
argb = 1;
break;
case 1: /* Client window */
if (Conf.testing.argb_clients || EVisualIsARGB(cwin->visual))
argb = 1;
break;
}
if (argb)
win = ECreateArgbWindow(parent, x, y, w, h, cwin);
else
win = ECreateWindow(parent, x, y, w, h, saveunder);
#else
win = ECreateWindow(parent, x, y, w, h, saveunder);
type = 0;
cwin = NULL;
#endif
if (argb_ret)
*argb_ret = argb;
return win;
}
Win
ECreateClientWindow(Win parent, int x, int y, int w, int h)
{
#if USE_COMPOSITE
if (Conf.testing.argb_internal_clients)
return ECreateArgbWindow(parent, x, y, w, h, NULL);
#endif
return ECreateWindow(parent, x, y, w, h, 0);
}
Win
ECreateEventWindow(Win parent, int x, int y, int w, int h)

View File

@ -70,9 +70,12 @@ void EventCallbacksProcess(Win win, XEvent * ev);
Win ECreateWindow(Win parent, int x, int y, int w, int h,
int saveunder);
Win ECreateVisualWindow(Win parent, int x, int y, int w,
int h, int saveunder,
XWindowAttributes * child_attr);
Win ECreateArgbWindow(Win parent, int x, int y, int w, int h,
Win cwin);
Win ECreateClientWindow(Win parent, int x, int y, int w, int h);
Win ECreateObjectWindow(Win parent, int x, int y, int w,
int h, int saveunder, int type,
Win cwin, char *argb);
Win ECreateEventWindow(Win parent, int x, int y, int w, int h);
Win ECreateFocusWindow(Win parent, int x, int y, int w, int h);
void EWindowSync(Win win);