2015-08-20 09:39:39 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "ecore_wl2_private.h"
|
2017-08-04 13:17:53 -07:00
|
|
|
#include "efl-hints-client-protocol.h"
|
2015-08-20 09:39:39 -07:00
|
|
|
|
2018-02-12 09:27:11 -08:00
|
|
|
static void _ecore_wl2_window_hide_send(Ecore_Wl2_Window *window);
|
|
|
|
|
2016-12-14 08:43:39 -08:00
|
|
|
void
|
2017-06-13 09:38:19 -07:00
|
|
|
_ecore_wl2_window_semi_free(Ecore_Wl2_Window *window)
|
2016-12-14 08:43:39 -08:00
|
|
|
{
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->xdg_popup) xdg_popup_destroy(window->xdg_popup);
|
|
|
|
window->xdg_popup = NULL;
|
|
|
|
|
|
|
|
if (window->xdg_toplevel) xdg_toplevel_destroy(window->xdg_toplevel);
|
|
|
|
window->xdg_toplevel = NULL;
|
|
|
|
|
|
|
|
if (window->xdg_surface) xdg_surface_destroy(window->xdg_surface);
|
|
|
|
window->xdg_surface = NULL;
|
|
|
|
|
2017-01-04 11:20:42 -08:00
|
|
|
if (window->zxdg_popup) zxdg_popup_v6_destroy(window->zxdg_popup);
|
|
|
|
window->zxdg_popup = NULL;
|
|
|
|
|
|
|
|
if (window->zxdg_toplevel) zxdg_toplevel_v6_destroy(window->zxdg_toplevel);
|
|
|
|
window->zxdg_toplevel = NULL;
|
|
|
|
|
|
|
|
if (window->zxdg_surface) zxdg_surface_v6_destroy(window->zxdg_surface);
|
|
|
|
window->zxdg_surface = NULL;
|
|
|
|
|
2016-12-14 08:43:39 -08:00
|
|
|
if (window->www_surface)
|
|
|
|
www_surface_destroy(window->www_surface);
|
|
|
|
window->www_surface = NULL;
|
|
|
|
|
|
|
|
if (window->surface) wl_surface_destroy(window->surface);
|
|
|
|
window->surface = NULL;
|
|
|
|
window->surface_id = -1;
|
2018-01-26 13:51:44 -08:00
|
|
|
|
|
|
|
if (window->callback) wl_callback_destroy(window->callback);
|
|
|
|
window->callback = NULL;
|
|
|
|
|
2018-02-13 15:09:19 -08:00
|
|
|
window->outputs = eina_list_free(window->outputs);
|
|
|
|
|
2018-06-15 11:18:56 -07:00
|
|
|
ecore_wl2_window_surface_flush(window, EINA_TRUE);
|
|
|
|
|
2018-01-26 13:51:44 -08:00
|
|
|
window->commit_pending = EINA_FALSE;
|
2016-12-14 08:43:39 -08:00
|
|
|
}
|
|
|
|
|
2017-06-27 06:41:03 -07:00
|
|
|
static void
|
|
|
|
_ecore_wl2_window_activate_send(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Event_Window_Activate *ev;
|
|
|
|
|
|
|
|
ev = calloc(1, sizeof(Ecore_Wl2_Event_Window_Activate));
|
|
|
|
if (!ev) return;
|
|
|
|
|
2018-07-06 07:16:21 -07:00
|
|
|
ev->win = window;
|
2017-06-27 06:41:03 -07:00
|
|
|
if (window->parent)
|
2018-07-06 07:16:21 -07:00
|
|
|
ev->parent_win = window->parent;
|
|
|
|
ev->event_win = window;
|
2017-06-27 06:41:03 -07:00
|
|
|
ecore_event_add(ECORE_WL2_EVENT_WINDOW_ACTIVATE, ev, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
2017-06-27 06:46:55 -07:00
|
|
|
static void
|
|
|
|
_ecore_wl2_window_deactivate_send(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Event_Window_Deactivate *ev;
|
|
|
|
|
|
|
|
ev = calloc(1, sizeof(Ecore_Wl2_Event_Window_Deactivate));
|
|
|
|
if (!ev) return;
|
|
|
|
|
2018-07-06 07:16:21 -07:00
|
|
|
ev->win = window;
|
2017-06-27 06:46:55 -07:00
|
|
|
if (window->parent)
|
2018-07-06 07:16:21 -07:00
|
|
|
ev->parent_win = window->parent;
|
|
|
|
ev->event_win = window;
|
2017-06-27 06:46:55 -07:00
|
|
|
ecore_event_add(ECORE_WL2_EVENT_WINDOW_DEACTIVATE, ev, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
2017-10-11 13:45:11 -07:00
|
|
|
static void
|
|
|
|
_ecore_wl2_window_configure_send(Ecore_Wl2_Window *win)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Event_Window_Configure *ev;
|
|
|
|
|
|
|
|
ev = calloc(1, sizeof(Ecore_Wl2_Event_Window_Configure));
|
|
|
|
if (!ev) return;
|
|
|
|
|
2018-07-06 07:16:21 -07:00
|
|
|
ev->win = win;
|
|
|
|
ev->event_win = win;
|
2017-10-11 13:45:11 -07:00
|
|
|
|
|
|
|
if ((win->set_config.geometry.w == win->def_config.geometry.w) &&
|
|
|
|
(win->set_config.geometry.h == win->def_config.geometry.h))
|
|
|
|
ev->w = ev->h = 0;
|
|
|
|
else if ((!win->def_config.geometry.w) && (!win->def_config.geometry.h) &&
|
|
|
|
(!win->def_config.fullscreen) &&
|
|
|
|
(!win->def_config.maximized) &&
|
|
|
|
((win->def_config.fullscreen != win->req_config.fullscreen) ||
|
|
|
|
(win->def_config.maximized != win->req_config.maximized)))
|
|
|
|
ev->w = win->saved.w, ev->h = win->saved.h;
|
|
|
|
else
|
|
|
|
ev->w = win->def_config.geometry.w, ev->h = win->def_config.geometry.h;
|
|
|
|
|
|
|
|
ev->edges = !!win->def_config.resizing;
|
|
|
|
if (win->def_config.fullscreen)
|
|
|
|
ev->states |= ECORE_WL2_WINDOW_STATE_FULLSCREEN;
|
|
|
|
if (win->def_config.maximized)
|
|
|
|
ev->states |= ECORE_WL2_WINDOW_STATE_MAXIMIZED;
|
|
|
|
|
|
|
|
win->req_config = win->def_config;
|
|
|
|
ecore_event_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE, ev, NULL, NULL);
|
|
|
|
|
|
|
|
if (win->def_config.focused)
|
|
|
|
_ecore_wl2_window_activate_send(win);
|
|
|
|
else
|
|
|
|
_ecore_wl2_window_deactivate_send(win);
|
|
|
|
}
|
|
|
|
|
2017-01-04 11:20:42 -08:00
|
|
|
static void
|
2017-08-17 13:42:41 -07:00
|
|
|
_configure_complete(Ecore_Wl2_Window *window)
|
2017-01-04 11:20:42 -08:00
|
|
|
{
|
2017-01-11 09:22:01 -08:00
|
|
|
Ecore_Wl2_Event_Window_Configure_Complete *ev;
|
2017-01-10 08:27:10 -08:00
|
|
|
|
|
|
|
window->pending.configure = EINA_FALSE;
|
2017-01-11 09:22:01 -08:00
|
|
|
|
|
|
|
ev = calloc(1, sizeof(Ecore_Wl2_Event_Window_Configure_Complete));
|
|
|
|
if (!ev) return;
|
|
|
|
|
2018-07-06 07:16:21 -07:00
|
|
|
ev->win = window;
|
2017-01-11 09:22:01 -08:00
|
|
|
ecore_event_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE, ev, NULL, NULL);
|
2017-08-17 13:42:41 -07:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-01-08 10:42:11 -08:00
|
|
|
#include "window_v6.x"
|
|
|
|
|
|
|
|
static void
|
|
|
|
_www_surface_end_drag(void *data, struct www_surface *www_surface EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Window *window = data;
|
|
|
|
Ecore_Wl2_Event_Window_WWW_Drag *ev;
|
|
|
|
|
|
|
|
ev = malloc(sizeof(Ecore_Wl2_Event_Window_WWW_Drag));
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(ev);
|
2018-07-06 07:16:21 -07:00
|
|
|
ev->window = window;
|
2018-01-08 10:42:11 -08:00
|
|
|
ev->dragging = 0;
|
|
|
|
|
|
|
|
ecore_event_add(_ecore_wl2_event_window_www_drag, ev, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_www_surface_start_drag(void *data, struct www_surface *www_surface EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Window *window = data;
|
|
|
|
Ecore_Wl2_Event_Window_WWW_Drag *ev;
|
|
|
|
|
|
|
|
ev = malloc(sizeof(Ecore_Wl2_Event_Window_WWW_Drag));
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(ev);
|
2018-07-06 07:16:21 -07:00
|
|
|
ev->window = window;
|
2018-01-08 10:42:11 -08:00
|
|
|
ev->dragging = 1;
|
|
|
|
|
|
|
|
ecore_event_add(_ecore_wl2_event_window_www_drag, ev, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
2017-08-17 13:42:41 -07:00
|
|
|
static void
|
2018-01-08 10:42:11 -08:00
|
|
|
_www_surface_status(void *data, struct www_surface *www_surface EINA_UNUSED, int32_t x_rel, int32_t y_rel, uint32_t timestamp)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Window *window = data;
|
|
|
|
Ecore_Wl2_Event_Window_WWW *ev;
|
|
|
|
|
|
|
|
ev = malloc(sizeof(Ecore_Wl2_Event_Window_WWW));
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(ev);
|
2018-07-06 07:16:21 -07:00
|
|
|
ev->window = window;
|
2018-01-08 10:42:11 -08:00
|
|
|
ev->x_rel = x_rel;
|
|
|
|
ev->y_rel = y_rel;
|
|
|
|
ev->timestamp = timestamp;
|
|
|
|
|
|
|
|
ecore_event_add(_ecore_wl2_event_window_www, ev, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct www_surface_listener _www_surface_listener =
|
|
|
|
{
|
|
|
|
.status = _www_surface_status,
|
|
|
|
.start_drag = _www_surface_start_drag,
|
|
|
|
.end_drag = _www_surface_end_drag,
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_wl2_window_www_surface_init(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
if (!window->surface) return;
|
|
|
|
if (!window->display->wl.www) return;
|
|
|
|
if (window->www_surface) return;
|
|
|
|
window->www_surface = www_create(window->display->wl.www, window->surface);
|
|
|
|
www_surface_set_user_data(window->www_surface, window);
|
|
|
|
www_surface_add_listener(window->www_surface, &_www_surface_listener,
|
|
|
|
window);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
_xdg_surface_cb_configure(void *data, struct xdg_surface *xdg_surface EINA_UNUSED, uint32_t serial)
|
2017-08-17 13:42:41 -07:00
|
|
|
{
|
|
|
|
Ecore_Wl2_Window *window;
|
|
|
|
|
|
|
|
window = data;
|
2017-10-11 13:45:11 -07:00
|
|
|
window->def_config.serial = serial;
|
2017-08-17 13:42:41 -07:00
|
|
|
|
2017-10-11 13:45:11 -07:00
|
|
|
if (window->pending.configure)
|
|
|
|
{
|
|
|
|
window->saved.w = window->set_config.geometry.w;
|
|
|
|
window->saved.h = window->set_config.geometry.h;
|
|
|
|
}
|
|
|
|
if (window->pending.configure && window->updating)
|
|
|
|
ERR("Window shouldn't be rendering before initial configure");
|
|
|
|
|
|
|
|
if (!window->updating)
|
|
|
|
_ecore_wl2_window_configure_send(window);
|
2018-04-17 09:12:27 -07:00
|
|
|
|
|
|
|
if (window->pending.configure)
|
|
|
|
_configure_complete(window);
|
2017-01-04 11:20:42 -08:00
|
|
|
}
|
|
|
|
|
2018-01-08 10:42:11 -08:00
|
|
|
static const struct xdg_surface_listener _xdg_surface_listener =
|
2017-01-04 11:20:42 -08:00
|
|
|
{
|
2018-01-08 10:42:11 -08:00
|
|
|
_xdg_surface_cb_configure,
|
2017-01-04 11:20:42 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
2018-01-08 10:42:11 -08:00
|
|
|
_xdg_toplevel_cb_configure(void *data, struct xdg_toplevel *xdg_toplevel EINA_UNUSED, int32_t width, int32_t height, struct wl_array *states)
|
2017-01-04 11:20:42 -08:00
|
|
|
{
|
|
|
|
Ecore_Wl2_Window *win = data;
|
|
|
|
uint32_t *s;
|
|
|
|
|
2017-10-11 13:45:11 -07:00
|
|
|
win->def_config.maximized = EINA_FALSE;
|
|
|
|
win->def_config.fullscreen = EINA_FALSE;
|
|
|
|
win->def_config.focused = EINA_FALSE;
|
|
|
|
win->def_config.resizing = EINA_FALSE;
|
|
|
|
win->def_config.geometry.w = width;
|
|
|
|
win->def_config.geometry.h = height;
|
2017-01-04 11:20:42 -08:00
|
|
|
|
|
|
|
wl_array_for_each(s, states)
|
|
|
|
{
|
|
|
|
switch (*s)
|
|
|
|
{
|
|
|
|
case ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED:
|
2017-10-11 13:45:11 -07:00
|
|
|
win->def_config.maximized = EINA_TRUE;
|
2017-01-04 11:20:42 -08:00
|
|
|
break;
|
|
|
|
case ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN:
|
2017-10-11 13:45:11 -07:00
|
|
|
win->def_config.fullscreen = EINA_TRUE;
|
2017-01-04 11:20:42 -08:00
|
|
|
break;
|
|
|
|
case ZXDG_TOPLEVEL_V6_STATE_RESIZING:
|
2017-10-11 13:45:11 -07:00
|
|
|
win->def_config.resizing = EINA_TRUE;
|
2017-01-04 11:20:42 -08:00
|
|
|
break;
|
|
|
|
case ZXDG_TOPLEVEL_V6_STATE_ACTIVATED:
|
2017-10-11 13:45:11 -07:00
|
|
|
win->def_config.focused = EINA_TRUE;
|
2017-01-04 11:20:42 -08:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2018-01-08 10:42:11 -08:00
|
|
|
_xdg_toplevel_cb_close(void *data, struct xdg_toplevel *xdg_toplevel EINA_UNUSED)
|
2017-01-04 11:20:42 -08:00
|
|
|
{
|
|
|
|
Ecore_Wl2_Window *win;
|
|
|
|
|
|
|
|
win = data;
|
|
|
|
if (!win) return;
|
2019-10-14 11:12:25 -07:00
|
|
|
if (win->cb_close)
|
|
|
|
{
|
|
|
|
win->cb_close(win->cb_close_data, win);
|
|
|
|
win->cb_close = NULL;
|
|
|
|
}
|
2017-01-04 11:20:42 -08:00
|
|
|
ecore_wl2_window_free(win);
|
|
|
|
}
|
|
|
|
|
2018-01-08 10:42:11 -08:00
|
|
|
static const struct xdg_toplevel_listener _xdg_toplevel_listener =
|
2017-01-04 11:20:42 -08:00
|
|
|
{
|
2018-01-08 10:42:11 -08:00
|
|
|
_xdg_toplevel_cb_configure,
|
|
|
|
_xdg_toplevel_cb_close,
|
2017-01-04 11:20:42 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
2018-01-08 10:42:11 -08:00
|
|
|
_xdg_popup_cb_configure(void *data, struct xdg_popup *xdg_popup EINA_UNUSED, int32_t x EINA_UNUSED, int32_t y EINA_UNUSED, int32_t width, int32_t height)
|
2017-01-04 11:20:42 -08:00
|
|
|
{
|
2017-10-20 13:01:58 -07:00
|
|
|
Ecore_Wl2_Window *win = data;
|
|
|
|
win->def_config.geometry.w = width;
|
|
|
|
win->def_config.geometry.h = height;
|
2017-01-04 11:20:42 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2018-01-08 10:42:11 -08:00
|
|
|
_xdg_popup_cb_done(void *data, struct xdg_popup *xdg_popup EINA_UNUSED)
|
2017-01-04 11:20:42 -08:00
|
|
|
{
|
|
|
|
Ecore_Wl2_Window *win;
|
|
|
|
|
|
|
|
win = data;
|
|
|
|
if (!win) return;
|
|
|
|
|
2017-05-17 13:02:53 -07:00
|
|
|
if (win->grab) _ecore_wl2_input_ungrab(win->grab);
|
2018-02-12 09:27:11 -08:00
|
|
|
|
|
|
|
_ecore_wl2_window_hide_send(win);
|
2017-01-04 11:20:42 -08:00
|
|
|
}
|
|
|
|
|
2018-01-08 10:42:11 -08:00
|
|
|
static const struct xdg_popup_listener _xdg_popup_listener =
|
2017-01-04 11:20:42 -08:00
|
|
|
{
|
2018-01-08 10:42:11 -08:00
|
|
|
_xdg_popup_cb_configure,
|
|
|
|
_xdg_popup_cb_done,
|
2017-01-04 11:20:42 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
2018-01-08 10:42:11 -08:00
|
|
|
_ecore_wl2_window_xdg_popup_create(Ecore_Wl2_Window *win)
|
2017-01-04 11:20:42 -08:00
|
|
|
{
|
2018-12-06 07:54:10 -08:00
|
|
|
int gw, gh;
|
2018-01-08 10:42:11 -08:00
|
|
|
struct xdg_positioner *pos;
|
2017-01-04 11:20:42 -08:00
|
|
|
|
2017-05-17 13:02:53 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(win->parent);
|
2018-01-08 10:42:11 -08:00
|
|
|
pos = xdg_wm_base_create_positioner(win->display->wl.xdg_wm_base);
|
2017-01-04 11:20:42 -08:00
|
|
|
if (!pos) return;
|
|
|
|
|
2018-12-06 07:54:10 -08:00
|
|
|
ecore_wl2_window_geometry_get(win, NULL, NULL, &gw, &gh);
|
|
|
|
xdg_positioner_set_anchor_rect(pos, 0, 0, 1, 1);
|
2018-11-28 12:18:45 -08:00
|
|
|
xdg_positioner_set_size(pos, gw, gh);
|
2018-01-08 10:42:11 -08:00
|
|
|
xdg_positioner_set_anchor(pos, XDG_POSITIONER_ANCHOR_TOP_LEFT);
|
|
|
|
xdg_positioner_set_gravity(pos, ZXDG_POSITIONER_V6_ANCHOR_BOTTOM |
|
2017-01-04 11:20:42 -08:00
|
|
|
ZXDG_POSITIONER_V6_ANCHOR_RIGHT);
|
|
|
|
|
2018-01-08 10:42:11 -08:00
|
|
|
win->xdg_popup = xdg_surface_get_popup(win->xdg_surface,
|
|
|
|
win->parent->xdg_surface, pos);
|
2017-01-04 11:20:42 -08:00
|
|
|
|
2018-01-08 10:42:11 -08:00
|
|
|
xdg_positioner_destroy(pos);
|
2017-08-11 15:43:15 -07:00
|
|
|
if (win->grab)
|
2018-01-08 10:42:11 -08:00
|
|
|
xdg_popup_grab(win->xdg_popup, win->grab->wl.seat,
|
2017-08-11 15:43:15 -07:00
|
|
|
wl_display_get_serial(win->display->wl.display));
|
2018-01-08 10:42:11 -08:00
|
|
|
xdg_popup_set_user_data(win->xdg_popup, win);
|
|
|
|
xdg_popup_add_listener(win->xdg_popup, &_xdg_popup_listener, win);
|
2017-01-10 08:48:18 -08:00
|
|
|
|
2017-01-10 09:00:39 -08:00
|
|
|
win->pending.configure = EINA_TRUE;
|
|
|
|
|
2017-08-30 12:52:29 -07:00
|
|
|
ecore_wl2_window_commit(win, EINA_TRUE);
|
2017-01-04 11:20:42 -08:00
|
|
|
}
|
|
|
|
|
2016-03-24 10:19:42 -07:00
|
|
|
static void
|
2018-01-08 10:42:11 -08:00
|
|
|
_window_shell_surface_create(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
if (window->xdg_surface) return;
|
|
|
|
window->xdg_surface =
|
|
|
|
xdg_wm_base_get_xdg_surface(window->display->wl.xdg_wm_base,
|
|
|
|
window->surface);
|
|
|
|
xdg_surface_set_user_data(window->xdg_surface, window);
|
|
|
|
xdg_surface_add_listener(window->xdg_surface,
|
|
|
|
&_xdg_surface_listener, window);
|
|
|
|
|
|
|
|
window->xdg_configure_ack = xdg_surface_ack_configure;
|
|
|
|
window->pending.configure = EINA_TRUE;
|
|
|
|
if (window->display->wl.efl_hints)
|
|
|
|
{
|
|
|
|
if (window->aspect.set)
|
|
|
|
efl_hints_set_aspect(window->display->wl.efl_hints, window->xdg_surface,
|
|
|
|
window->aspect.w, window->aspect.h, window->aspect.aspect);
|
|
|
|
if (window->weight.set)
|
|
|
|
efl_hints_set_weight(window->display->wl.efl_hints, window->xdg_surface,
|
|
|
|
window->weight.w, window->weight.h);
|
|
|
|
}
|
2016-03-24 10:19:42 -07:00
|
|
|
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->type == ECORE_WL2_WINDOW_TYPE_MENU)
|
|
|
|
_ecore_wl2_window_xdg_popup_create(window);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
struct xdg_toplevel *ptop = NULL;
|
2016-03-24 10:19:42 -07:00
|
|
|
|
2018-01-08 10:42:11 -08:00
|
|
|
window->xdg_toplevel =
|
|
|
|
xdg_surface_get_toplevel(window->xdg_surface);
|
|
|
|
xdg_toplevel_set_user_data(window->xdg_toplevel, window);
|
|
|
|
xdg_toplevel_add_listener(window->xdg_toplevel,
|
|
|
|
&_xdg_toplevel_listener, window);
|
2016-03-24 10:19:42 -07:00
|
|
|
|
2018-04-11 09:39:36 -07:00
|
|
|
if (window->deferred_minimize)
|
|
|
|
xdg_toplevel_set_minimized(window->xdg_toplevel);
|
|
|
|
window->deferred_minimize = EINA_FALSE;
|
|
|
|
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->title)
|
|
|
|
xdg_toplevel_set_title(window->xdg_toplevel, window->title);
|
|
|
|
if (window->class)
|
|
|
|
xdg_toplevel_set_app_id(window->xdg_toplevel, window->class);
|
2016-03-24 10:19:42 -07:00
|
|
|
|
2018-01-08 10:42:11 -08:00
|
|
|
window->xdg_set_min_size = xdg_toplevel_set_min_size;
|
|
|
|
window->xdg_set_max_size = xdg_toplevel_set_max_size;
|
2016-03-24 10:19:42 -07:00
|
|
|
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->parent)
|
|
|
|
ptop = window->parent->xdg_toplevel;
|
2016-03-24 10:19:42 -07:00
|
|
|
|
2018-01-08 10:42:11 -08:00
|
|
|
if (ptop)
|
|
|
|
xdg_toplevel_set_parent(window->xdg_toplevel, ptop);
|
2016-03-24 10:19:42 -07:00
|
|
|
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->set_config.maximized)
|
|
|
|
xdg_toplevel_set_maximized(window->xdg_toplevel);
|
2016-03-24 10:19:42 -07:00
|
|
|
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->set_config.fullscreen)
|
|
|
|
xdg_toplevel_set_fullscreen(window->xdg_toplevel, NULL);
|
|
|
|
}
|
2016-03-24 10:19:42 -07:00
|
|
|
|
2018-01-08 10:42:11 -08:00
|
|
|
ecore_wl2_window_commit(window, EINA_TRUE);
|
2016-03-24 10:19:42 -07:00
|
|
|
}
|
|
|
|
|
2015-12-04 16:01:02 -08:00
|
|
|
void
|
|
|
|
_ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
if (!window->surface) return;
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->display->wl.xdg_wm_base) _window_shell_surface_create(window);
|
|
|
|
if (window->display->wl.zxdg_shell) _window_v6_shell_surface_create(window);
|
2015-12-07 08:30:53 -08:00
|
|
|
|
2017-01-04 11:20:42 -08:00
|
|
|
if (window->display->wl.session_recovery)
|
|
|
|
{
|
|
|
|
if (window->uuid)
|
|
|
|
{
|
2018-11-28 12:18:45 -08:00
|
|
|
int gx, gy, gw, gh;
|
|
|
|
|
2017-01-04 11:20:42 -08:00
|
|
|
zwp_e_session_recovery_set_uuid(window->display->wl.session_recovery,
|
|
|
|
window->surface, window->uuid);
|
2018-11-28 12:18:45 -08:00
|
|
|
|
|
|
|
ecore_wl2_window_geometry_get(window, &gx, &gy, &gw, &gh);
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->xdg_surface)
|
|
|
|
xdg_surface_set_window_geometry(window->xdg_surface,
|
2018-11-28 12:18:45 -08:00
|
|
|
gx, gy, gw, gh);
|
2017-01-04 11:20:42 -08:00
|
|
|
if (window->zxdg_surface)
|
|
|
|
zxdg_surface_v6_set_window_geometry(window->zxdg_surface,
|
2018-11-28 12:18:45 -08:00
|
|
|
gx, gy, gw, gh);
|
2017-01-04 11:20:42 -08:00
|
|
|
|
|
|
|
ecore_wl2_window_opaque_region_set(window,
|
|
|
|
window->opaque.x,
|
|
|
|
window->opaque.y,
|
|
|
|
window->opaque.w,
|
|
|
|
window->opaque.h);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
zwp_e_session_recovery_get_uuid(window->display->wl.session_recovery, window->surface);
|
|
|
|
}
|
2015-12-04 16:01:02 -08:00
|
|
|
}
|
|
|
|
|
2018-01-30 12:52:55 -08:00
|
|
|
static void
|
|
|
|
_surface_enter(void *data, struct wl_surface *surf EINA_UNUSED, struct wl_output *op)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Window *win;
|
|
|
|
Ecore_Wl2_Output *output;
|
|
|
|
|
|
|
|
win = data;
|
|
|
|
|
|
|
|
output = _ecore_wl2_output_find(win->display, op);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(output);
|
|
|
|
|
|
|
|
win->outputs = eina_list_append(win->outputs, output);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_surface_leave(void *data, struct wl_surface *surf EINA_UNUSED, struct wl_output *op)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Window *win;
|
|
|
|
Ecore_Wl2_Output *output;
|
|
|
|
|
|
|
|
win = data;
|
|
|
|
output = _ecore_wl2_output_find(win->display, op);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(output);
|
|
|
|
|
|
|
|
win->outputs = eina_list_remove(win->outputs, output);
|
2018-01-30 13:19:43 -08:00
|
|
|
if (!win->outputs)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Event_Window_Offscreen *ev;
|
|
|
|
ev = calloc(1, sizeof(Ecore_Wl2_Event_Window_Offscreen));
|
|
|
|
if (ev)
|
|
|
|
{
|
2018-07-06 07:16:21 -07:00
|
|
|
ev->win = win;
|
2018-01-30 13:19:43 -08:00
|
|
|
ecore_event_add(ECORE_WL2_EVENT_WINDOW_OFFSCREEN, ev, NULL, NULL);
|
|
|
|
}
|
|
|
|
}
|
2018-01-30 12:52:55 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct wl_surface_listener _surface_listener =
|
|
|
|
{
|
|
|
|
_surface_enter,
|
|
|
|
_surface_leave,
|
|
|
|
};
|
|
|
|
|
2017-07-07 13:26:50 -07:00
|
|
|
void
|
2016-10-31 11:03:30 -07:00
|
|
|
_ecore_wl2_window_surface_create(Ecore_Wl2_Window *window)
|
|
|
|
{
|
2017-06-02 15:23:44 -07:00
|
|
|
if (!window->display->wl.compositor) return;
|
2016-10-31 11:03:30 -07:00
|
|
|
|
|
|
|
if (!window->surface)
|
|
|
|
{
|
2016-12-02 10:02:00 -08:00
|
|
|
window->surface =
|
|
|
|
wl_compositor_create_surface(window->display->wl.compositor);
|
|
|
|
if (!window->surface)
|
|
|
|
{
|
|
|
|
ERR("Failed to create surface for window");
|
|
|
|
return;
|
|
|
|
}
|
2017-01-13 08:34:07 -08:00
|
|
|
wl_surface_set_user_data(window->surface, window);
|
2016-10-31 11:03:30 -07:00
|
|
|
|
2016-12-02 10:02:00 -08:00
|
|
|
window->surface_id =
|
|
|
|
wl_proxy_get_id((struct wl_proxy *)window->surface);
|
2018-01-30 12:52:55 -08:00
|
|
|
|
|
|
|
wl_surface_add_listener(window->surface, &_surface_listener, window);
|
2017-07-28 12:44:43 -07:00
|
|
|
if (window->display->wl.efl_aux_hints)
|
2017-08-04 13:11:00 -07:00
|
|
|
{
|
|
|
|
efl_aux_hints_get_supported_aux_hints(window->display->wl.efl_aux_hints, window->surface);
|
|
|
|
if (_ecore_wl2_display_sync_get())
|
|
|
|
wl_display_roundtrip(window->display->wl.display);
|
|
|
|
}
|
2016-12-02 10:02:00 -08:00
|
|
|
}
|
2016-10-31 11:03:30 -07:00
|
|
|
}
|
|
|
|
|
2017-06-27 06:17:36 -07:00
|
|
|
static void
|
|
|
|
_ecore_wl2_window_show_send(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Event_Window_Show *ev;
|
|
|
|
|
|
|
|
ev = calloc(1, sizeof(Ecore_Wl2_Event_Window_Show));
|
|
|
|
if (!ev) return;
|
|
|
|
|
2018-07-06 07:16:21 -07:00
|
|
|
ev->win = window;
|
2017-06-27 06:17:36 -07:00
|
|
|
if (window->parent)
|
2018-07-06 07:16:21 -07:00
|
|
|
ev->parent_win = window->parent;
|
|
|
|
ev->event_win = window;
|
2017-06-27 06:17:36 -07:00
|
|
|
ecore_event_add(ECORE_WL2_EVENT_WINDOW_SHOW, ev, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
2017-06-27 06:26:55 -07:00
|
|
|
static void
|
|
|
|
_ecore_wl2_window_hide_send(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Event_Window_Hide *ev;
|
|
|
|
|
|
|
|
ev = calloc(1, sizeof(Ecore_Wl2_Event_Window_Hide));
|
|
|
|
if (!ev) return;
|
|
|
|
|
2018-07-06 07:16:21 -07:00
|
|
|
ev->win = window;
|
2017-06-27 06:26:55 -07:00
|
|
|
if (window->parent)
|
2018-07-06 07:16:21 -07:00
|
|
|
ev->parent_win = window->parent;
|
|
|
|
ev->event_win = window;
|
2017-06-27 06:26:55 -07:00
|
|
|
ecore_event_add(ECORE_WL2_EVENT_WINDOW_HIDE, ev, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
2015-08-20 09:39:39 -07:00
|
|
|
EAPI Ecore_Wl2_Window *
|
|
|
|
ecore_wl2_window_new(Ecore_Wl2_Display *display, Ecore_Wl2_Window *parent, int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Window *win;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(display, NULL);
|
2017-04-07 13:06:41 -07:00
|
|
|
if (display->pid) CRI("CANNOT CREATE WINDOW WITH SERVER DISPLAY");
|
2015-08-20 09:39:39 -07:00
|
|
|
|
|
|
|
/* try to allocate space for window structure */
|
|
|
|
win = calloc(1, sizeof(Ecore_Wl2_Window));
|
|
|
|
if (!win) return NULL;
|
2017-07-07 13:26:50 -07:00
|
|
|
display->refs++;
|
2015-08-20 09:39:39 -07:00
|
|
|
|
|
|
|
win->display = display;
|
|
|
|
win->parent = parent;
|
|
|
|
|
2017-10-04 10:12:55 -07:00
|
|
|
win->set_config.geometry.x = x;
|
|
|
|
win->set_config.geometry.y = y;
|
|
|
|
win->set_config.geometry.w = w;
|
|
|
|
win->set_config.geometry.h = h;
|
2015-08-20 09:39:39 -07:00
|
|
|
|
2015-09-28 06:36:34 -07:00
|
|
|
win->opaque.x = x;
|
|
|
|
win->opaque.y = y;
|
|
|
|
win->opaque.w = w;
|
|
|
|
win->opaque.h = h;
|
|
|
|
|
2017-01-19 13:25:17 -08:00
|
|
|
win->pending.configure = EINA_TRUE;
|
2015-09-10 10:21:02 -07:00
|
|
|
display->windows =
|
|
|
|
eina_inlist_append(display->windows, EINA_INLIST_GET(win));
|
|
|
|
|
2017-08-04 13:11:00 -07:00
|
|
|
_ecore_wl2_window_surface_create(win);
|
|
|
|
|
2015-08-20 09:39:39 -07:00
|
|
|
return win;
|
|
|
|
}
|
2015-08-20 09:44:17 -07:00
|
|
|
|
2019-10-14 11:12:25 -07:00
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_close_callback_set(Ecore_Wl2_Window *window, void (*cb) (void *data, Ecore_Wl2_Window *win), void *data)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
window->cb_close = cb;
|
|
|
|
window->cb_close_data = data;
|
|
|
|
}
|
|
|
|
|
2015-08-20 11:12:18 -07:00
|
|
|
EAPI struct wl_surface *
|
|
|
|
ecore_wl2_window_surface_get(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL);
|
|
|
|
|
2016-10-31 11:03:30 -07:00
|
|
|
_ecore_wl2_window_surface_create(window);
|
2015-08-20 11:12:18 -07:00
|
|
|
|
|
|
|
return window->surface;
|
2015-08-20 09:44:17 -07:00
|
|
|
}
|
2015-09-09 08:19:24 -07:00
|
|
|
|
2015-09-29 08:00:32 -07:00
|
|
|
EAPI int
|
|
|
|
ecore_wl2_window_surface_id_get(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, -1);
|
|
|
|
return window->surface_id;
|
|
|
|
}
|
|
|
|
|
2015-09-09 08:19:24 -07:00
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_show(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
2016-10-31 11:03:30 -07:00
|
|
|
_ecore_wl2_window_surface_create(window);
|
2015-09-09 08:19:24 -07:00
|
|
|
|
2016-10-07 08:00:08 -07:00
|
|
|
if (window->input_set)
|
2017-01-04 08:08:49 -08:00
|
|
|
ecore_wl2_window_input_region_set(window, window->input_rect.x,
|
|
|
|
window->input_rect.y,
|
|
|
|
window->input_rect.w,
|
|
|
|
window->input_rect.h);
|
2016-10-07 08:00:08 -07:00
|
|
|
if (window->opaque_set)
|
2017-01-04 08:08:49 -08:00
|
|
|
ecore_wl2_window_opaque_region_set(window, window->opaque.x,
|
|
|
|
window->opaque.y, window->opaque.w,
|
|
|
|
window->opaque.h);
|
2016-10-07 07:51:14 -07:00
|
|
|
|
2015-12-04 16:01:02 -08:00
|
|
|
if ((window->type != ECORE_WL2_WINDOW_TYPE_DND) &&
|
|
|
|
(window->type != ECORE_WL2_WINDOW_TYPE_NONE))
|
2016-03-24 10:19:42 -07:00
|
|
|
{
|
|
|
|
_ecore_wl2_window_shell_surface_init(window);
|
|
|
|
_ecore_wl2_window_www_surface_init(window);
|
2017-06-27 06:17:36 -07:00
|
|
|
_ecore_wl2_window_show_send(window);
|
2016-03-24 10:19:42 -07:00
|
|
|
}
|
2017-01-19 13:25:17 -08:00
|
|
|
else
|
2017-08-17 13:43:50 -07:00
|
|
|
_configure_complete(window);
|
2015-09-09 08:19:24 -07:00
|
|
|
}
|
2015-09-09 09:08:26 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_hide(Ecore_Wl2_Window *window)
|
|
|
|
{
|
2016-05-05 07:45:59 -07:00
|
|
|
Ecore_Wl2_Subsurface *subsurf;
|
|
|
|
Eina_Inlist *tmp;
|
2015-09-09 09:08:26 -07:00
|
|
|
|
2016-12-02 10:02:00 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
2016-03-24 10:19:42 -07:00
|
|
|
|
2017-06-27 06:26:55 -07:00
|
|
|
_ecore_wl2_window_hide_send(window);
|
|
|
|
|
2016-05-05 07:45:59 -07:00
|
|
|
EINA_INLIST_FOREACH_SAFE(window->subsurfs, tmp, subsurf)
|
|
|
|
_ecore_wl2_subsurf_unmap(subsurf);
|
|
|
|
|
2018-03-16 10:47:05 -07:00
|
|
|
if (window->commit_pending)
|
|
|
|
{
|
|
|
|
/* We've probably been hidden while an animator
|
|
|
|
* is ticking. Cancel the callback.
|
|
|
|
*/
|
|
|
|
window->commit_pending = EINA_FALSE;
|
|
|
|
if (window->callback)
|
|
|
|
{
|
|
|
|
wl_callback_destroy(window->callback);
|
|
|
|
window->callback = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-05 06:22:26 -08:00
|
|
|
if (window->surface)
|
|
|
|
{
|
|
|
|
wl_surface_attach(window->surface, NULL, 0, 0);
|
2017-08-30 12:52:29 -07:00
|
|
|
ecore_wl2_window_commit(window, EINA_TRUE);
|
2017-08-14 15:44:13 -07:00
|
|
|
window->commit_pending = EINA_FALSE;
|
2016-12-05 06:22:26 -08:00
|
|
|
}
|
|
|
|
|
2018-03-16 10:47:05 -07:00
|
|
|
/* The commit added a callback, disconnect it */
|
2017-08-14 15:46:49 -07:00
|
|
|
if (window->callback)
|
|
|
|
{
|
|
|
|
wl_callback_destroy(window->callback);
|
|
|
|
window->callback = NULL;
|
|
|
|
}
|
|
|
|
|
2017-10-04 10:12:55 -07:00
|
|
|
window->set_config.serial = 0;
|
|
|
|
window->req_config.serial = 0;
|
2017-10-11 13:45:11 -07:00
|
|
|
window->def_config.serial = 0;
|
2017-08-11 15:43:15 -07:00
|
|
|
window->zxdg_configure_ack = NULL;
|
2018-01-08 10:42:11 -08:00
|
|
|
window->xdg_configure_ack = NULL;
|
|
|
|
window->xdg_set_min_size = NULL;
|
|
|
|
window->xdg_set_max_size = NULL;
|
2017-08-11 15:43:15 -07:00
|
|
|
window->zxdg_set_min_size = NULL;
|
|
|
|
window->zxdg_set_max_size = NULL;
|
2015-09-09 09:08:26 -07:00
|
|
|
}
|
2015-09-09 09:12:53 -07:00
|
|
|
|
2017-08-03 07:15:41 -07:00
|
|
|
static void
|
|
|
|
_ecore_wl2_window_aux_hint_free(Ecore_Wl2_Window *win)
|
2017-07-28 12:44:43 -07:00
|
|
|
{
|
|
|
|
const char *supported;
|
2017-08-03 07:15:41 -07:00
|
|
|
|
2017-07-28 12:44:43 -07:00
|
|
|
EINA_LIST_FREE(win->supported_aux_hints, supported)
|
|
|
|
if (supported) eina_stringshare_del(supported);
|
|
|
|
}
|
|
|
|
|
2015-09-09 09:12:53 -07:00
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_free(Ecore_Wl2_Window *window)
|
|
|
|
{
|
2015-09-10 10:21:02 -07:00
|
|
|
Ecore_Wl2_Display *display;
|
2015-09-23 09:25:10 -07:00
|
|
|
Ecore_Wl2_Input *input;
|
2015-10-01 09:22:32 -07:00
|
|
|
Ecore_Wl2_Subsurface *subsurf;
|
|
|
|
Eina_Inlist *tmp;
|
2015-09-10 10:21:02 -07:00
|
|
|
|
2015-09-09 09:12:53 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
2015-09-10 10:21:02 -07:00
|
|
|
display = window->display;
|
|
|
|
|
2015-09-23 09:25:10 -07:00
|
|
|
EINA_INLIST_FOREACH(display->inputs, input)
|
2016-10-06 13:43:12 -07:00
|
|
|
_ecore_wl2_input_window_remove(input, window);
|
2015-09-23 09:25:10 -07:00
|
|
|
|
2015-10-01 09:22:32 -07:00
|
|
|
EINA_INLIST_FOREACH_SAFE(window->subsurfs, tmp, subsurf)
|
|
|
|
_ecore_wl2_subsurf_free(subsurf);
|
2015-09-09 09:12:53 -07:00
|
|
|
|
2017-08-03 07:15:41 -07:00
|
|
|
_ecore_wl2_window_aux_hint_free(window);
|
2017-06-13 09:38:19 -07:00
|
|
|
|
2017-08-14 15:46:49 -07:00
|
|
|
if (window->callback) wl_callback_destroy(window->callback);
|
|
|
|
window->callback = NULL;
|
|
|
|
|
2016-12-02 10:02:00 -08:00
|
|
|
if (window->uuid && window->surface && window->display->wl.session_recovery)
|
|
|
|
zwp_e_session_recovery_destroy_uuid(window->display->wl.session_recovery,
|
2017-01-04 08:08:49 -08:00
|
|
|
window->surface, window->uuid);
|
2016-12-02 10:02:00 -08:00
|
|
|
|
2017-06-13 09:38:19 -07:00
|
|
|
_ecore_wl2_window_semi_free(window);
|
2016-12-02 10:02:00 -08:00
|
|
|
|
2016-05-05 07:45:59 -07:00
|
|
|
eina_stringshare_replace(&window->uuid, NULL);
|
2015-09-09 09:12:53 -07:00
|
|
|
|
|
|
|
if (window->title) eina_stringshare_del(window->title);
|
|
|
|
if (window->class) eina_stringshare_del(window->class);
|
2017-06-15 07:53:08 -07:00
|
|
|
if (window->role) eina_stringshare_del(window->role);
|
2015-09-09 09:12:53 -07:00
|
|
|
|
2015-09-10 10:21:02 -07:00
|
|
|
display->windows =
|
|
|
|
eina_inlist_remove(display->windows, EINA_INLIST_GET(window));
|
|
|
|
|
2017-07-07 13:26:50 -07:00
|
|
|
ecore_wl2_display_disconnect(window->display);
|
2015-09-09 09:12:53 -07:00
|
|
|
free(window);
|
|
|
|
}
|
2015-09-09 09:24:30 -07:00
|
|
|
|
|
|
|
EAPI void
|
2017-05-17 13:02:53 -07:00
|
|
|
ecore_wl2_window_move(Ecore_Wl2_Window *window, Ecore_Wl2_Input *input)
|
2015-09-09 09:24:30 -07:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
2017-06-26 07:32:00 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window->display->inputs);
|
2017-08-30 06:04:05 -07:00
|
|
|
|
2017-05-17 13:02:53 -07:00
|
|
|
if (!input)
|
2018-05-08 11:27:00 -07:00
|
|
|
{
|
|
|
|
ERR("NULL input parameter is deprecated");
|
|
|
|
input = EINA_INLIST_CONTAINER_GET(window->display->inputs, Ecore_Wl2_Input);
|
|
|
|
}
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->xdg_toplevel)
|
|
|
|
xdg_toplevel_move(window->xdg_toplevel, input->wl.seat,
|
|
|
|
window->display->serial);
|
2017-01-04 11:20:42 -08:00
|
|
|
if (window->zxdg_toplevel)
|
|
|
|
zxdg_toplevel_v6_move(window->zxdg_toplevel, input->wl.seat,
|
2017-01-13 06:52:24 -08:00
|
|
|
window->display->serial);
|
2018-01-17 14:33:57 -08:00
|
|
|
ecore_wl2_display_flush(window->display);
|
2018-05-08 11:26:46 -07:00
|
|
|
|
|
|
|
_ecore_wl2_input_ungrab(input);
|
2015-09-09 09:24:30 -07:00
|
|
|
}
|
2015-09-09 09:27:23 -07:00
|
|
|
|
|
|
|
EAPI void
|
2017-05-17 13:02:53 -07:00
|
|
|
ecore_wl2_window_resize(Ecore_Wl2_Window *window, Ecore_Wl2_Input *input, int location)
|
2015-09-09 09:27:23 -07:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
2017-06-26 07:32:00 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window->display->inputs);
|
2017-08-30 06:04:05 -07:00
|
|
|
|
2017-05-17 13:02:53 -07:00
|
|
|
if (!input)
|
2018-05-08 11:27:00 -07:00
|
|
|
{
|
|
|
|
ERR("NULL input parameter is deprecated");
|
|
|
|
input = EINA_INLIST_CONTAINER_GET(window->display->inputs, Ecore_Wl2_Input);
|
|
|
|
}
|
2015-09-24 08:56:45 -07:00
|
|
|
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->xdg_toplevel)
|
|
|
|
xdg_toplevel_resize(window->xdg_toplevel, input->wl.seat,
|
|
|
|
window->display->serial, location);
|
2017-01-04 11:20:42 -08:00
|
|
|
if (window->zxdg_toplevel)
|
|
|
|
zxdg_toplevel_v6_resize(window->zxdg_toplevel, input->wl.seat,
|
2017-01-13 06:52:24 -08:00
|
|
|
window->display->serial, location);
|
2018-01-17 14:33:57 -08:00
|
|
|
ecore_wl2_display_flush(window->display);
|
2018-05-08 11:26:46 -07:00
|
|
|
|
|
|
|
_ecore_wl2_input_ungrab(input);
|
2015-09-09 09:27:23 -07:00
|
|
|
}
|
2015-09-09 10:06:54 -07:00
|
|
|
|
2015-09-28 06:15:49 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
ecore_wl2_window_alpha_get(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
|
|
|
|
|
|
|
|
return window->alpha;
|
|
|
|
}
|
2015-09-28 06:19:21 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_alpha_set(Ecore_Wl2_Window *window, Eina_Bool alpha)
|
|
|
|
{
|
2018-02-12 12:43:55 -08:00
|
|
|
Ecore_Wl2_Surface *surf;
|
|
|
|
|
2015-09-28 06:19:21 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
2015-09-28 06:25:52 -07:00
|
|
|
if (window->alpha == alpha) return;
|
2015-09-28 06:19:21 -07:00
|
|
|
|
2015-09-28 06:25:52 -07:00
|
|
|
window->alpha = alpha;
|
2018-02-12 12:43:55 -08:00
|
|
|
surf = window->wl2_surface;
|
|
|
|
if (surf)
|
|
|
|
ecore_wl2_surface_reconfigure(surf, surf->w, surf->h, 0, alpha);
|
2015-09-28 06:36:34 -07:00
|
|
|
}
|
|
|
|
|
2015-09-28 06:25:52 -07:00
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_opaque_region_set(Ecore_Wl2_Window *window, int x, int y, int w, int h)
|
|
|
|
{
|
2017-02-28 05:51:21 -08:00
|
|
|
int nx = 0, ny = 0, nw = 0, nh = 0;
|
2015-09-28 06:25:52 -07:00
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
|
|
|
switch (window->rotation)
|
|
|
|
{
|
|
|
|
case 0:
|
2017-02-28 05:51:21 -08:00
|
|
|
nx = x;
|
|
|
|
ny = y;
|
|
|
|
nw = w;
|
|
|
|
nh = h;
|
2015-09-28 06:25:52 -07:00
|
|
|
break;
|
|
|
|
case 90:
|
2017-02-28 05:51:21 -08:00
|
|
|
nx = y;
|
|
|
|
ny = x;
|
|
|
|
nw = h;
|
|
|
|
nh = w;
|
2017-02-14 06:58:49 -08:00
|
|
|
break;
|
|
|
|
case 180:
|
2017-02-28 05:51:21 -08:00
|
|
|
nx = x;
|
|
|
|
ny = x + y;
|
|
|
|
nw = w;
|
|
|
|
nh = h;
|
2015-09-28 06:25:52 -07:00
|
|
|
break;
|
|
|
|
case 270:
|
2017-02-28 05:51:21 -08:00
|
|
|
nx = x + y;
|
|
|
|
ny = x;
|
|
|
|
nw = h;
|
|
|
|
nh = w;
|
2017-02-14 06:58:49 -08:00
|
|
|
break;
|
|
|
|
default:
|
2015-09-28 06:25:52 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2017-02-28 05:51:21 -08:00
|
|
|
if ((window->opaque.x == nx) && (window->opaque.y == ny) &&
|
|
|
|
(window->opaque.w == nw) && (window->opaque.h == nh))
|
|
|
|
return;
|
|
|
|
|
2017-02-28 07:12:31 -08:00
|
|
|
window->opaque.x = nx;
|
|
|
|
window->opaque.y = ny;
|
|
|
|
window->opaque.w = nw;
|
|
|
|
window->opaque.h = nh;
|
2017-10-05 12:56:58 -07:00
|
|
|
window->opaque_set = x || y || w || h;
|
2017-10-11 13:45:11 -07:00
|
|
|
window->pending.opaque = EINA_TRUE;
|
2015-09-28 06:19:21 -07:00
|
|
|
}
|
2015-09-28 06:39:07 -07:00
|
|
|
|
2020-01-08 04:59:53 -08:00
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_opaque_region_get(Ecore_Wl2_Window *window, int *x, int *y, int *w, int *h)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
|
|
|
if (x) *x = window->opaque.x;
|
|
|
|
if (y) *y = window->opaque.y;
|
|
|
|
if (w) *w = window->opaque.w;
|
|
|
|
if (h) *h = window->opaque.h;
|
|
|
|
}
|
|
|
|
|
2015-10-01 07:06:35 -07:00
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_input_region_set(Ecore_Wl2_Window *window, int x, int y, int w, int h)
|
|
|
|
{
|
2017-02-28 05:51:21 -08:00
|
|
|
int nx = 0, ny = 0, nw = 0, nh = 0;
|
2015-10-01 07:06:35 -07:00
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
|
|
|
switch (window->rotation)
|
|
|
|
{
|
|
|
|
case 0:
|
2017-02-28 05:51:21 -08:00
|
|
|
nx = x;
|
|
|
|
ny = y;
|
|
|
|
nw = w;
|
|
|
|
nh = h;
|
2015-10-01 07:06:35 -07:00
|
|
|
break;
|
|
|
|
case 90:
|
2017-02-28 05:51:21 -08:00
|
|
|
nx = y;
|
|
|
|
ny = x;
|
|
|
|
nw = h;
|
|
|
|
nh = w;
|
2017-02-14 08:31:57 -08:00
|
|
|
break;
|
|
|
|
case 180:
|
2017-02-28 05:51:21 -08:00
|
|
|
nx = x;
|
|
|
|
ny = x + y;
|
|
|
|
nw = w;
|
|
|
|
nh = h;
|
2015-10-01 07:06:35 -07:00
|
|
|
break;
|
|
|
|
case 270:
|
2017-02-28 05:51:21 -08:00
|
|
|
nx = x + y;
|
|
|
|
ny = x;
|
|
|
|
nw = h;
|
|
|
|
nh = w;
|
2015-10-01 07:06:35 -07:00
|
|
|
break;
|
2017-02-14 08:31:57 -08:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2017-02-28 05:51:21 -08:00
|
|
|
if ((window->input_rect.x == nx) && (window->input_rect.y == ny) &&
|
|
|
|
(window->input_rect.w == nw) && (window->input_rect.h == nh))
|
|
|
|
return;
|
|
|
|
|
2017-02-28 07:12:31 -08:00
|
|
|
window->input_rect.x = nx;
|
|
|
|
window->input_rect.y = ny;
|
|
|
|
window->input_rect.w = nw;
|
|
|
|
window->input_rect.h = nh;
|
2017-10-05 13:15:10 -07:00
|
|
|
window->input_set = x || y || w || h;
|
2017-10-11 13:45:11 -07:00
|
|
|
window->pending.input = EINA_TRUE;
|
2015-10-01 07:06:35 -07:00
|
|
|
}
|
|
|
|
|
2020-01-08 04:59:53 -08:00
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_input_region_get(Ecore_Wl2_Window *window, int *x, int *y, int *w, int *h)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
|
|
|
if (x) *x = window->input_rect.x;
|
|
|
|
if (y) *y = window->input_rect.y;
|
|
|
|
if (w) *w = window->input_rect.w;
|
|
|
|
if (h) *h = window->input_rect.h;
|
|
|
|
}
|
|
|
|
|
2015-09-28 06:39:07 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
ecore_wl2_window_maximized_get(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
|
|
|
|
|
2017-10-04 10:12:55 -07:00
|
|
|
return window->set_config.maximized;
|
2015-09-28 06:39:07 -07:00
|
|
|
}
|
2015-09-28 06:40:39 -07:00
|
|
|
|
2015-09-28 08:28:23 -07:00
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_maximized_set(Ecore_Wl2_Window *window, Eina_Bool maximized)
|
|
|
|
{
|
2015-12-07 11:39:29 -08:00
|
|
|
Eina_Bool prev;
|
|
|
|
|
2015-09-28 08:28:23 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
2017-10-04 10:12:55 -07:00
|
|
|
prev = window->set_config.maximized;
|
2015-12-07 11:39:29 -08:00
|
|
|
maximized = !!maximized;
|
|
|
|
if (prev == maximized) return;
|
|
|
|
|
2017-10-04 10:12:55 -07:00
|
|
|
window->set_config.maximized = maximized;
|
2017-10-11 13:45:11 -07:00
|
|
|
if (window->updating)
|
|
|
|
{
|
|
|
|
window->pending.maximized = EINA_TRUE;
|
|
|
|
return;
|
|
|
|
}
|
2017-03-08 12:10:10 -08:00
|
|
|
|
2015-12-07 11:39:29 -08:00
|
|
|
if (maximized)
|
2015-09-28 08:28:23 -07:00
|
|
|
{
|
2017-10-11 13:39:26 -07:00
|
|
|
if (!window->set_config.fullscreen)
|
|
|
|
window->saved = window->set_config.geometry;
|
2015-11-09 08:57:42 -08:00
|
|
|
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->xdg_toplevel)
|
|
|
|
xdg_toplevel_set_maximized(window->xdg_toplevel);
|
2017-01-04 11:20:42 -08:00
|
|
|
if (window->zxdg_toplevel)
|
|
|
|
zxdg_toplevel_v6_set_maximized(window->zxdg_toplevel);
|
2015-09-28 08:28:23 -07:00
|
|
|
}
|
2015-12-07 11:39:29 -08:00
|
|
|
else
|
2015-09-28 08:28:23 -07:00
|
|
|
{
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->xdg_toplevel)
|
|
|
|
xdg_toplevel_unset_maximized(window->xdg_toplevel);
|
2017-01-04 11:20:42 -08:00
|
|
|
if (window->zxdg_toplevel)
|
|
|
|
zxdg_toplevel_v6_unset_maximized(window->zxdg_toplevel);
|
2015-09-30 09:59:26 -07:00
|
|
|
}
|
2017-10-11 13:30:54 -07:00
|
|
|
ecore_wl2_display_flush(window->display);
|
2015-09-28 08:28:23 -07:00
|
|
|
}
|
|
|
|
|
2015-09-28 06:40:39 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
ecore_wl2_window_fullscreen_get(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
|
|
|
|
|
2017-10-04 10:12:55 -07:00
|
|
|
return window->set_config.fullscreen;
|
2015-09-28 06:40:39 -07:00
|
|
|
}
|
2015-09-28 06:42:21 -07:00
|
|
|
|
2015-09-28 08:31:43 -07:00
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_fullscreen_set(Ecore_Wl2_Window *window, Eina_Bool fullscreen)
|
|
|
|
{
|
2015-12-07 11:39:29 -08:00
|
|
|
Eina_Bool prev;
|
|
|
|
|
2015-09-28 08:31:43 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
2017-10-04 10:12:55 -07:00
|
|
|
prev = window->set_config.fullscreen;
|
2015-12-07 11:39:29 -08:00
|
|
|
fullscreen = !!fullscreen;
|
|
|
|
if (prev == fullscreen) return;
|
|
|
|
|
2017-10-04 10:12:55 -07:00
|
|
|
window->set_config.fullscreen = fullscreen;
|
2017-10-11 13:45:11 -07:00
|
|
|
if (window->updating)
|
|
|
|
{
|
|
|
|
window->pending.fullscreen = EINA_TRUE;
|
|
|
|
return;
|
|
|
|
}
|
2017-03-08 12:10:10 -08:00
|
|
|
|
2015-09-28 08:31:43 -07:00
|
|
|
if (fullscreen)
|
|
|
|
{
|
2017-10-11 13:38:39 -07:00
|
|
|
if (!window->set_config.maximized)
|
|
|
|
window->saved = window->set_config.geometry;
|
2015-11-09 08:57:42 -08:00
|
|
|
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->xdg_toplevel)
|
|
|
|
xdg_toplevel_set_fullscreen(window->xdg_toplevel, NULL);
|
2017-01-04 11:20:42 -08:00
|
|
|
if (window->zxdg_toplevel)
|
|
|
|
zxdg_toplevel_v6_set_fullscreen(window->zxdg_toplevel, NULL);
|
2015-09-28 08:31:43 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->xdg_toplevel)
|
|
|
|
xdg_toplevel_unset_fullscreen(window->xdg_toplevel);
|
2017-01-04 11:20:42 -08:00
|
|
|
if (window->zxdg_toplevel)
|
|
|
|
zxdg_toplevel_v6_unset_fullscreen(window->zxdg_toplevel);
|
2015-09-30 09:59:26 -07:00
|
|
|
}
|
2017-10-11 13:26:29 -07:00
|
|
|
ecore_wl2_display_flush(window->display);
|
2015-09-28 08:31:43 -07:00
|
|
|
}
|
|
|
|
|
2015-11-10 06:35:25 -08:00
|
|
|
EAPI int
|
|
|
|
ecore_wl2_window_rotation_get(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, -1);
|
|
|
|
|
|
|
|
return window->rotation;
|
|
|
|
}
|
|
|
|
|
2015-09-28 06:42:21 -07:00
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_rotation_set(Ecore_Wl2_Window *window, int rotation)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
|
|
|
window->rotation = rotation;
|
|
|
|
}
|
2015-09-28 06:47:59 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_title_set(Ecore_Wl2_Window *window, const char *title)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
|
|
|
eina_stringshare_replace(&window->title, title);
|
|
|
|
if (!window->title) return;
|
2018-09-19 04:01:01 -07:00
|
|
|
if (!window->xdg_toplevel && !window->zxdg_toplevel) return;
|
2015-09-28 06:47:59 -07:00
|
|
|
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->xdg_toplevel)
|
|
|
|
xdg_toplevel_set_title(window->xdg_toplevel, window->title);
|
2017-01-04 11:20:42 -08:00
|
|
|
if (window->zxdg_toplevel)
|
|
|
|
zxdg_toplevel_v6_set_title(window->zxdg_toplevel, window->title);
|
2018-01-17 14:33:57 -08:00
|
|
|
ecore_wl2_display_flush(window->display);
|
2015-09-28 06:47:59 -07:00
|
|
|
}
|
2015-09-28 06:51:00 -07:00
|
|
|
|
2019-12-02 05:50:23 -08:00
|
|
|
EAPI const char *
|
|
|
|
ecore_wl2_window_title_get(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL);
|
|
|
|
|
|
|
|
return window->title ? window->title : NULL;
|
|
|
|
}
|
|
|
|
|
2015-09-28 06:51:00 -07:00
|
|
|
EAPI void
|
2015-11-10 06:50:19 -08:00
|
|
|
ecore_wl2_window_class_set(Ecore_Wl2_Window *window, const char *clas)
|
2015-09-28 06:51:00 -07:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
2015-11-10 06:50:19 -08:00
|
|
|
eina_stringshare_replace(&window->class, clas);
|
2015-09-28 06:51:00 -07:00
|
|
|
if (!window->class) return;
|
2018-09-19 04:01:01 -07:00
|
|
|
if (!window->xdg_toplevel && !window->zxdg_toplevel) return;
|
2015-09-28 06:51:00 -07:00
|
|
|
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->xdg_toplevel)
|
|
|
|
xdg_toplevel_set_app_id(window->xdg_toplevel, window->class);
|
2017-01-04 11:20:42 -08:00
|
|
|
if (window->zxdg_toplevel)
|
|
|
|
zxdg_toplevel_v6_set_app_id(window->zxdg_toplevel, window->class);
|
2018-01-17 14:33:57 -08:00
|
|
|
ecore_wl2_display_flush(window->display);
|
2015-09-28 06:51:00 -07:00
|
|
|
}
|
2015-09-28 08:16:03 -07:00
|
|
|
|
2019-12-02 05:50:23 -08:00
|
|
|
EAPI const char *
|
|
|
|
ecore_wl2_window_class_get(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL);
|
|
|
|
|
|
|
|
return window->class ? window->class : NULL;
|
|
|
|
}
|
|
|
|
|
2015-09-28 08:16:03 -07:00
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_geometry_get(Ecore_Wl2_Window *window, int *x, int *y, int *w, int *h)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
2017-10-04 10:12:55 -07:00
|
|
|
if (x) *x = window->set_config.geometry.x;
|
|
|
|
if (y) *y = window->set_config.geometry.y;
|
|
|
|
if (w) *w = window->set_config.geometry.w;
|
|
|
|
if (h) *h = window->set_config.geometry.h;
|
2015-09-28 08:16:03 -07:00
|
|
|
}
|
2015-09-28 08:18:23 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_geometry_set(Ecore_Wl2_Window *window, int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
2017-10-04 10:12:55 -07:00
|
|
|
if ((window->set_config.geometry.x == x) &&
|
|
|
|
(window->set_config.geometry.y == y) &&
|
|
|
|
(window->set_config.geometry.w == w) &&
|
|
|
|
(window->set_config.geometry.h == h))
|
2015-09-28 08:18:23 -07:00
|
|
|
return;
|
|
|
|
|
2017-10-04 10:12:55 -07:00
|
|
|
window->set_config.geometry.x = x;
|
|
|
|
window->set_config.geometry.y = y;
|
|
|
|
window->set_config.geometry.w = w;
|
|
|
|
window->set_config.geometry.h = h;
|
2017-10-11 13:45:11 -07:00
|
|
|
window->pending.geom = EINA_TRUE;
|
2015-09-28 08:18:23 -07:00
|
|
|
}
|
2015-09-28 08:37:11 -07:00
|
|
|
|
2015-09-28 08:43:20 -07:00
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_iconified_set(Ecore_Wl2_Window *window, Eina_Bool iconified)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
2015-12-08 06:56:57 -08:00
|
|
|
iconified = !!iconified;
|
|
|
|
|
2018-04-11 09:39:36 -07:00
|
|
|
if (!window->xdg_toplevel && !window->zxdg_toplevel)
|
|
|
|
{
|
|
|
|
window->deferred_minimize = iconified;
|
|
|
|
return;
|
|
|
|
}
|
2015-09-28 08:43:20 -07:00
|
|
|
|
|
|
|
if (iconified)
|
|
|
|
{
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->xdg_toplevel)
|
|
|
|
xdg_toplevel_set_minimized(window->xdg_toplevel);
|
2017-01-04 11:20:42 -08:00
|
|
|
if (window->zxdg_toplevel)
|
|
|
|
zxdg_toplevel_v6_set_minimized(window->zxdg_toplevel);
|
2018-01-18 15:21:27 -08:00
|
|
|
ecore_wl2_display_flush(window->display);
|
2015-09-28 08:43:20 -07:00
|
|
|
}
|
|
|
|
}
|
2015-09-28 09:07:39 -07:00
|
|
|
|
|
|
|
EAPI void
|
2017-05-17 13:02:53 -07:00
|
|
|
ecore_wl2_window_type_set(Ecore_Wl2_Window *window, Ecore_Wl2_Window_Type type)
|
2015-09-29 07:54:13 -07:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
2017-05-17 13:02:53 -07:00
|
|
|
window->type = type;
|
2015-09-29 07:54:13 -07:00
|
|
|
}
|
2015-09-29 08:17:33 -07:00
|
|
|
|
|
|
|
EAPI void
|
2017-05-17 13:02:53 -07:00
|
|
|
ecore_wl2_window_popup_input_set(Ecore_Wl2_Window *window, Ecore_Wl2_Input *input)
|
2015-09-29 08:17:33 -07:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
2017-05-17 13:02:53 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(input);
|
|
|
|
EINA_SAFETY_ON_TRUE_RETURN(window->type != ECORE_WL2_WINDOW_TYPE_MENU);
|
|
|
|
window->grab = input;
|
2015-09-29 08:17:33 -07:00
|
|
|
}
|
2015-09-29 08:19:54 -07:00
|
|
|
|
2020-01-08 04:59:53 -08:00
|
|
|
EAPI Ecore_Wl2_Input *
|
|
|
|
ecore_wl2_window_popup_input_get(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
|
|
|
return window->grab;
|
|
|
|
}
|
|
|
|
|
2015-12-05 10:05:15 -08:00
|
|
|
EAPI Ecore_Wl2_Display *
|
|
|
|
ecore_wl2_window_display_get(const Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL);
|
2017-11-29 13:17:36 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window->display, NULL);
|
|
|
|
|
2017-12-04 21:33:03 -08:00
|
|
|
if (window->display->recovering) return NULL;
|
2017-11-29 13:17:36 -08:00
|
|
|
|
2015-12-05 10:05:15 -08:00
|
|
|
return window->display;
|
|
|
|
}
|
|
|
|
|
2016-10-14 14:01:54 -07:00
|
|
|
EAPI Eina_Bool
|
2017-03-09 09:05:28 -08:00
|
|
|
ecore_wl2_window_shell_surface_exists(Ecore_Wl2_Window *window)
|
2016-10-14 14:01:54 -07:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
|
2018-01-08 10:42:11 -08:00
|
|
|
return !!window->zxdg_surface || !!window->xdg_surface;
|
2016-10-14 14:01:54 -07:00
|
|
|
}
|
2017-05-17 13:02:53 -07:00
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
ecore_wl2_window_activated_get(const Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
|
2017-10-04 10:12:55 -07:00
|
|
|
return window->req_config.focused;
|
2017-05-17 13:02:53 -07:00
|
|
|
}
|
2017-06-07 07:46:44 -07:00
|
|
|
|
|
|
|
EAPI Ecore_Wl2_Output *
|
|
|
|
ecore_wl2_window_output_find(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL);
|
|
|
|
|
2018-03-27 12:58:35 -07:00
|
|
|
return eina_list_data_get(window->outputs);
|
2017-06-07 07:46:44 -07:00
|
|
|
}
|
2017-06-07 08:08:33 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_buffer_transform_set(Ecore_Wl2_Window *window, int transform)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
|
|
|
wl_surface_set_buffer_transform(window->surface, transform);
|
|
|
|
}
|
2017-06-09 06:12:39 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_wm_rotation_supported_set(Ecore_Wl2_Window *window, Eina_Bool enabled)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
window->wm_rot.supported = enabled;
|
|
|
|
}
|
2017-06-09 06:13:36 -07:00
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
ecore_wl2_window_wm_rotation_supported_get(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
|
|
|
|
return window->wm_rot.supported;
|
|
|
|
}
|
2017-06-09 06:36:17 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_rotation_app_set(Ecore_Wl2_Window *window, Eina_Bool set)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
window->wm_rot.app_set = set;
|
|
|
|
}
|
2017-06-09 06:38:00 -07:00
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
ecore_wl2_window_rotation_app_get(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
|
|
|
|
return window->wm_rot.app_set;
|
|
|
|
}
|
2017-06-09 06:47:40 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_preferred_rotation_set(Ecore_Wl2_Window *window, int rot)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
window->wm_rot.preferred_rot = rot;
|
|
|
|
}
|
2017-06-09 06:51:19 -07:00
|
|
|
|
|
|
|
EAPI int
|
|
|
|
ecore_wl2_window_preferred_rotation_get(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, 0);
|
|
|
|
return window->wm_rot.preferred_rot;
|
|
|
|
}
|
2017-06-09 06:54:44 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_available_rotations_set(Ecore_Wl2_Window *window, const int *rots, unsigned int count)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
window->wm_rot.count = count;
|
2017-06-09 08:01:03 -07:00
|
|
|
window->wm_rot.available_rots = (int *)rots;
|
2017-06-09 06:54:44 -07:00
|
|
|
}
|
2017-06-09 07:08:06 -07:00
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2017-06-09 08:01:03 -07:00
|
|
|
ecore_wl2_window_available_rotations_get(Ecore_Wl2_Window *window, int **rots, unsigned int *count)
|
2017-06-09 07:08:06 -07:00
|
|
|
{
|
2017-06-09 08:01:03 -07:00
|
|
|
unsigned int i = 0;
|
2017-06-09 07:08:06 -07:00
|
|
|
int *val = NULL;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
|
|
|
|
|
2017-06-09 08:01:03 -07:00
|
|
|
*rots = NULL;
|
2017-06-09 07:08:06 -07:00
|
|
|
*count = window->wm_rot.count;
|
|
|
|
|
|
|
|
if (window->wm_rot.count >= 1)
|
|
|
|
{
|
|
|
|
val = calloc(window->wm_rot.count, sizeof(int));
|
|
|
|
if (!val) return EINA_FALSE;
|
|
|
|
|
|
|
|
for (; i < window->wm_rot.count; i++)
|
|
|
|
val[i] = ((int *)window->wm_rot.available_rots)[i];
|
|
|
|
|
|
|
|
*rots = val;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2017-06-09 07:27:54 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_rotation_change_prepare_send(Ecore_Wl2_Window *window, int rot, int w, int h, Eina_Bool resize)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Event_Window_Rotation_Change_Prepare *ev;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
|
|
|
ev = calloc(1, sizeof(Ecore_Wl2_Event_Window_Rotation_Change_Prepare));
|
|
|
|
if (!ev) return;
|
|
|
|
|
2018-07-06 07:16:21 -07:00
|
|
|
ev->win = window;
|
2017-06-09 07:27:54 -07:00
|
|
|
ev->rotation = rot;
|
|
|
|
ev->w = w;
|
|
|
|
ev->h = h;
|
|
|
|
ev->resize = resize;
|
|
|
|
|
|
|
|
ecore_event_add(ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_PREPARE, ev, NULL, NULL);
|
|
|
|
}
|
2017-06-09 07:39:00 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_rotation_change_prepare_done_send(Ecore_Wl2_Window *window, int rot)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Event_Window_Rotation_Change_Prepare_Done *ev;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
|
|
|
ev = calloc(1, sizeof(Ecore_Wl2_Event_Window_Rotation_Change_Prepare_Done));
|
|
|
|
if (!ev) return;
|
|
|
|
|
2018-07-06 07:16:21 -07:00
|
|
|
ev->win = window;
|
2017-06-09 07:39:00 -07:00
|
|
|
ev->rotation = rot;
|
|
|
|
ev->w = 0;
|
|
|
|
ev->h = 0;
|
|
|
|
ev->resize = 0;
|
|
|
|
|
|
|
|
ecore_event_add(ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_PREPARE_DONE,
|
|
|
|
ev, NULL, NULL);
|
|
|
|
}
|
2017-06-09 07:42:31 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_rotation_change_request_send(Ecore_Wl2_Window *window, int rot)
|
|
|
|
{
|
2017-06-09 08:01:03 -07:00
|
|
|
Ecore_Wl2_Event_Window_Rotation_Change_Request *ev;
|
2017-06-09 07:42:31 -07:00
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
|
|
|
ev = calloc(1, sizeof(Ecore_Wl2_Event_Window_Rotation_Change_Request));
|
|
|
|
if (!ev) return;
|
|
|
|
|
2018-07-06 07:16:21 -07:00
|
|
|
ev->win = window;
|
2017-06-09 07:42:31 -07:00
|
|
|
ev->rotation = rot;
|
|
|
|
ev->w = 0;
|
|
|
|
ev->h = 0;
|
|
|
|
ev->resize = 0;
|
|
|
|
|
|
|
|
ecore_event_add(ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_REQUEST,
|
|
|
|
ev, NULL, NULL);
|
|
|
|
}
|
2017-06-09 07:45:06 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_rotation_change_done_send(Ecore_Wl2_Window *window, int rot, int w, int h)
|
|
|
|
{
|
2017-06-09 08:01:03 -07:00
|
|
|
Ecore_Wl2_Event_Window_Rotation_Change_Done *ev;
|
2017-06-09 07:45:06 -07:00
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
2017-06-09 08:01:03 -07:00
|
|
|
ev = calloc(1, sizeof(Ecore_Wl2_Event_Window_Rotation_Change_Done));
|
2017-06-09 07:45:06 -07:00
|
|
|
if (!ev) return;
|
|
|
|
|
2018-07-06 07:16:21 -07:00
|
|
|
ev->win = window;
|
2017-06-09 07:45:06 -07:00
|
|
|
ev->rotation = rot;
|
|
|
|
ev->w = w;
|
|
|
|
ev->h = h;
|
|
|
|
ev->resize = 0;
|
|
|
|
|
|
|
|
ecore_event_add(ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_DONE,
|
|
|
|
ev, NULL, NULL);
|
|
|
|
}
|
2017-06-13 09:11:13 -07:00
|
|
|
|
|
|
|
EAPI Eina_List *
|
2017-07-28 12:44:43 -07:00
|
|
|
ecore_wl2_window_aux_hints_supported_get(Ecore_Wl2_Window *win)
|
2017-06-13 09:11:13 -07:00
|
|
|
{
|
2017-07-28 12:44:43 -07:00
|
|
|
Eina_List *res = NULL;
|
|
|
|
Eina_List *ll;
|
|
|
|
char *supported_hint = NULL;
|
|
|
|
const char *hint = NULL;
|
2017-06-13 09:11:13 -07:00
|
|
|
|
2017-07-28 12:44:43 -07:00
|
|
|
if (!win) return NULL;
|
|
|
|
if (!win->surface) return NULL;
|
2017-06-13 09:11:13 -07:00
|
|
|
|
2017-07-28 12:44:43 -07:00
|
|
|
EINA_LIST_FOREACH(win->supported_aux_hints, ll, supported_hint)
|
|
|
|
{
|
|
|
|
hint = eina_stringshare_add(supported_hint);
|
|
|
|
res = eina_list_append(res, hint);
|
|
|
|
}
|
|
|
|
return res;
|
2017-06-13 09:11:13 -07:00
|
|
|
}
|
2017-06-13 09:18:01 -07:00
|
|
|
|
|
|
|
EAPI void
|
2017-07-28 12:44:43 -07:00
|
|
|
ecore_wl2_window_aux_hint_add(Ecore_Wl2_Window *win, int id, const char *hint, const char *val)
|
2017-06-13 09:18:01 -07:00
|
|
|
{
|
2017-07-28 12:44:43 -07:00
|
|
|
if (!win) return;
|
2018-04-06 10:13:45 -07:00
|
|
|
if ((!win->surface) || (!win->display->wl.efl_aux_hints)) return;
|
|
|
|
|
|
|
|
efl_aux_hints_add_aux_hint(win->display->wl.efl_aux_hints, win->surface, id, hint, val);
|
2018-01-17 14:33:57 -08:00
|
|
|
ecore_wl2_display_flush(win->display);
|
2017-06-13 09:18:01 -07:00
|
|
|
}
|
2017-06-13 09:23:49 -07:00
|
|
|
|
|
|
|
EAPI void
|
2017-07-28 12:44:43 -07:00
|
|
|
ecore_wl2_window_aux_hint_change(Ecore_Wl2_Window *win, int id, const char *val)
|
2017-06-13 09:23:49 -07:00
|
|
|
{
|
2017-07-28 12:44:43 -07:00
|
|
|
if (!win) return;
|
2018-04-06 10:13:45 -07:00
|
|
|
if ((!win->surface) && (!win->display->wl.efl_aux_hints)) return;
|
|
|
|
|
|
|
|
efl_aux_hints_change_aux_hint(win->display->wl.efl_aux_hints, win->surface, id, val);
|
2018-01-17 14:33:57 -08:00
|
|
|
ecore_wl2_display_flush(win->display);
|
2017-06-13 09:23:49 -07:00
|
|
|
}
|
2017-06-13 09:32:59 -07:00
|
|
|
|
|
|
|
EAPI void
|
2017-07-28 12:44:43 -07:00
|
|
|
ecore_wl2_window_aux_hint_del(Ecore_Wl2_Window *win, int id)
|
2017-06-13 09:32:59 -07:00
|
|
|
{
|
2017-07-28 12:44:43 -07:00
|
|
|
if (!win) return;
|
2018-04-06 10:13:45 -07:00
|
|
|
if ((!win->surface) || (!win->display->wl.efl_aux_hints)) return;
|
|
|
|
|
|
|
|
efl_aux_hints_del_aux_hint(win->display->wl.efl_aux_hints, win->surface, id);
|
2018-01-17 14:33:57 -08:00
|
|
|
ecore_wl2_display_flush(win->display);
|
2017-06-13 09:32:59 -07:00
|
|
|
}
|
2017-08-30 06:04:05 -07:00
|
|
|
|
2017-06-15 07:32:25 -07:00
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_focus_skip_set(Ecore_Wl2_Window *window, Eina_Bool focus_skip)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
window->focus_skip = focus_skip;
|
|
|
|
}
|
2017-06-15 07:35:45 -07:00
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
ecore_wl2_window_focus_skip_get(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
|
|
|
|
return window->focus_skip;
|
|
|
|
}
|
2017-06-15 07:53:08 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_role_set(Ecore_Wl2_Window *window, const char *role)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
eina_stringshare_replace(&window->role, role);
|
|
|
|
}
|
2017-06-15 08:07:48 -07:00
|
|
|
|
2019-12-02 05:50:23 -08:00
|
|
|
EAPI const char *
|
|
|
|
ecore_wl2_window_role_get(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL);
|
|
|
|
|
|
|
|
return window->role ? window->role : NULL;
|
|
|
|
}
|
|
|
|
|
2017-06-15 08:07:48 -07:00
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_floating_mode_set(Ecore_Wl2_Window *window, Eina_Bool floating)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
window->floating = floating;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
ecore_wl2_window_floating_mode_get(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
|
|
|
|
return window->floating;
|
|
|
|
}
|
2017-08-04 13:17:53 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_aspect_set(Ecore_Wl2_Window *window, int w, int h, unsigned int aspect)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
EINA_SAFETY_ON_TRUE_RETURN(w < 1);
|
|
|
|
EINA_SAFETY_ON_TRUE_RETURN(h < 1);
|
2017-08-30 06:04:05 -07:00
|
|
|
|
|
|
|
if ((window->aspect.aspect == aspect) && (window->aspect.w == w) &&
|
|
|
|
(window->aspect.h == h))
|
|
|
|
return;
|
|
|
|
|
2017-08-04 13:17:53 -07:00
|
|
|
window->aspect.w = w;
|
|
|
|
window->aspect.h = h;
|
|
|
|
window->aspect.aspect = aspect;
|
|
|
|
window->aspect.set = 1;
|
2017-10-20 10:23:12 -07:00
|
|
|
if (!window->display->wl.efl_hints) return;
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->xdg_surface)
|
2017-08-30 06:04:05 -07:00
|
|
|
efl_hints_set_aspect(window->display->wl.efl_hints,
|
2018-01-08 10:42:11 -08:00
|
|
|
window->xdg_surface, w, h, aspect);
|
2018-01-17 14:33:57 -08:00
|
|
|
ecore_wl2_display_flush(window->display);
|
2017-08-04 13:17:53 -07:00
|
|
|
}
|
2017-08-14 15:44:13 -07:00
|
|
|
|
2019-12-02 05:50:23 -08:00
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_aspect_get(Ecore_Wl2_Window *window, int *w, int *h, unsigned int *aspect)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
|
|
|
if (w) *w = window->aspect.w;
|
|
|
|
if (h) *h = window->aspect.h;
|
|
|
|
if (aspect) *aspect = window->aspect.aspect;
|
|
|
|
}
|
|
|
|
|
2017-10-19 10:26:51 -07:00
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_weight_set(Ecore_Wl2_Window *window, double w, double h)
|
|
|
|
{
|
|
|
|
int ww, hh;
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
|
|
|
ww = lround(w * 100);
|
|
|
|
hh = lround(h * 100);
|
|
|
|
|
|
|
|
if ((window->weight.w == ww) && (window->weight.h == hh))
|
|
|
|
return;
|
|
|
|
|
|
|
|
window->weight.w = ww;
|
|
|
|
window->weight.h = hh;
|
|
|
|
window->weight.set = 1;
|
2017-10-20 10:23:12 -07:00
|
|
|
if (!window->display->wl.efl_hints) return;
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->xdg_surface)
|
2017-10-19 10:26:51 -07:00
|
|
|
efl_hints_set_weight(window->display->wl.efl_hints,
|
2018-01-08 10:42:11 -08:00
|
|
|
window->xdg_surface, ww, hh);
|
2018-01-17 14:33:57 -08:00
|
|
|
ecore_wl2_display_flush(window->display);
|
2017-10-19 10:26:51 -07:00
|
|
|
}
|
|
|
|
|
2017-08-14 15:46:49 -07:00
|
|
|
static void
|
|
|
|
_frame_cb(void *data, struct wl_callback *callback, uint32_t timestamp)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Frame_Cb_Handle *cb;
|
|
|
|
Ecore_Wl2_Window *window;
|
2019-01-10 13:58:16 -08:00
|
|
|
Eina_Inlist *l;
|
2017-08-14 15:46:49 -07:00
|
|
|
|
|
|
|
window = data;
|
|
|
|
window->commit_pending = EINA_FALSE;
|
|
|
|
wl_callback_destroy(callback);
|
|
|
|
window->callback = NULL;
|
2019-01-10 13:58:16 -08:00
|
|
|
EINA_INLIST_FOREACH_SAFE(window->frame_callbacks, l, cb)
|
2017-08-14 15:46:49 -07:00
|
|
|
cb->cb(window, timestamp, cb->data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct wl_callback_listener _frame_listener =
|
|
|
|
{
|
|
|
|
_frame_cb
|
|
|
|
};
|
|
|
|
|
2017-10-11 13:45:11 -07:00
|
|
|
static void
|
|
|
|
_maximized_set(Ecore_Wl2_Window *window)
|
|
|
|
{
|
2018-01-08 10:42:11 -08:00
|
|
|
EINA_SAFETY_ON_FALSE_RETURN(window->zxdg_toplevel || window->xdg_toplevel);
|
2017-10-11 13:45:11 -07:00
|
|
|
|
|
|
|
if (window->set_config.maximized)
|
|
|
|
{
|
|
|
|
window->saved = window->set_config.geometry;
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->xdg_toplevel)
|
|
|
|
xdg_toplevel_set_maximized(window->xdg_toplevel);
|
|
|
|
if (window->zxdg_toplevel)
|
|
|
|
zxdg_toplevel_v6_set_maximized(window->zxdg_toplevel);
|
2017-10-11 13:45:11 -07:00
|
|
|
}
|
|
|
|
else
|
2018-01-08 10:42:11 -08:00
|
|
|
{
|
|
|
|
if (window->xdg_toplevel)
|
|
|
|
xdg_toplevel_unset_maximized(window->xdg_toplevel);
|
|
|
|
if (window->zxdg_toplevel)
|
|
|
|
zxdg_toplevel_v6_unset_maximized(window->zxdg_toplevel);
|
|
|
|
}
|
2017-10-11 13:45:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_fullscreen_set(Ecore_Wl2_Window *window)
|
|
|
|
{
|
2018-01-08 10:42:11 -08:00
|
|
|
EINA_SAFETY_ON_FALSE_RETURN(window->zxdg_toplevel || window->xdg_toplevel);
|
2017-10-11 13:45:11 -07:00
|
|
|
|
|
|
|
if (window->set_config.fullscreen)
|
|
|
|
{
|
|
|
|
window->saved = window->set_config.geometry;
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->xdg_toplevel)
|
|
|
|
xdg_toplevel_set_fullscreen(window->xdg_toplevel, NULL);
|
|
|
|
if (window->zxdg_toplevel)
|
|
|
|
zxdg_toplevel_v6_set_fullscreen(window->zxdg_toplevel, NULL);
|
2017-10-11 13:45:11 -07:00
|
|
|
}
|
|
|
|
else
|
2018-01-08 10:42:11 -08:00
|
|
|
{
|
|
|
|
if (window->xdg_toplevel)
|
|
|
|
xdg_toplevel_unset_fullscreen(window->xdg_toplevel);
|
|
|
|
if (window->zxdg_toplevel)
|
|
|
|
zxdg_toplevel_v6_unset_fullscreen(window->zxdg_toplevel);
|
|
|
|
}
|
2017-10-11 13:45:11 -07:00
|
|
|
}
|
|
|
|
|
2018-04-05 11:01:22 -07:00
|
|
|
static struct wl_region *
|
|
|
|
_region_create(struct wl_compositor *comp, int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
struct wl_region *out;
|
|
|
|
|
|
|
|
out = wl_compositor_create_region(comp);
|
|
|
|
if (!out)
|
|
|
|
{
|
|
|
|
ERR("Failed to create region");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
wl_region_add(out, x, y, w, h);
|
|
|
|
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
2017-10-11 13:45:11 -07:00
|
|
|
static void
|
2018-04-05 12:59:26 -07:00
|
|
|
_regions_set(Ecore_Wl2_Window *window)
|
2017-10-11 13:45:11 -07:00
|
|
|
{
|
2018-04-05 12:59:26 -07:00
|
|
|
struct wl_region *region = NULL;
|
2017-10-11 13:45:11 -07:00
|
|
|
|
2018-04-05 12:59:26 -07:00
|
|
|
if (window->pending.opaque)
|
|
|
|
{
|
|
|
|
if (window->opaque_set)
|
|
|
|
{
|
|
|
|
region = _region_create(window->display->wl.compositor,
|
|
|
|
window->opaque.x, window->opaque.y,
|
|
|
|
window->opaque.w, window->opaque.h);
|
|
|
|
if (!region) return;
|
|
|
|
}
|
|
|
|
wl_surface_set_opaque_region(window->surface, region);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!window->pending.input) goto out;
|
|
|
|
if (window->type == ECORE_WL2_WINDOW_TYPE_DND) goto out;
|
2017-10-11 13:45:11 -07:00
|
|
|
|
|
|
|
if (!window->input_set)
|
|
|
|
{
|
|
|
|
wl_surface_set_input_region(window->surface, NULL);
|
2018-04-05 12:59:26 -07:00
|
|
|
goto out;
|
2017-10-11 13:45:11 -07:00
|
|
|
}
|
|
|
|
|
2018-04-05 12:59:26 -07:00
|
|
|
if (region && (window->opaque.x == window->input_rect.x) &&
|
|
|
|
(window->opaque.y == window->input_rect.y) &&
|
|
|
|
(window->opaque.w == window->input_rect.w) &&
|
|
|
|
(window->opaque.h == window->input_rect.h))
|
|
|
|
{
|
|
|
|
wl_surface_set_input_region(window->surface, region);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
if (region) wl_region_destroy(region);
|
|
|
|
|
2018-04-05 11:01:22 -07:00
|
|
|
region = _region_create(window->display->wl.compositor,
|
|
|
|
window->input_rect.x, window->input_rect.y,
|
|
|
|
window->input_rect.w, window->input_rect.h);
|
|
|
|
if (!region) return;
|
2017-10-11 13:45:11 -07:00
|
|
|
wl_surface_set_input_region(window->surface, region);
|
|
|
|
|
2018-04-05 12:59:26 -07:00
|
|
|
out:
|
|
|
|
if (region) wl_region_destroy(region);
|
2017-10-11 13:45:11 -07:00
|
|
|
}
|
|
|
|
|
2017-08-30 06:04:05 -07:00
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_commit(Ecore_Wl2_Window *window, Eina_Bool flush)
|
2017-08-14 15:44:13 -07:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window->surface);
|
|
|
|
|
2017-08-30 06:04:05 -07:00
|
|
|
if (window->commit_pending)
|
2017-12-13 14:34:10 -08:00
|
|
|
{
|
2018-01-26 13:51:44 -08:00
|
|
|
if (window->callback)
|
|
|
|
wl_callback_destroy(window->callback);
|
|
|
|
window->callback = NULL;
|
2018-05-22 09:33:36 -07:00
|
|
|
/* The elm mouse cursor bits do some harmless but weird stuff that
|
|
|
|
* can hit this, silence the warning for that case only. */
|
|
|
|
if (window->type != ECORE_WL2_WINDOW_TYPE_NONE)
|
2018-08-23 04:29:35 -07:00
|
|
|
WRN("Commit before previous commit processed");
|
2017-12-13 14:34:10 -08:00
|
|
|
}
|
2017-09-01 10:03:49 -07:00
|
|
|
if (!window->pending.configure)
|
|
|
|
{
|
2018-03-14 10:08:52 -07:00
|
|
|
if (window->has_buffer)
|
|
|
|
window->commit_pending = EINA_TRUE;
|
2017-09-01 10:03:49 -07:00
|
|
|
window->callback = wl_surface_frame(window->surface);
|
|
|
|
wl_callback_add_listener(window->callback, &_frame_listener, window);
|
2017-10-11 13:45:11 -07:00
|
|
|
/* Dispatch any state we've been saving along the way */
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->pending.geom)
|
|
|
|
{
|
2018-11-28 12:18:45 -08:00
|
|
|
int gx, gy, gw, gh;
|
|
|
|
|
|
|
|
ecore_wl2_window_geometry_get(window, &gx, &gy, &gw, &gh);
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->xdg_toplevel)
|
|
|
|
xdg_surface_set_window_geometry(window->xdg_surface,
|
2018-11-28 12:18:45 -08:00
|
|
|
gx, gy, gw, gh);
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->zxdg_surface)
|
|
|
|
zxdg_surface_v6_set_window_geometry(window->zxdg_surface,
|
2018-11-28 12:18:45 -08:00
|
|
|
gx, gy, gw, gh);
|
2018-01-08 10:42:11 -08:00
|
|
|
}
|
2018-04-05 12:59:26 -07:00
|
|
|
if (window->pending.opaque || window->pending.input)
|
|
|
|
_regions_set(window);
|
2017-10-11 13:45:11 -07:00
|
|
|
|
|
|
|
if (window->pending.maximized)
|
|
|
|
_maximized_set(window);
|
|
|
|
|
|
|
|
if (window->pending.fullscreen)
|
|
|
|
_fullscreen_set(window);
|
|
|
|
|
|
|
|
window->pending.geom = EINA_FALSE;
|
|
|
|
window->pending.opaque = EINA_FALSE;
|
|
|
|
window->pending.input = EINA_FALSE;
|
|
|
|
window->pending.maximized = EINA_FALSE;
|
|
|
|
window->pending.fullscreen = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (window->req_config.serial != window->set_config.serial)
|
|
|
|
{
|
2018-01-08 10:42:11 -08:00
|
|
|
if (window->xdg_configure_ack)
|
|
|
|
window->xdg_configure_ack(window->xdg_surface,
|
|
|
|
window->req_config.serial);
|
2017-10-11 13:45:11 -07:00
|
|
|
if (window->zxdg_configure_ack)
|
|
|
|
window->zxdg_configure_ack(window->zxdg_surface,
|
|
|
|
window->req_config.serial);
|
|
|
|
window->set_config.serial = window->req_config.serial;
|
2017-09-01 10:03:49 -07:00
|
|
|
}
|
2017-08-30 10:29:48 -07:00
|
|
|
if (flush)
|
|
|
|
{
|
|
|
|
wl_surface_commit(window->surface);
|
|
|
|
ecore_wl2_display_flush(window->display);
|
|
|
|
}
|
2017-10-11 13:45:11 -07:00
|
|
|
|
|
|
|
if (!window->updating) return;
|
|
|
|
|
2017-10-04 11:46:34 -07:00
|
|
|
window->updating = EINA_FALSE;
|
2017-10-11 13:45:11 -07:00
|
|
|
if (window->def_config.serial != window->set_config.serial)
|
|
|
|
_ecore_wl2_window_configure_send(window);
|
2017-08-14 15:44:13 -07:00
|
|
|
}
|
2017-08-14 15:45:41 -07:00
|
|
|
|
2017-11-10 12:59:51 -08:00
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_false_commit(Ecore_Wl2_Window *window)
|
2017-10-05 12:06:42 -07:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window->surface);
|
|
|
|
EINA_SAFETY_ON_TRUE_RETURN(window->pending.configure);
|
2018-03-28 08:07:46 -07:00
|
|
|
EINA_SAFETY_ON_TRUE_RETURN(window->commit_pending);
|
2017-10-05 12:06:42 -07:00
|
|
|
|
|
|
|
window->callback = wl_surface_frame(window->surface);
|
|
|
|
wl_callback_add_listener(window->callback, &_frame_listener, window);
|
|
|
|
wl_surface_commit(window->surface);
|
|
|
|
ecore_wl2_display_flush(window->display);
|
2018-03-14 10:08:52 -07:00
|
|
|
if (window->has_buffer)
|
|
|
|
window->commit_pending = EINA_TRUE;
|
2017-10-05 12:06:42 -07:00
|
|
|
}
|
|
|
|
|
2017-08-30 06:04:05 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
ecore_wl2_window_pending_get(Ecore_Wl2_Window *window)
|
2017-08-14 15:45:41 -07:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
|
|
|
|
|
|
|
|
return window->commit_pending;
|
|
|
|
}
|
2017-08-14 15:46:49 -07:00
|
|
|
|
2017-08-30 06:04:05 -07:00
|
|
|
EAPI Ecore_Wl2_Frame_Cb_Handle *
|
|
|
|
ecore_wl2_window_frame_callback_add(Ecore_Wl2_Window *window, Ecore_Wl2_Frame_Cb cb, void *data)
|
2017-08-14 15:46:49 -07:00
|
|
|
{
|
|
|
|
Ecore_Wl2_Frame_Cb_Handle *callback;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(cb, NULL);
|
|
|
|
|
|
|
|
callback = malloc(sizeof(*callback));
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(callback, NULL);
|
|
|
|
callback->cb = cb;
|
|
|
|
callback->data = data;
|
|
|
|
callback->win = window;
|
2017-08-30 06:04:05 -07:00
|
|
|
window->frame_callbacks =
|
2019-01-10 13:58:16 -08:00
|
|
|
eina_inlist_append(window->frame_callbacks, EINA_INLIST_GET(callback));
|
2017-08-14 15:46:49 -07:00
|
|
|
return callback;
|
|
|
|
}
|
|
|
|
|
2017-08-30 06:04:05 -07:00
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_frame_callback_del(Ecore_Wl2_Frame_Cb_Handle *handle)
|
2017-08-14 15:46:49 -07:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(handle);
|
|
|
|
|
2017-08-30 06:04:05 -07:00
|
|
|
handle->win->frame_callbacks =
|
2019-01-10 13:58:16 -08:00
|
|
|
eina_inlist_remove(handle->win->frame_callbacks, EINA_INLIST_GET(handle));
|
2017-08-14 15:46:49 -07:00
|
|
|
free(handle);
|
|
|
|
}
|
2017-08-17 13:10:59 -07:00
|
|
|
|
2017-08-30 06:04:05 -07:00
|
|
|
EAPI void
|
2017-08-30 10:10:33 -07:00
|
|
|
ecore_wl2_window_buffer_attach(Ecore_Wl2_Window *win, void *buffer, int x, int y, Eina_Bool implicit)
|
2017-08-17 13:10:59 -07:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(win);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(win->surface);
|
|
|
|
|
|
|
|
/* FIXME: Haven't given any thought to x and y since we always use 0... */
|
|
|
|
if (!implicit) wl_surface_attach(win->surface, buffer, x, y);
|
|
|
|
win->buffer = buffer;
|
2017-08-30 06:04:05 -07:00
|
|
|
if (!implicit && !buffer)
|
|
|
|
win->has_buffer = EINA_FALSE;
|
|
|
|
else
|
|
|
|
win->has_buffer = EINA_TRUE;
|
2017-08-17 13:10:59 -07:00
|
|
|
}
|
2017-09-29 14:16:11 -07:00
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
ecore_wl2_window_resizing_get(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
|
|
|
|
|
2017-10-04 10:12:55 -07:00
|
|
|
return window->req_config.resizing;
|
2017-09-29 14:16:11 -07:00
|
|
|
}
|
2017-10-04 11:46:34 -07:00
|
|
|
|
2017-11-10 12:59:51 -08:00
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_update_begin(Ecore_Wl2_Window *window)
|
2017-10-04 11:46:34 -07:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
EINA_SAFETY_ON_TRUE_RETURN(window->updating);
|
|
|
|
|
|
|
|
window->updating = EINA_TRUE;
|
|
|
|
}
|
2017-11-10 11:31:00 -08:00
|
|
|
|
2017-11-10 12:59:51 -08:00
|
|
|
EAPI void
|
|
|
|
ecore_wl2_window_damage(Ecore_Wl2_Window *window, Eina_Rectangle *rects, unsigned int count)
|
2017-11-10 11:31:00 -08:00
|
|
|
{
|
|
|
|
void (*damage)(struct wl_surface *, int32_t, int32_t, int32_t, int32_t);
|
|
|
|
unsigned int k;
|
|
|
|
int compositor_version;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
|
|
|
compositor_version = window->display->wl.compositor_version;
|
|
|
|
|
|
|
|
if (compositor_version >= WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION)
|
|
|
|
damage = wl_surface_damage_buffer;
|
|
|
|
else
|
|
|
|
damage = wl_surface_damage;
|
|
|
|
|
|
|
|
if ((rects) && (count > 0))
|
|
|
|
for (k = 0; k < count; k++)
|
|
|
|
damage(window->surface, rects[k].x, rects[k].y, rects[k].w, rects[k].h);
|
|
|
|
else
|
|
|
|
damage(window->surface, 0, 0, INT_MAX, INT_MAX);
|
|
|
|
}
|
2017-11-30 13:33:38 -08:00
|
|
|
|
|
|
|
EAPI void
|
2018-06-15 11:18:52 -07:00
|
|
|
ecore_wl2_window_surface_flush(Ecore_Wl2_Window *window, Eina_Bool purge)
|
2017-11-30 13:33:38 -08:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(window);
|
|
|
|
|
|
|
|
if (!window->wl2_surface) return;
|
2018-06-15 11:18:52 -07:00
|
|
|
ecore_wl2_surface_flush(window->wl2_surface, purge);
|
2017-11-30 13:33:38 -08:00
|
|
|
}
|
2019-11-19 06:28:27 -08:00
|
|
|
|
|
|
|
EAPI Ecore_Wl2_Window_Type
|
|
|
|
ecore_wl2_window_type_get(Ecore_Wl2_Window *window)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(window, ECORE_WL2_WINDOW_TYPE_NONE);
|
|
|
|
return window->type;
|
|
|
|
}
|
2019-11-19 06:37:11 -08:00
|
|
|
|
|
|
|
EAPI Ecore_Wl2_Window *
|
|
|
|
ecore_wl2_window_surface_find(struct wl_surface *surface)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Display *ewd;
|
|
|
|
Ecore_Wl2_Window *win;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(surface, NULL);
|
|
|
|
|
|
|
|
ewd = ecore_wl2_connected_display_get(NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(ewd, NULL);
|
|
|
|
|
|
|
|
win = ecore_wl2_display_window_find_by_surface(ewd, surface);
|
|
|
|
return win;
|
|
|
|
}
|