dont use the _OPENBOX_PREMAX window property anymore, save max and fullscreen pre-areas in the client struct
This commit is contained in:
parent
62b3b8c57e
commit
caca123b90
3 changed files with 74 additions and 110 deletions
115
openbox/client.c
115
openbox/client.c
|
@ -2013,41 +2013,30 @@ void client_fullscreen(ObClient *self, gboolean fs, gboolean savearea)
|
||||||
and adjust out layer/stacking */
|
and adjust out layer/stacking */
|
||||||
|
|
||||||
if (fs) {
|
if (fs) {
|
||||||
if (savearea) {
|
if (savearea)
|
||||||
guint32 dimensions[4];
|
self->pre_fullscreen_area = self->area;
|
||||||
dimensions[0] = self->area.x;
|
|
||||||
dimensions[1] = self->area.y;
|
|
||||||
dimensions[2] = self->area.width;
|
|
||||||
dimensions[3] = self->area.height;
|
|
||||||
|
|
||||||
PROP_SETA32(self->window, openbox_premax, cardinal,
|
|
||||||
dimensions, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* these are not actually used cuz client_configure will set them
|
/* these are not actually used cuz client_configure will set them
|
||||||
as appropriate when the window is fullscreened */
|
as appropriate when the window is fullscreened */
|
||||||
x = y = w = h = 0;
|
x = y = w = h = 0;
|
||||||
} else {
|
} else {
|
||||||
guint num;
|
|
||||||
gint32 *dimensions;
|
|
||||||
Rect *a;
|
Rect *a;
|
||||||
|
|
||||||
|
if (self->pre_fullscreen_area.width > 0 &&
|
||||||
|
self->pre_fullscreen_area.height > 0)
|
||||||
|
{
|
||||||
|
x = self->pre_fullscreen_area.x;
|
||||||
|
y = self->pre_fullscreen_area.y;
|
||||||
|
w = self->pre_fullscreen_area.width;
|
||||||
|
h = self->pre_fullscreen_area.height;
|
||||||
|
RECT_SET(self->pre_fullscreen_area, 0, 0, 0, 0);
|
||||||
|
} else {
|
||||||
/* pick some fallbacks... */
|
/* pick some fallbacks... */
|
||||||
a = screen_area_monitor(self->desktop, 0);
|
a = screen_area_monitor(self->desktop, 0);
|
||||||
x = a->x + a->width / 4;
|
x = a->x + a->width / 4;
|
||||||
y = a->y + a->height / 4;
|
y = a->y + a->height / 4;
|
||||||
w = a->width / 2;
|
w = a->width / 2;
|
||||||
h = a->height / 2;
|
h = a->height / 2;
|
||||||
|
|
||||||
if (PROP_GETA32(self->window, openbox_premax, cardinal,
|
|
||||||
(guint32**)&dimensions, &num)) {
|
|
||||||
if (num == 4) {
|
|
||||||
x = dimensions[0];
|
|
||||||
y = dimensions[1];
|
|
||||||
w = dimensions[2];
|
|
||||||
h = dimensions[3];
|
|
||||||
}
|
|
||||||
g_free(dimensions);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2161,72 +2150,45 @@ void client_maximize(ObClient *self, gboolean max, int dir, gboolean savearea)
|
||||||
if (dir == 2 && !self->max_vert) return;
|
if (dir == 2 && !self->max_vert) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* work with the frame's coords */
|
/* we just tell it to configure in the same place and client_configure
|
||||||
x = self->frame->area.x;
|
worries about filling the screen with the window */
|
||||||
y = self->frame->area.y;
|
x = self->area.x;
|
||||||
|
y = self->area.y;
|
||||||
w = self->area.width;
|
w = self->area.width;
|
||||||
h = self->area.height;
|
h = self->area.height;
|
||||||
|
|
||||||
if (max) {
|
if (max) {
|
||||||
if (savearea) {
|
if (savearea)
|
||||||
gint32 dimensions[4];
|
self->pre_max_area = self->area;
|
||||||
gint32 *readdim;
|
|
||||||
guint num;
|
|
||||||
|
|
||||||
dimensions[0] = x;
|
|
||||||
dimensions[1] = y;
|
|
||||||
dimensions[2] = w;
|
|
||||||
dimensions[3] = h;
|
|
||||||
|
|
||||||
/* get the property off the window and use it for the dimensions
|
|
||||||
we are already maxed on */
|
|
||||||
if (PROP_GETA32(self->window, openbox_premax, cardinal,
|
|
||||||
(guint32**)&readdim, &num)) {
|
|
||||||
if (num == 4) {
|
|
||||||
if (self->max_horz) {
|
|
||||||
dimensions[0] = readdim[0];
|
|
||||||
dimensions[2] = readdim[2];
|
|
||||||
}
|
|
||||||
if (self->max_vert) {
|
|
||||||
dimensions[1] = readdim[1];
|
|
||||||
dimensions[3] = readdim[3];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
g_free(readdim);
|
|
||||||
}
|
|
||||||
|
|
||||||
PROP_SETA32(self->window, openbox_premax, cardinal,
|
|
||||||
(guint32*)dimensions, 4);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
guint num;
|
|
||||||
gint32 *dimensions;
|
|
||||||
Rect *a;
|
Rect *a;
|
||||||
|
|
||||||
/* pick some fallbacks... */
|
|
||||||
a = screen_area_monitor(self->desktop, 0);
|
a = screen_area_monitor(self->desktop, 0);
|
||||||
if (dir == 0 || dir == 1) { /* horz */
|
if ((dir == 0 || dir == 1) && self->max_horz) { /* horz */
|
||||||
|
if (self->pre_max_area.width > 0) {
|
||||||
|
x = self->pre_max_area.x;
|
||||||
|
w = self->pre_max_area.width;
|
||||||
|
|
||||||
|
RECT_SET(self->pre_max_area, 0, self->pre_max_area.y,
|
||||||
|
0, self->pre_max_area.height);
|
||||||
|
} else {
|
||||||
|
/* pick some fallbacks... */
|
||||||
x = a->x + a->width / 4;
|
x = a->x + a->width / 4;
|
||||||
w = a->width / 2;
|
w = a->width / 2;
|
||||||
}
|
}
|
||||||
if (dir == 0 || dir == 2) { /* vert */
|
}
|
||||||
|
if ((dir == 0 || dir == 2) && self->max_vert) { /* vert */
|
||||||
|
if (self->pre_max_area.width > 0) {
|
||||||
|
y = self->pre_max_area.y;
|
||||||
|
h = self->pre_max_area.height;
|
||||||
|
|
||||||
|
RECT_SET(self->pre_max_area, self->pre_max_area.x, 0,
|
||||||
|
self->pre_max_area.width, 0);
|
||||||
|
} else {
|
||||||
|
/* pick some fallbacks... */
|
||||||
y = a->y + a->height / 4;
|
y = a->y + a->height / 4;
|
||||||
h = a->height / 2;
|
h = a->height / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PROP_GETA32(self->window, openbox_premax, cardinal,
|
|
||||||
(guint32**)&dimensions, &num)) {
|
|
||||||
if (num == 4) {
|
|
||||||
if (dir == 0 || dir == 1) { /* horz */
|
|
||||||
x = dimensions[0];
|
|
||||||
w = dimensions[2];
|
|
||||||
}
|
|
||||||
if (dir == 0 || dir == 2) { /* vert */
|
|
||||||
y = dimensions[1];
|
|
||||||
h = dimensions[3];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
g_free(dimensions);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2235,15 +2197,10 @@ void client_maximize(ObClient *self, gboolean max, int dir, gboolean savearea)
|
||||||
if (dir == 0 || dir == 2) /* vert */
|
if (dir == 0 || dir == 2) /* vert */
|
||||||
self->max_vert = max;
|
self->max_vert = max;
|
||||||
|
|
||||||
if (!self->max_horz && !self->max_vert)
|
|
||||||
PROP_ERASE(self->window, openbox_premax);
|
|
||||||
|
|
||||||
client_change_state(self); /* change the state hints on the client */
|
client_change_state(self); /* change the state hints on the client */
|
||||||
|
|
||||||
client_setup_decor_and_functions(self);
|
client_setup_decor_and_functions(self);
|
||||||
|
|
||||||
/* figure out where the client should be going */
|
|
||||||
frame_frame_gravity(self->frame, &x, &y);
|
|
||||||
client_move_resize(self, x, y, w, h);
|
client_move_resize(self, x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -137,6 +137,11 @@ struct _ObClient
|
||||||
*/
|
*/
|
||||||
Rect area;
|
Rect area;
|
||||||
|
|
||||||
|
/*! Position and size of the window prior to being maximized */
|
||||||
|
Rect pre_max_area;
|
||||||
|
/*! Position and size of the window prior to being fullscreened */
|
||||||
|
Rect pre_fullscreen_area;
|
||||||
|
|
||||||
/*! The window's strut
|
/*! The window's strut
|
||||||
The strut defines areas of the screen that are marked off-bounds for
|
The strut defines areas of the screen that are marked off-bounds for
|
||||||
window placement. In theory, where this window exists.
|
window placement. In theory, where this window exists.
|
||||||
|
|
|
@ -337,8 +337,6 @@ static gboolean session_save()
|
||||||
fprintf(f, "<openbox_session id=\"%s\">\n\n", sm_id);
|
fprintf(f, "<openbox_session id=\"%s\">\n\n", sm_id);
|
||||||
|
|
||||||
for (it = stacking_list; it; it = g_list_next(it)) {
|
for (it = stacking_list; it; it = g_list_next(it)) {
|
||||||
guint num;
|
|
||||||
gint32 *dimensions;
|
|
||||||
gint prex, prey, prew, preh;
|
gint prex, prey, prew, preh;
|
||||||
ObClient *c;
|
ObClient *c;
|
||||||
gchar *t;
|
gchar *t;
|
||||||
|
@ -358,15 +356,19 @@ static gboolean session_save()
|
||||||
prey = c->area.y;
|
prey = c->area.y;
|
||||||
prew = c->area.width;
|
prew = c->area.width;
|
||||||
preh = c->area.height;
|
preh = c->area.height;
|
||||||
if (PROP_GETA32(c->window, openbox_premax, cardinal,
|
if (c->fullscreen) {
|
||||||
(guint32**)&dimensions, &num)) {
|
prex = c->pre_fullscreen_area.x;
|
||||||
if (num == 4) {
|
prey = c->pre_fullscreen_area.x;
|
||||||
prex = dimensions[0];
|
prew = c->pre_fullscreen_area.width;
|
||||||
prey = dimensions[1];
|
preh = c->pre_fullscreen_area.height;
|
||||||
prew = dimensions[2];
|
|
||||||
preh = dimensions[3];
|
|
||||||
}
|
}
|
||||||
g_free(dimensions);
|
if (c->max_horz) {
|
||||||
|
prex = c->pre_max_area.x;
|
||||||
|
prew = c->pre_max_area.width;
|
||||||
|
}
|
||||||
|
if (c->max_vert) {
|
||||||
|
prey = c->pre_max_area.y;
|
||||||
|
preh = c->pre_max_area.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(f, "<window id=\"%s\">\n", c->sm_client_id);
|
fprintf(f, "<window id=\"%s\">\n", c->sm_client_id);
|
||||||
|
|
Loading…
Reference in a new issue