Pager fixups after imlib2 port.
Fix pager mini-window and tooltip unmapping. Pager code shuffling. SVN revision: 7972
This commit is contained in:
parent
6d713c7b75
commit
091523125a
27
src/E.h
27
src/E.h
|
@ -1627,6 +1627,7 @@ struct _pager
|
|||
char hi_visible;
|
||||
Window hi_win;
|
||||
EWin *hi_ewin;
|
||||
int hi_win_w, hi_win_h;
|
||||
};
|
||||
#endif /* DECLARE_STRUCT_PAGER */
|
||||
|
||||
|
@ -1885,6 +1886,11 @@ void EDestroyPixImg(PixImg * pi);
|
|||
void EBlendPixImg(EWin * ewin, PixImg * s1, PixImg * s2,
|
||||
PixImg * dst, int x, int y, int w, int h);
|
||||
|
||||
void ScaleLine(Pixmap dest, Window src, int dx, int dy, int sw,
|
||||
int pw, int sy, int sh);
|
||||
void ScaleRect(Pixmap dest, Window src, int sx, int sy, int dx,
|
||||
int dy, int sw, int sh, int dw, int dh);
|
||||
|
||||
Imlib_Image *ELoadImage(char *file);
|
||||
void DrawEwinShape(EWin * ewin, int md, int x, int y, int w,
|
||||
int h, char firstlast);
|
||||
|
@ -2724,31 +2730,19 @@ void FreeClone(Clone * c);
|
|||
void RemoveClones(void);
|
||||
void CloneDesktop(int d);
|
||||
|
||||
void PagerScaleLine(Pixmap dest, Window src, int dx, int dy,
|
||||
int sw, int pw, int sy, int sh);
|
||||
void PagerScaleRect(Pixmap dest, Window src, int sx, int sy,
|
||||
int dx, int dy, int sw, int sh, int dw,
|
||||
int dh);
|
||||
Pager *CreatePager(void);
|
||||
EWin *EwinInPagerAt(Pager * p, int x, int y);
|
||||
Pager *PagerCreate(void);
|
||||
void PagerDestroy(Pager * p);
|
||||
void PagerResize(Pager * p, int w, int h);
|
||||
void PagerShow(Pager * p);
|
||||
void PagerHide(Pager * p);
|
||||
void PagerTitle(Pager * p, char *title);
|
||||
void PagerKill(Pager * p);
|
||||
Pager **PagersForDesktop(int d, int *num);
|
||||
void RedrawPagersForDesktop(int d, char newbg);
|
||||
void ForceUpdatePagersForDesktop(int d);
|
||||
void PagerEwinUpdateMini(Pager * p, EWin * ewin);
|
||||
void PagerEwinUpdateFromPager(Pager * p, EWin * ewin);
|
||||
void PagerRedraw(Pager * p, char newbg);
|
||||
void PagerForceUpdate(Pager * p);
|
||||
void PagerShowMenu(Pager * p, int x, int y);
|
||||
void PagerReArea(void);
|
||||
void PagerEwinOutsideAreaUpdate(EWin * ewin);
|
||||
void PagerAreaAt(Pager * p, int x, int y, int *ax, int *ay);
|
||||
void UpdatePagerSel(void);
|
||||
void PagerHandleMotion(Pager * p, Window win, int x, int y);
|
||||
void EnableAllPagers(void);
|
||||
void DisableAllPagers(void);
|
||||
void PagerHideHi(Pager * p);
|
||||
|
@ -2761,6 +2755,11 @@ int PagerForDesktop(int desk);
|
|||
void DisablePagersForDesktop(int desk);
|
||||
Window PagerGetWin(Pager * p);
|
||||
Window PagerGetHiWin(Pager * p);
|
||||
void PagersEventMotion(XEvent * ev);
|
||||
void PagersEventMouseDown(XEvent * ev);
|
||||
void PagersEventMouseUp(XEvent * ev);
|
||||
int PagersEventMouseIn(XEvent * ev);
|
||||
int PagersEventMouseOut(XEvent * ev);
|
||||
|
||||
int CompareNetVersion(int major, int minor, int patchlevel,
|
||||
char *date);
|
||||
|
|
|
@ -1596,7 +1596,7 @@ FreeEwin(EWin * ewin)
|
|||
}
|
||||
|
||||
if (ewin->pager)
|
||||
PagerKill(ewin->pager);
|
||||
PagerDestroy(ewin->pager);
|
||||
if (ewin->ibox)
|
||||
IconboxDestroy(ewin->ibox);
|
||||
|
||||
|
|
|
@ -2422,7 +2422,6 @@ DialogEventMouseIn(XEvent * ev)
|
|||
|
||||
if (d)
|
||||
{
|
||||
PagerHideAllHi();
|
||||
DialogActivateButton(win, 0);
|
||||
}
|
||||
else
|
||||
|
@ -2432,7 +2431,6 @@ DialogEventMouseIn(XEvent * ev)
|
|||
di = FindDialogItem(win, &d);
|
||||
if (di)
|
||||
{
|
||||
PagerHideAllHi();
|
||||
if (di->type == DITEM_AREA)
|
||||
{
|
||||
if (di->item.area.event_func)
|
||||
|
|
441
src/draw.c
441
src/draw.c
|
@ -22,6 +22,9 @@
|
|||
*/
|
||||
#include "E.h"
|
||||
|
||||
/* Hmmm... */
|
||||
#define HIQ mode.pager_hiq
|
||||
|
||||
void
|
||||
HandleDrawQueue()
|
||||
{
|
||||
|
@ -868,6 +871,444 @@ EBlendPixImg(EWin * ewin, PixImg * s1, PixImg * s2, PixImg * dst, int x, int y,
|
|||
/* XCopyArea(disp, dst->pmap, root.win, dst->gc, x, y, w, h, x, y); */
|
||||
}
|
||||
|
||||
void
|
||||
ScaleLine(Pixmap dest, Window src, int dx, int dy, int sw, int pw, int sy,
|
||||
int sh)
|
||||
{
|
||||
static GC gc = 0;
|
||||
XGCValues gcv;
|
||||
int x, x2;
|
||||
PixImg *p_grab = NULL, *p_grab2 = NULL, *p_buf = NULL;
|
||||
XImage *px_grab = NULL, *px_grab2 = NULL, *px_buf = NULL;
|
||||
|
||||
if (!gc)
|
||||
{
|
||||
gcv.subwindow_mode = IncludeInferiors;
|
||||
gc = XCreateGC(disp, src, GCSubwindowMode, &gcv);
|
||||
}
|
||||
|
||||
p_grab = ECreatePixImg(dest, sw, 1);
|
||||
if (p_grab)
|
||||
{
|
||||
if (HIQ)
|
||||
{
|
||||
p_grab2 = ECreatePixImg(dest, sw, 1);
|
||||
if (!p_grab2)
|
||||
{
|
||||
EDestroyPixImg(p_grab);
|
||||
p_grab = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (p_grab)
|
||||
{
|
||||
p_buf = ECreatePixImg(dest, pw, 1);
|
||||
if (p_buf)
|
||||
{
|
||||
XCopyArea(disp, src, p_grab->pmap, gc, 0, sy, sw, 1, 0, 0);
|
||||
if (HIQ)
|
||||
XCopyArea(disp, src, p_grab2->pmap, gc, 0, sy + (sh / 2),
|
||||
sw, 1, 0, 0);
|
||||
XSync(disp, False);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EDestroyPixImg(p_grab);
|
||||
if (p_grab2)
|
||||
EDestroyPixImg(p_grab2);
|
||||
p_grab = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!p_grab)
|
||||
{
|
||||
px_grab = XGetImage(disp, src, 0, sy, sw, 1, 0xffffffff, ZPixmap);
|
||||
if (!px_grab)
|
||||
return;
|
||||
|
||||
if (HIQ)
|
||||
px_grab2 =
|
||||
XGetImage(disp, src, 0, sy + (sh / 2), sw, 1, 0xffffffff,
|
||||
ZPixmap);
|
||||
if (!px_grab2)
|
||||
{
|
||||
XDestroyImage(px_grab);
|
||||
return;
|
||||
}
|
||||
|
||||
px_buf =
|
||||
XCreateImage(disp, root.vis, root.depth, ZPixmap, 0, NULL, pw, 1,
|
||||
32, 0);
|
||||
if (!px_buf)
|
||||
{
|
||||
XDestroyImage(px_grab);
|
||||
XDestroyImage(px_grab2);
|
||||
return;
|
||||
}
|
||||
|
||||
px_buf->data = malloc(px_buf->bytes_per_line * px_buf->height);
|
||||
if (!px_buf->data)
|
||||
{
|
||||
XDestroyImage(px_grab);
|
||||
XDestroyImage(px_grab2);
|
||||
XDestroyImage(px_buf);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (HIQ)
|
||||
{
|
||||
int v1, v2, v3, v4, difx;
|
||||
XImage *xim1 = NULL, *xim2 = NULL, *xim3 = NULL;
|
||||
|
||||
if (p_grab)
|
||||
{
|
||||
xim1 = p_grab->xim;
|
||||
xim2 = p_grab2->xim;
|
||||
xim3 = p_buf->xim;
|
||||
}
|
||||
else
|
||||
{
|
||||
xim1 = px_grab;
|
||||
xim2 = px_grab2;
|
||||
xim3 = px_buf;
|
||||
}
|
||||
|
||||
difx = (sw / pw) / 2;
|
||||
switch (IC_RenderDepth())
|
||||
{
|
||||
case 24:
|
||||
case 32:
|
||||
for (x = 0; x < pw; x++)
|
||||
{
|
||||
x2 = (sw * x) / pw;
|
||||
v1 = XGetPixel(xim1, x2, 0);
|
||||
v2 = XGetPixel(xim1, x2 + difx, 0);
|
||||
v3 = XGetPixel(xim2, x2, 0);
|
||||
v4 = XGetPixel(xim2, x2 + difx, 0);
|
||||
v1 = ((v1 >> 2) & 0x3f3f3f3f) + ((v2 >> 2) & 0x3f3f3f3f) +
|
||||
((v3 >> 2) & 0x3f3f3f3f) + ((v4 >> 2) & 0x3f3f3f3f) +
|
||||
(v1 & v2 & v3 & v4 & 0x03030303);
|
||||
XPutPixel(xim3, x, 0, v1);
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
for (x = 0; x < pw; x++)
|
||||
{
|
||||
x2 = (sw * x) / pw;
|
||||
v1 = XGetPixel(xim1, x2, 0);
|
||||
v2 = XGetPixel(xim1, x2 + difx, 0);
|
||||
v3 = XGetPixel(xim2, x2, 0);
|
||||
v4 = XGetPixel(xim2, x2 + difx, 0);
|
||||
v1 = ((v1 >> 2) & ((0x70 << 7) | (0x78 << 2) | (0x70 >> 4)))
|
||||
+
|
||||
((v2 >> 2) & ((0x70 << 7) | (0x78 << 2) | (0x70 >> 4)))
|
||||
+
|
||||
((v3 >> 2) & ((0x70 << 7) | (0x78 << 2) | (0x70 >> 4)))
|
||||
+
|
||||
((v4 >> 2) & ((0x70 << 7) | (0x78 << 2) | (0x70 >> 4)))
|
||||
+ (v1 & v2 & v3 & v4 & ((0x3 << 11) | (0x3 << 5) | (0x3)));
|
||||
XPutPixel(xim3, x, 0, v1);
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
/* break; */
|
||||
default:
|
||||
for (x = 0; x < pw; x++)
|
||||
{
|
||||
x2 = (sw * x) / pw;
|
||||
XPutPixel(xim3, x, 0, XGetPixel(xim1, x2, 0));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
XImage *xim1 = NULL, *xim3 = NULL;
|
||||
|
||||
if (p_grab)
|
||||
{
|
||||
xim1 = p_grab->xim;
|
||||
xim3 = p_buf->xim;
|
||||
}
|
||||
else
|
||||
{
|
||||
xim1 = px_grab;
|
||||
xim3 = px_buf;
|
||||
}
|
||||
|
||||
for (x = 0; x < pw; x++)
|
||||
{
|
||||
x2 = (sw * x) / pw;
|
||||
XPutPixel(xim3, x, 0, XGetPixel(xim1, x2, 0));
|
||||
}
|
||||
}
|
||||
|
||||
if (p_buf)
|
||||
{
|
||||
XShmPutImage(disp, dest, gc, p_buf->xim, 0, 0, dx, dy, pw, 1, False);
|
||||
XSync(disp, False);
|
||||
if (p_grab)
|
||||
EDestroyPixImg(p_grab);
|
||||
if (p_grab2)
|
||||
EDestroyPixImg(p_grab2);
|
||||
if (p_buf)
|
||||
EDestroyPixImg(p_buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
XPutImage(disp, dest, gc, px_buf, 0, 0, dx, dy, pw, 1);
|
||||
if (px_grab)
|
||||
XDestroyImage(px_grab);
|
||||
if (px_grab2)
|
||||
XDestroyImage(px_grab2);
|
||||
if (px_buf)
|
||||
XDestroyImage(px_buf);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ScaleRect(Pixmap dest, Window src, int sx, int sy, int dx, int dy, int sw,
|
||||
int sh, int dw, int dh)
|
||||
{
|
||||
static GC gc = 0, gc2 = 0;
|
||||
XGCValues gcv;
|
||||
int y, y2, x, x2;
|
||||
PixImg *p_grab = NULL, *p_buf = NULL;
|
||||
XImage *px_grab = NULL, *px_buf = NULL;
|
||||
|
||||
if (sw > root.w * 2)
|
||||
return;
|
||||
if (sh > root.h * 2)
|
||||
return;
|
||||
if (dw > root.w * 2)
|
||||
return;
|
||||
if (dh > root.h * 2)
|
||||
return;
|
||||
|
||||
if (!gc)
|
||||
{
|
||||
gcv.subwindow_mode = IncludeInferiors;
|
||||
gc = XCreateGC(disp, src, GCSubwindowMode, &gcv);
|
||||
gc2 = XCreateGC(disp, src, 0, &gcv);
|
||||
}
|
||||
|
||||
if (HIQ)
|
||||
p_grab = ECreatePixImg(src, sw, dh * 2);
|
||||
else
|
||||
p_grab = ECreatePixImg(src, sw, dh);
|
||||
|
||||
if (p_grab)
|
||||
{
|
||||
p_buf = ECreatePixImg(dest, dw, dh);
|
||||
if (p_buf)
|
||||
{
|
||||
if (HIQ)
|
||||
{
|
||||
for (y = 0; y < (dh * 2); y++)
|
||||
{
|
||||
y2 = (sh * y) / (dh * 2);
|
||||
XCopyArea(disp, src, p_grab->pmap, gc, sx, sy + y2, sw,
|
||||
1, 0, y);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (y = 0; y < dh; y++)
|
||||
{
|
||||
y2 = (sh * y) / dh;
|
||||
XCopyArea(disp, src, p_grab->pmap, gc, sx, sy + y2, sw,
|
||||
1, 0, y);
|
||||
}
|
||||
}
|
||||
XSync(disp, False);
|
||||
}
|
||||
else
|
||||
{
|
||||
EDestroyPixImg(p_grab);
|
||||
p_grab = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!p_grab)
|
||||
{
|
||||
if (HIQ)
|
||||
{
|
||||
Pixmap pmap;
|
||||
|
||||
pmap = ECreatePixmap(disp, src, sw, dh * 2, root.depth);
|
||||
for (y = 0; y < (dh * 2); y++)
|
||||
{
|
||||
y2 = (sh * y) / (dh * 2);
|
||||
XCopyArea(disp, src, pmap, gc, sx, sy + y2, sw, 1, 0, y);
|
||||
}
|
||||
|
||||
px_grab =
|
||||
XGetImage(disp, pmap, 0, 0, sw, dh * 2, 0xffffffff, ZPixmap);
|
||||
EFreePixmap(disp, pmap);
|
||||
if (!px_grab)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Pixmap pmap;
|
||||
|
||||
pmap = ECreatePixmap(disp, src, sw, dh, root.depth);
|
||||
for (y = 0; y < dh; y++)
|
||||
{
|
||||
y2 = (sh * y) / dh;
|
||||
XCopyArea(disp, src, pmap, gc, sx, sy + y2, sw, 1, 0, y);
|
||||
}
|
||||
|
||||
px_grab = XGetImage(disp, pmap, 0, 0, sw, dh, 0xffffffff, ZPixmap);
|
||||
EFreePixmap(disp, pmap);
|
||||
if (!px_grab)
|
||||
return;
|
||||
}
|
||||
|
||||
px_buf =
|
||||
XCreateImage(disp, root.vis, root.depth, ZPixmap, 0, NULL, dw, dh,
|
||||
32, 0);
|
||||
if (!px_buf)
|
||||
{
|
||||
XDestroyImage(px_grab);
|
||||
return;
|
||||
}
|
||||
|
||||
px_buf->data = malloc(px_buf->bytes_per_line * px_buf->height);
|
||||
if (!px_buf->data)
|
||||
{
|
||||
XDestroyImage(px_buf);
|
||||
XDestroyImage(px_grab);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (HIQ)
|
||||
{
|
||||
int v1, v2, v3, v4, difx;
|
||||
XImage *xim1 = NULL, *xim3 = NULL;
|
||||
|
||||
if (p_grab)
|
||||
{
|
||||
xim1 = p_grab->xim;
|
||||
xim3 = p_buf->xim;
|
||||
}
|
||||
else
|
||||
{
|
||||
xim1 = px_grab;
|
||||
xim3 = px_buf;
|
||||
}
|
||||
|
||||
difx = (sw / dw) / 2;
|
||||
switch (root.depth)
|
||||
{
|
||||
case 24:
|
||||
case 32:
|
||||
for (y = 0; y < dh; y++)
|
||||
{
|
||||
for (x = 0; x < dw; x++)
|
||||
{
|
||||
y2 = (y * 2);
|
||||
x2 = (sw * x) / dw;
|
||||
v1 = XGetPixel(xim1, x2, y2);
|
||||
v2 = XGetPixel(xim1, x2 + difx, y2);
|
||||
v3 = XGetPixel(xim1, x2, y2 + 1);
|
||||
v4 = XGetPixel(xim1, x2 + difx, y2 + 1);
|
||||
v1 = ((v1 >> 2) & 0x3f3f3f3f) +
|
||||
((v2 >> 2) & 0x3f3f3f3f) +
|
||||
((v3 >> 2) & 0x3f3f3f3f) +
|
||||
((v4 >> 2) & 0x3f3f3f3f) +
|
||||
(v1 & v2 & v3 & v4 & 0x03030303);
|
||||
XPutPixel(xim3, x, y, v1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
for (y = 0; y < dh; y++)
|
||||
{
|
||||
for (x = 0; x < dw; x++)
|
||||
{
|
||||
y2 = (y * 2);
|
||||
x2 = (sw * x) / dw;
|
||||
v1 = XGetPixel(xim1, x2, y2);
|
||||
v2 = XGetPixel(xim1, x2 + difx, y2);
|
||||
v3 = XGetPixel(xim1, x2, y2 + 1);
|
||||
v4 = XGetPixel(xim1, x2 + difx, y2 + 1);
|
||||
v1 = ((v1 >> 2) &
|
||||
((0x70 << 7) | (0x78 << 2) | (0x70 >> 4))) +
|
||||
((v2 >> 2) &
|
||||
((0x70 << 7) | (0x78 << 2) | (0x70 >> 4))) +
|
||||
((v3 >> 2) &
|
||||
((0x70 << 7) | (0x78 << 2) | (0x70 >> 4))) +
|
||||
((v4 >> 2) &
|
||||
((0x70 << 7) | (0x78 << 2) | (0x70 >> 4))) +
|
||||
(v1 & v2 & v3 & v4 &
|
||||
((0x3 << 11) | (0x3 << 5) | (0x3)));
|
||||
XPutPixel(xim3, x, y, v1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
/* break; */
|
||||
default:
|
||||
for (y = 0; y < dh; y++)
|
||||
{
|
||||
for (x = 0; x < dw; x++)
|
||||
{
|
||||
y2 = (y * 2);
|
||||
x2 = (sw * x) / dw;
|
||||
XPutPixel(xim3, x, y, XGetPixel(xim1, x2, y2));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
XImage *xim1 = NULL, *xim3 = NULL;
|
||||
|
||||
if (p_grab)
|
||||
{
|
||||
xim1 = p_grab->xim;
|
||||
xim3 = p_buf->xim;
|
||||
}
|
||||
else
|
||||
{
|
||||
xim1 = px_grab;
|
||||
xim3 = px_buf;
|
||||
}
|
||||
|
||||
for (y = 0; y < dh; y++)
|
||||
{
|
||||
for (x = 0; x < dw; x++)
|
||||
{
|
||||
x2 = (sw * x) / dw;
|
||||
XPutPixel(xim3, x, y, XGetPixel(xim1, x2, y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (p_buf)
|
||||
{
|
||||
XShmPutImage(disp, dest, gc2, p_buf->xim, 0, 0, dx, dy, dw, dh, False);
|
||||
XSync(disp, False);
|
||||
if (p_grab)
|
||||
EDestroyPixImg(p_grab);
|
||||
if (p_buf)
|
||||
EDestroyPixImg(p_buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
XPutImage(disp, dest, gc, px_buf, 0, 0, dx, dy, dw, dh);
|
||||
if (px_grab)
|
||||
XDestroyImage(px_grab);
|
||||
if (px_buf)
|
||||
XDestroyImage(px_buf);
|
||||
}
|
||||
}
|
||||
|
||||
#include <X11/bitmaps/flipped_gray>
|
||||
#include <X11/bitmaps/gray>
|
||||
#include <X11/bitmaps/gray3>
|
||||
|
|
|
@ -343,7 +343,6 @@ HEnterNotify(XEvent * ev)
|
|||
*/
|
||||
if (ev->xany.window == root.win)
|
||||
{
|
||||
PagerHideAllHi();
|
||||
if (!mode.focuswin || FOCUS_POINTER == mode.focusmode)
|
||||
HandleFocusWindow(root.focuswin);
|
||||
}
|
||||
|
@ -678,6 +677,8 @@ HandleEvent(XEvent * ev)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (ev->type == KeyPress)
|
||||
PagerHideAllHi();
|
||||
WarpFocusHandleEvent(ev);
|
||||
lst = ListItemType(&num, LIST_TYPE_ACLASS_GLOBAL);
|
||||
if (lst)
|
||||
|
|
387
src/evhandlers.c
387
src/evhandlers.c
|
@ -20,7 +20,6 @@
|
|||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#define DECLARE_STRUCT_PAGER
|
||||
#include "E.h"
|
||||
|
||||
static ToolTip *ttip = NULL;
|
||||
|
@ -854,73 +853,8 @@ HandleMotion(XEvent * ev)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (mode.mode == MODE_NONE)
|
||||
{
|
||||
Pager *p;
|
||||
|
||||
p = FindPager(ev->xmotion.window);
|
||||
if (p)
|
||||
PagerHandleMotion(p, ev->xmotion.window, ev->xmotion.x,
|
||||
ev->xmotion.y);
|
||||
else
|
||||
PagerHandleMotion(NULL, ev->xmotion.window, -99, -99);
|
||||
}
|
||||
if ((mode.mode == MODE_PAGER_DRAG_PENDING) || (mode.mode == MODE_PAGER_DRAG))
|
||||
{
|
||||
Pager *p;
|
||||
|
||||
mode.mode = MODE_PAGER_DRAG;
|
||||
p = mode.context_pager;
|
||||
if (p)
|
||||
{
|
||||
int ax, ay, cx, cy, i, num;
|
||||
EWin **gwins;
|
||||
|
||||
cx = desks.desk[p->desktop].current_area_x;
|
||||
cy = desks.desk[p->desktop].current_area_y;
|
||||
GetAreaSize(&ax, &ay);
|
||||
dx = mode.x - mode.px;
|
||||
dy = mode.y - mode.py;
|
||||
if (!FindItem
|
||||
((char *)p->hi_ewin, 0, LIST_FINDBY_POINTER, LIST_TYPE_EWIN))
|
||||
p->hi_ewin = NULL;
|
||||
if ((p->hi_ewin) && (!p->hi_ewin->pager)
|
||||
&& (!p->hi_ewin->fixedpos))
|
||||
{
|
||||
Window dw;
|
||||
int px, py;
|
||||
|
||||
GetWinXY(p->hi_win, &x, &y);
|
||||
XRaiseWindow(disp, p->hi_win);
|
||||
x += dx;
|
||||
y += dy;
|
||||
EMoveWindow(disp, p->hi_win, x, y);
|
||||
XTranslateCoordinates(disp, p->win, root.win, 0, 0, &px, &py,
|
||||
&dw);
|
||||
x -= px + (cx * (p->w / ax));
|
||||
y -= py + (cy * (p->h / ay));
|
||||
MoveEwin(p->hi_ewin, (x * root.w * ax) / p->w,
|
||||
(y * root.h * ay) / p->h);
|
||||
}
|
||||
|
||||
gwins =
|
||||
ListWinGroupMembersForEwin(p->hi_ewin, ACTION_MOVE,
|
||||
mode.nogroup, &num);
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if ((gwins[i] != p->hi_ewin) && (!gwins[i]->pager)
|
||||
&& (!gwins[i]->fixedpos))
|
||||
{
|
||||
GetWinXY(gwins[i]->win, &x, &y);
|
||||
x += (dx * root.w * ax) / p->w;
|
||||
y += (dy * root.h * ay) / p->h;
|
||||
MoveEwin(gwins[i], x, y);
|
||||
}
|
||||
}
|
||||
if (gwins)
|
||||
Efree(gwins);
|
||||
}
|
||||
}
|
||||
PagersEventMotion(ev);
|
||||
|
||||
DialogEventMotion(ev);
|
||||
|
||||
|
@ -951,13 +885,11 @@ HandleDestroy(XEvent * ev)
|
|||
p = FindPager(ev->xdestroywindow.window);
|
||||
if (p)
|
||||
{
|
||||
if ((mode.mode == MODE_PAGER_DRAG) && (p->hi_ewin))
|
||||
{
|
||||
PagerHideHi(p);
|
||||
}
|
||||
PagerHideHi(p);
|
||||
mode.mode = MODE_NONE;
|
||||
mode.context_pager = NULL;
|
||||
}
|
||||
|
||||
if (ewin == mode.ewin)
|
||||
{
|
||||
if (mode.slideout)
|
||||
|
@ -1300,13 +1232,14 @@ HandleUnmap(XEvent * ev)
|
|||
{
|
||||
if (ewin->pager)
|
||||
{
|
||||
if ((mode.mode == MODE_PAGER_DRAG) && (ewin->pager->hi_ewin))
|
||||
PagerHideHi(ewin->pager);
|
||||
PagerHideHi(ewin->pager);
|
||||
mode.mode = MODE_NONE;
|
||||
mode.context_pager = NULL;
|
||||
}
|
||||
|
||||
if (mode.dockapp_support && ewin->docked)
|
||||
DockDestroy(ewin);
|
||||
|
||||
if (ewin == mode.ewin)
|
||||
{
|
||||
switch (mode.mode)
|
||||
|
@ -1435,8 +1368,6 @@ HandleExpose(XEvent * ev)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
static int *gwin_px, *gwin_py;
|
||||
|
||||
void
|
||||
HandleMouseDown(XEvent * ev)
|
||||
{
|
||||
|
@ -1678,82 +1609,7 @@ HandleMouseDown(XEvent * ev)
|
|||
}
|
||||
}
|
||||
|
||||
{
|
||||
Pager *p;
|
||||
|
||||
p = FindPager(ev->xbutton.window);
|
||||
if (p)
|
||||
{
|
||||
EWin **gwins;
|
||||
|
||||
gwins =
|
||||
ListWinGroupMembersForEwin(p->hi_ewin, 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] = gwins[i]->x;
|
||||
gwin_py[i] = gwins[i]->y;
|
||||
}
|
||||
|
||||
if (gwins)
|
||||
Efree(gwins);
|
||||
|
||||
if (ev->xbutton.window == p->hi_win)
|
||||
{
|
||||
int hx, hy;
|
||||
Window dw;
|
||||
|
||||
XTranslateCoordinates(disp, p->hi_win, p->win, 0, 0, &hx, &hy,
|
||||
&dw);
|
||||
ev->xbutton.x += hx;
|
||||
ev->xbutton.y += hy;
|
||||
}
|
||||
if ((int)ev->xbutton.button == mode.pager_menu_button)
|
||||
{
|
||||
if ((ev->xbutton.x >= 0) && (ev->xbutton.y >= 0)
|
||||
&& (ev->xbutton.x < p->w) && (ev->xbutton.y < p->h))
|
||||
PagerShowMenu(p, ev->xbutton.x, ev->xbutton.y);
|
||||
}
|
||||
else if ((int)ev->xbutton.button == mode.pager_win_button)
|
||||
{
|
||||
ewin = EwinInPagerAt(p, ev->xbutton.x, ev->xbutton.y);
|
||||
if ((ewin) && (!ewin->pager))
|
||||
{
|
||||
static int pgd_x = 0, pgd_y = 0;
|
||||
static int pwin_px, pwin_py;
|
||||
Window dw;
|
||||
int wx, wy, ww, wh, ax, ay, cx, cy, px, py;
|
||||
|
||||
PagerHideHi(p);
|
||||
pwin_px = ewin->x;
|
||||
pwin_py = ewin->y;
|
||||
GetAreaSize(&ax, &ay);
|
||||
cx = desks.desk[p->desktop].current_area_x;
|
||||
cy = desks.desk[p->desktop].current_area_y;
|
||||
wx = ((ewin->x + (cx * root.w)) * (p->w / ax)) / root.w;
|
||||
wy = ((ewin->y + (cy * root.h)) * (p->h / ay)) / root.h;
|
||||
ww = ((ewin->w) * (p->w / ax)) / root.w;
|
||||
wh = ((ewin->h) * (p->h / ay)) / root.h;
|
||||
XTranslateCoordinates(disp, p->win, root.win, 0, 0, &px,
|
||||
&py, &dw);
|
||||
EMoveResizeWindow(disp, p->hi_win, px + wx, py + wy, ww,
|
||||
wh);
|
||||
ESetWindowBackgroundPixmap(disp, p->hi_win,
|
||||
ewin->mini_pmm.pmap);
|
||||
EMapRaised(disp, p->hi_win);
|
||||
GrabThePointer(p->hi_win);
|
||||
p->hi_visible = 1;
|
||||
mode.mode = MODE_PAGER_DRAG_PENDING;
|
||||
mode.context_pager = p;
|
||||
pgd_x = ewin->x;
|
||||
pgd_y = ewin->y;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
PagersEventMouseDown(ev);
|
||||
|
||||
EDBUG_RETURN_;
|
||||
}
|
||||
|
@ -2101,227 +1957,15 @@ HandleMouseUp(XEvent * ev)
|
|||
}
|
||||
|
||||
if (!wasmovres)
|
||||
{
|
||||
Pager *p;
|
||||
int pax, pay;
|
||||
PagersEventMouseUp(ev);
|
||||
|
||||
p = FindPager(ev->xbutton.window);
|
||||
if ((p) && ((int)ev->xbutton.button == mode.pager_sel_button))
|
||||
{
|
||||
PagerAreaAt(p, ev->xbutton.x, ev->xbutton.y, &pax, &pay);
|
||||
GotoDesktop(p->desktop);
|
||||
if (p->desktop != desks.current)
|
||||
{
|
||||
AUDIO_PLAY("SOUND_DESKTOP_SHUT");
|
||||
}
|
||||
SetCurrentArea(pax, pay);
|
||||
}
|
||||
else if ((p) && ((int)ev->xbutton.button == mode.pager_win_button))
|
||||
{
|
||||
if (ev->xbutton.window == p->hi_win)
|
||||
{
|
||||
int hx, hy;
|
||||
Window dw;
|
||||
|
||||
XTranslateCoordinates(disp, p->hi_win, p->win, 0, 0, &hx, &hy,
|
||||
&dw);
|
||||
ev->xbutton.x += hx;
|
||||
ev->xbutton.y += hy;
|
||||
}
|
||||
if (!FindItem
|
||||
((char *)p->hi_ewin, 0, LIST_FINDBY_POINTER, LIST_TYPE_EWIN))
|
||||
p->hi_ewin = NULL;
|
||||
if ((mode.mode == MODE_PAGER_DRAG) && (p->hi_ewin))
|
||||
{
|
||||
ewin = NULL;
|
||||
for (i = 0; i < desks.desk[desks.current].num; i++)
|
||||
{
|
||||
EWin *ew;
|
||||
|
||||
ew = desks.desk[desks.current].list[i];
|
||||
if (((ew->pager) || (ew->ibox))
|
||||
&& ((ew->desktop == desks.current) || (ew->sticky)))
|
||||
{
|
||||
if ((ev->xbutton.x_root >=
|
||||
(ew->x + ew->border->border.left))
|
||||
&& (ev->xbutton.x_root <
|
||||
(ew->x + ew->w - ew->border->border.right))
|
||||
&& (ev->xbutton.y_root >=
|
||||
(ew->y + ew->border->border.top))
|
||||
&& (ev->xbutton.y_root <
|
||||
(ew->y + ew->h -
|
||||
ew->border->border.bottom)))
|
||||
{
|
||||
ewin = ew;
|
||||
i = desks.desk[desks.current].num;
|
||||
}
|
||||
}
|
||||
}
|
||||
ewin = GetEwinPointerInClient();
|
||||
if ((ewin) && (ewin->pager))
|
||||
{
|
||||
Pager *pp;
|
||||
int w, h, x, y, ax, ay, cx, cy, px, py;
|
||||
int wx, wy, base_x = 0, base_y = 0;
|
||||
Window dw;
|
||||
|
||||
pp = ewin->pager;
|
||||
cx = desks.desk[pp->desktop].current_area_x;
|
||||
cy = desks.desk[pp->desktop].current_area_y;
|
||||
GetAreaSize(&ax, &ay);
|
||||
GetWinXY(p->hi_win, &x, &y);
|
||||
GetWinWH(p->hi_win, &w, &h);
|
||||
XTranslateCoordinates(disp, pp->win, root.win, 0, 0, &px,
|
||||
&py, &dw);
|
||||
wx = ((x - px) -
|
||||
(cx * (pp->w / ax))) * (root.w / (pp->w / ax));
|
||||
wy = ((y - py) -
|
||||
(cy * (pp->h / ay))) * (root.h / (pp->h / ay));
|
||||
if (((x + w) <= px) || ((y + h) <= py)
|
||||
|| (x >= (px + pp->w)) || (y >= (py + pp->h)))
|
||||
{
|
||||
int ndesk, nx, ny;
|
||||
|
||||
ndesk = desks.current;
|
||||
nx = (int)ev->xbutton.x_root -
|
||||
desks.desk[desks.current].x -
|
||||
((int)p->hi_ewin->w / 2);
|
||||
ny = (int)ev->xbutton.y_root -
|
||||
desks.desk[desks.current].y -
|
||||
((int)p->hi_ewin->h / 2);
|
||||
MoveEwin(p->hi_ewin, nx, ny);
|
||||
if (!p->hi_ewin->sticky)
|
||||
MoveEwinToDesktop(p->hi_ewin, ndesk);
|
||||
}
|
||||
else
|
||||
{
|
||||
gwins =
|
||||
ListWinGroupMembersForEwin(p->hi_ewin,
|
||||
ACTION_MOVE,
|
||||
mode.nogroup, &num);
|
||||
/* get get the location of the base win so we can move the */
|
||||
/* rest of the windows in the group to the correct offset */
|
||||
for (i = 0; i < num; i++)
|
||||
if (gwins[i] == p->hi_ewin)
|
||||
{
|
||||
base_x = gwin_px[i];
|
||||
base_y = gwin_py[i];
|
||||
}
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (!gwins[i]->sticky)
|
||||
MoveEwinToDesktopAt(gwins[i], pp->desktop,
|
||||
wx + (gwin_px[i] -
|
||||
base_x),
|
||||
wy + (gwin_py[i] -
|
||||
base_y));
|
||||
else
|
||||
MoveEwin(gwins[i],
|
||||
((root.w * ax) + wx +
|
||||
(gwin_px[i] - base_x)) % root.w,
|
||||
((root.h * ay) + wy +
|
||||
(gwin_py[i] - base_y)) % root.h);
|
||||
}
|
||||
if (gwins)
|
||||
Efree(gwins);
|
||||
}
|
||||
}
|
||||
else if ((ewin) && (ewin->ibox) && (!((p->hi_ewin->ibox)
|
||||
/* || ((ewin->client.need_input) && ((ewin->skiptask) || (ewin->skipwinlist))) */
|
||||
)))
|
||||
{
|
||||
gwins =
|
||||
ListWinGroupMembersForEwin(p->hi_ewin, ACTION_MOVE,
|
||||
mode.nogroup, &num);
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (!gwins[i]->pager)
|
||||
{
|
||||
MoveEwin(gwins[i], gwin_px[i], gwin_py[i]);
|
||||
IconboxIconifyEwin(ewin->ibox, gwins[i]);
|
||||
}
|
||||
}
|
||||
if (gwins)
|
||||
Efree(gwins);
|
||||
}
|
||||
else
|
||||
{
|
||||
int ndesk, nx, ny, base_x = 0, base_y =
|
||||
0, ax, ay;
|
||||
|
||||
ndesk = desks.current;
|
||||
nx = (int)ev->xbutton.x_root -
|
||||
desks.desk[desks.current].x -
|
||||
((int)p->hi_ewin->w / 2);
|
||||
ny = (int)ev->xbutton.y_root -
|
||||
desks.desk[desks.current].y -
|
||||
((int)p->hi_ewin->h / 2);
|
||||
GetAreaSize(&ax, &ay);
|
||||
|
||||
gwins =
|
||||
ListWinGroupMembersForEwin(p->hi_ewin, ACTION_MOVE,
|
||||
mode.nogroup, &num);
|
||||
for (i = 0; i < num; i++)
|
||||
if (gwins[i] == p->hi_ewin)
|
||||
{
|
||||
base_x = gwin_px[i];
|
||||
base_y = gwin_py[i];
|
||||
}
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (!gwins[i]->sticky)
|
||||
MoveEwin(gwins[i], nx + (gwin_px[i] - base_x),
|
||||
ny + (gwin_py[i] - base_y));
|
||||
else
|
||||
MoveEwin(gwins[i],
|
||||
((root.w * ax) + nx +
|
||||
(gwin_px[i] - base_x)) % root.w,
|
||||
((root.h * ay) + ny +
|
||||
(gwin_py[i] - base_y)) % root.h);
|
||||
if (!gwins[i]->sticky)
|
||||
MoveEwinToDesktop(gwins[i], ndesk);
|
||||
}
|
||||
if (gwins)
|
||||
Efree(gwins);
|
||||
}
|
||||
}
|
||||
else if ((ev->xbutton.x >= 0) && (ev->xbutton.y >= 0)
|
||||
&& (ev->xbutton.x < p->w) && (ev->xbutton.y < p->h))
|
||||
{
|
||||
PagerAreaAt(p, ev->xbutton.x, ev->xbutton.y, &pax, &pay);
|
||||
GotoDesktop(p->desktop);
|
||||
SetCurrentArea(pax, pay);
|
||||
ewin = EwinInPagerAt(p, ev->xbutton.x, ev->xbutton.y);
|
||||
if (ewin)
|
||||
{
|
||||
RaiseEwin(ewin);
|
||||
FocusToEWin(ewin);
|
||||
}
|
||||
}
|
||||
if (p->hi_ewin)
|
||||
{
|
||||
RedrawPagersForDesktop(p->hi_ewin->desktop, 3);
|
||||
ForceUpdatePagersForDesktop(p->hi_ewin->desktop);
|
||||
p->hi_visible = 1;
|
||||
PagerHideHi(p);
|
||||
}
|
||||
mode.mode = MODE_NONE;
|
||||
mode.context_pager = NULL;
|
||||
}
|
||||
}
|
||||
mode.destroy = 0;
|
||||
/* unallocate the space that was holding the old positions of the */
|
||||
/* windows */
|
||||
if (gwin_px)
|
||||
{
|
||||
Efree(gwin_px);
|
||||
gwin_px = NULL;
|
||||
Efree(gwin_py);
|
||||
gwin_py = NULL;
|
||||
}
|
||||
|
||||
if ((mode.slideout) && (pslideout))
|
||||
HideSlideout(mode.slideout, mode.context_win);
|
||||
|
||||
click_was_in = 0;
|
||||
|
||||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
|
@ -2419,6 +2063,9 @@ HandleMouseIn(XEvent * ev)
|
|||
win = ev->xcrossing.window;
|
||||
mode.context_win = win;
|
||||
|
||||
if (PagersEventMouseIn(ev))
|
||||
EDBUG_RETURN_;
|
||||
|
||||
{
|
||||
Menu *m;
|
||||
MenuItem *mi;
|
||||
|
@ -2429,7 +2076,6 @@ HandleMouseIn(XEvent * ev)
|
|||
{
|
||||
int j;
|
||||
|
||||
PagerHideAllHi();
|
||||
if ((win == mi->icon_win) &&
|
||||
(ev->xcrossing.detail == NotifyAncestor))
|
||||
EDBUG_RETURN_;
|
||||
|
@ -2476,7 +2122,6 @@ HandleMouseIn(XEvent * ev)
|
|||
{
|
||||
if (win == ewins[i]->bits[j].win)
|
||||
{
|
||||
PagerHideAllHi();
|
||||
if (!clickmenu)
|
||||
{
|
||||
mode.noewin = 0;
|
||||
|
@ -2509,7 +2154,6 @@ HandleMouseIn(XEvent * ev)
|
|||
{
|
||||
if ((win == buttons[i]->win) || (win == buttons[i]->event_win))
|
||||
{
|
||||
PagerHideAllHi();
|
||||
mode.button = buttons[i];
|
||||
if (buttons[i]->state == STATE_CLICKED)
|
||||
buttons[i]->left = 0;
|
||||
|
@ -2553,6 +2197,9 @@ HandleMouseOut(XEvent * ev)
|
|||
win = ev->xcrossing.window;
|
||||
mode.context_win = win;
|
||||
|
||||
if (PagersEventMouseOut(ev))
|
||||
EDBUG_RETURN_;
|
||||
|
||||
{
|
||||
Menu *m;
|
||||
MenuItem *mi;
|
||||
|
|
14
src/focus.c
14
src/focus.c
|
@ -382,11 +382,15 @@ BeginNewDeskFocus(void)
|
|||
SubstructureRedirectMask | PropertyChangeMask |
|
||||
ResizeRedirectMask);
|
||||
if (ewin->pager)
|
||||
XSelectInput(disp, ewin->client.win,
|
||||
PropertyChangeMask | FocusChangeMask |
|
||||
ResizeRedirectMask | StructureNotifyMask |
|
||||
ColormapChangeMask | ButtonPressMask |
|
||||
ButtonReleaseMask | PointerMotionMask);
|
||||
{
|
||||
#if 0
|
||||
XSelectInput(disp, ewin->client.win,
|
||||
PropertyChangeMask | FocusChangeMask |
|
||||
ResizeRedirectMask | StructureNotifyMask |
|
||||
ColormapChangeMask | ButtonPressMask |
|
||||
ButtonReleaseMask | PointerMotionMask);
|
||||
#endif
|
||||
}
|
||||
else if (ewin->dialog)
|
||||
XSelectInput(disp, ewin->client.win,
|
||||
PropertyChangeMask | FocusChangeMask |
|
||||
|
|
|
@ -661,8 +661,8 @@ IB_SnapEWin(EWin * ewin)
|
|||
ewin->icon_w = w;
|
||||
ewin->icon_h = h;
|
||||
ewin->icon_pmm.pmap = ECreatePixmap(disp, ewin->win, w, h, root.depth);
|
||||
PagerScaleRect(ewin->icon_pmm.pmap, ewin->win, 0, 0, 0, 0, ewin->w, ewin->h,
|
||||
w, h);
|
||||
ScaleRect(ewin->icon_pmm.pmap, ewin->win, 0, 0, 0, 0, ewin->w, ewin->h,
|
||||
w, h);
|
||||
r = EShapeGetRectangles(disp, ewin->win, ShapeBounding, &rn, &ord);
|
||||
ewin->icon_pmm.mask = ECreatePixmap(disp, ewin->win, w, h, 1);
|
||||
gc = XCreateGC(disp, ewin->icon_pmm.mask, 0, &gcv);
|
||||
|
|
1079
src/pager.c
1079
src/pager.c
File diff suppressed because it is too large
Load Diff
|
@ -1252,7 +1252,7 @@ MatchToSnapInfoPager(Pager * p)
|
|||
if (sn->use_xy)
|
||||
EMoveWindow(disp, win, sn->x, sn->y);
|
||||
if (sn->use_wh)
|
||||
PagerResize(p, sn->w, sn->h);
|
||||
EResizeWindow(disp, win, sn->w, sn->h);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue