Simplify handling of top-level windows - part 3.
SVN revision: 14217
This commit is contained in:
parent
8a8f547e0c
commit
af3f3e6434
3
src/E.h
3
src/E.h
|
@ -519,7 +519,8 @@ struct _eobj
|
||||||
#define EOBJ_TYPE_BUTTON 1
|
#define EOBJ_TYPE_BUTTON 1
|
||||||
#define EOBJ_TYPE_DESK 2
|
#define EOBJ_TYPE_DESK 2
|
||||||
#define EOBJ_TYPE_MISC 3
|
#define EOBJ_TYPE_MISC 3
|
||||||
#define EOBJ_TYPE_EXT 4
|
#define EOBJ_TYPE_EVENT 4
|
||||||
|
#define EOBJ_TYPE_EXT 5
|
||||||
|
|
||||||
#define EoGetWin(eo) ((eo)->o.win)
|
#define EoGetWin(eo) ((eo)->o.win)
|
||||||
#define EoGetName(eo) ((eo)->o.name)
|
#define EoGetName(eo) ((eo)->o.name)
|
||||||
|
|
|
@ -127,6 +127,7 @@ SetAreaSize(int aw, int ah)
|
||||||
Conf.desks.areas_nx = area_w = aw;
|
Conf.desks.areas_nx = area_w = aw;
|
||||||
Conf.desks.areas_ny = area_h = ah;
|
Conf.desks.areas_ny = area_h = ah;
|
||||||
HintsSetViewportConfig();
|
HintsSetViewportConfig();
|
||||||
|
EdgeWindowsShow();
|
||||||
ModulesSignal(ESIGNAL_AREA_CONFIGURED, NULL);
|
ModulesSignal(ESIGNAL_AREA_CONFIGURED, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,12 +130,11 @@ ButtonCreate(const char *name, int id, ImageClass * iclass,
|
||||||
b->ref_count = 0;
|
b->ref_count = 0;
|
||||||
|
|
||||||
win = ECreateWindow(DeskGetWin(desk), -100, -100, 50, 50, 0);
|
win = ECreateWindow(DeskGetWin(desk), -100, -100, 50, 50, 0);
|
||||||
EobjInit(&b->o, EOBJ_TYPE_BUTTON, win, -100, -100, 50, 50, name);
|
|
||||||
|
|
||||||
EoSetSticky(b, sticky);
|
EoSetSticky(b, sticky);
|
||||||
EoSetDesk(b, desk);
|
EoSetDesk(b, desk);
|
||||||
EoSetLayer(b, ontop);
|
EoSetLayer(b, ontop);
|
||||||
EoSetShadow(b, 0);
|
EoSetShadow(b, 0);
|
||||||
|
EobjInit(&b->o, EOBJ_TYPE_BUTTON, win, -100, -100, 50, 50, name);
|
||||||
|
|
||||||
ESelectInput(EoGetWin(b), BUTTON_EVENT_MASK);
|
ESelectInput(EoGetWin(b), BUTTON_EVENT_MASK);
|
||||||
EventCallbackRegister(EoGetWin(b), 0, ButtonHandleEvents, b);
|
EventCallbackRegister(EoGetWin(b), 0, ButtonHandleEvents, b);
|
||||||
|
|
|
@ -1335,7 +1335,6 @@ StackDesktop(int desk)
|
||||||
}
|
}
|
||||||
|
|
||||||
XRestackWindows(disp, wl, tot);
|
XRestackWindows(disp, wl, tot);
|
||||||
EdgeWindowsShow();
|
|
||||||
HintsSetClientStacking();
|
HintsSetClientStacking();
|
||||||
|
|
||||||
if (wl)
|
if (wl)
|
||||||
|
|
60
src/edge.c
60
src/edge.c
|
@ -23,7 +23,9 @@
|
||||||
*/
|
*/
|
||||||
#include "E.h"
|
#include "E.h"
|
||||||
|
|
||||||
static Window w1 = 0, w2 = 0, w3 = 0, w4 = 0;
|
/* FIXME: Screen resizing not handled. */
|
||||||
|
|
||||||
|
static EObj *w1 = NULL, *w2 = NULL, *w3 = NULL, *w4 = NULL;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
EdgeTimeout(int val, void *data __UNUSED__)
|
EdgeTimeout(int val, void *data __UNUSED__)
|
||||||
|
@ -183,48 +185,50 @@ EdgeWindowsShow(void)
|
||||||
|
|
||||||
if (!w1)
|
if (!w1)
|
||||||
{
|
{
|
||||||
w1 = ECreateEventWindow(VRoot.win, 0, 0, 1, VRoot.h);
|
w1 = EobjWindowCreate(EOBJ_TYPE_EVENT, 0, 0, 1, VRoot.h, 0, "Edge-L");
|
||||||
w2 = ECreateEventWindow(VRoot.win, VRoot.w - 1, 0, 1, VRoot.h);
|
w2 = EobjWindowCreate(EOBJ_TYPE_EVENT, VRoot.w - 1, 0, 1, VRoot.h, 0,
|
||||||
w3 = ECreateEventWindow(VRoot.win, 0, 0, VRoot.w, 1);
|
"Edge-R");
|
||||||
w4 = ECreateEventWindow(VRoot.win, 0, VRoot.h - 1, VRoot.w, 1);
|
w3 = EobjWindowCreate(EOBJ_TYPE_EVENT, 0, 0, VRoot.w, 1, 0, "Edge-T");
|
||||||
ESelectInput(w1, EnterWindowMask | LeaveWindowMask);
|
w4 = EobjWindowCreate(EOBJ_TYPE_EVENT, 0, VRoot.h - 1, VRoot.w, 1, 0,
|
||||||
ESelectInput(w2, EnterWindowMask | LeaveWindowMask);
|
"Edge-B");
|
||||||
ESelectInput(w3, EnterWindowMask | LeaveWindowMask);
|
ESelectInput(w1->win, EnterWindowMask | LeaveWindowMask);
|
||||||
ESelectInput(w4, EnterWindowMask | LeaveWindowMask);
|
ESelectInput(w2->win, EnterWindowMask | LeaveWindowMask);
|
||||||
EventCallbackRegister(w1, 0, EdgeHandleEvents, (void *)0);
|
ESelectInput(w3->win, EnterWindowMask | LeaveWindowMask);
|
||||||
EventCallbackRegister(w2, 0, EdgeHandleEvents, (void *)1);
|
ESelectInput(w4->win, EnterWindowMask | LeaveWindowMask);
|
||||||
EventCallbackRegister(w3, 0, EdgeHandleEvents, (void *)2);
|
EventCallbackRegister(w1->win, 0, EdgeHandleEvents, (void *)0);
|
||||||
EventCallbackRegister(w4, 0, EdgeHandleEvents, (void *)3);
|
EventCallbackRegister(w2->win, 0, EdgeHandleEvents, (void *)1);
|
||||||
|
EventCallbackRegister(w3->win, 0, EdgeHandleEvents, (void *)2);
|
||||||
|
EventCallbackRegister(w4->win, 0, EdgeHandleEvents, (void *)3);
|
||||||
}
|
}
|
||||||
DeskGetCurrentArea(&cx, &cy);
|
DeskGetCurrentArea(&cx, &cy);
|
||||||
GetAreaSize(&ax, &ay);
|
GetAreaSize(&ax, &ay);
|
||||||
|
|
||||||
if (cx == 0 && !Conf.desks.areas_wraparound)
|
if (cx == 0 && !Conf.desks.areas_wraparound)
|
||||||
EUnmapWindow(w1);
|
EobjUnmap(w1);
|
||||||
else
|
else
|
||||||
EMapRaised(w1);
|
EobjMap(w1, 1);
|
||||||
if (cx == (ax - 1) && !Conf.desks.areas_wraparound)
|
if (cx == (ax - 1) && !Conf.desks.areas_wraparound)
|
||||||
EUnmapWindow(w2);
|
EobjUnmap(w2);
|
||||||
else
|
else
|
||||||
EMapRaised(w2);
|
EobjMap(w2, 1);
|
||||||
if (cy == 0 && !Conf.desks.areas_wraparound)
|
if (cy == 0 && !Conf.desks.areas_wraparound)
|
||||||
EUnmapWindow(w3);
|
EobjUnmap(w3);
|
||||||
else
|
else
|
||||||
EMapRaised(w3);
|
EobjMap(w3, 1);
|
||||||
if (cy == (ay - 1) && !Conf.desks.areas_wraparound)
|
if (cy == (ay - 1) && !Conf.desks.areas_wraparound)
|
||||||
EUnmapWindow(w4);
|
EobjUnmap(w4);
|
||||||
else
|
else
|
||||||
EMapRaised(w4);
|
EobjMap(w4, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EdgeWindowsHide(void)
|
EdgeWindowsHide(void)
|
||||||
{
|
{
|
||||||
if (w1)
|
if (!w1)
|
||||||
{
|
return;
|
||||||
EUnmapWindow(w1);
|
|
||||||
EUnmapWindow(w2);
|
EobjUnmap(w1);
|
||||||
EUnmapWindow(w3);
|
EobjUnmap(w2);
|
||||||
EUnmapWindow(w4);
|
EobjUnmap(w3);
|
||||||
}
|
EobjUnmap(w4);
|
||||||
}
|
}
|
||||||
|
|
11
src/eobj.c
11
src/eobj.c
|
@ -80,6 +80,7 @@ EobjSetLayer(EObj * eo, int layer)
|
||||||
if (eo->ilayer == 0)
|
if (eo->ilayer == 0)
|
||||||
eo->ilayer = 3;
|
eo->ilayer = 3;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EOBJ_TYPE_BUTTON:
|
case EOBJ_TYPE_BUTTON:
|
||||||
if (eo->layer > 0)
|
if (eo->layer > 0)
|
||||||
eo->ilayer = 75; /* Ontop */
|
eo->ilayer = 75; /* Ontop */
|
||||||
|
@ -90,9 +91,8 @@ EobjSetLayer(EObj * eo, int layer)
|
||||||
if (eo->layer > 0 && eo->sticky)
|
if (eo->layer > 0 && eo->sticky)
|
||||||
eo->floating = 1;
|
eo->floating = 1;
|
||||||
break;
|
break;
|
||||||
case EOBJ_TYPE_DESK:
|
|
||||||
case EOBJ_TYPE_MISC:
|
default:
|
||||||
case EOBJ_TYPE_EXT:
|
|
||||||
eo->ilayer = 10 * eo->layer;
|
eo->ilayer = 10 * eo->layer;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,10 @@ EobjWindowCreate(int type, int x, int y, int w, int h, int su, const char *name)
|
||||||
|
|
||||||
eo = Ecalloc(1, sizeof(EObj));
|
eo = Ecalloc(1, sizeof(EObj));
|
||||||
|
|
||||||
eo->win = ECreateWindow(VRoot.win, x, y, w, h, su);
|
if (type == EOBJ_TYPE_EVENT)
|
||||||
|
eo->win = ECreateEventWindow(VRoot.win, x, y, w, h);
|
||||||
|
else
|
||||||
|
eo->win = ECreateWindow(VRoot.win, x, y, w, h, su);
|
||||||
if (eo->win == None)
|
if (eo->win == None)
|
||||||
{
|
{
|
||||||
Efree(eo);
|
Efree(eo);
|
||||||
|
|
|
@ -972,7 +972,6 @@ EwinConformToDesktop(EWin * ewin)
|
||||||
}
|
}
|
||||||
RaiseEwin(ewin);
|
RaiseEwin(ewin);
|
||||||
ICCCM_Configure(ewin);
|
ICCCM_Configure(ewin);
|
||||||
EdgeWindowsShow();
|
|
||||||
}
|
}
|
||||||
else if (ewin->parent != dwin)
|
else if (ewin->parent != dwin)
|
||||||
{
|
{
|
||||||
|
|
465
src/pager.c
465
src/pager.c
|
@ -36,24 +36,26 @@ struct _pager
|
||||||
int update_phase;
|
int update_phase;
|
||||||
EWin *ewin;
|
EWin *ewin;
|
||||||
Window sel_win;
|
Window sel_win;
|
||||||
char hi_visible;
|
|
||||||
Window hi_win;
|
|
||||||
EWin *hi_ewin;
|
|
||||||
int hi_win_w, hi_win_h;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
EObj o;
|
||||||
|
EWin *ewin;
|
||||||
|
Pager *p;
|
||||||
|
} PagerHiwin;
|
||||||
|
|
||||||
#define PAGER_EVENT_MOUSE_OUT -1
|
#define PAGER_EVENT_MOUSE_OUT -1
|
||||||
#define PAGER_EVENT_MOTION 0
|
#define PAGER_EVENT_MOTION 0
|
||||||
#define PAGER_EVENT_MOUSE_IN 1
|
#define PAGER_EVENT_MOUSE_IN 1
|
||||||
|
|
||||||
static void PagerDrawQueueCallback(DrawQueue * dq);
|
static void PagerDrawQueueCallback(DrawQueue * dq);
|
||||||
|
|
||||||
static void PagerEwinUpdateFromPager(Pager * p, EWin * ewin);
|
static void PagerEwinUpdateFromPager(Pager * p, EWin * ewin);
|
||||||
|
static void PagerHiwinHide(Pager * p);
|
||||||
static void PagerEventMainWin(XEvent * ev, void *prm);
|
static void PagerEventMainWin(XEvent * ev, void *prm);
|
||||||
static void PagerEventHiWin(XEvent * ev, void *prm);
|
static void PagerHiwinEvent(XEvent * ev, void *prm);
|
||||||
|
|
||||||
static Pager *mode_context_pager = NULL;
|
static PagerHiwin *hiwin = NULL;
|
||||||
|
|
||||||
static Pager *
|
static Pager *
|
||||||
PagerCreate(void)
|
PagerCreate(void)
|
||||||
|
@ -86,13 +88,6 @@ PagerCreate(void)
|
||||||
EventCallbackRegister(p->win, 0, PagerEventMainWin, p);
|
EventCallbackRegister(p->win, 0, PagerEventMainWin, p);
|
||||||
p->pmap = ECreatePixmap(p->win, p->w, p->h, VRoot.depth);
|
p->pmap = ECreatePixmap(p->win, p->w, p->h, VRoot.depth);
|
||||||
ESetWindowBackgroundPixmap(p->win, p->pmap);
|
ESetWindowBackgroundPixmap(p->win, p->pmap);
|
||||||
p->hi_win = ECreateWindow(VRoot.win, 0, 0, 3, 3, 0);
|
|
||||||
EventCallbackRegister(p->hi_win, 0, PagerEventHiWin, p);
|
|
||||||
p->hi_visible = 0;
|
|
||||||
p->hi_ewin = NULL;
|
|
||||||
ESelectInput(p->hi_win,
|
|
||||||
ButtonPressMask | ButtonReleaseMask | PointerMotionMask |
|
|
||||||
EnterWindowMask | LeaveWindowMask);
|
|
||||||
p->desktop = 0;
|
p->desktop = 0;
|
||||||
p->visible = 0;
|
p->visible = 0;
|
||||||
p->update_phase = 0;
|
p->update_phase = 0;
|
||||||
|
@ -119,8 +114,7 @@ PagerDestroy(Pager * p)
|
||||||
if (p->name)
|
if (p->name)
|
||||||
Efree(p->name);
|
Efree(p->name);
|
||||||
EDestroyWindow(p->win);
|
EDestroyWindow(p->win);
|
||||||
if (p->hi_win)
|
PagerHiwinHide(p);
|
||||||
EDestroyWindow(p->hi_win);
|
|
||||||
if (p->pmap)
|
if (p->pmap)
|
||||||
EFreePixmap(p->pmap);
|
EFreePixmap(p->pmap);
|
||||||
FreePmapMask(&p->bgpmap);
|
FreePmapMask(&p->bgpmap);
|
||||||
|
@ -236,19 +230,19 @@ PagerUpdateTimeout(int val __UNUSED__, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PagerUpdateHiWin(Pager * p, EWin * ewin)
|
PagerHiwinUpdate(PagerHiwin * phi, Pager * p __UNUSED__, EWin * ewin)
|
||||||
{
|
{
|
||||||
Imlib_Image *im;
|
Imlib_Image *im;
|
||||||
|
|
||||||
if (!p->hi_visible || !ewin->mini_pmm.pmap)
|
if (!EoIsShown(phi) || !ewin->mini_pmm.pmap)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
imlib_context_set_drawable(ewin->mini_pmm.pmap);
|
imlib_context_set_drawable(ewin->mini_pmm.pmap);
|
||||||
im = imlib_create_image_from_drawable(0, 0, 0,
|
im = imlib_create_image_from_drawable(0, 0, 0,
|
||||||
ewin->mini_w, ewin->mini_h, 0);
|
ewin->mini_w, ewin->mini_h, 0);
|
||||||
imlib_context_set_image(im);
|
imlib_context_set_image(im);
|
||||||
imlib_context_set_drawable(p->hi_win);
|
imlib_context_set_drawable(EoGetWin(phi));
|
||||||
imlib_render_image_on_drawable_at_size(0, 0, p->hi_win_w, p->hi_win_h);
|
imlib_render_image_on_drawable_at_size(0, 0, EoGetW(phi), EoGetH(phi));
|
||||||
imlib_free_image_and_decache();
|
imlib_free_image_and_decache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,8 +290,8 @@ PagerEwinUpdateMini(Pager * p, EWin * ewin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ewin == p->hi_ewin)
|
if (hiwin && ewin == hiwin->ewin)
|
||||||
PagerUpdateHiWin(p, ewin);
|
PagerHiwinUpdate(hiwin, p, ewin);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -592,14 +586,8 @@ PagerEwinMoveResize(EWin * ewin, int resize __UNUSED__)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PagerEwinRefresh(EWin * ewin)
|
PagerEwinRefresh(EWin * ewin __UNUSED__)
|
||||||
{
|
{
|
||||||
/* This doesn't do anything anymore apparently
|
|
||||||
* --Mandrake
|
|
||||||
* This is new code.
|
|
||||||
* It can be removed but I have kept it around, just in case /Kim */
|
|
||||||
return;
|
|
||||||
ewin = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -808,8 +796,8 @@ PagerEwinUpdateFromPager(Pager * p, EWin * ewin)
|
||||||
}
|
}
|
||||||
XCopyArea(disp, p->pmap, ewin->mini_pmm.pmap, gc, x, y, w, h, 0, 0);
|
XCopyArea(disp, p->pmap, ewin->mini_pmm.pmap, gc, x, y, w, h, 0, 0);
|
||||||
|
|
||||||
if (ewin == p->hi_ewin)
|
if (hiwin && ewin == hiwin->ewin)
|
||||||
PagerUpdateHiWin(p, ewin);
|
PagerHiwinUpdate(hiwin, p, ewin);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1041,56 +1029,100 @@ PagerShowTt(EWin * ewin)
|
||||||
tt_ewin = ewin;
|
tt_ewin = ewin;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static PagerHiwin *
|
||||||
PagerHideHi(Pager * p)
|
PagerHiwinCreate(void)
|
||||||
{
|
{
|
||||||
if (p->hi_visible)
|
PagerHiwin *phi;
|
||||||
|
Window win;
|
||||||
|
|
||||||
|
phi = Ecalloc(1, sizeof(PagerHiwin));
|
||||||
|
if (!phi)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
win = ECreateWindow(VRoot.win, 0, 0, 3, 3, 1);
|
||||||
|
EoSetShadow(phi, 0);
|
||||||
|
EoSetFloating(phi, 1);
|
||||||
|
EoSetLayer(phi, 19);
|
||||||
|
EobjInit(&phi->o, EOBJ_TYPE_MISC, win, 0, 0, 3, 3, "HiWin");
|
||||||
|
EventCallbackRegister(EoGetWin(phi), 0, PagerHiwinEvent, phi);
|
||||||
|
ESelectInput(EoGetWin(phi),
|
||||||
|
ButtonPressMask | ButtonReleaseMask | PointerMotionMask |
|
||||||
|
EnterWindowMask | LeaveWindowMask);
|
||||||
|
|
||||||
|
hiwin = phi;
|
||||||
|
return phi;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
PagerHiwinHide(Pager * p __UNUSED__)
|
||||||
|
{
|
||||||
|
PagerHiwin *phi = hiwin;
|
||||||
|
|
||||||
|
if (phi)
|
||||||
{
|
{
|
||||||
p->hi_visible = 0;
|
if (EoIsShown(phi))
|
||||||
EUnmapWindow(p->hi_win);
|
EoUnmap(phi);
|
||||||
|
phi->ewin = NULL;
|
||||||
|
phi->p = NULL;
|
||||||
|
Mode.mode = MODE_NONE;
|
||||||
}
|
}
|
||||||
p->hi_ewin = NULL;
|
|
||||||
|
|
||||||
PagerShowTt(NULL);
|
PagerShowTt(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void
|
static void
|
||||||
PagerHideAllHi(void)
|
PagerHiwinShow(Pager * p, EWin * ewin, int px, int py)
|
||||||
{
|
{
|
||||||
Pager **pl = NULL;
|
PagerHiwin *phi = hiwin;
|
||||||
int i, pnum;
|
Window dw;
|
||||||
|
int wx, wy, ww, wh, ax, ay, cx, cy;
|
||||||
|
|
||||||
if (!Conf.pagers.enable)
|
PagerHiwinHide(p);
|
||||||
return;
|
|
||||||
|
|
||||||
pl = (Pager **) ListItemType(&pnum, LIST_TYPE_PAGER);
|
if (!phi)
|
||||||
if (pl)
|
|
||||||
{
|
{
|
||||||
for (i = 0; i < pnum; i++)
|
phi = PagerHiwinCreate();
|
||||||
PagerHideHi(pl[i]);
|
if (!phi)
|
||||||
Efree(pl);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GetAreaSize(&ax, &ay);
|
||||||
|
DeskGetArea(p->desktop, &cx, &cy);
|
||||||
|
|
||||||
|
wx = ((EoGetX(ewin) + (cx * VRoot.w)) * (p->w / ax)) / VRoot.w;
|
||||||
|
wy = ((EoGetY(ewin) + (cy * VRoot.h)) * (p->h / ay)) / VRoot.h;
|
||||||
|
ww = ((EoGetW(ewin)) * (p->w / ax)) / VRoot.w;
|
||||||
|
wh = ((EoGetH(ewin)) * (p->h / ay)) / VRoot.h;
|
||||||
|
XTranslateCoordinates(disp, p->win, VRoot.win, 0, 0, &px, &py, &dw);
|
||||||
|
EoMoveResize(phi, px + wx, py + wy, ww, wh);
|
||||||
|
ESetWindowBackgroundPixmap(EoGetWin(phi), ewin->mini_pmm.pmap);
|
||||||
|
EoMap(phi, 0);
|
||||||
|
GrabPointerSet(EoGetWin(phi), ECSR_ACT_MOVE, 1);
|
||||||
|
phi->ewin = ewin;
|
||||||
|
phi->p = p;
|
||||||
|
Mode.mode = MODE_PAGER_DRAG_PENDING;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PagerShowHi(Pager * p, EWin * ewin, int x, int y, int w, int h)
|
PagerHiwinZoom(Pager * p, EWin * ewin, int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
char pq;
|
|
||||||
ImageClass *ic = NULL;
|
ImageClass *ic = NULL;
|
||||||
|
PagerHiwin *phi = hiwin;
|
||||||
|
|
||||||
if (MenusActive()) /* Don't show HiWin when menu is up */
|
if (MenusActive()) /* Don't show HiWin when menu is up */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pq = Mode.queue_up;
|
if (!phi)
|
||||||
|
{
|
||||||
p->hi_win_w = 2 * w;
|
phi = PagerHiwinCreate();
|
||||||
p->hi_win_h = 2 * h;
|
if (!phi)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ic = ImageclassFind("PAGER_WIN", 0);
|
ic = ImageclassFind("PAGER_WIN", 0);
|
||||||
EMoveResizeWindow(p->hi_win, x, y, w, h);
|
EoMoveResize(phi, x, y, w, h);
|
||||||
EMapRaised(p->hi_win);
|
EoMap(phi, 1);
|
||||||
|
|
||||||
if (ewin->mini_pmm.pmap)
|
if (ewin->mini_pmm.pmap)
|
||||||
{
|
{
|
||||||
Imlib_Image *im;
|
Imlib_Image *im;
|
||||||
|
@ -1111,10 +1143,10 @@ PagerShowHi(Pager * p, EWin * ewin, int x, int y, int w, int h)
|
||||||
yy = y + ((h - hh) / 2);
|
yy = y + ((h - hh) / 2);
|
||||||
imlib_render_pixmaps_for_whole_image_at_size(&pmap,
|
imlib_render_pixmaps_for_whole_image_at_size(&pmap,
|
||||||
&mask, ww, hh);
|
&mask, ww, hh);
|
||||||
ESetWindowBackgroundPixmap(p->hi_win, pmap);
|
ESetWindowBackgroundPixmap(EoGetWin(phi), pmap);
|
||||||
imlib_free_pixmap_and_mask(pmap);
|
imlib_free_pixmap_and_mask(pmap);
|
||||||
EMoveResizeWindow(p->hi_win, xx, yy, ww, hh);
|
EoMoveResize(phi, xx, yy, ww, hh);
|
||||||
EClearWindow(p->hi_win);
|
EClearWindow(EoGetWin(phi));
|
||||||
{
|
{
|
||||||
int px, py;
|
int px, py;
|
||||||
|
|
||||||
|
@ -1123,7 +1155,7 @@ PagerShowHi(Pager * p, EWin * ewin, int x, int y, int w, int h)
|
||||||
|| (py >= (y + h)))
|
|| (py >= (y + h)))
|
||||||
{
|
{
|
||||||
imlib_free_image_and_decache();
|
imlib_free_image_and_decache();
|
||||||
EUnmapWindow(p->hi_win);
|
EoUnmap(phi);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1139,10 +1171,10 @@ PagerShowHi(Pager * p, EWin * ewin, int x, int y, int w, int h)
|
||||||
yy = y + ((h - hh) / 2);
|
yy = y + ((h - hh) / 2);
|
||||||
imlib_render_pixmaps_for_whole_image_at_size(&pmap,
|
imlib_render_pixmaps_for_whole_image_at_size(&pmap,
|
||||||
&mask, ww, hh);
|
&mask, ww, hh);
|
||||||
ESetWindowBackgroundPixmap(p->hi_win, pmap);
|
ESetWindowBackgroundPixmap(EoGetWin(phi), pmap);
|
||||||
imlib_free_pixmap_and_mask(pmap);
|
imlib_free_pixmap_and_mask(pmap);
|
||||||
EMoveResizeWindow(p->hi_win, xx, yy, ww, hh);
|
EoMoveResize(phi, xx, yy, ww, hh);
|
||||||
EClearWindow(p->hi_win);
|
EClearWindow(EoGetWin(phi));
|
||||||
{
|
{
|
||||||
int px, py;
|
int px, py;
|
||||||
|
|
||||||
|
@ -1151,23 +1183,22 @@ PagerShowHi(Pager * p, EWin * ewin, int x, int y, int w, int h)
|
||||||
|| (py >= (y + h)))
|
|| (py >= (y + h)))
|
||||||
{
|
{
|
||||||
imlib_free_image_and_decache();
|
imlib_free_image_and_decache();
|
||||||
EUnmapWindow(p->hi_win);
|
EoUnmap(phi);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EMoveResizeWindow(p->hi_win, x - (w / 2), y - (h / 2), w * 2, h * 2);
|
EoMoveResize(phi, x - (w / 2), y - (h / 2), w * 2, h * 2);
|
||||||
imlib_context_set_image(im);
|
imlib_context_set_image(im);
|
||||||
imlib_context_set_drawable(p->hi_win);
|
imlib_context_set_drawable(EoGetWin(phi));
|
||||||
imlib_render_image_on_drawable_at_size(0, 0, p->hi_win_w, p->hi_win_h);
|
imlib_render_image_on_drawable_at_size(0, 0, EoGetW(phi), EoGetH(phi));
|
||||||
imlib_free_image_and_decache();
|
imlib_free_image_and_decache();
|
||||||
}
|
}
|
||||||
else if (ic)
|
else if (ic)
|
||||||
{
|
{
|
||||||
int xx, yy, ww, hh, i;
|
int xx, yy, ww, hh, i;
|
||||||
|
|
||||||
Mode.queue_up = 0;
|
|
||||||
if (w > h)
|
if (w > h)
|
||||||
{
|
{
|
||||||
for (i = w; i < (w * 2); i++)
|
for (i = w; i < (w * 2); i++)
|
||||||
|
@ -1176,10 +1207,10 @@ PagerShowHi(Pager * p, EWin * ewin, int x, int y, int w, int h)
|
||||||
hh = (i * h) / w;
|
hh = (i * h) / w;
|
||||||
xx = x + ((w - ww) / 2);
|
xx = x + ((w - ww) / 2);
|
||||||
yy = y + ((h - hh) / 2);
|
yy = y + ((h - hh) / 2);
|
||||||
ImageclassApply(ic, p->hi_win, ww, hh, 0, 0, STATE_NORMAL, 0,
|
ImageclassApply(ic, EoGetWin(phi), ww, hh, 0, 0, STATE_NORMAL,
|
||||||
ST_PAGER);
|
0, ST_PAGER);
|
||||||
EMoveResizeWindow(p->hi_win, xx, yy, ww, hh);
|
EoMoveResize(phi, xx, yy, ww, hh);
|
||||||
EClearWindow(p->hi_win);
|
EClearWindow(EoGetWin(phi));
|
||||||
{
|
{
|
||||||
int px, py;
|
int px, py;
|
||||||
|
|
||||||
|
@ -1187,7 +1218,7 @@ PagerShowHi(Pager * p, EWin * ewin, int x, int y, int w, int h)
|
||||||
if ((px < x) || (py < y) || (px >= (x + w))
|
if ((px < x) || (py < y) || (px >= (x + w))
|
||||||
|| (py >= (y + h)))
|
|| (py >= (y + h)))
|
||||||
{
|
{
|
||||||
EUnmapWindow(p->hi_win);
|
EoUnmap(phi);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1201,10 +1232,10 @@ PagerShowHi(Pager * p, EWin * ewin, int x, int y, int w, int h)
|
||||||
hh = i;
|
hh = i;
|
||||||
xx = x + ((w - ww) / 2);
|
xx = x + ((w - ww) / 2);
|
||||||
yy = y + ((h - hh) / 2);
|
yy = y + ((h - hh) / 2);
|
||||||
ImageclassApply(ic, p->hi_win, ww, hh, 0, 0, STATE_NORMAL, 0,
|
ImageclassApply(ic, EoGetWin(phi), ww, hh, 0, 0, STATE_NORMAL,
|
||||||
ST_PAGER);
|
0, ST_PAGER);
|
||||||
EMoveResizeWindow(p->hi_win, xx, yy, ww, hh);
|
EoMoveResize(phi, xx, yy, ww, hh);
|
||||||
EClearWindow(p->hi_win);
|
EClearWindow(EoGetWin(phi));
|
||||||
{
|
{
|
||||||
int px, py;
|
int px, py;
|
||||||
|
|
||||||
|
@ -1212,13 +1243,13 @@ PagerShowHi(Pager * p, EWin * ewin, int x, int y, int w, int h)
|
||||||
if ((px < x) || (py < y) || (px >= (x + w))
|
if ((px < x) || (py < y) || (px >= (x + w))
|
||||||
|| (py >= (y + h)))
|
|| (py >= (y + h)))
|
||||||
{
|
{
|
||||||
EUnmapWindow(p->hi_win);
|
EoUnmap(phi);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EMoveResizeWindow(p->hi_win, x - (w / 2), y - (h / 2), w * 2, h * 2);
|
EoMoveResize(phi, x - (w / 2), y - (h / 2), w * 2, h * 2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1226,8 +1257,8 @@ PagerShowHi(Pager * p, EWin * ewin, int x, int y, int w, int h)
|
||||||
GC gc;
|
GC gc;
|
||||||
int xx, yy, ww, hh, i;
|
int xx, yy, ww, hh, i;
|
||||||
|
|
||||||
pmap = ECreatePixmap(p->hi_win, w * 2, h * 2, VRoot.depth);
|
pmap = ECreatePixmap(EoGetWin(phi), w * 2, h * 2, VRoot.depth);
|
||||||
ESetWindowBackgroundPixmap(p->hi_win, pmap);
|
ESetWindowBackgroundPixmap(EoGetWin(phi), pmap);
|
||||||
gc = ECreateGC(pmap, 0, NULL);
|
gc = ECreateGC(pmap, 0, NULL);
|
||||||
|
|
||||||
if (w > h)
|
if (w > h)
|
||||||
|
@ -1242,8 +1273,8 @@ PagerShowHi(Pager * p, EWin * ewin, int x, int y, int w, int h)
|
||||||
XFillRectangle(disp, pmap, gc, 0, 0, ww, hh);
|
XFillRectangle(disp, pmap, gc, 0, 0, ww, hh);
|
||||||
XSetForeground(disp, gc, WhitePixel(disp, VRoot.scr));
|
XSetForeground(disp, gc, WhitePixel(disp, VRoot.scr));
|
||||||
XFillRectangle(disp, pmap, gc, 1, 1, ww - 2, hh - 2);
|
XFillRectangle(disp, pmap, gc, 1, 1, ww - 2, hh - 2);
|
||||||
EMoveResizeWindow(p->hi_win, xx, yy, ww, hh);
|
EoMoveResize(phi, xx, yy, ww, hh);
|
||||||
EClearWindow(p->hi_win);
|
EClearWindow(EoGetWin(phi));
|
||||||
{
|
{
|
||||||
int px, py;
|
int px, py;
|
||||||
|
|
||||||
|
@ -1252,7 +1283,7 @@ PagerShowHi(Pager * p, EWin * ewin, int x, int y, int w, int h)
|
||||||
|| (py >= (y + h)))
|
|| (py >= (y + h)))
|
||||||
{
|
{
|
||||||
EFreePixmap(pmap);
|
EFreePixmap(pmap);
|
||||||
EUnmapWindow(p->hi_win);
|
EoUnmap(phi);
|
||||||
goto done1;
|
goto done1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1270,8 +1301,8 @@ PagerShowHi(Pager * p, EWin * ewin, int x, int y, int w, int h)
|
||||||
XFillRectangle(disp, pmap, gc, 0, 0, ww, hh);
|
XFillRectangle(disp, pmap, gc, 0, 0, ww, hh);
|
||||||
XSetForeground(disp, gc, WhitePixel(disp, VRoot.scr));
|
XSetForeground(disp, gc, WhitePixel(disp, VRoot.scr));
|
||||||
XFillRectangle(disp, pmap, gc, 1, 1, ww - 2, hh - 2);
|
XFillRectangle(disp, pmap, gc, 1, 1, ww - 2, hh - 2);
|
||||||
EMoveResizeWindow(p->hi_win, xx, yy, ww, hh);
|
EoMoveResize(phi, xx, yy, ww, hh);
|
||||||
EClearWindow(p->hi_win);
|
EClearWindow(EoGetWin(phi));
|
||||||
{
|
{
|
||||||
int px, py;
|
int px, py;
|
||||||
|
|
||||||
|
@ -1280,26 +1311,46 @@ PagerShowHi(Pager * p, EWin * ewin, int x, int y, int w, int h)
|
||||||
|| (py >= (y + h)))
|
|| (py >= (y + h)))
|
||||||
{
|
{
|
||||||
EFreePixmap(pmap);
|
EFreePixmap(pmap);
|
||||||
EUnmapWindow(p->hi_win);
|
EoUnmap(phi);
|
||||||
goto done1;
|
goto done1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EFreePixmap(pmap);
|
EFreePixmap(pmap);
|
||||||
EMoveResizeWindow(p->hi_win, x - (w / 2), y - (h / 2), w * 2, h * 2);
|
EoMoveResize(phi, x - (w / 2), y - (h / 2), w * 2, h * 2);
|
||||||
done1:
|
done1:
|
||||||
EFreeGC(gc);
|
EFreeGC(gc);
|
||||||
}
|
}
|
||||||
p->hi_visible = 1;
|
|
||||||
p->hi_ewin = ewin;
|
phi->ewin = ewin;
|
||||||
|
phi->p = p;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
Mode.queue_up = pq;
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static EWin *
|
||||||
|
PagerHiwinEwin(int check)
|
||||||
|
{
|
||||||
|
EWin *ewin;
|
||||||
|
PagerHiwin *phi = hiwin;
|
||||||
|
|
||||||
|
if (!phi)
|
||||||
|
return NULL;
|
||||||
|
if (!check || !phi->ewin)
|
||||||
|
return phi->ewin;
|
||||||
|
|
||||||
|
ewin = FindItem((char *)phi->ewin, 0, LIST_FINDBY_POINTER, LIST_TYPE_EWIN);
|
||||||
|
|
||||||
|
if (!ewin)
|
||||||
|
phi->ewin = NULL;
|
||||||
|
|
||||||
|
return ewin;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PagerHandleMotion(Pager * p, Window win, int x, int y, int in)
|
PagerHandleMotion(Pager * p, Window win __UNUSED__, int x, int y, int in)
|
||||||
{
|
{
|
||||||
int hx, hy;
|
int hx, hy;
|
||||||
Window rw, cw;
|
Window rw, cw;
|
||||||
|
@ -1326,7 +1377,7 @@ PagerHandleMotion(Pager * p, Window win, int x, int y, int in)
|
||||||
|
|
||||||
if (ewin == NULL)
|
if (ewin == NULL)
|
||||||
{
|
{
|
||||||
PagerHideHi(p);
|
PagerHiwinHide(p);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1336,15 +1387,14 @@ PagerHandleMotion(Pager * p, Window win, int x, int y, int in)
|
||||||
}
|
}
|
||||||
else if ((in == PAGER_EVENT_MOTION) && EoGetLayer(ewin) <= 0)
|
else if ((in == PAGER_EVENT_MOTION) && EoGetLayer(ewin) <= 0)
|
||||||
{
|
{
|
||||||
if (p->hi_ewin)
|
PagerHiwinHide(p);
|
||||||
PagerHideHi(p);
|
|
||||||
PagerShowTt(ewin);
|
PagerShowTt(ewin);
|
||||||
}
|
}
|
||||||
else if ((in == PAGER_EVENT_MOTION) && ewin != p->hi_ewin)
|
else if ((in == PAGER_EVENT_MOTION) && (!hiwin || ewin != hiwin->ewin))
|
||||||
{
|
{
|
||||||
int wx, wy, ww, wh, ax, ay, cx, cy, px, py;
|
int wx, wy, ww, wh, ax, ay, cx, cy, px, py;
|
||||||
|
|
||||||
PagerHideHi(p);
|
PagerHiwinHide(p);
|
||||||
GetAreaSize(&ax, &ay);
|
GetAreaSize(&ax, &ay);
|
||||||
DeskGetArea(p->desktop, &cx, &cy);
|
DeskGetArea(p->desktop, &cx, &cy);
|
||||||
|
|
||||||
|
@ -1353,17 +1403,13 @@ PagerHandleMotion(Pager * p, Window win, int x, int y, int in)
|
||||||
ww = ((EoGetW(ewin)) * (p->w / ax)) / VRoot.w;
|
ww = ((EoGetW(ewin)) * (p->w / ax)) / VRoot.w;
|
||||||
wh = ((EoGetH(ewin)) * (p->h / ay)) / VRoot.h;
|
wh = ((EoGetH(ewin)) * (p->h / ay)) / VRoot.h;
|
||||||
XTranslateCoordinates(disp, p->win, VRoot.win, 0, 0, &px, &py, &cw);
|
XTranslateCoordinates(disp, p->win, VRoot.win, 0, 0, &px, &py, &cw);
|
||||||
PagerShowHi(p, ewin, px + wx, py + wy, ww, wh);
|
PagerHiwinZoom(p, ewin, px + wx, py + wy, ww, wh);
|
||||||
PagerShowTt(ewin);
|
PagerShowTt(ewin);
|
||||||
}
|
}
|
||||||
else if (in == PAGER_EVENT_MOTION)
|
else if (in == PAGER_EVENT_MOTION)
|
||||||
{
|
{
|
||||||
PagerShowTt(ewin);
|
PagerShowTt(ewin);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
win = 0;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1402,7 +1448,7 @@ PagerSetHiQ(char onoff)
|
||||||
pl = (Pager **) ListItemType(&num, LIST_TYPE_PAGER);
|
pl = (Pager **) ListItemType(&num, LIST_TYPE_PAGER);
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
PagerHideHi(pl[i]);
|
PagerHiwinHide(pl[i]);
|
||||||
PagerRedraw(pl[i], 2);
|
PagerRedraw(pl[i], 2);
|
||||||
PagerForceUpdate(pl[i]);
|
PagerForceUpdate(pl[i]);
|
||||||
}
|
}
|
||||||
|
@ -1430,7 +1476,7 @@ PagerSetSnap(char onoff)
|
||||||
pl = (Pager **) ListItemType(&num, LIST_TYPE_PAGER);
|
pl = (Pager **) ListItemType(&num, LIST_TYPE_PAGER);
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
PagerHideHi(pl[i]);
|
PagerHiwinHide(pl[i]);
|
||||||
PagerRedraw(pl[i], 2);
|
PagerRedraw(pl[i], 2);
|
||||||
PagerForceUpdate(pl[i]);
|
PagerForceUpdate(pl[i]);
|
||||||
if (Conf.pagers.snap)
|
if (Conf.pagers.snap)
|
||||||
|
@ -1451,15 +1497,41 @@ PagerSetSnap(char onoff)
|
||||||
|
|
||||||
static int *gwin_px, *gwin_py;
|
static int *gwin_px, *gwin_py;
|
||||||
|
|
||||||
|
static void
|
||||||
|
PagerEwinGroupSet(void)
|
||||||
|
{
|
||||||
|
int i, num;
|
||||||
|
EWin *ewin, **gwins;
|
||||||
|
|
||||||
|
ewin = PagerHiwinEwin(0);
|
||||||
|
gwins = ListWinGroupMembersForEwin(ewin, GROUP_ACTION_MOVE,
|
||||||
|
Mode.nogroup, &num);
|
||||||
|
if (!gwins)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gwin_px = Emalloc(num * sizeof(int));
|
||||||
|
gwin_py = Emalloc(num * sizeof(int));
|
||||||
|
|
||||||
|
for (i = 0; i < num; i++)
|
||||||
|
{
|
||||||
|
gwin_px[i] = EoGetX(gwins[i]);
|
||||||
|
gwin_py[i] = EoGetY(gwins[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Efree(gwins);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
PagerEwinGroupUnset(void)
|
||||||
|
{
|
||||||
|
_EFREE(gwin_px);
|
||||||
|
_EFREE(gwin_py);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PagerEventUnmap(Pager * p)
|
PagerEventUnmap(Pager * p)
|
||||||
{
|
{
|
||||||
PagerHideHi(p);
|
PagerHiwinHide(p);
|
||||||
if (p == mode_context_pager)
|
|
||||||
{
|
|
||||||
mode_context_pager = NULL;
|
|
||||||
Mode.mode = MODE_NONE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1493,11 +1565,12 @@ EwinGroupMove(EWin * ewin, int desk, int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PagerEwinMove(Pager * p, Pager * pd)
|
PagerEwinMove(Pager * p __UNUSED__, Pager * pd)
|
||||||
{
|
{
|
||||||
int x, y, dx, dy, px, py;
|
int x, y, dx, dy, px, py;
|
||||||
int ax, ay, cx, cy;
|
int ax, ay, cx, cy;
|
||||||
Window child;
|
Window child;
|
||||||
|
PagerHiwin *phi = hiwin;
|
||||||
|
|
||||||
GetAreaSize(&ax, &ay);
|
GetAreaSize(&ax, &ay);
|
||||||
DeskGetArea(pd->desktop, &cx, &cy);
|
DeskGetArea(pd->desktop, &cx, &cy);
|
||||||
|
@ -1509,33 +1582,26 @@ PagerEwinMove(Pager * p, Pager * pd)
|
||||||
if (dx || dy)
|
if (dx || dy)
|
||||||
{
|
{
|
||||||
/* Move mini window */
|
/* Move mini window */
|
||||||
EGetGeometry(p->hi_win, NULL, &x, &y, NULL, NULL, NULL, NULL);
|
EoMove(phi, EoGetX(phi) + dx, EoGetY(phi) + dy);
|
||||||
x += dx;
|
|
||||||
y += dy;
|
|
||||||
ERaiseWindow(p->hi_win);
|
|
||||||
EMoveWindow(p->hi_win, x, y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find real window position */
|
/* Find real window position */
|
||||||
XTranslateCoordinates(disp, p->hi_win, pd->win, 0, 0, &px, &py, &child);
|
XTranslateCoordinates(disp, EoGetWin(phi), pd->win, 0, 0, &px, &py, &child);
|
||||||
x = (px * ax * VRoot.w) / pd->w - cx * VRoot.w;
|
x = (px * ax * VRoot.w) / pd->w - cx * VRoot.w;
|
||||||
y = (py * ay * VRoot.h) / pd->h - cy * VRoot.h;
|
y = (py * ay * VRoot.h) / pd->h - cy * VRoot.h;
|
||||||
|
|
||||||
/* Move all group members */
|
/* Move all group members */
|
||||||
EwinGroupMove(p->hi_ewin, pd->desktop, x, y);
|
EwinGroupMove(phi->ewin, pd->desktop, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
PagerEventMotion(Pager * p, XEvent * ev)
|
PagerEventMotion(Pager * p, XEvent * ev)
|
||||||
{
|
{
|
||||||
int used = 0;
|
EWin *ewin;
|
||||||
|
|
||||||
switch (Mode.mode)
|
switch (Mode.mode)
|
||||||
{
|
{
|
||||||
case MODE_NONE:
|
case MODE_NONE:
|
||||||
if (p == NULL)
|
|
||||||
break;
|
|
||||||
used = 1;
|
|
||||||
PagerHandleMotion(p, ev->xmotion.window, ev->xmotion.x,
|
PagerHandleMotion(p, ev->xmotion.window, ev->xmotion.x,
|
||||||
ev->xmotion.y, PAGER_EVENT_MOTION);
|
ev->xmotion.y, PAGER_EVENT_MOTION);
|
||||||
break;
|
break;
|
||||||
|
@ -1543,58 +1609,41 @@ PagerEventMotion(Pager * p, XEvent * ev)
|
||||||
case MODE_PAGER_DRAG_PENDING:
|
case MODE_PAGER_DRAG_PENDING:
|
||||||
case MODE_PAGER_DRAG:
|
case MODE_PAGER_DRAG:
|
||||||
Mode.mode = MODE_PAGER_DRAG;
|
Mode.mode = MODE_PAGER_DRAG;
|
||||||
if (p == NULL)
|
ewin = PagerHiwinEwin(1);
|
||||||
break;
|
if (!ewin || (ewin->type == EWIN_TYPE_PAGER) || (ewin->fixedpos))
|
||||||
used = 1;
|
{
|
||||||
|
Mode.mode = MODE_NONE;
|
||||||
if (!FindItem((char *)p->hi_ewin, 0, LIST_FINDBY_POINTER,
|
break;
|
||||||
LIST_TYPE_EWIN))
|
}
|
||||||
p->hi_ewin = NULL;
|
|
||||||
if ((!p->hi_ewin) ||
|
|
||||||
(p->hi_ewin->type == EWIN_TYPE_PAGER) || (p->hi_ewin->fixedpos))
|
|
||||||
break;
|
|
||||||
|
|
||||||
PagerEwinMove(p, p);
|
PagerEwinMove(p, p);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return used;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PagerEventMouseDown(Pager * p, XEvent * ev)
|
PagerEventMouseDown(Pager * p, XEvent * ev)
|
||||||
{
|
{
|
||||||
Window win = ev->xbutton.window, child;
|
Window win = ev->xbutton.window, child;
|
||||||
int i, num, px, py, in_pager;
|
int px, py, in_pager;
|
||||||
EWin *ewin, **gwins;
|
EWin *ewin;
|
||||||
|
|
||||||
gwins =
|
PagerEwinGroupSet();
|
||||||
ListWinGroupMembersForEwin(p->hi_ewin, GROUP_ACTION_MOVE, Mode.nogroup,
|
|
||||||
&num);
|
|
||||||
gwin_px = calloc(num, sizeof(int));
|
|
||||||
gwin_py = calloc(num, sizeof(int));
|
|
||||||
|
|
||||||
for (i = 0; i < num; i++)
|
|
||||||
{
|
|
||||||
gwin_px[i] = EoGetX(gwins[i]);
|
|
||||||
gwin_py[i] = EoGetY(gwins[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gwins)
|
|
||||||
Efree(gwins);
|
|
||||||
|
|
||||||
px = ev->xbutton.x;
|
px = ev->xbutton.x;
|
||||||
py = ev->xbutton.y;
|
py = ev->xbutton.y;
|
||||||
/* If hi-win, translate x,y to pager window coordinates */
|
/* If hi-win, translate x,y to pager window coordinates */
|
||||||
if (win == p->hi_win)
|
if (hiwin && win == EoGetWin(hiwin))
|
||||||
XTranslateCoordinates(disp, win, p->win, px, py, &px, &py, &child);
|
XTranslateCoordinates(disp, win, p->win, px, py, &px, &py, &child);
|
||||||
in_pager = (px >= 0 && py >= 0 && px < p->w && py < p->h);
|
in_pager = (px >= 0 && py >= 0 && px < p->w && py < p->h);
|
||||||
|
if (!in_pager)
|
||||||
|
return; // OK?
|
||||||
|
|
||||||
if ((int)ev->xbutton.button == Conf.pagers.menu_button)
|
if ((int)ev->xbutton.button == Conf.pagers.menu_button)
|
||||||
{
|
{
|
||||||
if (in_pager)
|
if (in_pager)
|
||||||
{
|
{
|
||||||
PagerHideHi(p);
|
PagerHiwinHide(p);
|
||||||
PagerMenuShow(p, px, py);
|
PagerMenuShow(p, px, py);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1603,40 +1652,17 @@ PagerEventMouseDown(Pager * p, XEvent * ev)
|
||||||
ewin = EwinInPagerAt(p, px, py);
|
ewin = EwinInPagerAt(p, px, py);
|
||||||
if ((ewin) && (ewin->type != EWIN_TYPE_PAGER))
|
if ((ewin) && (ewin->type != EWIN_TYPE_PAGER))
|
||||||
{
|
{
|
||||||
Window dw;
|
PagerHiwinShow(p, ewin, px, py);
|
||||||
int wx, wy, ww, wh, ax, ay, cx, cy;
|
|
||||||
|
|
||||||
PagerHideHi(p);
|
|
||||||
GetAreaSize(&ax, &ay);
|
|
||||||
DeskGetArea(p->desktop, &cx, &cy);
|
|
||||||
|
|
||||||
wx = ((EoGetX(ewin) + (cx * VRoot.w)) * (p->w / ax)) / VRoot.w;
|
|
||||||
wy = ((EoGetY(ewin) + (cy * VRoot.h)) * (p->h / ay)) / VRoot.h;
|
|
||||||
ww = ((EoGetW(ewin)) * (p->w / ax)) / VRoot.w;
|
|
||||||
wh = ((EoGetH(ewin)) * (p->h / ay)) / VRoot.h;
|
|
||||||
XTranslateCoordinates(disp, p->win, VRoot.win, 0, 0, &px, &py,
|
|
||||||
&dw);
|
|
||||||
EMoveResizeWindow(p->hi_win, px + wx, py + wy, ww, wh);
|
|
||||||
ESetWindowBackgroundPixmap(p->hi_win, ewin->mini_pmm.pmap);
|
|
||||||
EMapRaised(p->hi_win);
|
|
||||||
GrabPointerSet(p->hi_win, ECSR_ACT_MOVE, 1);
|
|
||||||
p->hi_visible = 1;
|
|
||||||
p->hi_ewin = ewin;
|
|
||||||
p->hi_win_w = ww;
|
|
||||||
p->hi_win_h = wh;
|
|
||||||
Mode.mode = MODE_PAGER_DRAG_PENDING;
|
|
||||||
mode_context_pager = p;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
PagerEventMouseUp(Pager * p, XEvent * ev)
|
PagerEventMouseUp(Pager * p, XEvent * ev)
|
||||||
{
|
{
|
||||||
Window win = ev->xbutton.window, child;
|
Window win = ev->xbutton.window, child;
|
||||||
int used = 0;
|
|
||||||
int i, num, px, py, in_pager, in_vroot;
|
int i, num, px, py, in_pager, in_vroot;
|
||||||
EWin *ewin, **gwins;
|
EWin *ewin, *ewin2, **gwins;
|
||||||
int x, y, pax, pay;
|
int x, y, pax, pay;
|
||||||
int mode_was;
|
int mode_was;
|
||||||
|
|
||||||
|
@ -1645,14 +1671,17 @@ PagerEventMouseUp(Pager * p, XEvent * ev)
|
||||||
|
|
||||||
px = ev->xbutton.x;
|
px = ev->xbutton.x;
|
||||||
py = ev->xbutton.y;
|
py = ev->xbutton.y;
|
||||||
|
|
||||||
/* If hi-win, translate x,y to pager window coordinates */
|
/* If hi-win, translate x,y to pager window coordinates */
|
||||||
if (win == p->hi_win)
|
if (hiwin && win == EoGetWin(hiwin))
|
||||||
XTranslateCoordinates(disp, win, p->win, px, py, &px, &py, &child);
|
XTranslateCoordinates(disp, win, p->win, px, py, &px, &py, &child);
|
||||||
in_pager = (px >= 0 && py >= 0 && px < p->w && py < p->h);
|
in_pager = (px >= 0 && py >= 0 && px < p->w && py < p->h);
|
||||||
|
|
||||||
in_vroot = (Mode.x >= 0 && Mode.x < VRoot.w &&
|
in_vroot = (Mode.x >= 0 && Mode.x < VRoot.w &&
|
||||||
Mode.y >= 0 && Mode.y < VRoot.h);
|
Mode.y >= 0 && Mode.y < VRoot.h);
|
||||||
|
|
||||||
|
ewin = PagerHiwinEwin(1);
|
||||||
|
|
||||||
if (((int)ev->xbutton.button == Conf.pagers.sel_button))
|
if (((int)ev->xbutton.button == Conf.pagers.sel_button))
|
||||||
{
|
{
|
||||||
if (win != Mode.last_bpress || !in_pager)
|
if (win != Mode.last_bpress || !in_pager)
|
||||||
|
@ -1667,37 +1696,34 @@ PagerEventMouseUp(Pager * p, XEvent * ev)
|
||||||
{
|
{
|
||||||
int prev_desk = -1;
|
int prev_desk = -1;
|
||||||
|
|
||||||
if (!FindItem((char *)p->hi_ewin, 0,
|
ewin = PagerHiwinEwin(1);
|
||||||
LIST_FINDBY_POINTER, LIST_TYPE_EWIN))
|
|
||||||
p->hi_ewin = NULL;
|
|
||||||
|
|
||||||
switch (mode_was)
|
switch (mode_was)
|
||||||
{
|
{
|
||||||
case MODE_PAGER_DRAG:
|
case MODE_PAGER_DRAG:
|
||||||
if (!p->hi_ewin)
|
if (!ewin)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Remember old desk for the dragged window */
|
/* Remember old desk for the dragged window */
|
||||||
prev_desk = EoGetDesk(p->hi_ewin);
|
prev_desk = EoGetDesk(ewin);
|
||||||
|
|
||||||
/* Find which pager or iconbox we are in (if any) */
|
/* Find which pager or iconbox we are in (if any) */
|
||||||
ewin = GetEwinPointerInClient();
|
ewin2 = GetEwinPointerInClient();
|
||||||
if ((ewin) && (ewin->type == EWIN_TYPE_PAGER))
|
if ((ewin2) && (ewin2->type == EWIN_TYPE_PAGER))
|
||||||
{
|
{
|
||||||
PagerEwinMove(p, ewin->data);
|
PagerEwinMove(p, ewin2->data);
|
||||||
}
|
}
|
||||||
else if ((ewin) && (ewin->type == EWIN_TYPE_ICONBOX))
|
else if ((ewin2) && (ewin2->type == EWIN_TYPE_ICONBOX))
|
||||||
{
|
{
|
||||||
/* Pointer is in iconbox */
|
/* Pointer is in iconbox */
|
||||||
|
|
||||||
/* Don't iconify an iconbox by dragging */
|
/* Don't iconify an iconbox by dragging */
|
||||||
if (p->hi_ewin->props.inhibit_iconify)
|
if (ewin->props.inhibit_iconify)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Iconify after moving back to pre-drag position */
|
/* Iconify after moving back to pre-drag position */
|
||||||
gwins =
|
gwins = ListWinGroupMembersForEwin(ewin, GROUP_ACTION_MOVE,
|
||||||
ListWinGroupMembersForEwin(p->hi_ewin, GROUP_ACTION_MOVE,
|
Mode.nogroup, &num);
|
||||||
Mode.nogroup, &num);
|
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
if (gwins[i]->type != EWIN_TYPE_PAGER)
|
if (gwins[i]->type != EWIN_TYPE_PAGER)
|
||||||
|
@ -1709,23 +1735,23 @@ PagerEventMouseUp(Pager * p, XEvent * ev)
|
||||||
if (gwins)
|
if (gwins)
|
||||||
Efree(gwins);
|
Efree(gwins);
|
||||||
}
|
}
|
||||||
else if (ewin && ewin->props.vroot)
|
else if (ewin2 && ewin2->props.vroot)
|
||||||
{
|
{
|
||||||
/* Dropping onto virtual root */
|
/* Dropping onto virtual root */
|
||||||
EwinReparent(p->hi_ewin, ewin->client.win);
|
EwinReparent(ewin, ewin2->client.win);
|
||||||
}
|
}
|
||||||
else if (!in_vroot)
|
else if (!in_vroot)
|
||||||
{
|
{
|
||||||
/* Move back to real root */
|
/* Move back to real root */
|
||||||
EwinReparent(p->hi_ewin, RRoot.win);
|
EwinReparent(ewin, RRoot.win);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Pointer is not in pager or iconbox */
|
/* Pointer is not in pager or iconbox */
|
||||||
/* Move window(s) to pointer location */
|
/* Move window(s) to pointer location */
|
||||||
x = Mode.x - EoGetW(p->hi_ewin) / 2;
|
x = Mode.x - EoGetW(ewin) / 2;
|
||||||
y = Mode.y - EoGetH(p->hi_ewin) / 2;
|
y = Mode.y - EoGetH(ewin) / 2;
|
||||||
EwinGroupMove(p->hi_ewin, DesksGetCurrent(), x, y);
|
EwinGroupMove(ewin, DesksGetCurrent(), x, y);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1735,43 +1761,34 @@ PagerEventMouseUp(Pager * p, XEvent * ev)
|
||||||
PagerAreaAt(p, px, py, &pax, &pay);
|
PagerAreaAt(p, px, py, &pax, &pay);
|
||||||
DeskGoto(p->desktop);
|
DeskGoto(p->desktop);
|
||||||
SetCurrentArea(pax, pay);
|
SetCurrentArea(pax, pay);
|
||||||
ewin = EwinInPagerAt(p, px, py);
|
ewin2 = EwinInPagerAt(p, px, py);
|
||||||
if (ewin)
|
if (ewin2)
|
||||||
{
|
{
|
||||||
RaiseEwin(ewin);
|
RaiseEwin(ewin2);
|
||||||
FocusToEWin(ewin, FOCUS_SET);
|
FocusToEWin(ewin2, FOCUS_SET);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->hi_ewin)
|
if (ewin)
|
||||||
{
|
{
|
||||||
RedrawPagersForDesktop(EoGetDesk(p->hi_ewin), 3);
|
RedrawPagersForDesktop(EoGetDesk(ewin), 3);
|
||||||
ForceUpdatePagersForDesktop(EoGetDesk(p->hi_ewin));
|
ForceUpdatePagersForDesktop(EoGetDesk(ewin));
|
||||||
if (prev_desk >= 0 && prev_desk != EoGetDesk(p->hi_ewin))
|
if (prev_desk >= 0 && prev_desk != EoGetDesk(ewin))
|
||||||
{
|
{
|
||||||
RedrawPagersForDesktop(prev_desk, 3);
|
RedrawPagersForDesktop(prev_desk, 3);
|
||||||
ForceUpdatePagersForDesktop(prev_desk);
|
ForceUpdatePagersForDesktop(prev_desk);
|
||||||
}
|
}
|
||||||
PagerHideHi(p);
|
PagerHiwinHide(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
mode_context_pager = NULL;
|
|
||||||
GrabPointerRelease();
|
GrabPointerRelease();
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
/* unallocate the space that was holding the old positions of the */
|
/* unallocate the space that was holding the old positions of the */
|
||||||
/* windows */
|
/* windows */
|
||||||
if (gwin_px)
|
PagerEwinGroupUnset();
|
||||||
{
|
|
||||||
Efree(gwin_px);
|
|
||||||
gwin_px = NULL;
|
|
||||||
Efree(gwin_py);
|
|
||||||
gwin_py = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return used;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1807,9 +1824,13 @@ PagerEventMainWin(XEvent * ev, void *prm)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PagerEventHiWin(XEvent * ev, void *prm)
|
PagerHiwinEvent(XEvent * ev, void *prm)
|
||||||
{
|
{
|
||||||
Pager *p = (Pager *) prm;
|
PagerHiwin *phi = (PagerHiwin *) prm;
|
||||||
|
Pager *p = phi->p;
|
||||||
|
|
||||||
|
if (!p)
|
||||||
|
return;
|
||||||
|
|
||||||
switch (ev->type)
|
switch (ev->type)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue