Fix wl_shell maximize as used by Qt

#Squirtle
This commit is contained in:
Derek Foreman 2016-07-28 15:12:59 -05:00
parent 0115cfd625
commit 23afcd648f
3 changed files with 45 additions and 11 deletions

View File

@ -3618,7 +3618,6 @@ e_client_maximize_geometry_get(const E_Client *ec, E_Maximize max, int *mx, int
int zx, zy, zw, zh;
int ecx, ecy, ecw, ech;
if (e_client_util_ignored_get(ec)) return EINA_FALSE;
zx = zy = zw = zh = 0;
switch (max & E_MAXIMIZE_TYPE)

View File

@ -329,6 +329,7 @@ struct _E_Comp_Wl_Client_Data
Eina_Bool maximizing : 1;
Eina_Bool in_commit : 1;
Eina_Bool is_xdg_surface : 1;
Eina_Bool map_maximized : 1;
};
struct _E_Comp_Wl_Output

View File

@ -298,7 +298,11 @@ _e_shell_surface_cb_toplevel_set(struct wl_client *client EINA_UNUSED, struct wl
ec->netwm.type = E_WINDOW_TYPE_NORMAL;
ec->comp_data->set_win_type = EINA_TRUE;
if ((!ec->lock_user_maximize) && (ec->maximized))
e_client_unmaximize(ec, E_MAXIMIZE_BOTH);
{
e_client_unmaximize(ec, E_MAXIMIZE_BOTH);
ec->comp_data->shell.set.maximize = 0;
ec->comp_data->shell.set.unmaximize = 1;
}
if ((!ec->lock_user_fullscreen) && (ec->fullscreen))
e_client_unfullscreen(ec);
EC_CHANGED(ec);
@ -402,6 +406,8 @@ static void
_e_shell_surface_cb_maximized_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *output_resource EINA_UNUSED)
{
E_Client *ec;
int w, h;
unsigned int edges = 0;
/* DBG("WL_SHELL: Surface Maximize: %d", wl_resource_get_id(resource)); */
@ -415,17 +421,31 @@ _e_shell_surface_cb_maximized_set(struct wl_client *client EINA_UNUSED, struct w
}
if (e_object_is_del(E_OBJECT(ec))) return;
/* tell E to maximize this client */
if (!ec->lock_user_maximize)
if (!ec->comp_data->mapped)
{
unsigned int edges = 0;
e_client_maximize(ec, ((e_config->maximize_policy & E_MAXIMIZE_TYPE) |
E_MAXIMIZE_BOTH));
edges = (WL_SHELL_SURFACE_RESIZE_TOP | WL_SHELL_SURFACE_RESIZE_LEFT);
wl_shell_surface_send_configure(resource, edges, ec->w, ec->h);
ec->comp_data->map_maximized = EINA_TRUE;
return;
}
if (ec->lock_user_maximize) return;
if (e_config->window_maximize_animate && (!ec->maximize_anims_disabled))
w = ec->w, h = ec->h;
else
{
switch (e_config->maximize_policy & E_MAXIMIZE_TYPE)
{
case E_MAXIMIZE_FULLSCREEN:
w = ec->zone->w, h = ec->zone->h;
break;
default:
e_zone_useful_geometry_get(ec->zone, NULL, NULL, &w, &h);
}
}
ec->comp_data->shell.set.maximize = 1;
ec->comp_data->shell.set.unmaximize = 0;
edges = (WL_SHELL_SURFACE_RESIZE_TOP | WL_SHELL_SURFACE_RESIZE_LEFT);
wl_shell_surface_send_configure(resource, edges, w, h);
}
static void
@ -574,6 +594,20 @@ _e_shell_surface_map(struct wl_resource *resource)
}
if (e_object_is_del(E_OBJECT(ec))) return;
if (ec->comp_data->map_maximized)
{
unsigned int edges = 0;
ec->comp_data->shell.set.maximize = 1;
ec->comp_data->shell.set.unmaximize = 0;
e_client_maximize(ec, ((e_config->maximize_policy & E_MAXIMIZE_TYPE) |
E_MAXIMIZE_BOTH));
edges = (WL_SHELL_SURFACE_RESIZE_TOP | WL_SHELL_SURFACE_RESIZE_LEFT);
wl_shell_surface_send_configure(resource, edges, ec->w, ec->h);
}
/* map this surface if needed */
if ((!ec->comp_data->mapped) && (e_pixmap_usable_get(ec->pixmap)))
{