Fix resizing normal->maximized->fullscreen and back.
Fix preserving maximised state across restart. SVN revision: 28787
This commit is contained in:
parent
19961cd8b7
commit
7b951769f7
|
@ -491,7 +491,7 @@ doEwinMoveResize(EWin * ewin, Desk * dsk, int x, int y, int w, int h, int flags)
|
|||
EwinBorderCalcSizes(ewin, 0);
|
||||
|
||||
/* Clear maximized state on resize */
|
||||
if (!ewin->state.maximizing && !ewin->state.shading)
|
||||
if (resize && !ewin->state.maximizing && !ewin->state.shading)
|
||||
{
|
||||
if (ewin->state.maximized_horz || ewin->state.maximized_vert)
|
||||
{
|
||||
|
@ -1381,11 +1381,11 @@ EwinOpFullscreen(EWin * ewin, int source __UNUSED__, int on)
|
|||
{
|
||||
if (ewin->state.inhibit_fullscreeen)
|
||||
return;
|
||||
ewin->lx = EoGetX(ewin);
|
||||
ewin->ly = EoGetY(ewin);
|
||||
ewin->lw = ewin->client.w;
|
||||
ewin->lh = ewin->client.h;
|
||||
ewin->ll = EoGetLayer(ewin);
|
||||
ewin->save_fs.x = EoGetX(ewin);
|
||||
ewin->save_fs.y = EoGetY(ewin);
|
||||
ewin->save_fs.w = ewin->client.w;
|
||||
ewin->save_fs.h = ewin->client.h;
|
||||
ewin->save_fs.layer = EoGetLayer(ewin);
|
||||
}
|
||||
ScreenGetAvailableArea(EoGetX(ewin), EoGetY(ewin), &x, &y, &w, &h);
|
||||
|
||||
|
@ -1415,25 +1415,27 @@ EwinOpFullscreen(EWin * ewin, int source __UNUSED__, int on)
|
|||
lst = EwinListTransients(ewin, &num, 0);
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
lst[i]->ll = EoGetLayer(lst[i]);
|
||||
EoSetLayer(lst[i], lst[i]->ll + EoGetLayer(ewin) - ewin->ll);
|
||||
lst[i]->save_fs.layer = EoGetLayer(lst[i]);
|
||||
EoSetLayer(lst[i], lst[i]->save_fs.layer +
|
||||
EoGetLayer(ewin) - ewin->save_fs.layer);
|
||||
}
|
||||
if (lst)
|
||||
Efree(lst);
|
||||
}
|
||||
|
||||
EwinRaise(ewin);
|
||||
ewin->state.maximizing = 1;
|
||||
EwinMoveResize(ewin, x, y, w, h);
|
||||
ewin->state.maximized_horz = ewin->state.maximized_vert = 0;
|
||||
ewin->state.maximizing = 0;
|
||||
ewin->state.fullscreen = 1;
|
||||
EwinStateUpdate(ewin);
|
||||
}
|
||||
else
|
||||
{
|
||||
x = ewin->lx;
|
||||
y = ewin->ly;
|
||||
w = ewin->lw;
|
||||
h = ewin->lh;
|
||||
x = ewin->save_fs.x;
|
||||
y = ewin->save_fs.y;
|
||||
w = ewin->save_fs.w;
|
||||
h = ewin->save_fs.h;
|
||||
GetOnScreenPos(x, y, w, h, &x, &y);
|
||||
b = ewin->normal_border;
|
||||
EwinBorderSetTo(ewin, b);
|
||||
|
@ -1442,16 +1444,18 @@ EwinOpFullscreen(EWin * ewin, int source __UNUSED__, int on)
|
|||
{
|
||||
lst = EwinListTransients(ewin, &num, 0);
|
||||
for (i = 0; i < num; i++)
|
||||
EoSetLayer(lst[i], lst[i]->ll);
|
||||
EoSetLayer(lst[i], lst[i]->save_fs.layer);
|
||||
if (lst)
|
||||
Efree(lst);
|
||||
}
|
||||
EoSetLayer(ewin, ewin->ll);
|
||||
EoSetLayer(ewin, ewin->save_fs.layer);
|
||||
|
||||
ewin->state.fullscreen = 0;
|
||||
EwinStateUpdate(ewin);
|
||||
EwinRaise(ewin);
|
||||
ewin->state.maximizing = 1;
|
||||
EwinMoveResize(ewin, x, y, w, h);
|
||||
ewin->state.maximizing = 0;
|
||||
}
|
||||
|
||||
HintsSetWindowState(ewin);
|
||||
|
|
21
src/ewins.c
21
src/ewins.c
|
@ -111,11 +111,10 @@ EwinCreate(int type)
|
|||
|
||||
ewin->update.shape = 1;
|
||||
ewin->update.border = 1;
|
||||
ewin->lx = -1;
|
||||
ewin->ly = -1;
|
||||
ewin->lw = -1;
|
||||
ewin->lh = -1;
|
||||
ewin->ll = -1;
|
||||
ewin->save_max.x = ewin->save_max.y = ewin->save_max.w = ewin->save_max.h =
|
||||
-1;
|
||||
ewin->save_fs.x = ewin->save_fs.y = ewin->save_fs.w = ewin->save_fs.h = -1;
|
||||
ewin->save_fs.layer = -1;
|
||||
|
||||
ewin->icccm.need_input = 1;
|
||||
|
||||
|
@ -161,10 +160,10 @@ EwinGetAttributes(EWin * ewin, Win win, Window xwin)
|
|||
EGetWindowAttributes(win, &xwa);
|
||||
|
||||
ewin->client.win = win;
|
||||
ewin->client.x = ewin->lx = xwa.x;
|
||||
ewin->client.y = ewin->ly = xwa.y;
|
||||
ewin->client.w = ewin->lw = xwa.width;
|
||||
ewin->client.h = ewin->lh = xwa.height;
|
||||
ewin->client.x = ewin->save_max.x = ewin->save_fs.x = xwa.x;
|
||||
ewin->client.y = ewin->save_max.y = ewin->save_fs.y = xwa.y;
|
||||
ewin->client.w = ewin->save_max.w = ewin->save_fs.w = xwa.width;
|
||||
ewin->client.h = ewin->save_max.h = ewin->save_fs.h = xwa.height;
|
||||
ewin->client.bw = xwa.border_width;
|
||||
ewin->client.cmap = xwa.colormap;
|
||||
ewin->client.grav = NorthWestGravity;
|
||||
|
@ -308,8 +307,8 @@ EwinConfigure(EWin * ewin)
|
|||
SnapshotsEwinMatch(ewin); /* Find a saved settings match */
|
||||
SnapshotEwinApply(ewin); /* Apply saved settings */
|
||||
|
||||
if (ewin->ll < 0)
|
||||
ewin->ll = EoGetLayer(ewin);
|
||||
if (ewin->save_fs.layer < 0)
|
||||
ewin->save_fs.layer = EoGetLayer(ewin);
|
||||
|
||||
EwinStateUpdate(ewin); /* Update after snaps etc. */
|
||||
|
||||
|
|
14
src/ewins.h
14
src/ewins.h
|
@ -257,9 +257,17 @@ struct _ewin
|
|||
int head; /* Unused? */
|
||||
|
||||
int vx, vy; /* Position in virtual root */
|
||||
int lx, ly; /* Last pos */
|
||||
int lw, lh; /* Last size */
|
||||
int ll; /* Last layer */
|
||||
struct
|
||||
{ /* Saved state before maximization */
|
||||
int x, y; /* Position */
|
||||
int w, h; /* Size */
|
||||
} save_max;
|
||||
struct
|
||||
{ /* Saved state before fullscreen */
|
||||
int x, y; /* Position */
|
||||
int w, h; /* Size */
|
||||
int layer; /* Layer */
|
||||
} save_fs;
|
||||
|
||||
void *data; /* Data hook for internal windows */
|
||||
const EWinOps *ops;
|
||||
|
|
32
src/hints.c
32
src/hints.c
|
@ -324,8 +324,8 @@ typedef union
|
|||
int all:32;
|
||||
} EWinInfoFlags;
|
||||
|
||||
#define ENL_DATA_ITEMS 8
|
||||
#define ENL_DATA_VERSION 0
|
||||
#define ENL_DATA_ITEMS 12
|
||||
#define ENL_DATA_VERSION 1
|
||||
|
||||
void
|
||||
EHintsSetInfo(const EWin * ewin)
|
||||
|
@ -346,11 +346,15 @@ EHintsSetInfo(const EWin * ewin)
|
|||
|
||||
c[2] = 0;
|
||||
|
||||
c[3] = ewin->lx;
|
||||
c[4] = ewin->ly;
|
||||
c[5] = ewin->lw;
|
||||
c[6] = ewin->lh;
|
||||
c[7] = ewin->ll;
|
||||
c[3] = ewin->save_max.x;
|
||||
c[4] = ewin->save_max.y;
|
||||
c[5] = ewin->save_max.w;
|
||||
c[6] = ewin->save_max.h;
|
||||
c[7] = ewin->save_fs.x;
|
||||
c[8] = ewin->save_fs.y;
|
||||
c[9] = ewin->save_fs.w;
|
||||
c[10] = ewin->save_fs.h;
|
||||
c[11] = ewin->save_fs.layer;
|
||||
|
||||
ecore_x_window_prop_card32_set(EwinGetClientXwin(ewin), ENL_WIN_DATA,
|
||||
(unsigned int *)c, ENL_DATA_ITEMS);
|
||||
|
@ -392,11 +396,15 @@ EHintsGetInfo(EWin * ewin)
|
|||
|
||||
EwinFlagsDecode(ewin, c[1]);
|
||||
|
||||
ewin->lx = c[3];
|
||||
ewin->ly = c[4];
|
||||
ewin->lw = c[5];
|
||||
ewin->lh = c[6];
|
||||
ewin->ll = c[7];
|
||||
ewin->save_max.x = c[3];
|
||||
ewin->save_max.y = c[4];
|
||||
ewin->save_max.w = c[5];
|
||||
ewin->save_max.h = c[6];
|
||||
ewin->save_fs.x = c[7];
|
||||
ewin->save_fs.y = c[8];
|
||||
ewin->save_fs.w = c[9];
|
||||
ewin->save_fs.h = c[10];
|
||||
ewin->save_fs.layer = c[11];
|
||||
|
||||
str =
|
||||
ecore_x_window_prop_string_get(EwinGetClientXwin(ewin), ENL_WIN_BORDER);
|
||||
|
|
19
src/size.c
19
src/size.c
|
@ -51,11 +51,12 @@ MaxSizeHV(EWin * ewin, const char *resize_type, int direction)
|
|||
|
||||
if (ewin->state.maximized_horz || ewin->state.maximized_vert)
|
||||
{
|
||||
EwinMoveResize(ewin, ewin->lx, ewin->ly, ewin->lw, ewin->lh);
|
||||
ewin->lx = EoGetX(ewin);
|
||||
ewin->ly = EoGetY(ewin);
|
||||
ewin->lw = ewin->client.w;
|
||||
ewin->lh = ewin->client.h;
|
||||
EwinMoveResize(ewin, ewin->save_max.x, ewin->save_max.y,
|
||||
ewin->save_max.w, ewin->save_max.h);
|
||||
ewin->save_max.x = EoGetX(ewin);
|
||||
ewin->save_max.y = EoGetY(ewin);
|
||||
ewin->save_max.w = ewin->client.w;
|
||||
ewin->save_max.h = ewin->client.h;
|
||||
ewin->state.maximized_horz = 0;
|
||||
ewin->state.maximized_vert = 0;
|
||||
goto done;
|
||||
|
@ -178,10 +179,10 @@ MaxSizeHV(EWin * ewin, const char *resize_type, int direction)
|
|||
if (h < 10)
|
||||
h = 10;
|
||||
|
||||
ewin->lx = EoGetX(ewin);
|
||||
ewin->ly = EoGetY(ewin);
|
||||
ewin->lw = ewin->client.w;
|
||||
ewin->lh = ewin->client.h;
|
||||
ewin->save_max.x = EoGetX(ewin);
|
||||
ewin->save_max.y = EoGetY(ewin);
|
||||
ewin->save_max.w = ewin->client.w;
|
||||
ewin->save_max.h = ewin->client.h;
|
||||
|
||||
ewin->state.maximizing = 1;
|
||||
EwinMoveResize(ewin, x, y, w, h);
|
||||
|
|
Loading…
Reference in New Issue