forked from e16/e16
1
0
Fork 0

Minor reorganisation of some ewin internals.

SVN revision: 27574
This commit is contained in:
Kim Woelders 2006-12-27 16:17:27 +00:00
parent b7acf33e70
commit 67882e6394
7 changed files with 61 additions and 44 deletions

View File

@ -272,14 +272,17 @@ ContainerEwinClose(EWin * ewin)
ewin->data = NULL;
}
static const EWinOps ContainerEwinOps = {
ContainerEwinLayout,
ContainerEwinMoveResize,
ContainerEwinClose,
};
static void
ContainerEwinInit(EWin * ewin, void *ptr)
{
ewin->data = (Container *) ptr;
ewin->Layout = ContainerEwinLayout;
ewin->MoveResize = ContainerEwinMoveResize;
ewin->Close = ContainerEwinClose;
ewin->ops = &ContainerEwinOps;
ewin->props.skip_ext_task = 1;
ewin->props.skip_ext_pager = 1;
@ -305,11 +308,10 @@ ContainerShow(Container * ct)
ewin = AddInternalToFamily(ct->win, "ICONBOX", EWIN_TYPE_ICONBOX, ct,
ContainerEwinInit);
ct->ewin = ewin;
if (!ewin)
return;
ct->ewin = ewin;
ContainerReconfigure(ct);
if (ewin->state.placed)

View File

@ -171,14 +171,14 @@ typedef struct
struct _dialog
{
EWin *ewin;
char *name;
char *title;
Win win;
Pixmap pmap;
int w, h;
char *name;
char *title;
PmapMask pmm_bg;
TextClass *tclass;
ImageClass *iclass;
int w, h;
DItem *item;
DialogCallbackFunc *exit_func;
int exit_val;
@ -526,19 +526,20 @@ DialogEwinClose(EWin * ewin)
ewin->data = NULL;
}
static const EWinOps DialogEwinOps = {
NULL,
DialogEwinMoveResize,
DialogEwinClose,
};
static void
DialogEwinInit(EWin * ewin, void *ptr)
{
Dialog *d = ptr;
ewin->data = ptr;
d->ewin = ewin;
ewin->ops = &DialogEwinOps;
ewin->props.focus_when_mapped = 1;
ewin->MoveResize = DialogEwinMoveResize;
ewin->Close = DialogEwinClose;
EoSetLayer(ewin, 10);
}
@ -585,6 +586,7 @@ DialogShowArranged(Dialog * d, int center)
ewin = AddInternalToFamily(d->win, "DIALOG", EWIN_TYPE_DIALOG, d,
DialogEwinInit);
d->ewin = ewin;
if (!ewin)
return;

View File

@ -415,9 +415,9 @@ doEwinMoveResize(EWin * ewin, Desk * dsk, int x, int y, int w, int h, int flags)
}
else
{
if (ewin->Layout)
if (ewin->ops && ewin->ops->Layout)
{
ewin->Layout(ewin, &x, &y, &w, &h);
ewin->ops->Layout(ewin, &x, &y, &w, &h);
}
else
{
@ -537,8 +537,8 @@ doEwinMoveResize(EWin * ewin, Desk * dsk, int x, int y, int w, int h, int flags)
if (Mode.op_source == OPSRC_USER)
EwinSetPlacementGravity(ewin, x, y);
if (ewin->MoveResize)
ewin->MoveResize(ewin, resize);
if (ewin->ops && ewin->ops->MoveResize)
ewin->ops->MoveResize(ewin, resize);
if (Mode.mode == MODE_NONE)
{

View File

@ -1470,8 +1470,8 @@ EwinHide(EWin * ewin)
if (!EwinIsInternal(ewin) || ewin->state.iconified)
return;
if (ewin->Close)
ewin->Close(ewin);
if (ewin->ops && ewin->ops->Close)
ewin->ops->Close(ewin);
EwinDestroy(ewin);
}

View File

@ -56,6 +56,14 @@ typedef union
#define EwinInhGetWM(ewin, item) (ewin->inh_wm.b.item)
#define EwinInhSetWM(ewin, item, on) ewin->inh_wm.b.item = (on)
typedef struct
{
void (*Layout) (EWin * ewin, int *px, int *py, int *pw,
int *ph);
void (*MoveResize) (EWin * ewin, int resize);
void (*Close) (EWin * ewin);
} EWinOps;
struct _ewin
{
EObj o;
@ -253,10 +261,7 @@ struct _ewin
int ll; /* Last layer */
void *data; /* Data hook for internal windows */
void (*Layout) (EWin * ewin, int *px, int *py, int *pw,
int *ph);
void (*MoveResize) (EWin * ewin, int resize);
void (*Close) (EWin * ewin);
const EWinOps *ops;
};
#define EWIN_STATE_NEW 0 /* New */

View File

@ -91,17 +91,17 @@ struct _menuitem
struct _menu
{
char *name;
char *alias;
char *title;
MenuStyle *style;
MenuLoader *loader;
EWin *ewin;
int w, h;
int num;
MenuItem **items;
Win win;
PmapMask pmm;
int w, h;
char *name;
char *title;
char *alias;
MenuStyle *style;
MenuLoader *loader;
int num;
MenuItem **items;
int icon_size;
char internal; /* Don't destroy when reloading */
char dynamic; /* May be emptied on close */
@ -224,15 +224,19 @@ MenuEwinClose(EWin * ewin)
ewin->data = NULL;
}
static const EWinOps MenuEwinOps = {
NULL,
MenuEwinMoveResize,
MenuEwinClose,
};
static void
MenuEwinInit(EWin * ewin, void *ptr)
{
Menu *m = ptr;
Menu *m = (Menu *) ptr;
ewin->data = ptr;
ewin->MoveResize = MenuEwinMoveResize;
ewin->Close = MenuEwinClose;
ewin->ops = &MenuEwinOps;
ewin->props.skip_ext_task = 1;
ewin->props.skip_ext_pager = 1;

View File

@ -78,16 +78,16 @@ static struct
typedef struct
{
char *name;
EWin *ewin;
Win win;
Pixmap pmap;
int w, h;
char *name;
Pixmap bgpmap;
Desk *dsk;
int w, h;
int dw, dh;
int screen_w, screen_h;
int update_phase;
EWin *ewin;
Win sel_win;
/* State flags */
@ -691,13 +691,17 @@ PagerEwinClose(EWin * ewin)
ewin->data = NULL;
}
static const EWinOps PagerEwinOps = {
NULL,
PagerEwinMoveResize,
PagerEwinClose,
};
static void
PagerEwinInit(EWin * ewin, void *ptr)
{
ewin->data = ptr;
ewin->MoveResize = PagerEwinMoveResize;
ewin->Close = PagerEwinClose;
ewin->ops = &PagerEwinOps;
ewin->props.skip_ext_task = 1;
ewin->props.skip_ext_pager = 1;
@ -732,10 +736,10 @@ PagerShow(Pager * p)
ewin =
AddInternalToFamily(p->win, "PAGER", EWIN_TYPE_PAGER, p, PagerEwinInit);
p->ewin = ewin;
if (!ewin)
return;
p->ewin = ewin;
p->screen_w = VRoot.w;
p->screen_h = VRoot.h;