Fix various issues with iconification of transients and state updates.

SVN revision: 18047
This commit is contained in:
Kim Woelders 2005-10-27 22:26:37 +00:00
parent aec50c69e6
commit 3eb7cd2d95
7 changed files with 57 additions and 67 deletions

View File

@ -586,7 +586,7 @@ EwinIconify(EWin * ewin)
if (!EwinIsTransient(ewin))
ModulesSignal(ESIGNAL_EWIN_ICONIFY, ewin);
ewin->state.iconified = 3;
ewin->state.iconified = 1;
HideEwin(ewin);
/* Save position at which the window was iconified */
@ -595,13 +595,6 @@ EwinIconify(EWin * ewin)
if (was_shaded != ewin->state.shaded)
EwinInstantShade(ewin, 0);
if (EwinIsTransient(ewin))
{
/* We should only get here during restart */
ewin->state.iconified = 4;
goto done;
}
ICCCM_Iconify(ewin);
lst = EwinListTransients(ewin, &num, 0);
@ -611,20 +604,17 @@ EwinIconify(EWin * ewin)
if (e->state.iconified)
continue;
e->state.iconified = 4;
HideEwin(e);
EwinRememberPositionSet(e);
EwinIconify(e);
}
if (lst)
Efree(lst);
#if ENABLE_GNOME
if (lst)
if (lst && call_depth == 1)
GNOME_SetClientList();
#endif
if (lst)
Efree(lst);
HintsSetWindowState(ewin);
done:
call_depth--;
}
@ -652,13 +642,13 @@ GetOnScreenPos(int x, int y, int w, int h, int *px, int *py)
*py = y;
}
void
EwinDeIconify(EWin * ewin)
static void
EwinDeIconify1(EWin * ewin, int dx, int dy)
{
static int call_depth = 0;
EWin **lst, *e;
int i, num;
int x, y, ox, oy, dx, dy;
int x, y;
if (call_depth > 256)
return;
@ -667,23 +657,12 @@ EwinDeIconify(EWin * ewin)
if (ewin->state.state != EWIN_STATE_ICONIC)
return;
EwinRememberPositionGet(ewin, &ox, &oy);
x = ox;
y = oy;
EwinRememberPositionGet(ewin, DesksGetCurrent(), &x, &y);
/* If we iconified an offscreen window, get it back on screen */
if (!ewin->state.showingdesk)
GetOnScreenPos(x, y, EoGetW(ewin), EoGetH(ewin), &x, &y);
EwinMoveToDesktopAt(ewin, DesksGetCurrent(), x + dx, y + dy);
dx = x - ox;
dy = y - oy;
if (EoIsSticky(ewin))
EwinMove(ewin, x, y);
else
EwinMoveToDesktopAt(ewin, DesksGetCurrent(), x, y);
ModulesSignal(ESIGNAL_EWIN_DEICONIFY, ewin);
if (!EwinIsTransient(ewin))
ModulesSignal(ESIGNAL_EWIN_DEICONIFY, ewin);
ewin->state.iconified = 0;
ewin->state.showingdesk = 0;
@ -696,32 +675,42 @@ EwinDeIconify(EWin * ewin)
for (i = 0; i < num; i++)
{
e = lst[i];
if (e->state.iconified != 4)
if (!e->state.iconified)
continue;
EwinRememberPositionGet(e, &ox, &oy);
if (EoIsSticky(e))
EwinMove(e, ox + dx, oy + dy);
else
EwinMoveToDesktopAt(e, DesksGetCurrent(), ox + dx, oy + dy);
e->state.iconified = 0;
RaiseEwin(e);
ShowEwin(e);
EwinDeIconify1(e, dx, dy);
}
if (lst)
Efree(lst);
#if ENABLE_GNOME
if (lst)
if (lst && call_depth == 1)
GNOME_SetClientList();
#endif
if (lst)
Efree(lst);
HintsSetWindowState(ewin);
call_depth--;
}
void
EwinDeIconify(EWin * ewin)
{
int x, y, ox, oy, dx, dy;
EwinRememberPositionGet(ewin, DesksGetCurrent(), &x, &y);
ox = x;
oy = y;
/* If we iconified an offscreen window, get it back on screen */
if (!ewin->state.showingdesk)
GetOnScreenPos(x, y, EoGetW(ewin), EoGetH(ewin), &x, &y);
dx = x - ox;
dy = y - oy;
EwinDeIconify1(ewin, dx, dy);
}
void
EwinUnStick(EWin * ewin)
{
@ -825,8 +814,6 @@ EwinInstantShade(EWin * ewin, int force)
#if 0 /* FIXME - Remove? */
ESync();
#endif
HintsSetWindowState(ewin);
}
void
@ -885,8 +872,6 @@ EwinInstantUnShade(EWin * ewin)
#if 0 /* FIXME - Remove? */
ESync();
#endif
HintsSetWindowState(ewin);
}
#define _EWIN_ADJUST_SHAPE(ewin, xo, yo) \

View File

@ -79,6 +79,12 @@ EwinCreate(Window win, int type)
ewin->type = type;
ewin->state.state = (Mode.wm.startup) ? EWIN_STATE_STARTUP : EWIN_STATE_NEW;
ewin->o.stacked = -1; /* Not placed on desk yet */
EoSetDesk(ewin, DesksGetCurrent());
EoSetLayer(ewin, 4);
EoSetShadow(ewin, 1);
ewin->update.shape = 1;
ewin->update.border = 1;
ewin->lx = -1;
@ -191,12 +197,8 @@ EwinManage(EWin * ewin)
ewin->win_container = ECreateWindow(frame, 0, 0, 1, 1, 0);
}
ewin->o.stacked = -1; /* Not placed on desk yet */
EoSetDesk(ewin, DesksGetCurrent());
EoInit(ewin, EOBJ_TYPE_EWIN, frame, -10, -10, -1, -1, 1, NULL);
EoSetName(ewin, Estrdup(ewin->icccm.wm_name));
EoSetLayer(ewin, 4);
EoSetShadow(ewin, 1);
EobjListFocusAdd(&ewin->o, 1);
EobjListOrderAdd(&ewin->o);
@ -1498,7 +1500,7 @@ EwinRememberPositionSet(EWin * ewin)
* Get saved position in relative viewport coordinates
*/
void
EwinRememberPositionGet(EWin * ewin, int *px, int *py)
EwinRememberPositionGet(EWin * ewin, Desk * dsk, int *px, int *py)
{
int x, y, ax, ay;
@ -1506,7 +1508,7 @@ EwinRememberPositionGet(EWin * ewin, int *px, int *py)
y = ewin->req_y;
if (!EoIsSticky(ewin))
{
DeskGetArea(EoGetDesk(ewin), &ax, &ay);
DeskGetArea(dsk, &ax, &ay);
x -= ax * VRoot.w;
y -= ay * VRoot.h;
}

View File

@ -59,13 +59,13 @@ struct _ewin
struct
{
char state;
char shaped;
char docked;
char visibility;
char iconified;
char shaped;
char shaded;
unsigned placed:1;
unsigned iconified:1;
unsigned docked:1;
unsigned click_grab_isset:1;
unsigned maximized_horz:1;
unsigned maximized_vert:1;
@ -272,7 +272,8 @@ const char *EwinGetName(const EWin * ewin);
const char *EwinGetIconName(const EWin * ewin);
int EwinIsOnScreen(const EWin * ewin);
void EwinRememberPositionSet(EWin * ewin);
void EwinRememberPositionGet(EWin * ewin, int *px, int *py);
void EwinRememberPositionGet(EWin * ewin, struct _desk *dsk,
int *px, int *py);
void EwinChange(EWin * ewin, unsigned int flag);

View File

@ -666,7 +666,7 @@ GNOME_SetClientList(void)
wl = Emalloc(num * sizeof(unsigned int));
for (i = 0; i < num; i++)
{
if (!lst[i]->props.skip_ext_task && lst[i]->state.iconified != 4)
if (!lst[i]->props.skip_ext_task && !EwinIsTransientChild(lst[i]))
wl[j++] = _EwinGetClientXwin(lst[i]);
}
}

View File

@ -2596,7 +2596,7 @@ IconboxesSighan(int sig, void *prm)
break;
case ESIGNAL_EWIN_DESTROY:
ewin = (EWin *) prm;
if (ewin->state.iconified > 0)
if (ewin->state.iconified)
RemoveMiniIcon(ewin);
break;
case ESIGNAL_EWIN_CHANGE_ICON:

View File

@ -446,9 +446,9 @@ IPC_WinOps(const char *params, Client * c __UNUSED__)
break;
case EWIN_OP_ICONIFY:
if (SetEwinBoolean
("window iconified", &ewin->state.iconified, param1, 0))
EwinOpIconify(ewin, !ewin->state.iconified);
on = ewin->state.iconified;
if (SetEwinBoolean("window iconified", &on, param1, 0))
EwinOpIconify(ewin, !on);
break;
case EWIN_OP_OPACITY:

View File

@ -51,7 +51,7 @@ MaxSizeHV(EWin * ewin, const char *resize_type, int direction)
ewin->lh = ewin->client.h;
ewin->state.maximized_horz = 0;
ewin->state.maximized_vert = 0;
return;
goto done;
}
type = MAX_ABSOLUTE; /* Select default */
@ -169,6 +169,8 @@ MaxSizeHV(EWin * ewin, const char *resize_type, int direction)
ewin->lw = ewin->client.w;
ewin->lh = ewin->client.h;
EwinMoveResize(ewin, x, y, w, h);
done:
HintsSetWindowState(ewin);
}
void