Compare commits

...

3 Commits

Author SHA1 Message Date
Derek Foreman 23afcd648f Fix wl_shell maximize as used by Qt 6 years ago
Derek Foreman 0115cfd625 Add versions to wayland extension setup macros 6 years ago
Derek Foreman 9bc8c033a7 Fix wayland extension global creation 6 years ago
  1. 1
      src/bin/e_client.c
  2. 7
      src/bin/e_comp_wl.h
  3. 27
      src/bin/e_comp_wl_extensions.c
  4. 52
      src/modules/wl_desktop_shell/e_mod_main.c

@ -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)

@ -97,17 +97,17 @@ typedef struct E_Comp_Wl_Extension_Data
{
struct
{
struct wl_resource *global;
struct wl_global *global;
struct wl_client *client;
void (*read_pixels)(E_Comp_Wl_Output *output, void *pixels);
} screenshooter;
struct
{
struct wl_resource *global;
struct wl_global *global;
} session_recovery;
struct
{
struct wl_resource *global;
struct wl_global *global;
} www;
} E_Comp_Wl_Extension_Data;
@ -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

@ -221,11 +221,6 @@ static const struct www_interface _e_www_interface =
#define GLOBAL_BIND_CB(NAME, IFACE, ...) \
static void \
_e_comp_wl_##NAME##_cb_unbind(struct wl_resource *resource EINA_UNUSED) \
{ \
e_comp_wl->extensions->NAME.global = NULL; \
} \
static void \
_e_comp_wl_##NAME##_cb_bind(struct wl_client *client, void *data EINA_UNUSED, uint32_t version EINA_UNUSED, uint32_t id) \
{ \
struct wl_resource *res; \
@ -237,8 +232,7 @@ _e_comp_wl_##NAME##_cb_bind(struct wl_client *client, void *data EINA_UNUSED, ui
return;\
}\
\
e_comp_wl->extensions->NAME.global = res; \
wl_resource_set_implementation(res, &_e_##NAME##_interface, NULL, _e_comp_wl_##NAME##_cb_unbind);\
wl_resource_set_implementation(res, &_e_##NAME##_interface, NULL, NULL);\
}
GLOBAL_BIND_CB(session_recovery, zwp_e_session_recovery_interface)
@ -246,14 +240,18 @@ GLOBAL_BIND_CB(screenshooter, screenshooter_interface)
GLOBAL_BIND_CB(www, www_interface)
#define GLOBAL_CREATE_OR_RETURN(NAME, IFACE) \
#define GLOBAL_CREATE_OR_RETURN(NAME, IFACE, VERSION) \
do { \
if (!wl_global_create(e_comp_wl->wl.disp, &(IFACE), 1, \
NULL, _e_comp_wl_##NAME##_cb_bind)) \
struct wl_global *global; \
\
global = wl_global_create(e_comp_wl->wl.disp, &(IFACE), VERSION, \
NULL, _e_comp_wl_##NAME##_cb_bind); \
if (!global) \
{ \
ERR("Could not add %s to wayland globals", #IFACE); \
return EINA_FALSE; \
} \
e_comp_wl->extensions->NAME.global = global; \
} while (0)
static Eina_Bool
@ -275,16 +273,17 @@ _dmabuf_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
EINTERN Eina_Bool
e_comp_wl_extensions_init(void)
{
e_comp_wl->extensions = E_NEW(E_Comp_Wl_Extension_Data, 1);
/* try to add session_recovery to wayland globals */
GLOBAL_CREATE_OR_RETURN(session_recovery, zwp_e_session_recovery_interface);
GLOBAL_CREATE_OR_RETURN(screenshooter, screenshooter_interface);
GLOBAL_CREATE_OR_RETURN(www, www_interface);
GLOBAL_CREATE_OR_RETURN(session_recovery, zwp_e_session_recovery_interface, 1);
GLOBAL_CREATE_OR_RETURN(screenshooter, screenshooter_interface, 1);
GLOBAL_CREATE_OR_RETURN(www, www_interface, 1);
ecore_event_handler_add(ECORE_WL2_EVENT_SYNC_DONE, _dmabuf_add, NULL);
e_client_hook_add(E_CLIENT_HOOK_MOVE_BEGIN, _e_comp_wl_extensions_client_move_begin, NULL);
e_client_hook_add(E_CLIENT_HOOK_MOVE_END, _e_comp_wl_extensions_client_move_end, NULL);
e_comp_wl->extensions = E_NEW(E_Comp_Wl_Extension_Data, 1);
return EINA_TRUE;
}

@ -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));
ec->comp_data->map_maximized = EINA_TRUE;
return;
}
edges = (WL_SHELL_SURFACE_RESIZE_TOP | WL_SHELL_SURFACE_RESIZE_LEFT);
wl_shell_surface_send_configure(resource, edges, ec->w, ec->h);
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)))
{

Loading…
Cancel
Save