wayland client maximize/fullscreen cleanups

ref da74e690f0
This commit is contained in:
Mike Blumenkrantz 2016-04-05 16:54:04 -04:00
parent ae7af6b8ef
commit 992e04feb2
2 changed files with 25 additions and 6 deletions

View File

@ -1059,6 +1059,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
Eina_Bool placed = EINA_TRUE;
int x = 0, y = 0, w, h;
Eina_Rectangle saved;
Eina_Bool saved_frame;
first = !e_pixmap_usable_get(ec->pixmap);
#ifndef HAVE_WAYLAND_ONLY
@ -1078,6 +1079,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
memcpy(&saved, &ec->client, sizeof(Eina_Rectangle));
saved.x -= ec->zone->x;
saved.y -= ec->zone->y;
saved_frame = !e_comp_object_frame_allowed(ec->frame);
if (state->new_attach)
_e_comp_wl_surface_state_attach(ec, state);
@ -1204,16 +1206,28 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
if (ec->comp_data->shell.surface)
{
if (ec->comp_data->shell.set.fullscreen)
if (ec->comp_data->shell.set.fullscreen && (!ec->fullscreen))
{
e_client_fullscreen(ec, E_FULLSCREEN_RESIZE);
memcpy(&ec->saved, &saved, sizeof(Eina_Rectangle));
ec->saved.frame = saved_frame;
}
if (ec->comp_data->shell.set.unfullscreen)
e_client_unfullscreen(ec);
if (ec->comp_data->shell.set.maximize)
e_client_maximize(ec,
(e_config->maximize_policy & E_MAXIMIZE_TYPE) | E_MAXIMIZE_BOTH);
{
unsigned int max = (e_config->maximize_policy & E_MAXIMIZE_TYPE) | E_MAXIMIZE_BOTH;
if (ec->maximized != max)
{
e_client_maximize(ec, max);
if (!ec->maximize_override)
{
memcpy(&ec->saved, &saved, sizeof(Eina_Rectangle));
ec->saved.frame = saved_frame;
}
}
}
if (ec->comp_data->shell.set.unmaximize)
e_client_unmaximize(ec, E_MAXIMIZE_BOTH);
if (ec->comp_data->shell.set.minimize)

View File

@ -641,7 +641,7 @@ _xdg_shell_surface_send_configure(struct wl_resource *resource, Eina_Bool fullsc
shd = ec->comp_data->shell.data;
if ((shd->edges == edges) && (shd->width == width) && (shd->height == height) &&
(shd->fullscreen == fullscreen) &&
((!fullscreen) || (shd->maximized == maximized)) &&
(shd->maximized == maximized) &&
(shd->activated == focused)) return;
shd->edges = edges;
shd->width = width;
@ -703,7 +703,7 @@ _e_xdg_shell_surface_configure_send(struct wl_resource *resource, uint32_t edges
}
if (ec->netwm.type == E_WINDOW_TYPE_POPUP_MENU) return;
_xdg_shell_surface_send_configure(resource, ec->fullscreen, ec->maximized, edges, ec->focused, width, height);
_xdg_shell_surface_send_configure(resource, ec->fullscreen, !!ec->maximized, edges, ec->focused, width, height);
}
static void
@ -977,6 +977,7 @@ static void
_e_xdg_shell_surface_cb_maximized_unset(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
{
E_Client *ec;
int w, h;
/* get the client for this resource */
if (!(ec = wl_resource_get_user_data(resource)))
@ -988,7 +989,11 @@ _e_xdg_shell_surface_cb_maximized_unset(struct wl_client *client EINA_UNUSED, st
}
if (ec->lock_user_maximize) return;
_xdg_shell_surface_send_configure(resource, ec->fullscreen, 0, 0, ec->focused, ec->saved.w, ec->saved.h);
if (e_config->window_maximize_animate)
w = ec->w, h = ec->h;
else
w = ec->saved.w, h = ec->saved.h;
_xdg_shell_surface_send_configure(resource, ec->fullscreen, 0, 0, ec->focused, w, h);
}
static void