Another attempt to fix some window placement and saved settings issues.

SVN revision: 10541
This commit is contained in:
Kim Woelders 2004-06-18 20:12:10 +00:00
parent f33bbc8441
commit f6e8774706
9 changed files with 113 additions and 157 deletions

View File

@ -1789,9 +1789,7 @@ void EwinBorderUpdateState(EWin * ewin);
void EwinEventDestroy(EWin * ewin); void EwinEventDestroy(EWin * ewin);
void EwinEventMap(EWin * ewin); void EwinEventMap(EWin * ewin);
void EwinEventUnmap(EWin * ewin); void EwinEventUnmap(EWin * ewin);
void EwinSetArea(EWin * ewin, int ax, int ay);
void MoveEwinToArea(EWin * ewin, int ax, int ay); void MoveEwinToArea(EWin * ewin, int ax, int ay);
void SetEwinToCurrentArea(EWin * ewin);
int EwinGetDesk(const EWin * ewin); int EwinGetDesk(const EWin * ewin);
const char *EwinGetTitle(const EWin * ewin); const char *EwinGetTitle(const EWin * ewin);
const char *EwinGetIconName(const EWin * ewin); const char *EwinGetIconName(const EWin * ewin);
@ -2065,6 +2063,7 @@ void EdgeHandleMotion(XEvent * ev);
#define EDBUG_TYPE_RAISELOWER 132 #define EDBUG_TYPE_RAISELOWER 132
#define EDBUG_TYPE_MOVERESIZE 133 #define EDBUG_TYPE_MOVERESIZE 133
#define EDBUG_TYPE_SESSION 134 #define EDBUG_TYPE_SESSION 134
#define EDBUG_TYPE_SNAPS 135
int EventDebug(unsigned int type); int EventDebug(unsigned int type);
#else #else
#define EventDebug(type) 0 #define EventDebug(type) 0
@ -2537,8 +2536,6 @@ void SetSMUserThemePath(const char *path);
char *GetSMFile(void); char *GetSMFile(void);
char *GetGenericSMFile(void); char *GetGenericSMFile(void);
void MatchEwinToSM(EWin * ewin); void MatchEwinToSM(EWin * ewin);
void MatchToSnapInfoPager(Pager * p);
void MatchToSnapInfoIconbox(Iconbox * ib);
void SaveSession(int shutdown); void SaveSession(int shutdown);
void autosave(void); void autosave(void);
int EExit(int exitcode); int EExit(int exitcode);
@ -2616,7 +2613,6 @@ void LoadSnapInfo(void);
void MatchEwinToSnapInfo(EWin * ewin); void MatchEwinToSnapInfo(EWin * ewin);
void UnmatchEwinToSnapInfo(EWin * ewin); void UnmatchEwinToSnapInfo(EWin * ewin);
void RememberImportantInfoForEwin(EWin * ewin); void RememberImportantInfoForEwin(EWin * ewin);
void RememberImportantInfoForEwins(EWin * ewin);
/* sound.c */ /* sound.c */
SoundClass *SclassCreate(const char *name, const char *file); SoundClass *SclassCreate(const char *name, const char *file);

View File

@ -670,6 +670,7 @@ AddInternalToFamily(Window win, const char *bname, int type, void *ptr,
ICCCM_Configure(ewin); ICCCM_Configure(ewin);
EwinBorderDraw(ewin, 1, 1); EwinBorderDraw(ewin, 1, 1);
DetermineEwinArea(ewin);
UngrabX(); UngrabX();
EDBUG_RETURN(ewin); EDBUG_RETURN(ewin);
@ -1121,6 +1122,17 @@ HonorIclass(char *s, int id)
EDBUG_RETURN_; EDBUG_RETURN_;
} }
static void
EwinGetSize(EWin * ewin)
{
ewin->x = ewin->client.x - ewin->border->border.left;
ewin->y = ewin->client.y - ewin->border->border.top;
ewin->w = ewin->client.w +
ewin->border->border.left + ewin->border->border.right;
ewin->h = ewin->client.h +
ewin->border->border.top + ewin->border->border.bottom;
}
static EWin * static EWin *
Adopt(Window win) Adopt(Window win)
{ {
@ -1151,6 +1163,8 @@ Adopt(Window win)
ICCCM_MatchSize(ewin); ICCCM_MatchSize(ewin);
ICCCM_Adopt(ewin); ICCCM_Adopt(ewin);
EwinGetSize(ewin);
EwinEventsConfigure(ewin, 0); EwinEventsConfigure(ewin, 0);
UngrabX(); UngrabX();
@ -1189,11 +1203,13 @@ AdoptInternal(Window win, Border * border, int type)
ewin->skipfocus = 1; ewin->skipfocus = 1;
break; break;
case EWIN_TYPE_ICONBOX: case EWIN_TYPE_ICONBOX:
ewin->sticky = 1;
ewin->skiptask = 1; ewin->skiptask = 1;
ewin->skip_ext_pager = 1; ewin->skip_ext_pager = 1;
ewin->skipfocus = 1; ewin->skipfocus = 1;
break; break;
case EWIN_TYPE_PAGER: case EWIN_TYPE_PAGER:
ewin->sticky = 1;
ewin->skiptask = 1; ewin->skiptask = 1;
ewin->skip_ext_pager = 1; ewin->skip_ext_pager = 1;
ewin->skipfocus = 1; ewin->skipfocus = 1;
@ -1205,6 +1221,15 @@ AdoptInternal(Window win, Border * border, int type)
ICCCM_GetInfo(ewin, 0); ICCCM_GetInfo(ewin, 0);
ICCCM_GetShapeInfo(ewin); ICCCM_GetShapeInfo(ewin);
ICCCM_GetGeoms(ewin, 0); ICCCM_GetGeoms(ewin, 0);
switch (type)
{
case EWIN_TYPE_DIALOG:
case EWIN_TYPE_MENU:
ewin->client.width.min = ewin->client.width.max = ewin->client.w;
ewin->client.height.min = ewin->client.height.max = ewin->client.h;
ewin->client.no_resize_h = ewin->client.no_resize_v = 1;
break;
}
MatchEwinToSnapInfo(ewin); MatchEwinToSnapInfo(ewin);
if (!ewin->border) if (!ewin->border)
@ -1213,6 +1238,8 @@ AdoptInternal(Window win, Border * border, int type)
ICCCM_MatchSize(ewin); ICCCM_MatchSize(ewin);
ICCCM_Adopt(ewin); ICCCM_Adopt(ewin);
EwinGetSize(ewin);
EwinEventsConfigure(ewin, 0); EwinEventsConfigure(ewin, 0);
UngrabX(); UngrabX();
@ -1714,7 +1741,7 @@ EwinUpdateAfterMoveResize(EWin * ewin, int resize)
} }
void void
EwinFixPosition(EWin * ewin __UNUSED__) EwinFixPosition(EWin * ewin)
{ {
int x, y; int x, y;
@ -1734,10 +1761,6 @@ EwinFixPosition(EWin * ewin __UNUSED__)
if (x != ewin->x || y != ewin->y) if (x != ewin->x || y != ewin->y)
MoveEwin(ewin, x, y); MoveEwin(ewin, x, y);
#if 0
RememberImportantInfoForEwin(ewin);
#endif
} }
#define MR_FLAGS_MOVE 1 #define MR_FLAGS_MOVE 1
@ -1804,6 +1827,8 @@ doMoveResizeEwin(EWin * ewin, int x, int y, int w, int h, int flags)
move = 1; move = 1;
ewin->x = x; ewin->x = x;
ewin->y = y; ewin->y = y;
ewin->client.x += dx;
ewin->client.y += dy;
} }
if (flags & MR_FLAGS_RESIZE) if (flags & MR_FLAGS_RESIZE)
@ -2122,8 +2147,6 @@ ShowEwin(EWin * ewin)
if (ewin->win) if (ewin->win)
EMapWindow(disp, ewin->win); EMapWindow(disp, ewin->win);
SetEwinToCurrentArea(ewin);
if (Mode.mode == MODE_NONE) if (Mode.mode == MODE_NONE)
{ {
PagerEwinOutsideAreaUpdate(ewin); PagerEwinOutsideAreaUpdate(ewin);
@ -3147,7 +3170,7 @@ EwinSetFullscreen(EWin * ewin, int on)
HintsSetWindowState(ewin); HintsSetWindowState(ewin);
} }
void static void
EwinSetArea(EWin * ewin, int ax, int ay) EwinSetArea(EWin * ewin, int ax, int ay)
{ {
if (ax == ewin->area_x && ay == ewin->area_y) if (ax == ewin->area_x && ay == ewin->area_y)
@ -3184,17 +3207,9 @@ MoveEwinToArea(EWin * ewin, int ax, int ay)
AreaFix(&ax, &ay); AreaFix(&ax, &ay);
MoveEwin(ewin, ewin->x + (VRoot.w * (ax - ewin->area_x)), MoveEwin(ewin, ewin->x + (VRoot.w * (ax - ewin->area_x)),
ewin->y + (VRoot.h * (ay - ewin->area_y))); ewin->y + (VRoot.h * (ay - ewin->area_y)));
EwinSetArea(ewin, ax, ay);
EDBUG_RETURN_; EDBUG_RETURN_;
} }
void
SetEwinToCurrentArea(EWin * ewin)
{
EwinSetArea(ewin, desks.desk[ewin->desktop].current_area_x,
desks.desk[ewin->desktop].current_area_y);
}
int int
EwinGetDesk(const EWin * ewin) EwinGetDesk(const EWin * ewin)
{ {

View File

@ -881,7 +881,6 @@ EWMH_ProcessClientMessage(XClientMessageEvent * event)
ewin->toggle = 0; ewin->toggle = 0;
func(ewin, "available"); func(ewin, "available");
RememberImportantInfoForEwin(ewin);
EWMH_SetWindowState(ewin); EWMH_SetWindowState(ewin);
} }
else if (atom == _NET_WM_STATE_FULLSCREEN) else if (atom == _NET_WM_STATE_FULLSCREEN)

View File

@ -356,8 +356,8 @@ ICCCM_Configure(EWin * ewin)
ev.xconfigure.display = disp; ev.xconfigure.display = disp;
ev.xconfigure.event = ewin->client.win; ev.xconfigure.event = ewin->client.win;
ev.xconfigure.window = ewin->client.win; ev.xconfigure.window = ewin->client.win;
ev.xconfigure.x = desks.desk[d].x + ewin->x + ewin->border->border.left; ev.xconfigure.x = desks.desk[d].x + ewin->client.x;
ev.xconfigure.y = desks.desk[d].y + ewin->y + ewin->border->border.top; ev.xconfigure.y = desks.desk[d].y + ewin->client.y;
ev.xconfigure.width = ewin->client.w; ev.xconfigure.width = ewin->client.w;
ev.xconfigure.height = ewin->client.h; ev.xconfigure.height = ewin->client.h;
ev.xconfigure.border_width = 0; ev.xconfigure.border_width = 0;
@ -395,12 +395,6 @@ ICCCM_Adopt(EWin * ewin)
c[0] = (ewin->client.start_iconified) ? IconicState : NormalState; c[0] = (ewin->client.start_iconified) ? IconicState : NormalState;
XChangeProperty(disp, win, E_XA_WM_STATE, E_XA_WM_STATE, 32, PropModeReplace, XChangeProperty(disp, win, E_XA_WM_STATE, E_XA_WM_STATE, 32, PropModeReplace,
(unsigned char *)c, 2); (unsigned char *)c, 2);
ewin->x = ewin->client.x;
ewin->y = ewin->client.y;
ewin->w = ewin->client.w +
ewin->border->border.left + ewin->border->border.right;
ewin->h = ewin->client.h +
ewin->border->border.top + ewin->border->border.bottom;
EDBUG_RETURN_; EDBUG_RETURN_;
} }
@ -538,6 +532,7 @@ ICCCM_GetGeoms(EWin * ewin, Atom atom_change)
ewin->client.w = w; ewin->client.w = w;
ewin->client.h = h; ewin->client.h = h;
ewin->client.bw = bw; ewin->client.bw = bw;
if (XGetWMNormalHints(disp, ewin->client.win, &hint, &mask)) if (XGetWMNormalHints(disp, ewin->client.win, &hint, &mask))
{ {
if (!(ewin->client.already_placed)) if (!(ewin->client.already_placed))
@ -589,6 +584,7 @@ ICCCM_GetGeoms(EWin * ewin, Atom atom_change)
ewin->client.y = 0; ewin->client.y = 0;
ewin->client.already_placed = 0; ewin->client.already_placed = 0;
} }
if (hint.flags & PMinSize) if (hint.flags & PMinSize)
{ {
ewin->client.width.min = hint.min_width; ewin->client.width.min = hint.min_width;
@ -599,6 +595,7 @@ ICCCM_GetGeoms(EWin * ewin, Atom atom_change)
ewin->client.width.min = 0; ewin->client.width.min = 0;
ewin->client.height.min = 0; ewin->client.height.min = 0;
} }
if (hint.flags & PMaxSize) if (hint.flags & PMaxSize)
{ {
ewin->client.width.max = hint.max_width; ewin->client.width.max = hint.max_width;
@ -613,6 +610,7 @@ ICCCM_GetGeoms(EWin * ewin, Atom atom_change)
ewin->client.width.max = 65535; ewin->client.width.max = 65535;
ewin->client.height.max = 65535; ewin->client.height.max = 65535;
} }
if (hint.flags & PResizeInc) if (hint.flags & PResizeInc)
{ {
ewin->client.w_inc = hint.width_inc; ewin->client.w_inc = hint.width_inc;
@ -627,6 +625,7 @@ ICCCM_GetGeoms(EWin * ewin, Atom atom_change)
ewin->client.w_inc = 1; ewin->client.w_inc = 1;
ewin->client.h_inc = 1; ewin->client.h_inc = 1;
} }
if (hint.flags & PAspect) if (hint.flags & PAspect)
{ {
if ((hint.min_aspect.y > 0.0) && (hint.min_aspect.x > 0.0)) if ((hint.min_aspect.y > 0.0) && (hint.min_aspect.x > 0.0))
@ -653,6 +652,7 @@ ICCCM_GetGeoms(EWin * ewin, Atom atom_change)
ewin->client.aspect_min = 0.0; ewin->client.aspect_min = 0.0;
ewin->client.aspect_max = 65535.0; ewin->client.aspect_max = 65535.0;
} }
if (hint.flags & PBaseSize) if (hint.flags & PBaseSize)
{ {
ewin->client.base_w = hint.base_width; ewin->client.base_w = hint.base_width;
@ -663,21 +663,13 @@ ICCCM_GetGeoms(EWin * ewin, Atom atom_change)
ewin->client.base_w = ewin->client.width.min; ewin->client.base_w = ewin->client.width.min;
ewin->client.base_h = ewin->client.height.min; ewin->client.base_h = ewin->client.height.min;
} }
if (ewin->client.width.min < ewin->client.base_w) if (ewin->client.width.min < ewin->client.base_w)
ewin->client.width.min = ewin->client.base_w; ewin->client.width.min = ewin->client.base_w;
if (ewin->client.height.min < ewin->client.base_h) if (ewin->client.height.min < ewin->client.base_h)
ewin->client.height.min = ewin->client.base_h; ewin->client.height.min = ewin->client.base_h;
} }
if (ewin->client.width.min == 0)
{
if (ewin->internal)
{
ewin->client.width.min = w;
ewin->client.height.min = h;
ewin->client.width.max = w;
ewin->client.height.max = h;
}
}
ewin->client.no_resize_h = 0; ewin->client.no_resize_h = 0;
ewin->client.no_resize_v = 0; ewin->client.no_resize_v = 0;
if (ewin->client.width.min == ewin->client.width.max) if (ewin->client.width.min == ewin->client.width.max)
@ -685,6 +677,11 @@ ICCCM_GetGeoms(EWin * ewin, Atom atom_change)
if (ewin->client.height.min == ewin->client.height.max) if (ewin->client.height.min == ewin->client.height.max)
ewin->client.no_resize_v = 1; ewin->client.no_resize_v = 1;
if (EventDebug(EDBUG_TYPE_SNAPS))
Eprintf("Snap get icccm %#lx: %4d+%4d %4dx%4d: %s\n",
ewin->client.win, ewin->client.x, ewin->client.y,
ewin->client.w, ewin->client.h, EwinGetTitle(ewin));
EDBUG_RETURN_; EDBUG_RETURN_;
} }
@ -1070,8 +1067,8 @@ ICCCM_SetEInfo(EWin * ewin)
aa = XInternAtom(disp, "ENL_INTERNAL_DATA_BORDER", False); aa = XInternAtom(disp, "ENL_INTERNAL_DATA_BORDER", False);
c[0] = ewin->desktop; c[0] = ewin->desktop;
c[1] = ewin->sticky; c[1] = ewin->sticky;
c[2] = ewin->x; c[2] = ewin->client.x;
c[3] = ewin->y; c[3] = ewin->client.y;
c[4] = ewin->iconified; c[4] = ewin->iconified;
if (ewin->iconified) if (ewin->iconified)
ICCCM_DeIconify(ewin); ICCCM_DeIconify(ewin);
@ -1083,6 +1080,10 @@ ICCCM_SetEInfo(EWin * ewin)
XChangeProperty(disp, ewin->client.win, aa, XA_STRING, 8, PropModeReplace, XChangeProperty(disp, ewin->client.win, aa, XA_STRING, 8, PropModeReplace,
(unsigned char *)ewin->border->name, (unsigned char *)ewin->border->name,
strlen(ewin->border->name) + 1); strlen(ewin->border->name) + 1);
if (EventDebug(EDBUG_TYPE_SNAPS))
Eprintf("Snap set einf %#lx: %4d+%4d %4dx%4d: %s\n",
ewin->client.win, ewin->client.x, ewin->client.y,
ewin->client.w, ewin->client.h, EwinGetTitle(ewin));
EDBUG_RETURN_; EDBUG_RETURN_;
} }
@ -1117,7 +1118,7 @@ ICCCM_GetMainEInfo(void)
a = XInternAtom(disp, "ENL_INTERNAL_AREA_DATA", False); a = XInternAtom(disp, "ENL_INTERNAL_AREA_DATA", False);
puc = NULL; puc = NULL;
XGetWindowProperty(disp, VRoot.win, a, 0, 10, False, XA_CARDINAL, &a2, XGetWindowProperty(disp, VRoot.win, a, 0, 0xffff, False, XA_CARDINAL, &a2,
&dummy, &lnum, &ldummy, &puc); &dummy, &lnum, &ldummy, &puc);
c = (CARD32 *) puc; c = (CARD32 *) puc;
num = (int)lnum; num = (int)lnum;
@ -1136,7 +1137,7 @@ ICCCM_GetMainEInfo(void)
a = XInternAtom(disp, "ENL_INTERNAL_DESK_DATA", False); a = XInternAtom(disp, "ENL_INTERNAL_DESK_DATA", False);
puc = NULL; puc = NULL;
XGetWindowProperty(disp, VRoot.win, a, 0, 10, False, XA_CARDINAL, &a2, XGetWindowProperty(disp, VRoot.win, a, 0, 1, False, XA_CARDINAL, &a2,
&dummy, &lnum, &ldummy, &puc); &dummy, &lnum, &ldummy, &puc);
c = (CARD32 *) puc; c = (CARD32 *) puc;
num = (int)lnum; num = (int)lnum;
@ -1200,6 +1201,10 @@ ICCCM_GetEInfo(EWin * ewin)
if ((num > 0) && (str)) if ((num > 0) && (str))
EwinSetBorderByName(ewin, str, 0); EwinSetBorderByName(ewin, str, 0);
XFree(str); XFree(str);
if (EventDebug(EDBUG_TYPE_SNAPS))
Eprintf("Snap get einf %#lx: %4d+%4d %4dx%4d: %s\n",
ewin->client.win, ewin->client.x, ewin->client.y,
ewin->client.w, ewin->client.h, EwinGetTitle(ewin));
} }
EDBUG_RETURN(0); EDBUG_RETURN(0);
} }

View File

@ -546,6 +546,8 @@ IconboxEwinMoveResize(EWin * ewin, int resize __UNUSED__)
return; return;
call_depth++; call_depth++;
RememberImportantInfoForEwin(ewin);
if (!Conf.theme.transparency && if (!Conf.theme.transparency &&
ib->w == ewin->client.w && ib->h == ewin->client.h) ib->w == ewin->client.w && ib->h == ewin->client.h)
goto done; goto done;
@ -602,8 +604,6 @@ IconboxShow(Iconbox * ib)
HintsSetWindowName(ib->win, "Iconbox"); HintsSetWindowName(ib->win, "Iconbox");
HintsSetWindowClass(ib->win, ib->name, "Enlightenment_IconBox"); HintsSetWindowClass(ib->win, ib->name, "Enlightenment_IconBox");
MatchToSnapInfoIconbox(ib);
ewin = AddInternalToFamily(ib->win, "ICONBOX", EWIN_TYPE_ICONBOX, ib, ewin = AddInternalToFamily(ib->win, "ICONBOX", EWIN_TYPE_ICONBOX, ib,
IconboxEwinInit); IconboxEwinInit);
if (ewin) if (ewin)
@ -615,7 +615,6 @@ IconboxShow(Iconbox * ib)
IB_Reconfigure(ib); IB_Reconfigure(ib);
sn = FindSnapshot(ewin); sn = FindSnapshot(ewin);
ConformEwinToDesktop(ewin);
w = ewin->client.w; w = ewin->client.w;
h = ewin->client.h; h = ewin->client.h;
@ -623,7 +622,7 @@ IconboxShow(Iconbox * ib)
ewin->client.h = 1; ewin->client.h = 1;
if (sn) if (sn)
{ {
ResizeEwin(ewin, w, h); MoveResizeEwin(ewin, ewin->x, ewin->y, w, h);
} }
else else
{ {
@ -2082,7 +2081,6 @@ IconboxRedraw(Iconbox * ib)
EResizeWindow(disp, ib->win, w, h); EResizeWindow(disp, ib->win, w, h);
EFreePixmap(disp, ib->pmap); EFreePixmap(disp, ib->pmap);
ib->pmap = ECreatePixmap(disp, ib->icon_win, w, h, VRoot.depth); ib->pmap = ECreatePixmap(disp, ib->icon_win, w, h, VRoot.depth);
RememberImportantInfoForEwins(ib->ewin);
ib->force_update = 0; ib->force_update = 0;
} }

View File

@ -159,7 +159,6 @@ ActionMoveEnd(EWin * ewin)
FX_Pause(); FX_Pause();
UngrabX(); UngrabX();
} }
RememberImportantInfoForEwins(ewin);
if (wasresize) if (wasresize)
ForceUpdatePagersForDesktop(desks.current); ForceUpdatePagersForDesktop(desks.current);
Efree(gwins); Efree(gwins);
@ -358,7 +357,6 @@ ActionResizeEnd(EWin * ewin)
UngrabX(); UngrabX();
} }
ForceUpdatePagersForDesktop(desks.current); ForceUpdatePagersForDesktop(desks.current);
RememberImportantInfoForEwin(ewin);
EwinUpdateAfterMoveResize(ewin, 1); EwinUpdateAfterMoveResize(ewin, 1);

View File

@ -235,6 +235,8 @@ PagerEwinMoveResize(EWin * ewin, int resize)
if (!Conf.pagers.enable || !p) if (!Conf.pagers.enable || !p)
return; return;
RememberImportantInfoForEwin(ewin);
w = ewin->client.w; w = ewin->client.w;
h = ewin->client.h; h = ewin->client.h;
if ((w == p->w) && (h == p->h)) if ((w == p->w) && (h == p->h))
@ -334,8 +336,6 @@ PagerShow(Pager * p)
pq = Mode.queue_up; pq = Mode.queue_up;
Mode.queue_up = 0; Mode.queue_up = 0;
MatchToSnapInfoPager(p);
ewin = AddInternalToFamily(p->win, (p->border_name) ? p->border_name : ewin = AddInternalToFamily(p->win, (p->border_name) ? p->border_name :
"PAGER", EWIN_TYPE_PAGER, p, PagerEwinInit); "PAGER", EWIN_TYPE_PAGER, p, PagerEwinInit);
if (ewin) if (ewin)
@ -344,11 +344,9 @@ PagerShow(Pager * p)
Snapshot *sn; Snapshot *sn;
double aspect; double aspect;
#if 1 /* Do we need this? */
ewin->client.event_mask |= ewin->client.event_mask |=
ButtonPressMask | ButtonReleaseMask | PointerMotionMask; ButtonPressMask | ButtonReleaseMask | PointerMotionMask;
XSelectInput(disp, p->win, ewin->client.event_mask); XSelectInput(disp, p->win, ewin->client.event_mask);
#endif
aspect = ((double)VRoot.w) / ((double)VRoot.h); aspect = ((double)VRoot.w) / ((double)VRoot.h);
GetAreaSize(&ax, &ay); GetAreaSize(&ax, &ay);
@ -384,9 +382,6 @@ PagerShow(Pager * p)
/* show the pager ewin */ /* show the pager ewin */
ShowEwin(ewin); ShowEwin(ewin);
if (((sn) && (sn->use_sticky) && (sn->sticky)) || (!sn))
EwinStick(ewin);
RememberImportantInfoForEwin(ewin);
if (Conf.pagers.snap) if (Conf.pagers.snap)
{ {
Esnprintf(s, sizeof(s), "__.%x", (unsigned)p->win); Esnprintf(s, sizeof(s), "__.%x", (unsigned)p->win);

View File

@ -236,7 +236,7 @@ SaveWindowStates(void)
y = desks.desk[ewin->desktop].current_area_y * VRoot.h; y = desks.desk[ewin->desktop].current_area_y * VRoot.h;
} }
fprintf(f, "[CLIENT] %i %i %i %i %i %i %i %i %i\n", fprintf(f, "[CLIENT] %i %i %i %i %i %i %i %i %i\n",
ewin->x + x, ewin->y + y, ewin->client.w, ewin->client.x + x, ewin->client.y + y, ewin->client.w,
ewin->client.h, ewin->desktop, ewin->iconified, ewin->client.h, ewin->desktop, ewin->iconified,
ewin->shaded, ewin->sticky, ewin->layer); ewin->shaded, ewin->sticky, ewin->layer);
if (ewin->session_id) if (ewin->session_id)
@ -418,6 +418,10 @@ MatchEwinToSM(EWin * ewin)
ewin->client.y, ewin->client.w, ewin->client.y, ewin->client.w,
ewin->client.h); ewin->client.h);
} }
if (EventDebug(EDBUG_TYPE_SNAPS))
Eprintf("Snap get sess %#lx: %4d+%4d %4dx%4d: %s\n",
ewin->client.win, ewin->client.x, ewin->client.y,
ewin->client.w, ewin->client.h, EwinGetTitle(ewin));
break; break;
} }
} }

View File

@ -629,10 +629,17 @@ SnapshotEwinLocation(EWin * ewin)
if (!sn) if (!sn)
return; return;
sn->use_xy = 1; sn->use_xy = 1;
sn->x = ewin->x; sn->x = ewin->client.x;
sn->y = ewin->y; sn->y = ewin->client.y;
sn->area_x = ewin->area_x; sn->area_x = ewin->area_x;
sn->area_y = ewin->area_y; sn->area_y = ewin->area_y;
if (!ewin->sticky)
{
sn->x +=
((desks.desk[ewin->desktop].current_area_x - sn->area_x) * VRoot.w);
sn->y +=
((desks.desk[ewin->desktop].current_area_y - sn->area_y) * VRoot.h);
}
} }
void void
@ -1146,64 +1153,65 @@ MatchEwinToSnapInfo(EWin * ewin)
ewin->snap = sn; ewin->snap = sn;
sn->used = 1; sn->used = 1;
ListChangeItemID(LIST_TYPE_SNAPSHOT, ewin->snap, 1); ListChangeItemID(LIST_TYPE_SNAPSHOT, ewin->snap, 1);
if (sn->use_desktop)
ewin->desktop = sn->desktop; if (sn->use_sticky)
ewin->sticky = sn->sticky;
if (sn->use_desktop && !ewin->sticky)
ewin->desktop = DESKTOPS_WRAP_NUM(sn->desktop);
else
ewin->desktop = desks.current;
if (sn->use_wh) if (sn->use_wh)
{ {
ewin->client.w = sn->w; ewin->client.w = sn->w;
ewin->client.h = sn->h; ewin->client.h = sn->h;
} }
if (sn->use_xy) if (sn->use_xy)
{ {
ewin->client.already_placed = 1; ewin->client.already_placed = 1;
ewin->client.x = sn->x; ewin->client.x = sn->x;
ewin->client.y = sn->y; ewin->client.y = sn->y;
if ((!((sn->use_sticky) && (sn->sticky))) && (!ewin->sticky)) ewin->area_x = sn->area_x;
ewin->area_y = sn->area_y;
if (!ewin->sticky)
{ {
if (sn->use_desktop) ewin->client.x +=
{ ((sn->area_x - desks.desk[ewin->desktop].current_area_x) *
ewin->client.x += VRoot.w);
((sn->area_x - desks.desk[ewin->desktop].current_area_x) * ewin->client.y +=
VRoot.w); ((sn->area_y - desks.desk[ewin->desktop].current_area_y) *
ewin->client.y += VRoot.h);
((sn->area_y - desks.desk[ewin->desktop].current_area_y) *
VRoot.h);
}
else
{
ewin->client.x +=
((sn->area_x - desks.desk[desks.current].current_area_x) *
VRoot.w);
ewin->client.y +=
((sn->area_y - desks.desk[desks.current].current_area_y) *
VRoot.h);
}
} }
ewin->x = ewin->client.x;
ewin->y = ewin->client.y;
EMoveResizeWindow(disp, ewin->client.win, ewin->client.x, EMoveResizeWindow(disp, ewin->client.win, ewin->client.x,
ewin->client.y, ewin->client.w, ewin->client.h); ewin->client.y, ewin->client.w, ewin->client.h);
} }
if (sn->use_layer) if (sn->use_layer)
ewin->layer = sn->layer; ewin->layer = sn->layer;
if (sn->use_sticky)
ewin->sticky = sn->sticky;
if (sn->use_skiplists) if (sn->use_skiplists)
{ {
ewin->skipfocus = sn->skipfocus; ewin->skipfocus = sn->skipfocus;
ewin->skiptask = sn->skiptask; ewin->skiptask = sn->skiptask;
ewin->skipwinlist = sn->skipwinlist; ewin->skipwinlist = sn->skipwinlist;
} }
if (sn->use_neverfocus) if (sn->use_neverfocus)
ewin->neverfocus = sn->neverfocus; ewin->neverfocus = sn->neverfocus;
if (sn->use_shade) if (sn->use_shade)
ewin->shaded = sn->shade; ewin->shaded = sn->shade;
if (sn->iclass_name) if (sn->iclass_name)
{ {
/* FIXME: fill this in */ /* FIXME: fill this in */
} }
if (sn->border_name) if (sn->border_name)
EwinSetBorderByName(ewin, sn->border_name, 0); EwinSetBorderByName(ewin, sn->border_name, 0);
if (sn->groups) if (sn->groups)
{ {
for (i = 0; i < sn->num_groups; i++) for (i = 0; i < sn->num_groups; i++)
@ -1224,6 +1232,11 @@ MatchEwinToSnapInfo(EWin * ewin)
AddEwinToGroup(ewin, g); AddEwinToGroup(ewin, g);
} }
} }
if (EventDebug(EDBUG_TYPE_SNAPS))
Eprintf("Snap get snap %#lx: %4d+%4d %4dx%4d: %s\n",
ewin->client.win, ewin->client.x, ewin->client.y,
ewin->client.w, ewin->client.h, EwinGetTitle(ewin));
} }
/* make a client window conform to snapshot info */ /* make a client window conform to snapshot info */
@ -1241,67 +1254,15 @@ UnmatchEwinToSnapInfo(EWin * ewin)
ListChangeItemID(LIST_TYPE_SNAPSHOT, sn, 0); ListChangeItemID(LIST_TYPE_SNAPSHOT, sn, 0);
} }
void
MatchToSnapInfoPager(Pager * p)
{
XClassHint hint;
char buf[1024];
Snapshot *sn = NULL;
Window win = PagerGetWin(p);
if ((!XGetClassHint(disp, win, &hint)))
return;
if ((hint.res_name) && (hint.res_class))
{
Esnprintf(buf, sizeof(buf), "%s.%s", hint.res_name, hint.res_class);
sn = FindItem(buf, 0, LIST_FINDBY_BOTH, LIST_TYPE_SNAPSHOT);
}
if (hint.res_name)
XFree(hint.res_name);
if (hint.res_class)
XFree(hint.res_class);
if (!sn)
return;
if (sn->use_xy)
EMoveWindow(disp, win, sn->x, sn->y);
if (sn->use_wh)
EResizeWindow(disp, win, sn->w, sn->h);
}
void
MatchToSnapInfoIconbox(Iconbox * ib)
{
XClassHint hint;
char buf[1024];
Snapshot *sn = NULL;
Window win = IconboxGetWin(ib);
if ((!XGetClassHint(disp, win, &hint)))
return;
if ((hint.res_name) && (hint.res_class))
{
Esnprintf(buf, sizeof(buf), "%s.%s", hint.res_name, hint.res_class);
sn = FindItem(buf, 0, LIST_FINDBY_BOTH, LIST_TYPE_SNAPSHOT);
}
if (hint.res_name)
XFree(hint.res_name);
if (hint.res_class)
XFree(hint.res_class);
if (!sn)
return;
if (sn->use_xy)
EMoveWindow(disp, win, sn->x, sn->y);
if (sn->use_wh)
EResizeWindow(disp, win, sn->w, sn->h);
}
void void
RememberImportantInfoForEwin(EWin * ewin) RememberImportantInfoForEwin(EWin * ewin)
{ {
if ((ewin->pager) || (ewin->ibox)) if ((ewin->pager) || (ewin->ibox))
{ {
if (EventDebug(EDBUG_TYPE_SNAPS))
Eprintf("RememberImportantInfoForEwin %#lx %s\n",
ewin->client.win, EwinGetTitle(ewin));
SnapshotEwinBorder(ewin); SnapshotEwinBorder(ewin);
SnapshotEwinDesktop(ewin); SnapshotEwinDesktop(ewin);
SnapshotEwinSize(ewin); SnapshotEwinSize(ewin);
@ -1315,18 +1276,3 @@ RememberImportantInfoForEwin(EWin * ewin)
SaveSnapInfo(); SaveSnapInfo();
} }
} }
void
RememberImportantInfoForEwins(EWin * ewin)
{
int i, num;
EWin **gwins;
gwins = ListWinGroupMembersForEwin(ewin, ACTION_MOVE, Mode.nogroup, &num);
if (gwins)
{
for (i = 0; i < num; i++)
RememberImportantInfoForEwin(gwins[i]);
Efree(gwins);
}
}