parent
3fa45c933c
commit
e8695258fa
14
src/E.h
14
src/E.h
|
@ -335,7 +335,6 @@ typedef struct _pager Pager;
|
|||
typedef struct _snapshot Snapshot;
|
||||
typedef struct _group Group;
|
||||
typedef struct _button Button;
|
||||
typedef struct _slideout Slideout;
|
||||
typedef struct _background Background;
|
||||
typedef struct _ecursor ECursor;
|
||||
typedef struct _efont Efont;
|
||||
|
@ -1073,9 +1072,7 @@ typedef struct
|
|||
int px, py, x, y;
|
||||
int server_grabbed;
|
||||
int deskdrag;
|
||||
char button_move_pending;
|
||||
Colormap current_cmap;
|
||||
Slideout *slideout;
|
||||
Window context_win;
|
||||
char constrained;
|
||||
char nogroup;
|
||||
|
@ -1284,12 +1281,13 @@ int ButtonGetRefcount(const Button * b);
|
|||
int ButtonGetDesk(const Button * b);
|
||||
int ButtonGetInfo(const Button * b, RectBox * r, int desk);
|
||||
ActionClass *ButtonGetAClass(const Button * b);
|
||||
Window ButtonGetWindow(const Button * b);
|
||||
Window ButtonGetWin(const Button * b);
|
||||
int ButtonGetWidth(const Button * b);
|
||||
int ButtonGetHeight(const Button * b);
|
||||
int ButtonIsFixed(const Button * b);
|
||||
int ButtonIsInternal(const Button * b);
|
||||
int ButtonDoShowDefault(const Button * b);
|
||||
void ButtonDoAction(Button * b, EWin * ewin, XEvent * ev);
|
||||
int ButtonEmbedWindow(Button * ButtonToUse,
|
||||
Window WindowToEmbed);
|
||||
|
||||
|
@ -1527,6 +1525,8 @@ void EobjSlideTo(EObj * eo, int fx, int fy, int tx, int ty,
|
|||
int speed);
|
||||
void EobjsSlideBy(EObj ** peo, int num, int dx, int dy,
|
||||
int speed);
|
||||
void EobjSlideSizeTo(EObj * eo, int fx, int fy, int tx, int ty,
|
||||
int fw, int fh, int tw, int th, int speed);
|
||||
|
||||
/* events.c */
|
||||
/* Re-mapped X-events */
|
||||
|
@ -1898,7 +1898,7 @@ void ITApply(Window win, ImageClass * ic, ImageState * is, int w,
|
|||
void __PRINTF__ IpcPrintf(const char *fmt, ...);
|
||||
int HandleIPC(const char *params, Client * c);
|
||||
void ButtonIPC(int val, void *data);
|
||||
int EFunc(const char *params);
|
||||
int EFunc(EWin * ewin, const char *params);
|
||||
|
||||
/* lang.c */
|
||||
void LangInit(void);
|
||||
|
@ -2094,10 +2094,6 @@ void MaxHeight(EWin * ewin, const char *resize_type);
|
|||
|
||||
/* slideouts.c */
|
||||
int SlideoutsConfigLoad(FILE * fs);
|
||||
void SlideoutShow(Slideout * s, EWin * ewin, Window win);
|
||||
void SlideoutHide(Slideout * s);
|
||||
|
||||
void SlideoutsHide(void);
|
||||
|
||||
/* snaps.c */
|
||||
void Real_SaveSnapInfo(int dumval, void *dumdat);
|
||||
|
|
|
@ -821,9 +821,7 @@ ActionGetModifiers(Action * aa)
|
|||
static void
|
||||
handleAction(EWin * ewin, ActionType * action)
|
||||
{
|
||||
SetContextEwin(ewin);
|
||||
EFunc(action->params);
|
||||
SetContextEwin(NULL);
|
||||
EFunc(ewin, action->params);
|
||||
|
||||
/* Did we just hose ourselves? if so, we'd best not stick around here */
|
||||
if (mode_action_destroy)
|
||||
|
|
|
@ -63,6 +63,7 @@ static struct
|
|||
{
|
||||
Button *button;
|
||||
char loading_user;
|
||||
char move_pending;
|
||||
} Mode_buttons;
|
||||
|
||||
static void ButtonHandleEvents(XEvent * ev, void *btn);
|
||||
|
@ -398,7 +399,7 @@ ButtonGetAClass(const Button * b)
|
|||
}
|
||||
|
||||
Window
|
||||
ButtonGetWindow(const Button * b)
|
||||
ButtonGetWin(const Button * b)
|
||||
{
|
||||
return EoGetWin(b);
|
||||
}
|
||||
|
@ -433,6 +434,13 @@ ButtonDoShowDefault(const Button * b)
|
|||
return !b->internal && b->default_show;
|
||||
}
|
||||
|
||||
void
|
||||
ButtonDoAction(Button * b, EWin * ewin, XEvent * ev)
|
||||
{
|
||||
if (b->aclass)
|
||||
EventAclass(ev, ewin, b->aclass);
|
||||
}
|
||||
|
||||
int
|
||||
ButtonEmbedWindow(Button * b, Window WindowToEmbed)
|
||||
{
|
||||
|
@ -464,7 +472,7 @@ ButtonDragStart(Button * b)
|
|||
|
||||
GrabPointerSet(EoGetWin(b), ECSR_GRAB, 0);
|
||||
Mode.mode = MODE_BUTTONDRAG;
|
||||
Mode.button_move_pending = 1;
|
||||
Mode_buttons.move_pending = 1;
|
||||
Mode.start_x = Mode.x;
|
||||
Mode.start_y = Mode.y;
|
||||
Mode.win_x = EoGetX(b);
|
||||
|
@ -478,7 +486,7 @@ ButtonDragEnd(Button * b)
|
|||
|
||||
Mode.mode = MODE_NONE;
|
||||
|
||||
if (!Mode.button_move_pending)
|
||||
if (!Mode_buttons.move_pending)
|
||||
{
|
||||
d = DesktopAt(Mode.x, Mode.y);
|
||||
ButtonMoveToDesktop(b, d);
|
||||
|
@ -486,7 +494,7 @@ ButtonDragEnd(Button * b)
|
|||
ButtonMoveRelative(b, -DeskGetX(d), -DeskGetY(d));
|
||||
}
|
||||
else
|
||||
Mode.button_move_pending = 0;
|
||||
Mode_buttons.move_pending = 0;
|
||||
|
||||
autosave();
|
||||
}
|
||||
|
@ -543,9 +551,14 @@ ButtonEventMouseDown(Button * b, XEvent * ev)
|
|||
b->state = STATE_CLICKED;
|
||||
ButtonDraw(b);
|
||||
|
||||
ac = FindItem("ACTION_BUTTON_DRAG", 0, LIST_FINDBY_NAME, LIST_TYPE_ACLASS);
|
||||
if (ac)
|
||||
EventAclass(ev, NULL, ac);
|
||||
if (!b->internal)
|
||||
{
|
||||
ac = FindItem("ACTION_BUTTON_DRAG", 0, LIST_FINDBY_NAME,
|
||||
LIST_TYPE_ACLASS);
|
||||
if (ac)
|
||||
EventAclass(ev, NULL, ac);
|
||||
}
|
||||
|
||||
if (b->aclass)
|
||||
EventAclass(ev, NULL, b->aclass);
|
||||
}
|
||||
|
@ -568,6 +581,10 @@ ButtonEventMouseUp(Button * b, XEvent * ev)
|
|||
b->state = STATE_NORMAL;
|
||||
ButtonDraw(b);
|
||||
|
||||
#if 1 /* FIXME - Here? */
|
||||
GrabPointerRelease();
|
||||
#endif
|
||||
|
||||
if (b->aclass && !b->left)
|
||||
EventAclass(ev, NULL, b->aclass);
|
||||
|
||||
|
@ -577,7 +594,9 @@ ButtonEventMouseUp(Button * b, XEvent * ev)
|
|||
ButtonDragEnd(Mode_buttons.button);
|
||||
Mode_buttons.button = NULL;
|
||||
|
||||
#if 0 /* FIXME - Move? */
|
||||
GrabPointerRelease();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -591,7 +610,7 @@ ButtonEventMotion(Button * b, XEvent * ev __UNUSED__)
|
|||
dx = Mode.x - Mode.px;
|
||||
dy = Mode.y - Mode.py;
|
||||
|
||||
if (Mode.button_move_pending)
|
||||
if (Mode_buttons.move_pending)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
|
@ -603,10 +622,10 @@ ButtonEventMotion(Button * b, XEvent * ev __UNUSED__)
|
|||
y = -y;
|
||||
if ((x > Conf.button_move_resistance) ||
|
||||
(y > Conf.button_move_resistance))
|
||||
Mode.button_move_pending = 0;
|
||||
Mode_buttons.move_pending = 0;
|
||||
Mode.action_inhibit = 1;
|
||||
}
|
||||
if (!Mode.button_move_pending)
|
||||
if (!Mode_buttons.move_pending)
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
|
|
28
src/eobj.c
28
src/eobj.c
|
@ -491,6 +491,34 @@ EobjsSlideBy(EObj ** peo, int num, int dx, int dy, int speed)
|
|||
Efree(xy);
|
||||
}
|
||||
|
||||
void
|
||||
EobjSlideSizeTo(EObj * eo, int fx, int fy, int tx, int ty, int fw, int fh,
|
||||
int tw, int th, int speed)
|
||||
{
|
||||
int k, x, y, w, h;
|
||||
|
||||
#if 0 /* FIXME - Need this? */
|
||||
EGrabServer();
|
||||
#endif
|
||||
|
||||
ETimedLoopInit(0, 1024, speed);
|
||||
for (k = 0; k <= 1024;)
|
||||
{
|
||||
x = ((fx * (1024 - k)) + (tx * k)) >> 10;
|
||||
y = ((fy * (1024 - k)) + (ty * k)) >> 10;
|
||||
w = ((fw * (1024 - k)) + (tw * k)) >> 10;
|
||||
h = ((fh * (1024 - k)) + (th * k)) >> 10;
|
||||
EobjMoveResize(eo, x, y, w, h);
|
||||
|
||||
k = ETimedLoopNext();
|
||||
}
|
||||
EobjMoveResize(eo, tx, ty, tw, th);
|
||||
|
||||
#if 0 /* FIXME - Need this? */
|
||||
EUngrabServer();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
EobjsRepaint(void)
|
||||
{
|
||||
|
|
|
@ -165,7 +165,6 @@ HandleEvent(XEvent * ev)
|
|||
{
|
||||
void **lst;
|
||||
int i, num;
|
||||
Slideout *pslideout = NULL;
|
||||
|
||||
#if ENABLE_DEBUG_EVENTS
|
||||
if (EventDebug(ev->type))
|
||||
|
@ -265,8 +264,6 @@ HandleEvent(XEvent * ev)
|
|||
}
|
||||
#endif
|
||||
|
||||
pslideout = Mode.slideout;
|
||||
|
||||
ActionsEnd(NULL);
|
||||
break;
|
||||
case MotionNotify: /* 6 */
|
||||
|
@ -329,10 +326,6 @@ HandleEvent(XEvent * ev)
|
|||
switch (ev->type)
|
||||
{
|
||||
case ButtonRelease: /* 5 */
|
||||
/* This shouldn't be here */
|
||||
if ((Mode.slideout) && (pslideout))
|
||||
SlideoutHide(Mode.slideout);
|
||||
|
||||
Mode.last_bpress = 0;
|
||||
Mode.action_inhibit = 0;
|
||||
break;
|
||||
|
|
|
@ -889,9 +889,6 @@ EwinUnmap1(EWin * ewin)
|
|||
FocusEnable(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (ewin == GetContextEwin())
|
||||
SlideoutsHide();
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -1753,7 +1753,7 @@ IB_ShowMenu(Iconbox * ib, int x __UNUSED__, int y __UNUSED__)
|
|||
mi = MenuItemCreate(_("Create New Iconbox"), NULL, "ibox new", NULL);
|
||||
MenuAddItem(p_menu, mi);
|
||||
|
||||
EFunc("menus show __IBOX_MENU");
|
||||
EFunc(NULL, "menus show __IBOX_MENU");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1767,7 +1767,7 @@ IB_ShowMenu(Iconbox * ib, int x __UNUSED__, int y __UNUSED__)
|
|||
mi = MenuItemCreate(_("Close Systray"), NULL, s, NULL);
|
||||
MenuAddItem(p_menu, mi);
|
||||
|
||||
EFunc("menus show __TRAY_MENU");
|
||||
EFunc(NULL, "menus show __TRAY_MENU");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
28
src/ipc.c
28
src/ipc.c
|
@ -1230,22 +1230,6 @@ IPC_Reparent(const char *params, Client * c __UNUSED__)
|
|||
EwinReparent(ewin, enew->client.win);
|
||||
}
|
||||
|
||||
static void
|
||||
IPC_Slideout(const char *params, Client * c __UNUSED__)
|
||||
{
|
||||
Slideout *s;
|
||||
|
||||
if (!params)
|
||||
return;
|
||||
|
||||
s = FindItem(params, 0, LIST_FINDBY_NAME, LIST_TYPE_SLIDEOUT);
|
||||
if (s)
|
||||
{
|
||||
SoundPlay("SOUND_SLIDEOUT_SHOW");
|
||||
SlideoutShow(s, GetContextEwin(), Mode.context_win);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
IPC_Warp(const char *params, Client * c __UNUSED__)
|
||||
{
|
||||
|
@ -1502,8 +1486,6 @@ IpcItem IPCArray[] = {
|
|||
"reparent", "rep",
|
||||
"Reparent window",
|
||||
" reparent <windowid> <new parent>\n"},
|
||||
{
|
||||
IPC_Slideout, "slideout", NULL, "Show slideout", NULL},
|
||||
{
|
||||
IPC_Remember,
|
||||
"remember", NULL,
|
||||
|
@ -1599,9 +1581,15 @@ HandleIPC(const char *params, Client * c)
|
|||
}
|
||||
|
||||
int
|
||||
EFunc(const char *params)
|
||||
EFunc(EWin * ewin, const char *params)
|
||||
{
|
||||
return HandleIPC(params, NULL);
|
||||
int err;
|
||||
|
||||
SetContextEwin(ewin);
|
||||
err = HandleIPC(params, NULL);
|
||||
SetContextEwin(NULL);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
25
src/menus.c
25
src/menus.c
|
@ -1190,23 +1190,6 @@ MenuFindParentItem(Menu * m)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static EWin *
|
||||
MenuFindContextEwin(Menu * m __UNUSED__)
|
||||
{
|
||||
#if 0
|
||||
while (m && m->parent)
|
||||
m = m->parent;
|
||||
|
||||
if (!m)
|
||||
return NULL;
|
||||
|
||||
return FindEwinSpawningMenu(m);
|
||||
#endif
|
||||
return Mode_menus.context_ewin;
|
||||
}
|
||||
#endif
|
||||
|
||||
static KeySym
|
||||
MenuKeyPressConversion(KeySym key)
|
||||
{
|
||||
|
@ -1290,9 +1273,7 @@ MenuEventKeyPress(Menu * m, XEvent * ev)
|
|||
break;
|
||||
MenusHide();
|
||||
EobjsRepaint();
|
||||
SetContextEwin(Mode_menus.context_ewin);
|
||||
EFunc(mi->params);
|
||||
SetContextEwin(NULL);
|
||||
EFunc(Mode_menus.context_ewin, mi->params);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1365,9 +1346,7 @@ MenuItemEventMouseUp(MenuItem * mi, XEvent * ev __UNUSED__)
|
|||
{
|
||||
MenusHide();
|
||||
EobjsRepaint();
|
||||
SetContextEwin(Mode_menus.context_ewin);
|
||||
EFunc(mi->params);
|
||||
SetContextEwin(NULL);
|
||||
EFunc(Mode_menus.context_ewin, mi->params);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -856,7 +856,7 @@ PagerMenuShow(Pager * p, int x, int y)
|
|||
mi = MenuItemCreate(_("Stick / Unstick"), NULL, s, NULL);
|
||||
MenuAddItem(pw_menu, mi);
|
||||
|
||||
EFunc("menus show __DESK_WIN_MENU");
|
||||
EFunc(NULL, "menus show __DESK_WIN_MENU");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -882,7 +882,7 @@ PagerMenuShow(Pager * p, int x, int y)
|
|||
MenuAddItem(p_menu, mi);
|
||||
}
|
||||
|
||||
EFunc("menus show __DESK_MENU");
|
||||
EFunc(NULL, "menus show __DESK_MENU");
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
305
src/slideout.c
305
src/slideout.c
|
@ -23,91 +23,71 @@
|
|||
*/
|
||||
#include "E.h"
|
||||
|
||||
struct _slideout
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
EObj *win;
|
||||
char direction;
|
||||
int num_buttons;
|
||||
Button **button;
|
||||
int w, h;
|
||||
Window win;
|
||||
Window from_win;
|
||||
unsigned int ref_count;
|
||||
};
|
||||
EWin *context_ewin;
|
||||
} Slideout;
|
||||
|
||||
static void SlideoutCalcSize(Slideout * s);
|
||||
|
||||
static void
|
||||
SlideWindowSizeTo(Window win, int fx, int fy, int tx, int ty, int fw, int fh,
|
||||
int tw, int th, int speed)
|
||||
struct
|
||||
{
|
||||
int k, x, y, w, h;
|
||||
Slideout *active;
|
||||
} Mode_slideouts =
|
||||
{
|
||||
NULL};
|
||||
|
||||
EGrabServer();
|
||||
|
||||
ETimedLoopInit(0, 1024, speed);
|
||||
for (k = 0; k <= 1024;)
|
||||
{
|
||||
x = ((fx * (1024 - k)) + (tx * k)) >> 10;
|
||||
y = ((fy * (1024 - k)) + (ty * k)) >> 10;
|
||||
w = ((fw * (1024 - k)) + (tw * k)) >> 10;
|
||||
h = ((fh * (1024 - k)) + (th * k)) >> 10;
|
||||
EMoveResizeWindow(win, x, y, w, h);
|
||||
|
||||
k = ETimedLoopNext();
|
||||
}
|
||||
EMoveResizeWindow(win, tx, ty, tw, th);
|
||||
|
||||
EUngrabServer();
|
||||
}
|
||||
static void SlideoutHandleEvent(XEvent * ev, void *prm);
|
||||
|
||||
static Slideout *
|
||||
SlideoutCreate(char *name, char dir)
|
||||
{
|
||||
Slideout *s;
|
||||
|
||||
s = Emalloc(sizeof(Slideout));
|
||||
s = Ecalloc(1, sizeof(Slideout));
|
||||
if (!s)
|
||||
return NULL;
|
||||
|
||||
s->name = Estrdup(name);
|
||||
s->win = EobjWindowCreate(EOBJ_TYPE_MISC, -10, -10, 1, 1, 1, name);
|
||||
s->direction = dir;
|
||||
s->num_buttons = 0;
|
||||
s->button = NULL;
|
||||
s->w = 0;
|
||||
s->h = 0;
|
||||
s->win = ECreateWindow(VRoot.win, -10, -10, 1, 1, 1);
|
||||
s->from_win = 0;
|
||||
s->ref_count = 0;
|
||||
EventCallbackRegister(s->win->win, 0, SlideoutHandleEvent, s);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
SlideoutShow(Slideout * s, EWin * ewin, Window win)
|
||||
{
|
||||
int x, y, i, xx, yy, di;
|
||||
int x, y, i, xx, yy, sw, sh;
|
||||
Window dw;
|
||||
char pdir;
|
||||
XSetWindowAttributes att;
|
||||
int w, h, d;
|
||||
int w, h;
|
||||
Desk *d;
|
||||
|
||||
/* Don't ever show more than one slideout */
|
||||
if (Mode.slideout)
|
||||
if (Mode_slideouts.active)
|
||||
return;
|
||||
|
||||
SlideoutCalcSize(s);
|
||||
EGetGeometry(win, &dw, &di, &di, &w, &h, &d, &d);
|
||||
EGetGeometry(win, NULL, NULL, NULL, &w, &h, NULL, NULL);
|
||||
XTranslateCoordinates(disp, win, VRoot.win, 0, 0, &x, &y, &dw);
|
||||
|
||||
sw = s->win->w;
|
||||
sh = s->win->h;
|
||||
xx = 0;
|
||||
yy = 0;
|
||||
switch (s->direction)
|
||||
{
|
||||
case 2:
|
||||
xx = x + ((w - s->w) >> 1);
|
||||
yy = y - s->h;
|
||||
if ((yy < 0) && (s->h < VRoot.h))
|
||||
xx = x + ((w - sw) >> 1);
|
||||
yy = y - sh;
|
||||
if ((yy < 0) && (sh < VRoot.h))
|
||||
{
|
||||
pdir = s->direction;
|
||||
s->direction = 1;
|
||||
|
@ -117,9 +97,9 @@ SlideoutShow(Slideout * s, EWin * ewin, Window win)
|
|||
}
|
||||
break;
|
||||
case 3:
|
||||
xx = x + ((w - s->w) >> 1);
|
||||
xx = x + ((w - sw) >> 1);
|
||||
yy = y + h;
|
||||
if (((yy + s->h) > VRoot.h) && (s->h < VRoot.h))
|
||||
if (((yy + sh) > VRoot.h) && (sh < VRoot.h))
|
||||
{
|
||||
pdir = s->direction;
|
||||
s->direction = 0;
|
||||
|
@ -129,9 +109,9 @@ SlideoutShow(Slideout * s, EWin * ewin, Window win)
|
|||
}
|
||||
break;
|
||||
case 0:
|
||||
xx = x - s->w;
|
||||
yy = y + ((h - s->h) >> 1);
|
||||
if ((xx < 0) && (s->w < VRoot.w))
|
||||
xx = x - sw;
|
||||
yy = y + ((h - sh) >> 1);
|
||||
if ((xx < 0) && (sw < VRoot.w))
|
||||
{
|
||||
pdir = s->direction;
|
||||
s->direction = 1;
|
||||
|
@ -142,8 +122,8 @@ SlideoutShow(Slideout * s, EWin * ewin, Window win)
|
|||
break;
|
||||
case 1:
|
||||
xx = x + w;
|
||||
yy = y + ((h - s->h) >> 1);
|
||||
if (((xx + s->w) > VRoot.w) && (s->w < VRoot.w))
|
||||
yy = y + ((h - sh) >> 1);
|
||||
if (((xx + sw) > VRoot.w) && (sw < VRoot.w))
|
||||
{
|
||||
pdir = s->direction;
|
||||
s->direction = 0;
|
||||
|
@ -156,107 +136,113 @@ SlideoutShow(Slideout * s, EWin * ewin, Window win)
|
|||
break;
|
||||
}
|
||||
|
||||
/* If the slideout is associated with an ewin,
|
||||
* put it on the same virtual desktop. */
|
||||
dw = VRoot.win;
|
||||
if (ewin && BorderWinpartIndex(ewin, win) >= 0 &&
|
||||
!EoIsFloating(ewin) /* && !ewin->sticky */ )
|
||||
if (ewin)
|
||||
{
|
||||
int desk = EoGetDesk(ewin);
|
||||
|
||||
xx -= DeskGetX(desk);
|
||||
yy -= DeskGetY(desk);
|
||||
dw = DeskGetWin(desk);
|
||||
/* If the slideout is associated with an ewin,
|
||||
* put it on the same virtual desktop. */
|
||||
d = DeskGet(EoGetDesk(ewin));
|
||||
if (BorderWinpartIndex(ewin, win) >= 0 &&
|
||||
!EoIsFloating(ewin) /* && !ewin->sticky */ )
|
||||
{
|
||||
xx -= EoGetX(d);
|
||||
yy -= EoGetY(d);
|
||||
}
|
||||
}
|
||||
EReparentWindow(s->win, dw, xx, yy);
|
||||
else
|
||||
{
|
||||
d = DeskGet(0);
|
||||
}
|
||||
EobjReparent(s->win, d->num, xx, yy);
|
||||
|
||||
switch (s->direction)
|
||||
{
|
||||
case 0:
|
||||
att.win_gravity = SouthEastGravity;
|
||||
EChangeWindowAttributes(s->win, CWWinGravity, &att);
|
||||
EChangeWindowAttributes(s->win->win, CWWinGravity, &att);
|
||||
att.win_gravity = NorthWestGravity;
|
||||
for (i = 0; i < s->num_buttons; i++)
|
||||
EChangeWindowAttributes(ButtonGetWindow(s->button[i]),
|
||||
EChangeWindowAttributes(ButtonGetWin(s->button[i]),
|
||||
CWWinGravity, &att);
|
||||
EMoveResizeWindow(s->win, xx, yy, 1, 1);
|
||||
EobjMoveResize(s->win, xx, yy, 1, 1);
|
||||
ESync();
|
||||
EMapRaised(s->win);
|
||||
SlideWindowSizeTo(s->win, xx + s->w, yy, xx, yy, 0, s->h, s->w, s->h,
|
||||
Conf.slidespeedmap);
|
||||
EobjMap(s->win, 1);
|
||||
EobjSlideSizeTo(s->win, xx + sw, yy, xx, yy, 0, sh, sw, sh,
|
||||
Conf.slidespeedmap);
|
||||
break;
|
||||
case 1:
|
||||
att.win_gravity = NorthWestGravity;
|
||||
EChangeWindowAttributes(s->win, CWWinGravity, &att);
|
||||
EChangeWindowAttributes(s->win->win, CWWinGravity, &att);
|
||||
att.win_gravity = SouthEastGravity;
|
||||
for (i = 0; i < s->num_buttons; i++)
|
||||
EChangeWindowAttributes(ButtonGetWindow(s->button[i]),
|
||||
EChangeWindowAttributes(ButtonGetWin(s->button[i]),
|
||||
CWWinGravity, &att);
|
||||
EMoveResizeWindow(s->win, xx, yy, 1, 1);
|
||||
EobjMoveResize(s->win, xx, yy, 1, 1);
|
||||
ESync();
|
||||
EMapRaised(s->win);
|
||||
SlideWindowSizeTo(s->win, xx, yy, xx, yy, 0, s->h, s->w, s->h,
|
||||
Conf.slidespeedmap);
|
||||
EobjMap(s->win, 1);
|
||||
EobjSlideSizeTo(s->win, xx, yy, xx, yy, 0, sh, sw, sh,
|
||||
Conf.slidespeedmap);
|
||||
break;
|
||||
case 2:
|
||||
att.win_gravity = SouthEastGravity;
|
||||
EChangeWindowAttributes(s->win, CWWinGravity, &att);
|
||||
EChangeWindowAttributes(s->win->win, CWWinGravity, &att);
|
||||
att.win_gravity = NorthWestGravity;
|
||||
for (i = 0; i < s->num_buttons; i++)
|
||||
EChangeWindowAttributes(ButtonGetWindow(s->button[i]),
|
||||
EChangeWindowAttributes(ButtonGetWin(s->button[i]),
|
||||
CWWinGravity, &att);
|
||||
EMoveResizeWindow(s->win, xx, yy, 1, 1);
|
||||
EobjMoveResize(s->win, xx, yy, 1, 1);
|
||||
ESync();
|
||||
EMapRaised(s->win);
|
||||
SlideWindowSizeTo(s->win, xx, yy + s->h, xx, yy, s->w, 0, s->w, s->h,
|
||||
Conf.slidespeedmap);
|
||||
EobjMap(s->win, 1);
|
||||
EobjSlideSizeTo(s->win, xx, yy + sh, xx, yy, sw, 0, sw, sh,
|
||||
Conf.slidespeedmap);
|
||||
break;
|
||||
case 3:
|
||||
att.win_gravity = NorthWestGravity;
|
||||
EChangeWindowAttributes(s->win, CWWinGravity, &att);
|
||||
EChangeWindowAttributes(s->win->win, CWWinGravity, &att);
|
||||
att.win_gravity = SouthEastGravity;
|
||||
for (i = 0; i < s->num_buttons; i++)
|
||||
EChangeWindowAttributes(ButtonGetWindow(s->button[i]),
|
||||
EChangeWindowAttributes(ButtonGetWin(s->button[i]),
|
||||
CWWinGravity, &att);
|
||||
EMoveResizeWindow(s->win, xx, yy, 1, 1);
|
||||
EobjMoveResize(s->win, xx, yy, 1, 1);
|
||||
ESync();
|
||||
EMapRaised(s->win);
|
||||
SlideWindowSizeTo(s->win, xx, yy, xx, yy, s->w, 0, s->w, s->h,
|
||||
Conf.slidespeedmap);
|
||||
EobjMap(s->win, 1);
|
||||
EobjSlideSizeTo(s->win, xx, yy, xx, yy, sw, 0, sw, sh,
|
||||
Conf.slidespeedmap);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
s->from_win = win;
|
||||
s->ref_count++;
|
||||
s->context_ewin = ewin;
|
||||
|
||||
Mode.slideout = s;
|
||||
GrabPointerSet(s->win->win, ECSR_ROOT, 0);
|
||||
|
||||
Mode_slideouts.active = s;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
SlideoutHide(Slideout * s)
|
||||
{
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
EUnmapWindow(s->win);
|
||||
s->from_win = 0;
|
||||
GrabPointerRelease();
|
||||
EobjUnmap(s->win);
|
||||
s->context_ewin = NULL;
|
||||
s->ref_count--;
|
||||
Mode.slideout = NULL;
|
||||
Mode_slideouts.active = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
SlideoutCalcSize(Slideout * s)
|
||||
{
|
||||
int i;
|
||||
int mx, my, x, y;
|
||||
int bw, bh;
|
||||
int i, x, y;
|
||||
int sw, sh, bw, bh;
|
||||
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
mx = 0;
|
||||
my = 0;
|
||||
sw = 0;
|
||||
sh = 0;
|
||||
x = 0;
|
||||
y = 0;
|
||||
for (i = 0; i < s->num_buttons; i++)
|
||||
|
@ -268,24 +254,22 @@ SlideoutCalcSize(Slideout * s)
|
|||
{
|
||||
case 2:
|
||||
case 3:
|
||||
if (bw > mx)
|
||||
mx = bw;
|
||||
my += bh;
|
||||
if (bw > sw)
|
||||
sw = bw;
|
||||
sh += bh;
|
||||
break;
|
||||
case 0:
|
||||
case 1:
|
||||
if (bh > my)
|
||||
my = bh;
|
||||
mx += bw;
|
||||
if (bh > sh)
|
||||
sh = bh;
|
||||
sw += bw;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
EResizeWindow(s->win, mx, my);
|
||||
s->w = mx;
|
||||
s->h = my;
|
||||
EobjResize(s->win, sw, sh);
|
||||
|
||||
for (i = 0; i < s->num_buttons; i++)
|
||||
{
|
||||
|
@ -296,26 +280,24 @@ SlideoutCalcSize(Slideout * s)
|
|||
{
|
||||
case 2:
|
||||
y += bh;
|
||||
EMoveWindow(ButtonGetWindow(s->button[i]),
|
||||
(s->w - bw) >> 1, s->h - y);
|
||||
EMoveWindow(ButtonGetWin(s->button[i]), (sw - bw) >> 1, sh - y);
|
||||
break;
|
||||
case 3:
|
||||
EMoveWindow(ButtonGetWindow(s->button[i]), (s->w - bw) >> 1, y);
|
||||
EMoveWindow(ButtonGetWin(s->button[i]), (sw - bw) >> 1, y);
|
||||
y += bh;
|
||||
break;
|
||||
case 0:
|
||||
x += bw;
|
||||
EMoveWindow(ButtonGetWindow(s->button[i]), s->w - x,
|
||||
(s->h - bh) >> 1);
|
||||
EMoveWindow(ButtonGetWin(s->button[i]), sw - x, (sh - bh) >> 1);
|
||||
break;
|
||||
case 1:
|
||||
EMoveWindow(ButtonGetWindow(s->button[i]), x, (s->h - bh) >> 1);
|
||||
EMoveWindow(ButtonGetWin(s->button[i]), x, (sh - bh) >> 1);
|
||||
x += bw;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
EShapePropagate(s->win);
|
||||
EShapePropagate(s->win->win);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -329,7 +311,7 @@ SlideoutAddButton(Slideout * s, Button * b)
|
|||
s->num_buttons++;
|
||||
s->button = Erealloc(s->button, sizeof(Button *) * s->num_buttons);
|
||||
s->button[s->num_buttons - 1] = b;
|
||||
EReparentWindow(ButtonGetWindow(b), s->win, 0, 0);
|
||||
EReparentWindow(ButtonGetWin(b), s->win->win, 0, 0);
|
||||
ButtonSetSwallowed(b);
|
||||
ButtonShow(b);
|
||||
SlideoutCalcSize(s);
|
||||
|
@ -347,36 +329,58 @@ SlideoutRemoveButton(Slideout * s, Button * b)
|
|||
static const char *
|
||||
SlideoutGetName(Slideout * s)
|
||||
{
|
||||
return s->name;
|
||||
return s->win->name;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static EWin *
|
||||
SlideoutsGetContextEwin(void)
|
||||
static void
|
||||
SlideoutCheckButtonEvent(Slideout * s, XEvent * ev)
|
||||
{
|
||||
if (Mode.slideout)
|
||||
return FindEwinByChildren(Mode.slideout->from_win);
|
||||
int i, x, y, bx, by, bw, bh;
|
||||
Button *b;
|
||||
|
||||
return NULL;
|
||||
x = ev->xbutton.x;
|
||||
y = ev->xbutton.y;
|
||||
|
||||
if (x < 0 || y < 0 || x > s->win->w || y >= s->win->h)
|
||||
return;
|
||||
|
||||
for (i = 0; i < s->num_buttons; i++)
|
||||
{
|
||||
b = s->button[i];
|
||||
EGetGeometry(ButtonGetWin(b), NULL, &bx, &by, &bw, &bh, NULL, NULL);
|
||||
if (x < bx || y < by || x >= bx + bw || y >= by + bh)
|
||||
continue;
|
||||
ButtonDoAction(b, s->context_ewin, ev);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
static void
|
||||
SlideoutHandleEvent(XEvent * ev, void *prm)
|
||||
{
|
||||
Slideout *s = prm;
|
||||
|
||||
switch (ev->type)
|
||||
{
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
SlideoutHide(s);
|
||||
break;
|
||||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
SlideoutCheckButtonEvent(s, ev);
|
||||
if (ev->type == ButtonRelease)
|
||||
SlideoutHide(s);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
SlideoutsHide(void)
|
||||
{
|
||||
if (Mode.slideout)
|
||||
SlideoutHide(Mode.slideout);
|
||||
if (Mode_slideouts.active)
|
||||
SlideoutHide(Mode_slideouts.active);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
SlideoutsHideIfContextWin(Window win)
|
||||
{
|
||||
if ((Mode.slideout) && (Mode.slideout->from_win == win))
|
||||
SlideoutHide(Mode.slideout);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Configuration load/save
|
||||
*/
|
||||
|
@ -460,7 +464,7 @@ SlideoutsConfigLoad(FILE * fs)
|
|||
*/
|
||||
|
||||
static void
|
||||
SlideoutsSighan(int sig, void *prm __UNUSED__)
|
||||
SlideoutsSighan(int sig, void *prm)
|
||||
{
|
||||
switch (sig)
|
||||
{
|
||||
|
@ -468,16 +472,43 @@ SlideoutsSighan(int sig, void *prm __UNUSED__)
|
|||
case ESIGNAL_DESK_SWITCH_START:
|
||||
SlideoutsHide();
|
||||
break;
|
||||
|
||||
case ESIGNAL_EWIN_UNMAP:
|
||||
if (Mode_slideouts.active
|
||||
&& Mode_slideouts.active->context_ewin == (EWin *) prm)
|
||||
SlideoutsHide();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
IPC_Slideout(const char *params, Client * c __UNUSED__)
|
||||
{
|
||||
Slideout *s;
|
||||
|
||||
if (!params)
|
||||
return;
|
||||
|
||||
s = FindItem(params, 0, LIST_FINDBY_NAME, LIST_TYPE_SLIDEOUT);
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
SoundPlay("SOUND_SLIDEOUT_SHOW");
|
||||
SlideoutShow(s, GetContextEwin(), Mode.context_win);
|
||||
}
|
||||
|
||||
static IpcItem SlideoutsIpcArray[] = {
|
||||
{
|
||||
IPC_Slideout, "slideout", NULL, "Show slideout", NULL},
|
||||
};
|
||||
#define N_IPC_FUNCS (sizeof(SlideoutsIpcArray)/sizeof(IpcItem))
|
||||
|
||||
/*
|
||||
* Module descriptor
|
||||
*/
|
||||
EModule ModSlideouts = {
|
||||
"slideouts", "slideout",
|
||||
SlideoutsSighan,
|
||||
{0, NULL}
|
||||
,
|
||||
{N_IPC_FUNCS, SlideoutsIpcArray},
|
||||
{0, NULL}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue