2012-10-08 07:09:53 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2012-12-05 13:15:42 -08:00
|
|
|
#include "ecore_evas_wayland_private.h"
|
2016-11-01 14:20:49 -07:00
|
|
|
#include <Evas_Engine_Wayland.h>
|
2020-02-10 00:20:18 -08:00
|
|
|
#include "ecore_wl2_internal.h"
|
2012-12-05 13:15:42 -08:00
|
|
|
|
2016-11-02 11:13:07 -07:00
|
|
|
extern EAPI Eina_List *_evas_canvas_image_data_unset(Evas *eo_e);
|
|
|
|
extern EAPI void _evas_canvas_image_data_regenerate(Eina_List *list);
|
|
|
|
|
2013-03-21 16:45:44 -07:00
|
|
|
#define _smart_frame_type "ecore_evas_wl_frame"
|
|
|
|
|
2012-12-05 13:15:42 -08:00
|
|
|
static const char *interface_wl_name = "wayland";
|
2013-02-05 04:47:27 -08:00
|
|
|
static const int interface_wl_version = 1;
|
2012-10-08 07:09:53 -07:00
|
|
|
|
2016-05-05 07:45:59 -07:00
|
|
|
Eina_List *ee_list;
|
|
|
|
|
2016-10-03 08:34:10 -07:00
|
|
|
/* local structure for evas devices with IDs */
|
|
|
|
typedef struct _EE_Wl_Device EE_Wl_Device;
|
|
|
|
struct _EE_Wl_Device
|
|
|
|
{
|
|
|
|
Evas_Device *seat;
|
2016-10-05 06:36:19 -07:00
|
|
|
Evas_Device *pointer;
|
|
|
|
Evas_Device *keyboard;
|
|
|
|
Evas_Device *touch;
|
2016-10-03 08:34:10 -07:00
|
|
|
unsigned int id;
|
|
|
|
};
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
/* local variables */
|
|
|
|
static int _ecore_evas_wl_init_count = 0;
|
2017-10-17 08:32:57 -07:00
|
|
|
static Eina_Array *_ecore_evas_wl_event_hdls;
|
2012-10-08 07:09:53 -07:00
|
|
|
|
2013-02-27 14:12:58 -08:00
|
|
|
static void _ecore_evas_wayland_resize(Ecore_Evas *ee, int location);
|
2017-06-09 08:06:05 -07:00
|
|
|
static void _ecore_evas_wl_common_rotation_set(Ecore_Evas *ee, int rotation, int resize);
|
2020-02-10 00:20:18 -08:00
|
|
|
static void _ecore_evas_wl_selection_init(Ecore_Evas *ee);
|
2013-02-27 01:49:23 -08:00
|
|
|
|
|
|
|
/* local functions */
|
2017-08-18 12:13:11 -07:00
|
|
|
static void
|
|
|
|
_anim_cb_tick(Ecore_Wl2_Window *win EINA_UNUSED, uint32_t timestamp EINA_UNUSED, void *data)
|
|
|
|
{
|
|
|
|
Ecore_Evas *ee = data;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *edata;
|
|
|
|
|
|
|
|
edata = ee->engine.data;
|
|
|
|
|
|
|
|
if (!edata->ticking) return;
|
|
|
|
|
|
|
|
ecore_evas_animator_tick(ee, NULL, ecore_loop_time_get());
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ecore_evas_wl_common_animator_register(Ecore_Evas *ee)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *edata;
|
|
|
|
|
|
|
|
edata = (Ecore_Evas_Engine_Wl_Data *)ee->engine.data;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_TRUE_RETURN(edata->ticking);
|
2018-03-26 10:29:41 -07:00
|
|
|
EINA_SAFETY_ON_TRUE_RETURN(edata->frame != NULL);
|
2017-08-18 12:13:11 -07:00
|
|
|
|
|
|
|
edata->frame = ecore_wl2_window_frame_callback_add(edata->win,
|
|
|
|
_anim_cb_tick, ee);
|
2018-03-15 12:36:27 -07:00
|
|
|
if (!ecore_wl2_window_pending_get(edata->win) && !ee->in_async_render &&
|
2018-04-12 11:44:10 -07:00
|
|
|
!ee->animator_ticked && !ee->animator_ran && !ee->draw_block)
|
2017-10-05 12:07:26 -07:00
|
|
|
ecore_wl2_window_false_commit(edata->win);
|
2017-08-18 12:13:11 -07:00
|
|
|
edata->ticking = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ecore_evas_wl_common_animator_unregister(Ecore_Evas *ee)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *edata;
|
|
|
|
|
|
|
|
edata = ee->engine.data;
|
|
|
|
edata->ticking = EINA_FALSE;
|
2018-03-26 10:29:41 -07:00
|
|
|
if (edata->frame)
|
|
|
|
ecore_wl2_window_frame_callback_del(edata->frame);
|
2017-08-18 12:13:11 -07:00
|
|
|
edata->frame = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ecore_evas_wl_common_evas_changed(Ecore_Evas *ee, Eina_Bool changed)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *edata;
|
|
|
|
|
|
|
|
if (changed) return;
|
|
|
|
|
|
|
|
edata = (Ecore_Evas_Engine_Wl_Data *)ee->engine.data;
|
|
|
|
if (edata->ticking && !ecore_wl2_window_pending_get(edata->win))
|
2017-10-05 12:07:26 -07:00
|
|
|
ecore_wl2_window_false_commit(edata->win);
|
2017-08-18 12:13:11 -07:00
|
|
|
}
|
|
|
|
|
2017-06-05 11:05:53 -07:00
|
|
|
static void
|
2013-11-01 01:41:30 -07:00
|
|
|
_ecore_evas_wl_common_state_update(Ecore_Evas *ee)
|
|
|
|
{
|
|
|
|
if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
|
|
|
|
}
|
|
|
|
|
2017-06-09 08:06:05 -07:00
|
|
|
static void
|
|
|
|
_ecore_evas_wl_common_wm_rotation_protocol_set(Ecore_Evas *ee)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
|
|
|
|
ee->prop.wm_rot.supported =
|
|
|
|
ecore_wl2_window_wm_rotation_supported_get(wdata->win);
|
|
|
|
}
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
static Eina_Bool
|
2012-11-25 01:55:32 -08:00
|
|
|
_ecore_evas_wl_common_cb_mouse_in(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
2012-10-08 07:09:53 -07:00
|
|
|
{
|
|
|
|
Ecore_Evas *ee;
|
2015-09-28 10:42:38 -07:00
|
|
|
Ecore_Event_Mouse_IO *ev;
|
2012-10-08 07:09:53 -07:00
|
|
|
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
ev = event;
|
2018-07-06 07:16:21 -07:00
|
|
|
ee = ecore_event_window_match((Ecore_Window)ev->window);
|
2012-10-08 07:09:53 -07:00
|
|
|
if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
|
2018-07-06 07:16:21 -07:00
|
|
|
if ((Ecore_Window)ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
2016-11-09 11:54:55 -08:00
|
|
|
if (_ecore_evas_mouse_in_check(ee, ev->dev)) return ECORE_CALLBACK_PASS_ON;
|
2013-05-08 10:01:23 -07:00
|
|
|
|
2016-11-09 11:54:55 -08:00
|
|
|
_ecore_evas_mouse_inout_set(ee, ev->dev, EINA_TRUE, EINA_FALSE);
|
2016-11-09 05:44:18 -08:00
|
|
|
ecore_event_evas_seat_modifier_lock_update(ee->evas, ev->modifiers, ev->dev);
|
2012-12-02 23:01:02 -08:00
|
|
|
evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL);
|
2016-11-22 10:14:03 -08:00
|
|
|
_ecore_evas_mouse_device_move_process(ee, ev->dev, ev->x, ev->y, ev->timestamp);
|
2012-10-08 07:09:53 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2012-11-25 01:55:32 -08:00
|
|
|
_ecore_evas_wl_common_cb_mouse_out(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
2012-10-08 07:09:53 -07:00
|
|
|
{
|
|
|
|
Ecore_Evas *ee;
|
2015-09-30 10:14:26 -07:00
|
|
|
Ecore_Event_Mouse_IO *ev;
|
2012-10-08 07:09:53 -07:00
|
|
|
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
ev = event;
|
2018-07-06 07:16:21 -07:00
|
|
|
ee = ecore_event_window_match((Ecore_Window)ev->window);
|
2012-10-08 07:09:53 -07:00
|
|
|
if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
|
2018-07-06 07:16:21 -07:00
|
|
|
if ((Ecore_Window)ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
2016-11-09 11:54:55 -08:00
|
|
|
if (!_ecore_evas_mouse_in_check(ee, ev->dev)) return ECORE_CALLBACK_PASS_ON;
|
2013-10-29 01:04:05 -07:00
|
|
|
|
2016-11-09 05:44:18 -08:00
|
|
|
ecore_event_evas_seat_modifier_lock_update(ee->evas,
|
|
|
|
ev->modifiers, ev->dev);
|
2016-11-22 10:14:03 -08:00
|
|
|
_ecore_evas_mouse_device_move_process(ee, ev->dev, ev->x, ev->y, ev->timestamp);
|
2016-11-09 11:54:55 -08:00
|
|
|
evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL);
|
|
|
|
_ecore_evas_mouse_inout_set(ee, ev->dev, EINA_FALSE, EINA_FALSE);
|
2012-10-08 07:09:53 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2012-11-25 01:55:32 -08:00
|
|
|
_ecore_evas_wl_common_cb_focus_in(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
2012-10-08 07:09:53 -07:00
|
|
|
{
|
|
|
|
Ecore_Evas *ee;
|
2015-09-30 10:14:26 -07:00
|
|
|
Ecore_Wl2_Event_Focus_In *ev;
|
2012-10-08 07:09:53 -07:00
|
|
|
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
ev = event;
|
2018-07-06 07:16:21 -07:00
|
|
|
ee = ecore_event_window_match((Ecore_Window)ev->window);
|
2012-10-08 07:09:53 -07:00
|
|
|
if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
|
2018-07-06 07:16:21 -07:00
|
|
|
if ((Ecore_Window)ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
2016-11-03 07:07:40 -07:00
|
|
|
_ecore_evas_focus_device_set(ee, ev->dev, EINA_TRUE);
|
2012-10-08 07:09:53 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2012-11-25 01:55:32 -08:00
|
|
|
_ecore_evas_wl_common_cb_focus_out(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
2012-10-08 07:09:53 -07:00
|
|
|
{
|
|
|
|
Ecore_Evas *ee;
|
2015-09-30 10:14:26 -07:00
|
|
|
Ecore_Wl2_Event_Focus_Out *ev;
|
2012-10-08 07:09:53 -07:00
|
|
|
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
ev = event;
|
2018-07-06 07:16:21 -07:00
|
|
|
ee = ecore_event_window_match((Ecore_Window)ev->window);
|
2012-10-08 07:09:53 -07:00
|
|
|
if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
|
2018-07-06 07:16:21 -07:00
|
|
|
if ((Ecore_Window)ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
2016-11-03 07:07:40 -07:00
|
|
|
_ecore_evas_focus_device_set(ee, ev->dev, EINA_FALSE);
|
2012-10-08 07:09:53 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
2017-03-02 13:50:24 -08:00
|
|
|
static void
|
|
|
|
_ee_display_unset(Ecore_Evas *ee)
|
|
|
|
{
|
|
|
|
Evas_Engine_Info_Wayland *einfo;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
|
|
|
einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas);
|
|
|
|
if (!einfo) return;
|
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
if (!strcmp(ee->driver, "wayland_egl"))
|
|
|
|
wdata->regen_objs = _evas_canvas_image_data_unset(ecore_evas_get(ee));
|
|
|
|
|
|
|
|
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
|
|
|
|
WRN("Failed to set Evas Engine Info for '%s'", ee->driver);
|
|
|
|
}
|
|
|
|
|
2016-05-05 07:45:59 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_ecore_evas_wl_common_cb_disconnect(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Event_Disconnect *ev = event;
|
|
|
|
Eina_List *l;
|
|
|
|
Ecore_Evas *ee;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ee_list, l, ee)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
|
|
|
|
|
|
|
|
if (wdata->display != ev->display) continue;
|
|
|
|
wdata->sync_done = EINA_FALSE;
|
|
|
|
wdata->defer_show = EINA_TRUE;
|
2017-03-01 12:39:32 -08:00
|
|
|
ee->visible = EINA_FALSE;
|
2016-05-05 07:45:59 -07:00
|
|
|
wdata->reset_pending = 1;
|
2018-04-12 11:44:10 -07:00
|
|
|
ee->draw_block = EINA_TRUE;
|
2017-03-02 13:50:24 -08:00
|
|
|
_ee_display_unset(ee);
|
2016-05-05 07:45:59 -07:00
|
|
|
}
|
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
|
|
|
|
2018-02-12 12:58:01 -08:00
|
|
|
static Eina_Bool
|
|
|
|
ee_needs_alpha(Ecore_Evas *ee)
|
|
|
|
{
|
|
|
|
return ee->shadow.l || ee->shadow.r || ee->shadow.t || ee->shadow.b ||
|
|
|
|
ee->alpha;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ecore_evas_wayland_window_update(Ecore_Evas *ee, Ecore_Evas_Engine_Wl_Data *wdata, Eina_Bool new_alpha)
|
|
|
|
{
|
|
|
|
Evas_Engine_Info_Wayland *einfo;
|
|
|
|
Eina_Bool has_shadow, needs_alpha, change;
|
|
|
|
int w, h, fw, fh, shw = 0, shh = 0;
|
|
|
|
int fullw, fullh;
|
|
|
|
|
|
|
|
einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas);
|
2019-10-18 10:29:44 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(einfo);
|
2018-02-12 12:58:01 -08:00
|
|
|
|
|
|
|
change = ee->shadow.changed || (new_alpha != ee->alpha);
|
|
|
|
ee->alpha = new_alpha;
|
|
|
|
has_shadow = ee->shadow.l || ee->shadow.r || ee->shadow.t || ee->shadow.b;
|
|
|
|
|
|
|
|
needs_alpha = ee_needs_alpha(ee);
|
|
|
|
|
|
|
|
if (einfo->info.destination_alpha != needs_alpha)
|
|
|
|
{
|
|
|
|
ecore_wl2_window_alpha_set(wdata->win, needs_alpha);
|
|
|
|
einfo->info.destination_alpha = needs_alpha;
|
|
|
|
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
|
|
|
|
ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
|
|
|
|
|
|
|
|
change |= EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
|
|
|
|
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
|
|
|
|
|
|
|
|
if (has_shadow)
|
|
|
|
{
|
|
|
|
shh = ee->shadow.r + ee->shadow.l;
|
|
|
|
shw = ee->shadow.t + ee->shadow.b;
|
|
|
|
}
|
|
|
|
|
|
|
|
fullw = w + fw - shw;
|
|
|
|
fullh = h + fh - shh;
|
|
|
|
|
2018-11-08 12:42:38 -08:00
|
|
|
/* shadow but no window alpha means we have a translucent visual but the
|
|
|
|
* window contents are always opaque - we can set the opaque region
|
|
|
|
* hint so the compositor can render more efficiently
|
|
|
|
*/
|
2018-02-12 12:58:01 -08:00
|
|
|
if (has_shadow && !ee->alpha)
|
|
|
|
{
|
|
|
|
ecore_wl2_window_opaque_region_set(wdata->win,
|
|
|
|
ee->shadow.l, ee->shadow.t,
|
|
|
|
fullw, fullh);
|
|
|
|
}
|
2018-11-08 12:42:38 -08:00
|
|
|
/* No alpha, no shadows - this should really not be a visual capable
|
|
|
|
* of translucent behaviour, but just in case things are sketchy in
|
|
|
|
* the back-end, let the compositor know we're fully opaque.
|
|
|
|
*/
|
|
|
|
else if (!ee->alpha)
|
|
|
|
{
|
|
|
|
ecore_wl2_window_opaque_region_set(wdata->win,
|
|
|
|
0, 0,
|
|
|
|
fullw, fullh);
|
|
|
|
}
|
|
|
|
/* alpha is set and we might use it, so we'd better clear the
|
|
|
|
* opaque region, let the compositor blend it all.
|
|
|
|
*/
|
2018-02-12 12:58:01 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
ecore_wl2_window_opaque_region_set(wdata->win, 0, 0, 0, 0);
|
|
|
|
}
|
|
|
|
ecore_wl2_window_input_region_set(wdata->win,
|
|
|
|
ee->shadow.l, ee->shadow.t,
|
|
|
|
fullw, fullh);
|
|
|
|
ecore_wl2_window_geometry_set(wdata->win,
|
|
|
|
ee->shadow.l, ee->shadow.t,
|
|
|
|
fullw, fullh);
|
|
|
|
if (!change) return;
|
|
|
|
|
|
|
|
if (ECORE_EVAS_PORTRAIT(ee))
|
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, fullw, fullh);
|
|
|
|
else
|
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, fullh, fullw);
|
|
|
|
|
|
|
|
ee->shadow.changed = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2017-04-25 08:59:33 -07:00
|
|
|
_ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
2020-01-17 14:24:26 -08:00
|
|
|
int ow, oh, ew, eh, fw, fh;
|
2017-04-25 08:59:33 -07:00
|
|
|
int diff = 0;
|
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
if (!ee) return;
|
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
if (!wdata) return;
|
|
|
|
|
|
|
|
ee->req.w = w;
|
|
|
|
ee->req.h = h;
|
|
|
|
|
2020-01-17 14:24:26 -08:00
|
|
|
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
|
|
|
|
|
2017-04-25 08:59:33 -07:00
|
|
|
/* TODO: wayland client can resize the ecore_evas directly.
|
|
|
|
* In the future, we will remove ee->req value in wayland backend */
|
2017-08-04 13:17:53 -07:00
|
|
|
ew = ee->w;
|
|
|
|
eh = ee->h;
|
2017-04-25 08:59:33 -07:00
|
|
|
ee->w = w;
|
|
|
|
ee->h = h;
|
|
|
|
|
2018-01-08 10:42:11 -08:00
|
|
|
if (wdata->win->xdg_set_min_size && wdata->win->xdg_toplevel && wdata->win->pending.min)
|
|
|
|
{
|
2020-01-17 14:24:26 -08:00
|
|
|
wdata->win->xdg_set_min_size(wdata->win->xdg_toplevel, ee->prop.min.w + fw, ee->prop.min.h + fh);
|
2018-01-08 10:42:11 -08:00
|
|
|
wdata->win->pending.min = 0;
|
|
|
|
}
|
|
|
|
if (wdata->win->xdg_set_max_size && wdata->win->xdg_toplevel && wdata->win->pending.max)
|
|
|
|
{
|
2020-01-17 14:24:26 -08:00
|
|
|
wdata->win->xdg_set_max_size(wdata->win->xdg_toplevel, ee->prop.max.w + fw, ee->prop.max.h + fh);
|
2018-01-08 10:42:11 -08:00
|
|
|
wdata->win->pending.max = 0;
|
|
|
|
}
|
|
|
|
|
2017-08-11 15:43:15 -07:00
|
|
|
if (wdata->win->zxdg_set_min_size && wdata->win->zxdg_toplevel && wdata->win->pending.min)
|
|
|
|
{
|
2020-01-17 14:24:26 -08:00
|
|
|
wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, ee->prop.min.w + fw, ee->prop.min.h + fh);
|
2017-08-11 15:43:15 -07:00
|
|
|
wdata->win->pending.min = 0;
|
|
|
|
}
|
|
|
|
if (wdata->win->zxdg_set_max_size && wdata->win->zxdg_toplevel && wdata->win->pending.max)
|
|
|
|
{
|
2020-01-17 14:24:26 -08:00
|
|
|
wdata->win->zxdg_set_max_size(wdata->win->zxdg_toplevel, ee->prop.max.w + fw, ee->prop.max.h + fh);
|
2017-08-11 15:43:15 -07:00
|
|
|
wdata->win->pending.max = 0;
|
|
|
|
}
|
|
|
|
|
2017-04-25 08:59:33 -07:00
|
|
|
if (!ee->prop.fullscreen)
|
|
|
|
{
|
|
|
|
int maxw = 0, maxh = 0;
|
|
|
|
int minw = 0, minh = 0;
|
|
|
|
|
|
|
|
if (ECORE_EVAS_PORTRAIT(ee))
|
|
|
|
{
|
|
|
|
if (ee->prop.min.w > 0)
|
2020-01-17 14:24:26 -08:00
|
|
|
minw = (ee->prop.min.w);
|
2017-04-25 08:59:33 -07:00
|
|
|
if (ee->prop.min.h > 0)
|
2020-01-17 14:24:26 -08:00
|
|
|
minh = (ee->prop.min.h);
|
2017-04-25 08:59:33 -07:00
|
|
|
if (ee->prop.max.w > 0)
|
2020-01-17 14:24:26 -08:00
|
|
|
maxw = (ee->prop.max.w);
|
2017-04-25 08:59:33 -07:00
|
|
|
if (ee->prop.max.h > 0)
|
2020-01-17 14:24:26 -08:00
|
|
|
maxh = (ee->prop.max.h);
|
2017-04-25 08:59:33 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ee->prop.min.w > 0)
|
2020-01-17 14:24:26 -08:00
|
|
|
minw = (ee->prop.min.w);
|
2017-04-25 08:59:33 -07:00
|
|
|
if (ee->prop.min.h > 0)
|
2020-01-17 14:24:26 -08:00
|
|
|
minh = (ee->prop.min.h);
|
2017-04-25 08:59:33 -07:00
|
|
|
if (ee->prop.max.w > 0)
|
2020-01-17 14:24:26 -08:00
|
|
|
maxw = (ee->prop.max.w);
|
2017-04-25 08:59:33 -07:00
|
|
|
if (ee->prop.max.h > 0)
|
2020-01-17 14:24:26 -08:00
|
|
|
maxh = (ee->prop.max.h);
|
2017-04-25 08:59:33 -07:00
|
|
|
}
|
|
|
|
|
2017-08-04 13:17:53 -07:00
|
|
|
if ((maxw > 0) && (w > maxw))
|
|
|
|
w = maxw;
|
|
|
|
else if (w < minw)
|
|
|
|
w = minw;
|
2017-04-25 08:59:33 -07:00
|
|
|
|
2017-08-04 13:17:53 -07:00
|
|
|
if ((maxh > 0) && (h > maxh))
|
|
|
|
h = maxh;
|
|
|
|
else if (h < minh)
|
|
|
|
h = minh;
|
2017-04-25 08:59:33 -07:00
|
|
|
|
|
|
|
if (!ee->prop.maximized)
|
|
|
|
{
|
|
|
|
/* calc new size using base size & step size */
|
2017-08-04 13:17:53 -07:00
|
|
|
if (ee->prop.step.w > 1)
|
2017-04-25 08:59:33 -07:00
|
|
|
{
|
2020-01-17 14:24:26 -08:00
|
|
|
int bw = ee->prop.base.w;
|
2017-08-04 13:17:53 -07:00
|
|
|
w = (bw + (((w - bw) / ee->prop.step.w) * ee->prop.step.w));
|
2017-04-25 08:59:33 -07:00
|
|
|
}
|
|
|
|
|
2017-08-04 13:17:53 -07:00
|
|
|
if (ee->prop.step.h > 1)
|
2017-04-25 08:59:33 -07:00
|
|
|
{
|
2020-01-17 14:24:26 -08:00
|
|
|
int bh = ee->prop.base.h;
|
2017-08-04 13:17:53 -07:00
|
|
|
h = (bh + (((h - bh) / ee->prop.step.h) * ee->prop.step.h));
|
2017-04-25 08:59:33 -07:00
|
|
|
}
|
|
|
|
|
2017-08-04 13:17:53 -07:00
|
|
|
if (!wdata->win->display->wl.efl_hints && EINA_DBL_NONZERO(ee->prop.aspect))
|
|
|
|
{
|
|
|
|
/* copied from e_client.c */
|
|
|
|
Evas_Aspect_Control aspect;
|
|
|
|
int aw, ah;
|
2017-09-27 21:58:08 -07:00
|
|
|
double val, a;
|
2017-04-25 08:59:33 -07:00
|
|
|
|
2017-09-27 21:58:08 -07:00
|
|
|
if (h > 0)
|
2017-08-04 13:17:53 -07:00
|
|
|
{
|
2017-09-27 21:58:08 -07:00
|
|
|
a = (double)w / (double)h;
|
|
|
|
if (fabs(a - ee->prop.aspect) > 0.001)
|
2017-08-04 13:17:53 -07:00
|
|
|
{
|
2017-09-27 21:58:08 -07:00
|
|
|
int step_w = ee->prop.step.w ?: 1;
|
|
|
|
int step_h = ee->prop.step.h ?: 1;
|
|
|
|
|
2017-09-29 14:17:18 -07:00
|
|
|
if (wdata->resizing ||
|
|
|
|
ecore_wl2_window_resizing_get(wdata->win))
|
2017-09-27 21:58:08 -07:00
|
|
|
ew = wdata->cw, eh = wdata->ch;
|
|
|
|
if (abs(w - ew) > abs(h - eh))
|
|
|
|
aspect = EVAS_ASPECT_CONTROL_HORIZONTAL;
|
2017-08-04 13:17:53 -07:00
|
|
|
else
|
2017-09-27 21:58:08 -07:00
|
|
|
aspect = EVAS_ASPECT_CONTROL_VERTICAL;
|
|
|
|
switch (aspect)
|
2017-08-04 13:17:53 -07:00
|
|
|
{
|
2017-09-27 21:58:08 -07:00
|
|
|
case EVAS_ASPECT_CONTROL_HORIZONTAL:
|
|
|
|
val = ((h - (w / ee->prop.aspect)) *
|
|
|
|
step_h) / step_h;
|
|
|
|
if (val > 0) ah = ceil(val);
|
|
|
|
else ah = floor(val);
|
|
|
|
if ((h - ah > minh) || (minh < 1))
|
|
|
|
{
|
|
|
|
h -= ah;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
EINA_FALLTHROUGH;
|
|
|
|
/* no break */
|
|
|
|
default:
|
|
|
|
val = (((h * ee->prop.aspect) - w) *
|
|
|
|
step_w) / step_w;
|
|
|
|
if (val > 0) aw = ceil(val);
|
|
|
|
else aw = floor(val);
|
|
|
|
if ((w + aw < maxw) || (maxw < 1))
|
|
|
|
w += aw;
|
2017-08-04 13:17:53 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-04-25 08:59:33 -07:00
|
|
|
|
|
|
|
ee->w = w;
|
|
|
|
ee->h = h;
|
|
|
|
ee->req.w = w;
|
|
|
|
ee->req.h = h;
|
|
|
|
|
|
|
|
if (ECORE_EVAS_PORTRAIT(ee))
|
|
|
|
{
|
|
|
|
w += fw;
|
|
|
|
h += fh;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
w += fh;
|
|
|
|
h += fw;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-18 05:10:21 -07:00
|
|
|
if (ECORE_EVAS_PORTRAIT(ee))
|
|
|
|
evas_output_size_get(ee->evas, &ow, &oh);
|
|
|
|
else
|
|
|
|
evas_output_size_get(ee->evas, &oh, &ow);
|
2017-04-25 08:59:33 -07:00
|
|
|
|
|
|
|
if (ECORE_EVAS_PORTRAIT(ee) && ((ow != w) || (oh != h)))
|
|
|
|
diff = 1;
|
|
|
|
if (!ECORE_EVAS_PORTRAIT(ee) && ((ow != h) || (oh != w)))
|
|
|
|
diff = 1;
|
|
|
|
|
|
|
|
if (diff)
|
|
|
|
{
|
|
|
|
if (ECORE_EVAS_PORTRAIT(ee))
|
|
|
|
{
|
|
|
|
evas_output_size_set(ee->evas, w, h);
|
|
|
|
evas_output_viewport_set(ee->evas, 0, 0, w, h);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_output_size_set(ee->evas, h, w);
|
|
|
|
evas_output_viewport_set(ee->evas, 0, 0, h, w);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ee->prop.avoid_damage)
|
|
|
|
{
|
|
|
|
int pdam = 0;
|
|
|
|
|
|
|
|
pdam = ecore_evas_avoid_damage_get(ee);
|
|
|
|
ecore_evas_avoid_damage_set(ee, 0);
|
|
|
|
ecore_evas_avoid_damage_set(ee, pdam);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ee->func.fn_resize) ee->func.fn_resize(ee);
|
|
|
|
}
|
2018-02-12 12:58:01 -08:00
|
|
|
_ecore_evas_wayland_window_update(ee, wdata, ee->alpha);
|
2017-04-25 08:59:33 -07:00
|
|
|
}
|
|
|
|
|
2017-06-09 08:06:05 -07:00
|
|
|
static void
|
|
|
|
_ecore_evas_wl_common_wm_rot_manual_rotation_done_job(void *data)
|
|
|
|
{
|
|
|
|
Ecore_Evas *ee = (Ecore_Evas *)data;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
|
|
|
|
wdata->wm_rot.manual_mode_job = NULL;
|
|
|
|
ee->prop.wm_rot.manual_mode.wait_for_done = EINA_FALSE;
|
|
|
|
|
|
|
|
ecore_wl2_window_rotation_change_done_send
|
|
|
|
(wdata->win, ee->rotation, ee->w, ee->h);
|
|
|
|
|
|
|
|
wdata->wm_rot.done = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ecore_evas_wl_common_wm_rot_manual_rotation_done(Ecore_Evas *ee)
|
|
|
|
{
|
|
|
|
if ((ee->prop.wm_rot.supported) &&
|
|
|
|
(ee->prop.wm_rot.app_set) &&
|
|
|
|
(ee->prop.wm_rot.manual_mode.set))
|
|
|
|
{
|
|
|
|
if (ee->prop.wm_rot.manual_mode.wait_for_done)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
|
|
|
|
if (ee->prop.wm_rot.manual_mode.timer)
|
|
|
|
ecore_timer_del(ee->prop.wm_rot.manual_mode.timer);
|
|
|
|
ee->prop.wm_rot.manual_mode.timer = NULL;
|
|
|
|
|
|
|
|
if (wdata->wm_rot.manual_mode_job)
|
|
|
|
ecore_job_del(wdata->wm_rot.manual_mode_job);
|
|
|
|
|
|
|
|
wdata->wm_rot.manual_mode_job = ecore_job_add
|
|
|
|
(_ecore_evas_wl_common_wm_rot_manual_rotation_done_job, ee);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_ecore_evas_wl_common_wm_rot_manual_rotation_done_timeout(void *data)
|
|
|
|
{
|
|
|
|
Ecore_Evas *ee = data;
|
|
|
|
|
|
|
|
ee->prop.wm_rot.manual_mode.timer = NULL;
|
|
|
|
_ecore_evas_wl_common_wm_rot_manual_rotation_done(ee);
|
|
|
|
return ECORE_CALLBACK_CANCEL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ecore_evas_wl_common_wm_rot_manual_rotation_done_timeout_update(Ecore_Evas *ee)
|
|
|
|
{
|
|
|
|
if (ee->prop.wm_rot.manual_mode.timer)
|
|
|
|
ecore_timer_del(ee->prop.wm_rot.manual_mode.timer);
|
|
|
|
|
|
|
|
ee->prop.wm_rot.manual_mode.timer = ecore_timer_add
|
|
|
|
(4.0f, _ecore_evas_wl_common_wm_rot_manual_rotation_done_timeout, ee);
|
|
|
|
}
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
static Eina_Bool
|
2012-11-25 01:55:32 -08:00
|
|
|
_ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
2012-10-08 07:09:53 -07:00
|
|
|
{
|
|
|
|
Ecore_Evas *ee;
|
2013-04-30 12:29:00 -07:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
2015-09-28 10:42:38 -07:00
|
|
|
Ecore_Wl2_Event_Window_Configure *ev;
|
2018-08-08 11:58:44 -07:00
|
|
|
int nw = 0, nh = 0, fw, fh, pfw, pfh, sw, sh, contentw, contenth;
|
2018-11-28 12:19:56 -08:00
|
|
|
int ww, wh;
|
2018-02-08 12:36:16 -08:00
|
|
|
int framew, frameh;
|
2018-08-08 11:58:44 -07:00
|
|
|
Eina_Bool active, prev_max, prev_full, state_change = EINA_FALSE;
|
2012-10-08 07:09:53 -07:00
|
|
|
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
ev = event;
|
2018-07-06 07:16:21 -07:00
|
|
|
ee = ecore_event_window_match((Ecore_Window)ev->win);
|
2012-10-08 07:09:53 -07:00
|
|
|
if (!ee) return ECORE_CALLBACK_PASS_ON;
|
2018-07-06 07:16:21 -07:00
|
|
|
if ((Ecore_Window)ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
2012-10-08 07:09:53 -07:00
|
|
|
|
2013-04-30 12:29:00 -07:00
|
|
|
wdata = ee->engine.data;
|
|
|
|
if (!wdata) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
2017-09-29 14:17:18 -07:00
|
|
|
if (!ecore_wl2_window_resizing_get(wdata->win) && !wdata->resizing)
|
2017-08-04 13:17:53 -07:00
|
|
|
wdata->cw = wdata->ch = 0;
|
|
|
|
|
2013-04-30 12:29:00 -07:00
|
|
|
prev_max = ee->prop.maximized;
|
|
|
|
prev_full = ee->prop.fullscreen;
|
2017-01-10 06:44:53 -08:00
|
|
|
ee->prop.maximized =
|
|
|
|
(ev->states & ECORE_WL2_WINDOW_STATE_MAXIMIZED) == ECORE_WL2_WINDOW_STATE_MAXIMIZED;
|
|
|
|
ee->prop.fullscreen =
|
|
|
|
(ev->states & ECORE_WL2_WINDOW_STATE_FULLSCREEN) == ECORE_WL2_WINDOW_STATE_FULLSCREEN;
|
2017-05-17 13:02:53 -07:00
|
|
|
active = wdata->activated;
|
|
|
|
wdata->activated = ecore_wl2_window_activated_get(wdata->win);
|
2013-04-30 12:29:00 -07:00
|
|
|
|
2018-07-25 13:47:52 -07:00
|
|
|
/* If the compositor set these, we need to update internal state
|
|
|
|
* so things like CSD continue to function */
|
|
|
|
wdata->win->set_config.maximized = ee->prop.maximized;
|
|
|
|
wdata->win->set_config.fullscreen = ee->prop.fullscreen;
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
nw = ev->w;
|
|
|
|
nh = ev->h;
|
2013-10-31 10:21:33 -07:00
|
|
|
|
2018-12-05 08:34:01 -08:00
|
|
|
ecore_evas_geometry_get(ee, NULL, NULL, &ww, &wh);
|
2018-11-28 12:19:56 -08:00
|
|
|
|
2018-02-08 12:36:16 -08:00
|
|
|
sw = ee->shadow.l + ee->shadow.r;
|
|
|
|
sh = ee->shadow.t + ee->shadow.b;
|
|
|
|
evas_output_framespace_get(ee->evas, NULL, NULL, &framew, &frameh);
|
2018-11-28 12:19:56 -08:00
|
|
|
contentw = ww - (framew - sw);
|
|
|
|
contenth = wh - (frameh - sh);
|
|
|
|
pfw = fw = ww - contentw;
|
|
|
|
pfh = fh = wh - contenth;
|
2016-04-07 11:14:14 -07:00
|
|
|
|
2015-11-17 15:21:11 -08:00
|
|
|
if ((prev_max != ee->prop.maximized) ||
|
2017-05-17 13:02:53 -07:00
|
|
|
(prev_full != ee->prop.fullscreen) ||
|
|
|
|
(active != wdata->activated))
|
2016-04-07 11:14:14 -07:00
|
|
|
{
|
2018-08-08 11:58:44 -07:00
|
|
|
state_change = EINA_TRUE;
|
2016-04-07 11:14:14 -07:00
|
|
|
_ecore_evas_wl_common_state_update(ee);
|
2018-02-08 12:36:16 -08:00
|
|
|
sw = ee->shadow.l + ee->shadow.r;
|
|
|
|
sh = ee->shadow.t + ee->shadow.b;
|
|
|
|
evas_output_framespace_get(ee->evas, NULL, NULL, &framew, &frameh);
|
2018-11-28 12:19:56 -08:00
|
|
|
contentw = ww - (framew - sw);
|
|
|
|
contenth = wh - (frameh - sh);
|
|
|
|
fw = ww - contentw;
|
|
|
|
fh = wh - contenth;
|
2016-04-07 11:14:14 -07:00
|
|
|
}
|
2017-03-10 12:54:34 -08:00
|
|
|
if ((!nw) && (!nh))
|
2018-08-08 11:58:44 -07:00
|
|
|
{
|
|
|
|
if ((wdata->win->set_config.serial != wdata->win->req_config.serial) &&
|
|
|
|
wdata->win->req_config.serial && wdata->win->surface &&
|
|
|
|
((!state_change) || ((pfw == fw) && (pfh == fh))))
|
|
|
|
{
|
2018-08-08 11:58:47 -07:00
|
|
|
ecore_wl2_window_commit(wdata->win, EINA_TRUE);
|
2018-08-08 11:58:44 -07:00
|
|
|
}
|
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
2017-01-10 08:28:40 -08:00
|
|
|
|
2017-10-16 14:17:29 -07:00
|
|
|
if (!ee->prop.borderless)
|
|
|
|
{
|
|
|
|
nw -= fw;
|
|
|
|
nh -= fh;
|
|
|
|
}
|
2013-11-15 00:11:09 -08:00
|
|
|
|
2015-11-17 15:21:11 -08:00
|
|
|
if (ee->prop.fullscreen || (ee->req.w != nw) || (ee->req.h != nh))
|
2017-08-04 13:17:53 -07:00
|
|
|
{
|
2017-09-29 14:17:18 -07:00
|
|
|
if (ecore_wl2_window_resizing_get(wdata->win) || wdata->resizing)
|
2017-08-04 13:17:53 -07:00
|
|
|
{
|
|
|
|
if ((wdata->cw != nw) || (wdata->ch != nh))
|
|
|
|
_ecore_evas_wl_common_resize(ee, nw, nh);
|
|
|
|
wdata->cw = nw, wdata->ch = nh;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
_ecore_evas_wl_common_resize(ee, nw, nh);
|
|
|
|
}
|
2017-09-29 14:17:18 -07:00
|
|
|
wdata->resizing = ecore_wl2_window_resizing_get(wdata->win);
|
2013-11-15 00:11:09 -08:00
|
|
|
|
2017-06-09 08:06:05 -07:00
|
|
|
if (ee->prop.wm_rot.supported)
|
|
|
|
{
|
|
|
|
if (wdata->wm_rot.prepare)
|
|
|
|
{
|
|
|
|
if ((ee->prop.wm_rot.w == nw) &&
|
|
|
|
(ee->prop.wm_rot.h == nh))
|
|
|
|
{
|
|
|
|
ee->prop.wm_rot.win_resize = EINA_FALSE;
|
|
|
|
wdata->wm_rot.configure_coming = EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (wdata->wm_rot.request)
|
|
|
|
{
|
|
|
|
if ((wdata->wm_rot.configure_coming) &&
|
|
|
|
(ee->prop.wm_rot.w == nw) &&
|
|
|
|
(ee->prop.wm_rot.h == nh))
|
|
|
|
{
|
|
|
|
wdata->wm_rot.configure_coming = EINA_FALSE;
|
|
|
|
|
|
|
|
if (ee->prop.wm_rot.manual_mode.set)
|
|
|
|
{
|
|
|
|
ee->prop.wm_rot.manual_mode.wait_for_done = EINA_TRUE;
|
|
|
|
_ecore_evas_wl_common_wm_rot_manual_rotation_done_timeout_update(ee);
|
|
|
|
}
|
|
|
|
|
|
|
|
_ecore_evas_wl_common_rotation_set(ee,
|
|
|
|
ee->prop.wm_rot.angle,
|
|
|
|
EINA_TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-12 12:58:01 -08:00
|
|
|
_ecore_evas_wayland_window_update(ee, wdata, ee->alpha);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
2017-01-11 09:23:53 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_ecore_evas_wl_common_cb_window_configure_complete(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Ecore_Evas *ee;
|
|
|
|
Ecore_Wl2_Event_Window_Configure_Complete *ev;
|
|
|
|
Evas_Engine_Info_Wayland *einfo;
|
2017-10-30 12:23:07 -07:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
2017-01-11 09:23:53 -08:00
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
ev = event;
|
2018-07-06 07:16:21 -07:00
|
|
|
ee = ecore_event_window_match((Ecore_Window)ev->win);
|
2017-01-11 09:23:53 -08:00
|
|
|
if (!ee) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
2018-07-06 07:16:21 -07:00
|
|
|
if ((Ecore_Window)ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
2017-01-11 09:23:53 -08:00
|
|
|
|
|
|
|
einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas);
|
|
|
|
if (!einfo) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
|
|
|
einfo->info.hidden = EINA_FALSE;
|
|
|
|
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
|
|
|
|
ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
|
|
|
|
|
2017-10-30 12:23:07 -07:00
|
|
|
wdata = ee->engine.data;
|
2018-04-12 11:44:10 -07:00
|
|
|
ee->draw_block = EINA_FALSE;
|
2017-10-30 12:23:07 -07:00
|
|
|
if (wdata->frame) ecore_evas_manual_render(ee);
|
2017-08-18 12:13:11 -07:00
|
|
|
|
2017-01-11 09:23:53 -08:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
2017-08-04 13:08:42 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_ecore_evas_wl_common_cb_aux_message(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Ecore_Evas *ee;
|
|
|
|
Ecore_Wl2_Event_Aux_Message *ev;
|
|
|
|
|
|
|
|
ev = event;
|
2018-07-06 07:16:21 -07:00
|
|
|
ee = ecore_event_window_match((Ecore_Window)ev->win);
|
2017-08-04 13:08:42 -07:00
|
|
|
if (!ee) return ECORE_CALLBACK_PASS_ON;
|
2018-07-06 07:16:21 -07:00
|
|
|
if ((Ecore_Window)ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
2017-08-04 13:08:42 -07:00
|
|
|
if (eina_streq(ev->key, "stack_del"))
|
|
|
|
{
|
|
|
|
if (ee->func.fn_delete_request)
|
|
|
|
ee->func.fn_delete_request(ee);
|
|
|
|
}
|
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
|
|
|
|
2017-07-28 12:44:43 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_ecore_evas_wl_common_cb_aux_hint_supported(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Ecore_Evas *ee;
|
|
|
|
Ecore_Wl2_Event_Aux_Hint_Supported *ev;
|
|
|
|
Eina_Stringshare *hint;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
|
|
|
ev = event;
|
2018-07-06 07:16:21 -07:00
|
|
|
ee = ecore_event_window_match((Ecore_Window)ev->win);
|
2017-07-28 12:44:43 -07:00
|
|
|
if (!ee) return ECORE_CALLBACK_PASS_ON;
|
2018-07-06 07:16:21 -07:00
|
|
|
if ((Ecore_Window)ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
2017-07-28 12:44:43 -07:00
|
|
|
wdata = ee->engine.data;
|
|
|
|
EINA_LIST_FREE(ee->prop.aux_hint.supported_list, hint) eina_stringshare_del(hint);
|
|
|
|
ee->prop.aux_hint.supported_list = ecore_wl2_window_aux_hints_supported_get(wdata->win);
|
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_ecore_evas_wl_common_cb_aux_hint_allowed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Ecore_Evas *ee;
|
|
|
|
Ecore_Wl2_Event_Aux_Hint_Allowed *ev;
|
|
|
|
Eina_List *l;
|
|
|
|
Ecore_Evas_Aux_Hint *aux;
|
|
|
|
|
|
|
|
ev = event;
|
2018-07-06 07:16:21 -07:00
|
|
|
ee = ecore_event_window_match((Ecore_Window)ev->win);
|
2017-07-28 12:44:43 -07:00
|
|
|
if (!ee) return ECORE_CALLBACK_PASS_ON;
|
2018-07-06 07:16:21 -07:00
|
|
|
if ((Ecore_Window)ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
2017-07-28 12:44:43 -07:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ee->prop.aux_hint.hints, l, aux)
|
|
|
|
{
|
|
|
|
if (aux->id == ev->id)
|
|
|
|
{
|
|
|
|
aux->allowed = 1;
|
|
|
|
if (!aux->notified)
|
|
|
|
{
|
|
|
|
_ecore_evas_wl_common_state_update(ee);
|
|
|
|
aux->notified = 1;
|
2017-08-08 07:00:11 -07:00
|
|
|
}
|
2017-07-28 12:44:43 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
2017-06-09 08:06:05 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_ecore_evas_wl_common_cb_window_rotate(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Ecore_Evas *ee;
|
|
|
|
Ecore_Wl2_Event_Window_Rotation *ev;
|
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
ev = event;
|
2018-07-06 07:16:21 -07:00
|
|
|
ee = ecore_event_window_match((Ecore_Window)ev->win);
|
2017-06-09 08:06:05 -07:00
|
|
|
if (!ee) return ECORE_CALLBACK_PASS_ON;
|
2018-07-06 07:16:21 -07:00
|
|
|
if ((Ecore_Window)ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
2017-06-09 08:06:05 -07:00
|
|
|
_ecore_evas_wl_common_rotation_set(ee, ev->rotation, ev->resize);
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
2016-11-30 07:29:19 -08:00
|
|
|
static void
|
|
|
|
_mouse_move_dispatch(Ecore_Evas *ee)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Cursor *cursor;
|
|
|
|
Eina_Iterator *itr = eina_hash_iterator_data_new(ee->prop.cursors);
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(itr);
|
|
|
|
|
|
|
|
EINA_ITERATOR_FOREACH(itr, cursor)
|
|
|
|
_ecore_evas_mouse_move_process(ee, cursor->pos_x, cursor->pos_y,
|
|
|
|
ecore_loop_time_get());
|
|
|
|
eina_iterator_free(itr);
|
|
|
|
}
|
|
|
|
|
2013-05-06 10:48:03 -07:00
|
|
|
static void
|
|
|
|
_rotation_do(Ecore_Evas *ee, int rotation, int resize)
|
2013-04-24 11:21:44 -07:00
|
|
|
{
|
2017-02-13 10:37:06 -08:00
|
|
|
Evas_Engine_Info_Wayland *einfo;
|
2013-04-24 11:21:44 -07:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
int rot_dif;
|
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
|
2017-02-13 10:37:06 -08:00
|
|
|
einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas);
|
|
|
|
if (einfo)
|
|
|
|
{
|
|
|
|
einfo->info.rotation = rotation;
|
|
|
|
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
|
|
|
|
ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
|
|
|
|
}
|
|
|
|
|
2013-09-16 23:37:07 -07:00
|
|
|
/* calculate difference in rotation */
|
2013-04-24 11:21:44 -07:00
|
|
|
rot_dif = ee->rotation - rotation;
|
|
|
|
if (rot_dif < 0) rot_dif = -rot_dif;
|
|
|
|
|
2013-09-16 23:37:07 -07:00
|
|
|
/* set ecore_wayland window rotation */
|
2015-09-28 10:42:38 -07:00
|
|
|
ecore_wl2_window_rotation_set(wdata->win, rotation);
|
2013-09-16 23:37:07 -07:00
|
|
|
|
|
|
|
/* check if rotation is just a flip */
|
2013-04-24 11:21:44 -07:00
|
|
|
if (rot_dif != 180)
|
|
|
|
{
|
2013-09-16 23:37:07 -07:00
|
|
|
int minw, minh, maxw, maxh;
|
|
|
|
int basew, baseh, stepw, steph;
|
2013-04-24 11:21:44 -07:00
|
|
|
|
2013-09-16 23:37:07 -07:00
|
|
|
/* check if we are rotating with resize */
|
2013-04-24 11:21:44 -07:00
|
|
|
if (!resize)
|
|
|
|
{
|
2013-09-16 23:37:07 -07:00
|
|
|
int fw, fh;
|
2013-11-26 08:01:35 -08:00
|
|
|
int ww, hh;
|
2013-09-16 23:37:07 -07:00
|
|
|
|
|
|
|
/* grab framespace width & height */
|
|
|
|
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
|
|
|
|
|
|
|
|
/* check for fullscreen */
|
2017-05-17 13:02:53 -07:00
|
|
|
if (ee->prop.fullscreen)
|
2013-09-16 23:37:07 -07:00
|
|
|
{
|
|
|
|
/* resize the canvas based on rotation */
|
2014-01-18 05:04:25 -08:00
|
|
|
if ((rotation == 0) || (rotation == 180))
|
2013-04-24 13:14:15 -07:00
|
|
|
{
|
2013-09-16 23:37:07 -07:00
|
|
|
/* resize the canvas */
|
|
|
|
evas_output_size_set(ee->evas, ee->req.w, ee->req.h);
|
2020-01-05 06:05:36 -08:00
|
|
|
evas_output_viewport_set(ee->evas, 0, 0,
|
2013-09-16 23:37:07 -07:00
|
|
|
ee->req.w, ee->req.h);
|
2013-04-30 23:32:54 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-09-16 23:37:07 -07:00
|
|
|
/* resize the canvas */
|
|
|
|
evas_output_size_set(ee->evas, ee->req.h, ee->req.w);
|
2020-01-05 06:05:36 -08:00
|
|
|
evas_output_viewport_set(ee->evas, 0, 0,
|
2013-09-16 23:37:07 -07:00
|
|
|
ee->req.h, ee->req.w);
|
2013-04-24 13:14:15 -07:00
|
|
|
}
|
2013-04-24 11:21:44 -07:00
|
|
|
}
|
2013-09-16 23:37:07 -07:00
|
|
|
|
|
|
|
/* add canvas damage */
|
2014-01-18 05:26:10 -08:00
|
|
|
if (ECORE_EVAS_PORTRAIT(ee))
|
2013-09-16 23:37:07 -07:00
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
|
2013-04-24 11:21:44 -07:00
|
|
|
else
|
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.h, ee->req.w);
|
2013-11-26 08:01:35 -08:00
|
|
|
ww = ee->h;
|
|
|
|
hh = ee->w;
|
|
|
|
ee->w = ww;
|
|
|
|
ee->h = hh;
|
|
|
|
ee->req.w = ww;
|
|
|
|
ee->req.h = hh;
|
2013-04-24 11:21:44 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-09-16 23:37:07 -07:00
|
|
|
/* resize the canvas based on rotation */
|
2014-01-18 05:04:25 -08:00
|
|
|
if ((rotation == 0) || (rotation == 180))
|
2013-04-24 11:21:44 -07:00
|
|
|
{
|
|
|
|
evas_output_size_set(ee->evas, ee->w, ee->h);
|
|
|
|
evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_output_size_set(ee->evas, ee->h, ee->w);
|
|
|
|
evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
|
|
|
|
}
|
2013-09-16 23:37:07 -07:00
|
|
|
|
|
|
|
/* call the ecore_evas' resize function */
|
2013-04-24 11:21:44 -07:00
|
|
|
if (ee->func.fn_resize) ee->func.fn_resize(ee);
|
2013-09-16 23:37:07 -07:00
|
|
|
|
|
|
|
/* add canvas damage */
|
2014-01-18 05:26:10 -08:00
|
|
|
if (ECORE_EVAS_PORTRAIT(ee))
|
2013-04-24 11:21:44 -07:00
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
|
2013-09-16 23:37:07 -07:00
|
|
|
else
|
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
|
2013-04-24 11:21:44 -07:00
|
|
|
}
|
2013-09-16 23:37:07 -07:00
|
|
|
|
|
|
|
/* get min, max, base, & step sizes */
|
2013-04-24 11:21:44 -07:00
|
|
|
ecore_evas_size_min_get(ee, &minw, &minh);
|
|
|
|
ecore_evas_size_max_get(ee, &maxw, &maxh);
|
|
|
|
ecore_evas_size_base_get(ee, &basew, &baseh);
|
|
|
|
ecore_evas_size_step_get(ee, &stepw, &steph);
|
2013-09-16 23:37:07 -07:00
|
|
|
|
|
|
|
/* record the current rotation of the ecore_evas */
|
2013-04-24 11:21:44 -07:00
|
|
|
ee->rotation = rotation;
|
2013-09-16 23:37:07 -07:00
|
|
|
|
|
|
|
/* reset min, max, base, & step sizes */
|
2013-04-24 11:21:44 -07:00
|
|
|
ecore_evas_size_min_set(ee, minh, minw);
|
|
|
|
ecore_evas_size_max_set(ee, maxh, maxw);
|
|
|
|
ecore_evas_size_base_set(ee, baseh, basew);
|
|
|
|
ecore_evas_size_step_set(ee, steph, stepw);
|
2013-09-16 23:37:07 -07:00
|
|
|
|
|
|
|
/* send a mouse_move process
|
2013-11-26 08:10:15 -08:00
|
|
|
*
|
|
|
|
* NB: Is This Really Needed ?
|
|
|
|
* Yes, it's required to update the mouse position, relatively to
|
|
|
|
* widgets. After a rotation change, e.g., the mouse might not be over
|
|
|
|
* a button anymore. */
|
2016-11-30 07:29:19 -08:00
|
|
|
_mouse_move_dispatch(ee);
|
2013-04-24 11:21:44 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-09-16 23:37:07 -07:00
|
|
|
/* record the current rotation of the ecore_evas */
|
2013-04-24 11:21:44 -07:00
|
|
|
ee->rotation = rotation;
|
2013-09-16 23:37:07 -07:00
|
|
|
|
|
|
|
/* send a mouse_move process
|
2013-11-26 08:10:15 -08:00
|
|
|
*
|
|
|
|
* NB: Is This Really Needed ? Yes, it's required to update the mouse
|
|
|
|
* position, relatively to widgets. */
|
2016-11-30 07:29:19 -08:00
|
|
|
_mouse_move_dispatch(ee);
|
2013-09-16 23:37:07 -07:00
|
|
|
|
|
|
|
/* call the ecore_evas' resize function */
|
2013-04-24 11:21:44 -07:00
|
|
|
if (ee->func.fn_resize) ee->func.fn_resize(ee);
|
|
|
|
|
2013-09-16 23:37:07 -07:00
|
|
|
/* add canvas damage */
|
2014-01-18 05:26:10 -08:00
|
|
|
if (ECORE_EVAS_PORTRAIT(ee))
|
2013-04-24 11:21:44 -07:00
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
|
2013-09-16 23:37:07 -07:00
|
|
|
else
|
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
|
2013-04-24 11:21:44 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-24 10:44:21 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_ecore_evas_wl_common_cb_www_drag(void *d EINA_UNUSED, int t EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Event_Window_WWW_Drag *ev = event;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
Ecore_Evas *ee;
|
|
|
|
|
2018-07-06 07:16:21 -07:00
|
|
|
ee = ecore_event_window_match((Ecore_Window)ev->window);
|
2016-03-24 10:44:21 -07:00
|
|
|
if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
|
2018-07-06 07:16:21 -07:00
|
|
|
if ((Ecore_Window)ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
2016-03-24 10:44:21 -07:00
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
wdata->dragging = !!ev->dragging;
|
|
|
|
if (!ev->dragging)
|
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
|
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_ecore_evas_wl_common_cb_www(void *d EINA_UNUSED, int t EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Event_Window_WWW *ev = event;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
Ecore_Evas *ee;
|
|
|
|
|
2018-07-06 07:16:21 -07:00
|
|
|
ee = ecore_event_window_match((Ecore_Window)ev->window);
|
2016-03-24 10:44:21 -07:00
|
|
|
if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
|
2018-07-06 07:16:21 -07:00
|
|
|
if ((Ecore_Window)ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
2016-03-24 10:44:21 -07:00
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
wdata->x_rel += ev->x_rel;
|
|
|
|
wdata->y_rel += ev->y_rel;
|
|
|
|
wdata->timestamp = ev->timestamp;
|
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
|
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
|
|
|
|
2016-10-06 13:43:12 -07:00
|
|
|
static void
|
|
|
|
_ecore_evas_wl_common_cb_device_event_free(void *user_data, void *func_data)
|
|
|
|
{
|
|
|
|
efl_unref(user_data);
|
|
|
|
free(func_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ecore_evas_wl_common_device_event_add(int event_type, Ecore_Wl2_Device_Type device_type, unsigned int id, Evas_Device *dev, Ecore_Evas *ee)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Event_Device *ev;
|
|
|
|
|
|
|
|
ev = calloc(1, sizeof(Ecore_Wl2_Event_Device));
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(ev);
|
|
|
|
|
|
|
|
ev->dev = efl_ref(dev);
|
|
|
|
ev->type = device_type;
|
|
|
|
ev->seat_id = id;
|
2018-07-06 07:16:21 -07:00
|
|
|
ev->window = (Ecore_Wl2_Window *)ee->prop.window;
|
2016-10-06 13:43:12 -07:00
|
|
|
|
2017-01-10 06:44:53 -08:00
|
|
|
ecore_event_add(event_type, ev,
|
|
|
|
_ecore_evas_wl_common_cb_device_event_free, dev);
|
2016-10-06 13:43:12 -07:00
|
|
|
}
|
|
|
|
|
Ecore Evas Wayland: Create the devices during Ecore_Evas setup.
Summary:
When launching an Elementary App using Wayland the elm_config will
automatically connect to the Wayland's display server and all events
regarding seats are lost, since by the time that Ecore_Evas is created
the global events were already dispatched. To fix this problem,
everytime an Ecore_Evas is created, the code must check if there
are any seat capabilities available, if so, the devices will be created.
Reviewers: bdilly, barbieri, cedric, jpeg
Subscribers: devilhorns, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4390
2016-11-13 18:03:56 -08:00
|
|
|
static EE_Wl_Device *
|
2018-05-08 11:26:57 -07:00
|
|
|
_ecore_evas_wl_common_seat_add(Ecore_Evas *ee, unsigned int id, const char *name)
|
Ecore Evas Wayland: Create the devices during Ecore_Evas setup.
Summary:
When launching an Elementary App using Wayland the elm_config will
automatically connect to the Wayland's display server and all events
regarding seats are lost, since by the time that Ecore_Evas is created
the global events were already dispatched. To fix this problem,
everytime an Ecore_Evas is created, the code must check if there
are any seat capabilities available, if so, the devices will be created.
Reviewers: bdilly, barbieri, cedric, jpeg
Subscribers: devilhorns, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4390
2016-11-13 18:03:56 -08:00
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
EE_Wl_Device *device;
|
|
|
|
Evas_Device *dev;
|
2016-11-16 11:04:02 -08:00
|
|
|
char buf[32];
|
Ecore Evas Wayland: Create the devices during Ecore_Evas setup.
Summary:
When launching an Elementary App using Wayland the elm_config will
automatically connect to the Wayland's display server and all events
regarding seats are lost, since by the time that Ecore_Evas is created
the global events were already dispatched. To fix this problem,
everytime an Ecore_Evas is created, the code must check if there
are any seat capabilities available, if so, the devices will be created.
Reviewers: bdilly, barbieri, cedric, jpeg
Subscribers: devilhorns, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4390
2016-11-13 18:03:56 -08:00
|
|
|
|
|
|
|
device = calloc(1, sizeof(EE_Wl_Device));
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(device, NULL);
|
|
|
|
|
2018-05-08 11:26:57 -07:00
|
|
|
if (!name)
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "seat-%u", id);
|
|
|
|
name = buf;
|
|
|
|
}
|
2017-01-10 06:44:53 -08:00
|
|
|
dev =
|
2018-05-08 11:26:57 -07:00
|
|
|
evas_device_add_full(ee->evas, name, "Wayland seat", NULL, NULL,
|
2017-01-10 06:44:53 -08:00
|
|
|
EVAS_DEVICE_CLASS_SEAT, EVAS_DEVICE_SUBCLASS_NONE);
|
Ecore Evas Wayland: Create the devices during Ecore_Evas setup.
Summary:
When launching an Elementary App using Wayland the elm_config will
automatically connect to the Wayland's display server and all events
regarding seats are lost, since by the time that Ecore_Evas is created
the global events were already dispatched. To fix this problem,
everytime an Ecore_Evas is created, the code must check if there
are any seat capabilities available, if so, the devices will be created.
Reviewers: bdilly, barbieri, cedric, jpeg
Subscribers: devilhorns, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4390
2016-11-13 18:03:56 -08:00
|
|
|
EINA_SAFETY_ON_NULL_GOTO(dev, err_dev);
|
2017-05-17 13:02:53 -07:00
|
|
|
evas_device_seat_id_set(dev, id);
|
Ecore Evas Wayland: Create the devices during Ecore_Evas setup.
Summary:
When launching an Elementary App using Wayland the elm_config will
automatically connect to the Wayland's display server and all events
regarding seats are lost, since by the time that Ecore_Evas is created
the global events were already dispatched. To fix this problem,
everytime an Ecore_Evas is created, the code must check if there
are any seat capabilities available, if so, the devices will be created.
Reviewers: bdilly, barbieri, cedric, jpeg
Subscribers: devilhorns, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4390
2016-11-13 18:03:56 -08:00
|
|
|
device->seat = dev;
|
|
|
|
device->id = id;
|
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
wdata->devices_list = eina_list_append(wdata->devices_list, device);
|
|
|
|
|
|
|
|
_ecore_evas_wl_common_device_event_add(ECORE_WL2_EVENT_DEVICE_ADDED,
|
|
|
|
ECORE_WL2_DEVICE_TYPE_SEAT,
|
|
|
|
id, dev, ee);
|
|
|
|
return device;
|
|
|
|
err_dev:
|
|
|
|
free(device);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-10-03 08:34:10 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_ecore_evas_wl_common_cb_global_added(void *d EINA_UNUSED, int t EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Event_Global *ev = event;
|
|
|
|
Ecore_Evas *ee;
|
2016-11-24 12:26:50 -08:00
|
|
|
Eina_List *l, *ll;
|
|
|
|
EE_Wl_Device *device;
|
2016-10-03 08:34:10 -07:00
|
|
|
|
|
|
|
if ((!ev->interface) || (strcmp(ev->interface, "wl_seat")))
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ee_list, l, ee)
|
|
|
|
{
|
2016-11-24 12:26:50 -08:00
|
|
|
Eina_Bool already_present = EINA_FALSE;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
|
|
|
|
|
2017-06-02 15:23:44 -07:00
|
|
|
if (ev->display != wdata->display) continue;
|
2016-11-24 12:26:50 -08:00
|
|
|
EINA_LIST_FOREACH(wdata->devices_list, ll, device)
|
|
|
|
{
|
|
|
|
if (device->id == ev->id)
|
|
|
|
{
|
|
|
|
already_present = EINA_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (already_present)
|
|
|
|
continue;
|
|
|
|
|
2018-05-08 11:26:57 -07:00
|
|
|
if (!_ecore_evas_wl_common_seat_add(ee, ev->id, NULL))
|
2016-11-16 11:04:02 -08:00
|
|
|
break;
|
2016-10-03 08:34:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ecore_evas_wl_common_device_free(EE_Wl_Device *device)
|
|
|
|
{
|
|
|
|
if (device->seat)
|
|
|
|
evas_device_del(device->seat);
|
2016-10-05 06:36:19 -07:00
|
|
|
if (device->pointer)
|
|
|
|
evas_device_del(device->pointer);
|
|
|
|
if (device->keyboard)
|
|
|
|
evas_device_del(device->keyboard);
|
|
|
|
if (device->touch)
|
|
|
|
evas_device_del(device->touch);
|
2016-10-03 08:34:10 -07:00
|
|
|
free(device);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_ecore_evas_wl_common_cb_global_removed(void *d EINA_UNUSED, int t EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Event_Global *ev = event;
|
|
|
|
Ecore_Evas *ee;
|
|
|
|
Eina_List *l, *ll;
|
|
|
|
|
|
|
|
if ((!ev->interface) || (strcmp(ev->interface, "wl_seat")))
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ee_list, l, ee)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
EE_Wl_Device *device;
|
|
|
|
Eina_Bool found = EINA_FALSE;
|
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
2017-06-02 15:23:44 -07:00
|
|
|
if (ev->display != wdata->display) continue;
|
2016-10-03 08:34:10 -07:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(wdata->devices_list, ll, device)
|
|
|
|
{
|
|
|
|
if (device->id == ev->id)
|
|
|
|
{
|
|
|
|
found = EINA_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (found)
|
|
|
|
{
|
2017-01-10 06:44:53 -08:00
|
|
|
_ecore_evas_wl_common_device_event_add
|
|
|
|
(ECORE_WL2_EVENT_DEVICE_REMOVED, ECORE_WL2_DEVICE_TYPE_SEAT,
|
|
|
|
ev->id, device->seat, ee);
|
|
|
|
|
|
|
|
wdata->devices_list =
|
|
|
|
eina_list_remove(wdata->devices_list, device);
|
|
|
|
|
2016-10-03 08:34:10 -07:00
|
|
|
_ecore_evas_wl_common_device_free(device);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
2016-10-04 11:19:51 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_ecore_evas_wl_common_cb_seat_name_changed(void *d EINA_UNUSED, int t EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Event_Seat_Name *ev = event;
|
|
|
|
Ecore_Evas *ee;
|
|
|
|
Eina_List *l, *ll;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ee_list, l, ee)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
EE_Wl_Device *device;
|
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
2017-06-02 15:23:44 -07:00
|
|
|
if (ev->display != wdata->display) continue;
|
2016-10-04 11:19:51 -07:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(wdata->devices_list, ll, device)
|
|
|
|
{
|
|
|
|
if (device->id == ev->id)
|
|
|
|
{
|
|
|
|
evas_device_name_set(device->seat, ev->name);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
2016-10-05 06:36:19 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_ecore_evas_wl_common_cb_seat_capabilities_changed(void *d EINA_UNUSED, int t EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Event_Seat_Capabilities *ev = event;
|
|
|
|
Ecore_Evas *ee;
|
|
|
|
Eina_List *l, *ll;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ee_list, l, ee)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
EE_Wl_Device *device;
|
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
2017-06-02 15:23:44 -07:00
|
|
|
if (ev->display != wdata->display) continue;
|
2016-10-05 06:36:19 -07:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(wdata->devices_list, ll, device)
|
|
|
|
{
|
|
|
|
if (device->id == ev->id)
|
|
|
|
{
|
|
|
|
if (ev->pointer_enabled && !device->pointer)
|
|
|
|
{
|
2017-01-10 06:44:53 -08:00
|
|
|
device->pointer =
|
|
|
|
evas_device_add_full(ee->evas, "Mouse",
|
|
|
|
"A wayland pointer device",
|
|
|
|
device->seat, NULL,
|
|
|
|
EVAS_DEVICE_CLASS_MOUSE,
|
|
|
|
EVAS_DEVICE_SUBCLASS_NONE);
|
|
|
|
|
|
|
|
_ecore_evas_wl_common_device_event_add
|
|
|
|
(ECORE_WL2_EVENT_DEVICE_ADDED,
|
|
|
|
ECORE_WL2_DEVICE_TYPE_POINTER,
|
|
|
|
ev->id, device->pointer, ee);
|
2016-10-05 06:36:19 -07:00
|
|
|
}
|
|
|
|
else if (!ev->pointer_enabled && device->pointer)
|
|
|
|
{
|
2017-01-10 06:44:53 -08:00
|
|
|
_ecore_evas_wl_common_device_event_add
|
2017-01-11 07:08:43 -08:00
|
|
|
(ECORE_WL2_EVENT_DEVICE_REMOVED,
|
ee_wayland: Fix device leak on disconnect
Summary:
A reference was taken on these when they were added, so by passing NULL
here we're not allowing that reference to be dropped. This results in
not only leaking the device forever, but also potentially leaving it as
a default device after it's removed so that no new attach will replace it.
Under weston all devices are removed on a VT switch, and when you switch
back the default device is wrong, which leads to problems with events
like "mouse in" which, for legacy reasons, don't take a seat, but
instead look up the default seat.
This allows the delete callback to be fired for the first time ever,
and while I've tried to fix some bugs this has revealed, I'm not
actually sure I've caught them all.
Depends on D6182
Reviewers: zmike
Reviewed By: zmike
Subscribers: cedric, zmike
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D6183
2018-05-18 10:46:47 -07:00
|
|
|
ECORE_WL2_DEVICE_TYPE_POINTER, ev->id,
|
|
|
|
device->pointer, ee);
|
2017-01-10 06:44:53 -08:00
|
|
|
|
2016-10-05 06:36:19 -07:00
|
|
|
evas_device_del(device->pointer);
|
|
|
|
device->pointer = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ev->keyboard_enabled && !device->keyboard)
|
|
|
|
{
|
2017-01-10 06:44:53 -08:00
|
|
|
device->keyboard =
|
|
|
|
evas_device_add_full(ee->evas, "Keyboard",
|
|
|
|
"A wayland keyboard device",
|
|
|
|
device->seat, NULL,
|
|
|
|
EVAS_DEVICE_CLASS_KEYBOARD,
|
|
|
|
EVAS_DEVICE_SUBCLASS_NONE);
|
|
|
|
|
|
|
|
_ecore_evas_wl_common_device_event_add
|
2017-01-11 07:08:43 -08:00
|
|
|
(ECORE_WL2_EVENT_DEVICE_ADDED,
|
|
|
|
ECORE_WL2_DEVICE_TYPE_KEYBOARD,
|
|
|
|
ev->id, device->keyboard, ee);
|
2016-10-05 06:36:19 -07:00
|
|
|
}
|
|
|
|
else if (!ev->keyboard_enabled && device->keyboard)
|
|
|
|
{
|
2017-01-10 06:44:53 -08:00
|
|
|
_ecore_evas_wl_common_device_event_add
|
2017-01-11 07:08:43 -08:00
|
|
|
(ECORE_WL2_EVENT_DEVICE_REMOVED,
|
ee_wayland: Fix device leak on disconnect
Summary:
A reference was taken on these when they were added, so by passing NULL
here we're not allowing that reference to be dropped. This results in
not only leaking the device forever, but also potentially leaving it as
a default device after it's removed so that no new attach will replace it.
Under weston all devices are removed on a VT switch, and when you switch
back the default device is wrong, which leads to problems with events
like "mouse in" which, for legacy reasons, don't take a seat, but
instead look up the default seat.
This allows the delete callback to be fired for the first time ever,
and while I've tried to fix some bugs this has revealed, I'm not
actually sure I've caught them all.
Depends on D6182
Reviewers: zmike
Reviewed By: zmike
Subscribers: cedric, zmike
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D6183
2018-05-18 10:46:47 -07:00
|
|
|
ECORE_WL2_DEVICE_TYPE_KEYBOARD, ev->id,
|
|
|
|
device->keyboard, ee);
|
2017-01-10 06:44:53 -08:00
|
|
|
|
2016-10-05 06:36:19 -07:00
|
|
|
evas_device_del(device->keyboard);
|
|
|
|
device->keyboard = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ev->touch_enabled && !device->touch)
|
|
|
|
{
|
2017-01-10 06:44:53 -08:00
|
|
|
device->touch =
|
|
|
|
evas_device_add_full(ee->evas, "Touch",
|
|
|
|
"A wayland touch device",
|
|
|
|
device->seat, NULL,
|
|
|
|
EVAS_DEVICE_CLASS_TOUCH,
|
|
|
|
EVAS_DEVICE_SUBCLASS_NONE);
|
|
|
|
|
|
|
|
_ecore_evas_wl_common_device_event_add
|
2017-01-11 07:08:43 -08:00
|
|
|
(ECORE_WL2_EVENT_DEVICE_ADDED,
|
|
|
|
ECORE_WL2_DEVICE_TYPE_TOUCH,
|
|
|
|
ev->id, device->touch, ee);
|
2016-10-05 06:36:19 -07:00
|
|
|
}
|
|
|
|
else if (!ev->touch_enabled && device->touch)
|
|
|
|
{
|
2017-01-10 06:44:53 -08:00
|
|
|
_ecore_evas_wl_common_device_event_add
|
2017-01-11 07:08:43 -08:00
|
|
|
(ECORE_WL2_EVENT_DEVICE_REMOVED,
|
|
|
|
ECORE_WL2_DEVICE_TYPE_TOUCH,
|
ee_wayland: Fix device leak on disconnect
Summary:
A reference was taken on these when they were added, so by passing NULL
here we're not allowing that reference to be dropped. This results in
not only leaking the device forever, but also potentially leaving it as
a default device after it's removed so that no new attach will replace it.
Under weston all devices are removed on a VT switch, and when you switch
back the default device is wrong, which leads to problems with events
like "mouse in" which, for legacy reasons, don't take a seat, but
instead look up the default seat.
This allows the delete callback to be fired for the first time ever,
and while I've tried to fix some bugs this has revealed, I'm not
actually sure I've caught them all.
Depends on D6182
Reviewers: zmike
Reviewed By: zmike
Subscribers: cedric, zmike
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D6183
2018-05-18 10:46:47 -07:00
|
|
|
ev->id, device->touch, ee);
|
2017-01-10 06:44:53 -08:00
|
|
|
|
2016-10-05 06:36:19 -07:00
|
|
|
evas_device_del(device->touch);
|
|
|
|
device->touch = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
2017-08-08 07:00:11 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_ecore_evas_wl_common_cb_iconify_state_change(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Ecore_Evas *ee;
|
|
|
|
Ecore_Wl2_Event_Window_Iconify_State_Change *ev;
|
|
|
|
|
|
|
|
ev = event;
|
2018-07-06 07:16:21 -07:00
|
|
|
ee = ecore_event_window_match((Ecore_Window)ev->win);
|
2017-08-08 07:00:11 -07:00
|
|
|
if (!ee) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
if (!ev->force) return ECORE_CALLBACK_PASS_ON;
|
2018-07-06 07:16:21 -07:00
|
|
|
if ((Ecore_Window)ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
2017-08-08 07:00:11 -07:00
|
|
|
|
|
|
|
if (ee->prop.iconified == ev->iconified)
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
|
|
|
ee->prop.iconified = ev->iconified;
|
|
|
|
_ecore_evas_wl_common_state_update(ee);
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static int
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_init(void)
|
|
|
|
{
|
2017-10-17 08:32:57 -07:00
|
|
|
Ecore_Event_Handler *h;
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
if (++_ecore_evas_wl_init_count != 1)
|
|
|
|
return _ecore_evas_wl_init_count;
|
|
|
|
|
2019-10-22 07:12:51 -07:00
|
|
|
_ecore_evas_wl_event_hdls = eina_array_new(1);
|
2019-10-22 07:06:23 -07:00
|
|
|
|
2017-10-17 08:32:57 -07:00
|
|
|
h = ecore_event_handler_add(ECORE_EVENT_MOUSE_IN,
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_cb_mouse_in, NULL);
|
2017-10-17 08:32:57 -07:00
|
|
|
eina_array_push(_ecore_evas_wl_event_hdls, h);
|
2019-10-22 07:06:23 -07:00
|
|
|
|
|
|
|
h = ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT,
|
|
|
|
_ecore_evas_wl_common_cb_mouse_out, NULL);
|
2017-10-17 08:32:57 -07:00
|
|
|
eina_array_push(_ecore_evas_wl_event_hdls, h);
|
2019-10-22 07:06:23 -07:00
|
|
|
|
|
|
|
h = ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_IN,
|
|
|
|
_ecore_evas_wl_common_cb_focus_in, NULL);
|
2017-10-17 08:32:57 -07:00
|
|
|
eina_array_push(_ecore_evas_wl_event_hdls, h);
|
2019-10-22 07:06:23 -07:00
|
|
|
|
|
|
|
h = ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_OUT,
|
|
|
|
_ecore_evas_wl_common_cb_focus_out, NULL);
|
2017-10-17 08:32:57 -07:00
|
|
|
eina_array_push(_ecore_evas_wl_event_hdls, h);
|
2019-10-22 07:06:23 -07:00
|
|
|
|
|
|
|
h = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE,
|
|
|
|
_ecore_evas_wl_common_cb_window_configure, NULL);
|
2017-10-17 08:32:57 -07:00
|
|
|
eina_array_push(_ecore_evas_wl_event_hdls, h);
|
2019-10-22 07:06:23 -07:00
|
|
|
|
|
|
|
h = ecore_event_handler_add(_ecore_wl2_event_window_www,
|
|
|
|
_ecore_evas_wl_common_cb_www, NULL);
|
2017-10-17 08:32:57 -07:00
|
|
|
eina_array_push(_ecore_evas_wl_event_hdls, h);
|
2019-10-22 07:06:23 -07:00
|
|
|
|
|
|
|
h = ecore_event_handler_add(_ecore_wl2_event_window_www_drag,
|
|
|
|
_ecore_evas_wl_common_cb_www_drag, NULL);
|
2017-10-17 08:32:57 -07:00
|
|
|
eina_array_push(_ecore_evas_wl_event_hdls, h);
|
2019-10-22 07:06:23 -07:00
|
|
|
|
|
|
|
h = ecore_event_handler_add(ECORE_WL2_EVENT_DISCONNECT,
|
|
|
|
_ecore_evas_wl_common_cb_disconnect, NULL);
|
2017-10-17 08:32:57 -07:00
|
|
|
eina_array_push(_ecore_evas_wl_event_hdls, h);
|
2019-10-22 07:06:23 -07:00
|
|
|
|
|
|
|
h = ecore_event_handler_add(ECORE_WL2_EVENT_GLOBAL_ADDED,
|
|
|
|
_ecore_evas_wl_common_cb_global_added, NULL);
|
2017-10-17 08:32:57 -07:00
|
|
|
eina_array_push(_ecore_evas_wl_event_hdls, h);
|
2019-10-22 07:06:23 -07:00
|
|
|
|
|
|
|
h = ecore_event_handler_add(ECORE_WL2_EVENT_GLOBAL_REMOVED,
|
|
|
|
_ecore_evas_wl_common_cb_global_removed, NULL);
|
2017-10-17 08:32:57 -07:00
|
|
|
eina_array_push(_ecore_evas_wl_event_hdls, h);
|
2019-10-22 07:06:23 -07:00
|
|
|
|
|
|
|
h = ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_NAME_CHANGED,
|
|
|
|
_ecore_evas_wl_common_cb_seat_name_changed, NULL);
|
2017-10-17 08:32:57 -07:00
|
|
|
eina_array_push(_ecore_evas_wl_event_hdls, h);
|
2019-10-22 07:06:23 -07:00
|
|
|
|
|
|
|
h = ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_CAPABILITIES_CHANGED,
|
|
|
|
_ecore_evas_wl_common_cb_seat_capabilities_changed,
|
|
|
|
NULL);
|
2017-10-17 08:32:57 -07:00
|
|
|
eina_array_push(_ecore_evas_wl_event_hdls, h);
|
2019-10-22 07:06:23 -07:00
|
|
|
|
|
|
|
h = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE,
|
|
|
|
_ecore_evas_wl_common_cb_window_configure_complete,
|
|
|
|
NULL);
|
2017-10-17 08:32:57 -07:00
|
|
|
eina_array_push(_ecore_evas_wl_event_hdls, h);
|
2019-10-22 07:06:23 -07:00
|
|
|
|
|
|
|
h = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ROTATE,
|
|
|
|
_ecore_evas_wl_common_cb_window_rotate, NULL);
|
2017-10-17 08:32:57 -07:00
|
|
|
eina_array_push(_ecore_evas_wl_event_hdls, h);
|
2019-10-22 07:06:23 -07:00
|
|
|
|
|
|
|
h = ecore_event_handler_add(ECORE_WL2_EVENT_AUX_HINT_ALLOWED,
|
|
|
|
_ecore_evas_wl_common_cb_aux_hint_allowed, NULL);
|
2017-10-17 08:32:57 -07:00
|
|
|
eina_array_push(_ecore_evas_wl_event_hdls, h);
|
2019-10-22 07:06:23 -07:00
|
|
|
|
|
|
|
h = ecore_event_handler_add(ECORE_WL2_EVENT_AUX_HINT_SUPPORTED,
|
|
|
|
_ecore_evas_wl_common_cb_aux_hint_supported, NULL);
|
2017-10-17 08:32:57 -07:00
|
|
|
eina_array_push(_ecore_evas_wl_event_hdls, h);
|
2019-10-22 07:06:23 -07:00
|
|
|
|
|
|
|
h = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE,
|
|
|
|
_ecore_evas_wl_common_cb_iconify_state_change, NULL);
|
2017-10-17 08:32:57 -07:00
|
|
|
eina_array_push(_ecore_evas_wl_event_hdls, h);
|
2019-10-22 07:06:23 -07:00
|
|
|
|
|
|
|
h = ecore_event_handler_add(ECORE_WL2_EVENT_AUX_MESSAGE,
|
|
|
|
_ecore_evas_wl_common_cb_aux_message, NULL);
|
2019-10-22 07:11:24 -07:00
|
|
|
eina_array_push(_ecore_evas_wl_event_hdls, h);
|
2016-10-03 08:34:10 -07:00
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
ecore_event_evas_init();
|
|
|
|
|
|
|
|
return _ecore_evas_wl_init_count;
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static int
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_shutdown(void)
|
|
|
|
{
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
if (--_ecore_evas_wl_init_count != 0)
|
|
|
|
return _ecore_evas_wl_init_count;
|
|
|
|
|
2017-10-17 08:32:57 -07:00
|
|
|
while (eina_array_count(_ecore_evas_wl_event_hdls))
|
|
|
|
ecore_event_handler_del(eina_array_pop(_ecore_evas_wl_event_hdls));
|
|
|
|
eina_array_free(_ecore_evas_wl_event_hdls);
|
|
|
|
_ecore_evas_wl_event_hdls = NULL;
|
2012-10-08 07:09:53 -07:00
|
|
|
|
|
|
|
ecore_event_evas_shutdown();
|
|
|
|
|
|
|
|
return _ecore_evas_wl_init_count;
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_free(Ecore_Evas *ee)
|
|
|
|
{
|
2012-12-05 13:15:42 -08:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
2016-10-03 08:34:10 -07:00
|
|
|
EE_Wl_Device *device;
|
2012-12-05 13:15:42 -08:00
|
|
|
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2015-01-05 06:09:02 -08:00
|
|
|
if (!ee) return;
|
2015-09-28 10:42:38 -07:00
|
|
|
|
2012-12-05 13:15:42 -08:00
|
|
|
wdata = ee->engine.data;
|
2016-05-05 07:45:59 -07:00
|
|
|
ee_list = eina_list_remove(ee_list, ee);
|
|
|
|
|
|
|
|
eina_list_free(wdata->regen_objs);
|
2017-08-18 12:13:11 -07:00
|
|
|
if (wdata->frame) ecore_wl2_window_frame_callback_del(wdata->frame);
|
|
|
|
wdata->frame = NULL;
|
2016-05-05 07:45:59 -07:00
|
|
|
ecore_event_handler_del(wdata->sync_handler);
|
2020-02-10 00:20:18 -08:00
|
|
|
ecore_event_handler_del(wdata->changed_handler);
|
|
|
|
ecore_event_handler_del(wdata->send_handler);
|
|
|
|
ecore_event_handler_del(wdata->offer_handler);
|
|
|
|
ecore_event_handler_del(wdata->dnd_leave_handler);
|
|
|
|
ecore_event_handler_del(wdata->dnd_enter_handler);
|
|
|
|
ecore_event_handler_del(wdata->dnd_motion_handler);
|
|
|
|
ecore_event_handler_del(wdata->dnd_drop_handler);
|
|
|
|
ecore_event_handler_del(wdata->dnd_end_handler);
|
|
|
|
|
2019-10-14 11:12:25 -07:00
|
|
|
if (wdata->win)
|
|
|
|
{
|
|
|
|
ecore_wl2_window_close_callback_set(wdata->win, NULL, NULL);
|
|
|
|
ecore_wl2_window_free(wdata->win);
|
|
|
|
wdata->win = NULL;
|
|
|
|
}
|
2015-09-28 10:42:38 -07:00
|
|
|
ecore_wl2_display_disconnect(wdata->display);
|
2016-10-03 07:19:22 -07:00
|
|
|
|
2016-10-03 08:34:10 -07:00
|
|
|
EINA_LIST_FREE(wdata->devices_list, device)
|
|
|
|
free(device);
|
|
|
|
|
2012-12-05 13:15:42 -08:00
|
|
|
free(wdata);
|
2012-10-08 07:09:53 -07:00
|
|
|
|
|
|
|
ecore_event_window_unregister(ee->prop.window);
|
|
|
|
|
|
|
|
_ecore_evas_wl_common_shutdown();
|
2015-09-28 10:42:38 -07:00
|
|
|
|
2017-04-25 08:59:33 -07:00
|
|
|
ecore_wl2_shutdown();
|
|
|
|
}
|
2012-10-08 07:09:53 -07:00
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2017-08-07 10:26:41 -07:00
|
|
|
_ecore_evas_wl_common_move_resize(Ecore_Evas *ee, int x EINA_UNUSED, int y EINA_UNUSED, int w, int h)
|
2017-04-25 08:59:33 -07:00
|
|
|
{
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2012-10-08 07:09:53 -07:00
|
|
|
|
2017-04-25 08:59:33 -07:00
|
|
|
if (!ee) return;
|
2016-11-01 05:42:23 -07:00
|
|
|
if ((ee->w != w) || (ee->h != h))
|
|
|
|
_ecore_evas_wl_common_resize(ee, w, h);
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
|
|
|
|
{
|
|
|
|
if (!ee) return;
|
|
|
|
ee->func.fn_resize = func;
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
|
|
|
|
{
|
|
|
|
if (!ee) return;
|
|
|
|
ee->func.fn_move = func;
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
|
|
|
|
{
|
|
|
|
if (!ee) return;
|
|
|
|
ee->func.fn_delete_request = func;
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
|
|
|
|
{
|
|
|
|
if (!ee) return;
|
|
|
|
ee->func.fn_focus_in = func;
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
|
|
|
|
{
|
|
|
|
if (!ee) return;
|
|
|
|
ee->func.fn_focus_out = func;
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
|
|
|
|
{
|
|
|
|
if (!ee) return;
|
|
|
|
ee->func.fn_mouse_in = func;
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_callback_mouse_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
|
|
|
|
{
|
|
|
|
if (!ee) return;
|
|
|
|
ee->func.fn_mouse_out = func;
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2015-09-28 10:42:38 -07:00
|
|
|
_ecore_evas_wl_common_pointer_xy_get(const Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y)
|
2013-07-08 03:02:58 -07:00
|
|
|
{
|
2015-09-28 10:42:38 -07:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
2017-05-17 13:02:53 -07:00
|
|
|
Ecore_Wl2_Input *input;
|
2015-09-28 10:42:38 -07:00
|
|
|
|
2013-07-08 03:02:58 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2015-09-28 10:42:38 -07:00
|
|
|
wdata = ee->engine.data;
|
2017-05-17 13:02:53 -07:00
|
|
|
input = ecore_wl2_display_input_find_by_name(ecore_wl2_window_display_get(wdata->win), "default");
|
|
|
|
if (input) ecore_wl2_input_pointer_xy_get(input, x, y);
|
2013-07-08 03:02:58 -07:00
|
|
|
}
|
|
|
|
|
2017-06-09 08:06:05 -07:00
|
|
|
static void
|
|
|
|
_ecore_evas_wl_common_wm_rot_preferred_rotation_set(Ecore_Evas *ee, int rot)
|
|
|
|
{
|
|
|
|
if (ee->prop.wm_rot.supported)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
if (!ee->prop.wm_rot.app_set)
|
|
|
|
{
|
|
|
|
ecore_wl2_window_rotation_app_set(wdata->win, EINA_TRUE);
|
|
|
|
ee->prop.wm_rot.app_set = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ecore_wl2_window_preferred_rotation_set(wdata->win, rot);
|
|
|
|
ee->prop.wm_rot.preferred_rot = rot;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ecore_evas_wl_common_wm_rot_available_rotations_set(Ecore_Evas *ee, const int *rots, unsigned int count)
|
|
|
|
{
|
|
|
|
if (ee->prop.wm_rot.supported)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
if (!ee->prop.wm_rot.app_set)
|
|
|
|
{
|
|
|
|
ecore_wl2_window_rotation_app_set(wdata->win, EINA_TRUE);
|
|
|
|
ee->prop.wm_rot.app_set = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ee->prop.wm_rot.available_rots)
|
|
|
|
{
|
|
|
|
free(ee->prop.wm_rot.available_rots);
|
|
|
|
ee->prop.wm_rot.available_rots = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ee->prop.wm_rot.count = 0;
|
|
|
|
|
|
|
|
if (count > 0)
|
|
|
|
{
|
|
|
|
ee->prop.wm_rot.available_rots = calloc(count, sizeof(int));
|
|
|
|
if (!ee->prop.wm_rot.available_rots) return;
|
|
|
|
|
|
|
|
memcpy(ee->prop.wm_rot.available_rots, rots, sizeof(int) * count);
|
|
|
|
}
|
|
|
|
|
|
|
|
ee->prop.wm_rot.count = count;
|
|
|
|
|
|
|
|
ecore_wl2_window_available_rotations_set(wdata->win, rots, count);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ecore_evas_wl_common_wm_rot_manual_rotation_done_set(Ecore_Evas *ee, Eina_Bool set)
|
|
|
|
{
|
|
|
|
ee->prop.wm_rot.manual_mode.set = set;
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2017-01-10 06:44:53 -08:00
|
|
|
_ecore_evas_wl_common_pointer_device_xy_get(const Ecore_Evas *ee, const Efl_Input_Device *pointer, Evas_Coord *x, Evas_Coord *y)
|
2016-11-21 09:57:05 -08:00
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
2017-05-17 13:02:53 -07:00
|
|
|
Ecore_Wl2_Input *input;
|
|
|
|
const Eo *seat;
|
2016-11-21 09:57:05 -08:00
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
2017-05-17 13:02:53 -07:00
|
|
|
seat = evas_device_parent_get(pointer);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(seat);
|
|
|
|
input = ecore_wl2_display_input_find(ecore_wl2_window_display_get(wdata->win), evas_device_seat_id_get(seat));
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(input);
|
|
|
|
ecore_wl2_input_pointer_xy_get(input, x, y);
|
2016-11-21 09:57:05 -08:00
|
|
|
}
|
|
|
|
|
2017-07-28 12:44:43 -07:00
|
|
|
void
|
|
|
|
_ecore_evas_wl_common_aux_hints_supported_update(Ecore_Evas *ee)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
if (!ee) return;
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
ee->prop.aux_hint.supported_list = ecore_wl2_window_aux_hints_supported_get(wdata->win);
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_title_set(Ecore_Evas *ee, const char *title)
|
|
|
|
{
|
2012-12-05 13:15:42 -08:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
if (!ee) return;
|
2015-01-22 11:37:56 -08:00
|
|
|
if (eina_streq(ee->prop.title, title)) return;
|
2016-10-26 21:33:36 -07:00
|
|
|
free(ee->prop.title);
|
|
|
|
ee->prop.title = eina_strdup(title);
|
2012-10-08 07:09:53 -07:00
|
|
|
|
2013-11-01 06:38:05 -07:00
|
|
|
if (ee->prop.title)
|
2016-10-26 21:33:36 -07:00
|
|
|
{
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
ecore_wl2_window_title_set(wdata->win, ee->prop.title);
|
|
|
|
}
|
2012-10-08 07:09:53 -07:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_name_class_set(Ecore_Evas *ee, const char *n, const char *c)
|
|
|
|
{
|
2012-12-05 13:15:42 -08:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
if (!ee) return;
|
2012-12-05 13:15:42 -08:00
|
|
|
wdata = ee->engine.data;
|
2015-01-22 11:37:56 -08:00
|
|
|
if (!eina_streq(ee->prop.name, n))
|
|
|
|
{
|
|
|
|
if (ee->prop.name) free(ee->prop.name);
|
|
|
|
ee->prop.name = NULL;
|
|
|
|
if (n) ee->prop.name = strdup(n);
|
|
|
|
}
|
|
|
|
if (!eina_streq(ee->prop.clas, c))
|
|
|
|
{
|
|
|
|
if (ee->prop.clas) free(ee->prop.clas);
|
|
|
|
ee->prop.clas = NULL;
|
|
|
|
if (c) ee->prop.clas = strdup(c);
|
|
|
|
}
|
2015-09-28 10:42:38 -07:00
|
|
|
|
2013-11-01 06:38:05 -07:00
|
|
|
if (ee->prop.clas)
|
2015-11-22 15:48:00 -08:00
|
|
|
ecore_wl2_window_class_set(wdata->win, ee->prop.clas);
|
2012-10-08 07:09:53 -07:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_size_min_set(Ecore_Evas *ee, int w, int h)
|
|
|
|
{
|
2020-01-17 14:24:26 -08:00
|
|
|
int fw, fh;
|
2017-08-04 13:11:00 -07:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
if (!ee) return;
|
2017-08-04 13:11:00 -07:00
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
if (w < 0) w = 0;
|
|
|
|
if (h < 0) h = 0;
|
|
|
|
if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return;
|
|
|
|
ee->prop.min.w = w;
|
|
|
|
ee->prop.min.h = h;
|
2017-08-04 13:11:00 -07:00
|
|
|
wdata = ee->engine.data;
|
2020-01-17 14:24:26 -08:00
|
|
|
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
|
2018-01-08 10:42:11 -08:00
|
|
|
if (wdata->win->xdg_set_min_size && wdata->win->xdg_toplevel)
|
|
|
|
{
|
2020-01-17 14:24:26 -08:00
|
|
|
wdata->win->xdg_set_min_size(wdata->win->xdg_toplevel, w + fw, h + fh);
|
2018-01-08 10:42:11 -08:00
|
|
|
wdata->win->pending.min = 0;
|
|
|
|
}
|
2017-08-04 13:11:00 -07:00
|
|
|
if (wdata->win->zxdg_set_min_size && wdata->win->zxdg_toplevel)
|
2017-08-11 15:43:15 -07:00
|
|
|
{
|
2020-01-17 14:24:26 -08:00
|
|
|
wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, w + fw, h + fh);
|
2017-08-11 15:43:15 -07:00
|
|
|
wdata->win->pending.min = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
wdata->win->pending.min = 1;
|
2017-08-04 13:11:00 -07:00
|
|
|
_ecore_evas_wl_common_resize(ee, ee->w, ee->h);
|
2012-10-08 07:09:53 -07:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_size_max_set(Ecore_Evas *ee, int w, int h)
|
|
|
|
{
|
2020-01-17 14:24:26 -08:00
|
|
|
int fw, fh;
|
2017-08-04 13:11:00 -07:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
if (!ee) return;
|
2017-08-07 08:05:58 -07:00
|
|
|
if (w < 0) w = 0;
|
|
|
|
if (h < 0) h = 0;
|
2012-10-08 07:09:53 -07:00
|
|
|
if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return;
|
|
|
|
ee->prop.max.w = w;
|
|
|
|
ee->prop.max.h = h;
|
2017-08-04 13:11:00 -07:00
|
|
|
wdata = ee->engine.data;
|
2020-01-17 14:24:26 -08:00
|
|
|
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
|
2018-01-08 10:42:11 -08:00
|
|
|
if (wdata->win->xdg_set_max_size && wdata->win->xdg_toplevel)
|
|
|
|
{
|
2020-01-17 14:24:26 -08:00
|
|
|
wdata->win->xdg_set_max_size(wdata->win->xdg_toplevel, w + fw, h + fh);
|
2018-01-08 10:42:11 -08:00
|
|
|
wdata->win->pending.max = 0;
|
|
|
|
}
|
2017-08-04 13:11:00 -07:00
|
|
|
if (wdata->win->zxdg_set_max_size && wdata->win->zxdg_toplevel)
|
2017-08-11 15:43:15 -07:00
|
|
|
{
|
2020-01-17 14:24:26 -08:00
|
|
|
wdata->win->zxdg_set_max_size(wdata->win->zxdg_toplevel, w + fw, h + fh);
|
2017-08-11 15:43:15 -07:00
|
|
|
wdata->win->pending.max = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
wdata->win->pending.max = 1;
|
2017-08-04 13:11:00 -07:00
|
|
|
_ecore_evas_wl_common_resize(ee, ee->w, ee->h);
|
2012-10-08 07:09:53 -07:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_size_base_set(Ecore_Evas *ee, int w, int h)
|
|
|
|
{
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
if (!ee) return;
|
|
|
|
if (w < 0) w = 0;
|
|
|
|
if (h < 0) h = 0;
|
|
|
|
if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return;
|
|
|
|
ee->prop.base.w = w;
|
|
|
|
ee->prop.base.h = h;
|
2017-08-04 13:11:00 -07:00
|
|
|
_ecore_evas_wl_common_resize(ee, ee->w, ee->h);
|
2012-10-08 07:09:53 -07:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_size_step_set(Ecore_Evas *ee, int w, int h)
|
|
|
|
{
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
if (!ee) return;
|
|
|
|
if (w < 0) w = 0;
|
|
|
|
if (h < 0) h = 0;
|
|
|
|
if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return;
|
|
|
|
ee->prop.step.w = w;
|
|
|
|
ee->prop.step.h = h;
|
2017-08-04 13:11:00 -07:00
|
|
|
_ecore_evas_wl_common_resize(ee, ee->w, ee->h);
|
2012-10-08 07:09:53 -07:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
Add code to deal with min, max, step, aspect, and base sizes.
Properly fix efl wayland elm window resize problem.
This adds support for min, max, step, aspect, and base size properties
when resizing a canvas under EFL Wayland.
This Also Properly fixes raster's report for EFL Wayland elm windows not
resizing properly. Previously, when resizing an elm window in wayland,
a portion of the window would draw outside the frame.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2013-12-05 03:48:25 -08:00
|
|
|
_ecore_evas_wl_common_aspect_set(Ecore_Evas *ee, double aspect)
|
|
|
|
{
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2015-01-05 06:09:02 -08:00
|
|
|
if (!ee) return;
|
2017-01-06 09:57:46 -08:00
|
|
|
if (EINA_FLT_EQ(ee->prop.aspect, aspect)) return;
|
Add code to deal with min, max, step, aspect, and base sizes.
Properly fix efl wayland elm window resize problem.
This adds support for min, max, step, aspect, and base size properties
when resizing a canvas under EFL Wayland.
This Also Properly fixes raster's report for EFL Wayland elm windows not
resizing properly. Previously, when resizing an elm window in wayland,
a portion of the window would draw outside the frame.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2013-12-05 03:48:25 -08:00
|
|
|
ee->prop.aspect = aspect;
|
2017-08-04 13:11:00 -07:00
|
|
|
_ecore_evas_wl_common_resize(ee, ee->w, ee->h);
|
Add code to deal with min, max, step, aspect, and base sizes.
Properly fix efl wayland elm window resize problem.
This adds support for min, max, step, aspect, and base size properties
when resizing a canvas under EFL Wayland.
This Also Properly fixes raster's report for EFL Wayland elm windows not
resizing properly. Previously, when resizing an elm window in wayland,
a portion of the window would draw outside the frame.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2013-12-05 03:48:25 -08:00
|
|
|
}
|
|
|
|
|
2017-06-15 07:42:28 -07:00
|
|
|
static void
|
|
|
|
_ecore_evas_wl_common_focus_skip_set(Ecore_Evas *ee, Eina_Bool skip)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
if (!wdata) return;
|
|
|
|
if (ee->prop.focus_skip == skip) return;
|
|
|
|
ee->prop.focus_skip = skip;
|
|
|
|
ecore_wl2_window_focus_skip_set(wdata->win, skip);
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2017-05-17 13:02:53 -07:00
|
|
|
_ecore_evas_wl_common_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer EINA_UNUSED, int hot_x, int hot_y)
|
2012-11-07 08:12:14 -08:00
|
|
|
{
|
2015-09-28 10:42:38 -07:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
2017-05-17 13:02:53 -07:00
|
|
|
Ecore_Wl2_Input *input;
|
2014-06-25 10:20:13 -07:00
|
|
|
|
2015-09-28 10:42:38 -07:00
|
|
|
wdata = ee->engine.data;
|
2017-05-17 13:02:53 -07:00
|
|
|
if (obj == _ecore_evas_default_cursor_image_get(ee)) return;
|
|
|
|
input = ecore_wl2_display_input_find_by_name(ecore_wl2_window_display_get(wdata->win), "default");
|
|
|
|
if (input) ecore_wl2_input_pointer_set(input, NULL, hot_x, hot_y);
|
2012-11-07 08:12:14 -08:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_layer_set(Ecore_Evas *ee, int layer)
|
|
|
|
{
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
if (!ee) return;
|
|
|
|
if (ee->prop.layer == layer) return;
|
|
|
|
if (layer < 1) layer = 1;
|
|
|
|
else if (layer > 255) layer = 255;
|
|
|
|
ee->prop.layer = layer;
|
2013-10-31 04:47:53 -07:00
|
|
|
_ecore_evas_wl_common_state_update(ee);
|
2012-10-08 07:09:53 -07:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2014-01-11 01:19:43 -08:00
|
|
|
_ecore_evas_wl_common_iconified_set(Ecore_Evas *ee, Eina_Bool on)
|
2012-10-08 07:09:53 -07:00
|
|
|
{
|
2014-08-23 06:00:04 -07:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
if (!ee) return;
|
2014-01-11 01:19:43 -08:00
|
|
|
ee->prop.iconified = on;
|
2014-08-23 06:00:04 -07:00
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
2015-09-28 10:42:38 -07:00
|
|
|
ecore_wl2_window_iconified_set(wdata->win, on);
|
2012-10-08 07:09:53 -07:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2014-01-12 21:26:36 -08:00
|
|
|
_ecore_evas_wl_common_borderless_set(Ecore_Evas *ee, Eina_Bool on)
|
2013-05-08 15:18:55 -07:00
|
|
|
{
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
if (!ee) return;
|
2014-01-12 21:26:36 -08:00
|
|
|
if (ee->prop.borderless == on) return;
|
|
|
|
ee->prop.borderless = on;
|
2013-05-08 15:18:55 -07:00
|
|
|
|
2013-10-31 04:47:53 -07:00
|
|
|
_ecore_evas_wl_common_state_update(ee);
|
2013-05-08 15:18:55 -07:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2014-01-12 21:26:36 -08:00
|
|
|
_ecore_evas_wl_common_maximized_set(Ecore_Evas *ee, Eina_Bool on)
|
2012-10-08 07:09:53 -07:00
|
|
|
{
|
2012-12-05 13:15:42 -08:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
if (!ee) return;
|
2014-01-12 21:26:36 -08:00
|
|
|
if (ee->prop.maximized == on) return;
|
2015-09-28 10:42:38 -07:00
|
|
|
|
2013-11-14 04:45:33 -08:00
|
|
|
wdata = ee->engine.data;
|
2015-09-28 10:42:38 -07:00
|
|
|
ecore_wl2_window_maximized_set(wdata->win, on);
|
2012-10-08 07:09:53 -07:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2014-01-12 21:26:36 -08:00
|
|
|
_ecore_evas_wl_common_fullscreen_set(Ecore_Evas *ee, Eina_Bool on)
|
2012-10-08 07:09:53 -07:00
|
|
|
{
|
2012-12-05 13:15:42 -08:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
if (!ee) return;
|
2014-01-12 21:26:36 -08:00
|
|
|
if (ee->prop.fullscreen == on) return;
|
2015-09-28 10:42:38 -07:00
|
|
|
|
2012-12-05 13:15:42 -08:00
|
|
|
wdata = ee->engine.data;
|
2015-09-28 10:42:38 -07:00
|
|
|
ecore_wl2_window_fullscreen_set(wdata->win, on);
|
2012-10-08 07:09:53 -07:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_ignore_events_set(Ecore_Evas *ee, int ignore)
|
|
|
|
{
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
if (!ee) return;
|
|
|
|
ee->ignore_events = ignore;
|
|
|
|
/* NB: Hmmm, may need to pass this to ecore_wl_window in the future */
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2016-11-02 11:13:07 -07:00
|
|
|
_ecore_evas_wl_common_render_flush_pre(void *data, Evas *evas, void *event EINA_UNUSED)
|
2015-10-20 13:41:28 -07:00
|
|
|
{
|
|
|
|
Ecore_Evas *ee = data;
|
2016-11-02 11:13:07 -07:00
|
|
|
Evas_Engine_Info_Wayland *einfo;
|
2015-10-20 13:41:28 -07:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
2016-11-02 11:13:07 -07:00
|
|
|
int fx, fy;
|
2015-10-20 13:41:28 -07:00
|
|
|
|
2017-03-03 11:13:14 -08:00
|
|
|
einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(evas);
|
|
|
|
if (!einfo) return;
|
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
2017-06-07 10:37:30 -07:00
|
|
|
if (!wdata) return;
|
|
|
|
|
2017-01-10 08:28:40 -08:00
|
|
|
if (wdata->win->pending.configure) return;
|
|
|
|
|
2017-03-09 09:05:28 -08:00
|
|
|
if (!ecore_wl2_window_shell_surface_exists(wdata->win)) return;
|
2017-01-03 14:40:21 -08:00
|
|
|
|
2017-10-04 11:46:34 -07:00
|
|
|
ecore_wl2_window_update_begin(wdata->win);
|
2016-11-02 11:13:07 -07:00
|
|
|
|
|
|
|
/* Surviving bits of WWW - track interesting state we might want
|
|
|
|
* to pass to clients to do client side effects
|
|
|
|
*/
|
2018-11-28 12:19:56 -08:00
|
|
|
ecore_wl2_window_geometry_get(wdata->win,
|
|
|
|
&einfo->window.x,
|
|
|
|
&einfo->window.y,
|
|
|
|
&einfo->window.w,
|
|
|
|
&einfo->window.h);
|
2016-11-02 11:13:07 -07:00
|
|
|
if (einfo->resizing)
|
|
|
|
{
|
|
|
|
einfo->x_rel = 0;
|
|
|
|
einfo->y_rel = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
einfo->x_rel = wdata->x_rel;
|
|
|
|
einfo->y_rel = wdata->y_rel;
|
|
|
|
}
|
|
|
|
einfo->timestamp = wdata->timestamp;
|
2017-10-31 00:36:32 -07:00
|
|
|
evas_pointer_canvas_xy_get(evas, &einfo->x_cursor, &einfo->y_cursor);
|
2016-11-02 11:13:07 -07:00
|
|
|
evas_output_framespace_get(evas, &fx, &fy, NULL, NULL);
|
|
|
|
einfo->x_cursor -= fx;
|
|
|
|
einfo->y_cursor -= fy;
|
|
|
|
wdata->x_rel = wdata->y_rel = 0;
|
2017-09-29 14:17:18 -07:00
|
|
|
einfo->resizing = ecore_wl2_window_resizing_get(wdata->win);
|
2016-11-02 11:13:07 -07:00
|
|
|
einfo->dragging = wdata->dragging;
|
|
|
|
einfo->drag_start = EINA_FALSE;
|
|
|
|
einfo->drag_stop = EINA_FALSE;
|
|
|
|
if (einfo->drag_ack && !einfo->dragging) einfo->drag_stop = EINA_TRUE;
|
|
|
|
if (einfo->dragging && !einfo->drag_ack) einfo->drag_start = EINA_TRUE;
|
|
|
|
einfo->drag_ack = wdata->dragging;
|
2015-12-09 06:38:01 -08:00
|
|
|
}
|
|
|
|
|
2017-04-25 08:59:33 -07:00
|
|
|
static void
|
|
|
|
_ecore_evas_wayland_alpha_do(Ecore_Evas *ee, int alpha)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
if (!ee) return;
|
|
|
|
if (ee->alpha == alpha) return;
|
2017-06-09 08:06:05 -07:00
|
|
|
|
2018-08-17 08:30:20 -07:00
|
|
|
/* alpha used for transparent as well.
|
|
|
|
ecore_evas_transparent_get() must be valid. */
|
|
|
|
ee->transparent = ee->alpha = alpha;
|
|
|
|
|
2018-02-12 12:58:01 -08:00
|
|
|
wdata = ee->engine.data;
|
2018-08-17 08:30:20 -07:00
|
|
|
if (!wdata->sync_done) return;
|
|
|
|
|
2018-02-12 12:58:01 -08:00
|
|
|
_ecore_evas_wayland_window_update(ee, wdata, alpha);
|
|
|
|
|
|
|
|
_ecore_evas_wl_common_wm_rotation_protocol_set(ee);
|
2017-04-25 08:59:33 -07:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2017-05-09 08:46:48 -07:00
|
|
|
_ecore_evas_wl_common_render_updates(void *data, Evas *evas EINA_UNUSED, void *event EINA_UNUSED)
|
2013-01-28 11:45:41 -08:00
|
|
|
{
|
2013-03-25 19:48:23 -07:00
|
|
|
Ecore_Evas *ee = data;
|
2013-01-28 11:45:41 -08:00
|
|
|
|
2013-05-06 10:48:03 -07:00
|
|
|
if (ee->delayed.alpha_changed)
|
|
|
|
{
|
|
|
|
_ecore_evas_wayland_alpha_do(ee, ee->delayed.alpha);
|
|
|
|
ee->delayed.alpha_changed = EINA_FALSE;
|
|
|
|
}
|
|
|
|
if (ee->delayed.rotation_changed)
|
|
|
|
{
|
|
|
|
_rotation_do(ee, ee->delayed.rotation, ee->delayed.rotation_resize);
|
|
|
|
ee->delayed.rotation_changed = EINA_FALSE;
|
|
|
|
}
|
2013-01-28 11:45:41 -08:00
|
|
|
}
|
|
|
|
|
2017-05-08 15:03:51 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_ecore_evas_wl_common_prepare(Ecore_Evas *ee)
|
2012-10-08 07:22:17 -07:00
|
|
|
{
|
2013-01-28 12:28:19 -08:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
2013-02-27 01:49:23 -08:00
|
|
|
|
2017-05-08 15:03:51 -07:00
|
|
|
if (!(wdata = ee->engine.data)) return EINA_FALSE;
|
|
|
|
if (!wdata->sync_done) return EINA_FALSE;
|
2013-01-28 12:28:19 -08:00
|
|
|
|
2017-05-08 15:03:51 -07:00
|
|
|
if (wdata->win->pending.configure) return EINA_FALSE;
|
2014-08-22 10:31:09 -07:00
|
|
|
|
2017-05-08 15:03:51 -07:00
|
|
|
return EINA_TRUE;
|
2012-10-08 07:09:53 -07:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2014-01-12 21:26:36 -08:00
|
|
|
_ecore_evas_wl_common_withdrawn_set(Ecore_Evas *ee, Eina_Bool on)
|
2013-11-30 04:14:05 -08:00
|
|
|
{
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2014-01-12 23:52:24 -08:00
|
|
|
if (ee->prop.withdrawn == on) return;
|
2013-12-04 12:50:19 -08:00
|
|
|
|
2014-01-12 21:26:36 -08:00
|
|
|
ee->prop.withdrawn = on;
|
2014-01-12 23:52:24 -08:00
|
|
|
|
|
|
|
if (on)
|
2013-11-30 04:14:05 -08:00
|
|
|
ecore_evas_hide(ee);
|
|
|
|
else
|
|
|
|
ecore_evas_show(ee);
|
2014-01-12 23:52:24 -08:00
|
|
|
|
2013-12-04 12:50:19 -08:00
|
|
|
_ecore_evas_wl_common_state_update(ee);
|
2013-11-30 04:14:05 -08:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2015-09-28 10:42:38 -07:00
|
|
|
_ecore_evas_wl_common_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h)
|
2012-10-08 07:09:53 -07:00
|
|
|
{
|
2015-09-28 10:42:38 -07:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
if (x) *x = 0;
|
|
|
|
if (y) *y = 0;
|
2015-09-28 10:42:38 -07:00
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
ecore_wl2_display_screen_size_get(wdata->display, w, h);
|
2012-10-08 07:09:53 -07:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2018-02-19 03:39:47 -08:00
|
|
|
_ecore_evas_wl_common_screen_dpi_get(const Ecore_Evas *ee, int *xdpi, int *ydpi)
|
2012-10-08 07:09:53 -07:00
|
|
|
{
|
2018-02-19 03:39:47 -08:00
|
|
|
Ecore_Wl2_Window *win;
|
|
|
|
Ecore_Wl2_Output *output;
|
2012-10-08 07:09:53 -07:00
|
|
|
int dpi = 0;
|
|
|
|
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2018-02-19 03:39:47 -08:00
|
|
|
if (!ee) return;
|
2012-10-08 07:09:53 -07:00
|
|
|
if (xdpi) *xdpi = 0;
|
|
|
|
if (ydpi) *ydpi = 0;
|
2015-09-28 10:42:38 -07:00
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
/* FIXME: Ideally this needs to get the DPI from a specific screen */
|
2015-09-28 10:42:38 -07:00
|
|
|
|
2018-02-19 03:39:47 -08:00
|
|
|
win = ecore_evas_wayland2_window_get(ee);
|
|
|
|
output = ecore_wl2_window_output_find(win);
|
|
|
|
dpi = ecore_wl2_output_dpi_get(output);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
if (xdpi) *xdpi = dpi;
|
|
|
|
if (ydpi) *ydpi = dpi;
|
|
|
|
}
|
2012-12-05 13:15:42 -08:00
|
|
|
|
|
|
|
static void
|
|
|
|
_ecore_evas_wayland_resize(Ecore_Evas *ee, int location)
|
|
|
|
{
|
2016-11-02 05:41:33 -07:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-12-05 13:15:42 -08:00
|
|
|
if (!ee) return;
|
2016-11-02 05:41:33 -07:00
|
|
|
wdata = ee->engine.data;
|
|
|
|
if (wdata->win)
|
2018-05-08 11:26:22 -07:00
|
|
|
ecore_wl2_window_resize(wdata->win, NULL, location);
|
2012-12-05 13:15:42 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-05-17 13:02:53 -07:00
|
|
|
_ecore_evas_wayland_move(Ecore_Evas *ee, int x EINA_UNUSED, int y EINA_UNUSED)
|
2012-12-05 13:15:42 -08:00
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
2017-05-17 13:02:53 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-12-05 13:15:42 -08:00
|
|
|
if (!ee) return;
|
2017-05-17 13:02:53 -07:00
|
|
|
wdata = ee->engine.data;
|
|
|
|
if (wdata->win) ecore_wl2_window_move(wdata->win, NULL);
|
2012-12-05 13:15:42 -08:00
|
|
|
}
|
|
|
|
|
2015-09-30 07:58:13 -07:00
|
|
|
static void
|
|
|
|
_ecore_evas_wayland_type_set(Ecore_Evas *ee, int type)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
2012-12-05 13:15:42 -08:00
|
|
|
|
2015-09-30 07:58:13 -07:00
|
|
|
if (!ee) return;
|
|
|
|
wdata = ee->engine.data;
|
2012-12-05 13:15:42 -08:00
|
|
|
|
2015-09-30 07:58:13 -07:00
|
|
|
ecore_wl2_window_type_set(wdata->win, type);
|
|
|
|
}
|
2012-12-05 13:15:42 -08:00
|
|
|
|
2015-09-30 07:58:13 -07:00
|
|
|
static Ecore_Wl2_Window *
|
|
|
|
_ecore_evas_wayland_window_get(const Ecore_Evas *ee)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
2012-12-05 13:15:42 -08:00
|
|
|
|
2015-09-28 10:42:38 -07:00
|
|
|
if (!(!strncmp(ee->driver, "wayland", 7)))
|
|
|
|
return NULL;
|
|
|
|
|
2015-09-30 07:58:13 -07:00
|
|
|
wdata = ee->engine.data;
|
|
|
|
return wdata->win;
|
|
|
|
}
|
2013-06-05 20:30:40 -07:00
|
|
|
|
2015-09-28 10:42:38 -07:00
|
|
|
/* static void */
|
|
|
|
/* _ecore_evas_wayland_pointer_set(Ecore_Evas *ee EINA_UNUSED, int hot_x EINA_UNUSED, int hot_y EINA_UNUSED) */
|
|
|
|
/* { */
|
2012-12-05 13:15:42 -08:00
|
|
|
|
2015-09-28 10:42:38 -07:00
|
|
|
/* } */
|
2012-12-05 13:15:42 -08:00
|
|
|
|
2017-06-13 09:56:24 -07:00
|
|
|
static void
|
|
|
|
_ecore_evas_wayland_aux_hint_add(Ecore_Evas *ee, int id, const char *hint, const char *val)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
|
|
|
if (!ee) return;
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
ecore_wl2_window_aux_hint_add(wdata->win, id, hint, val);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ecore_evas_wayland_aux_hint_change(Ecore_Evas *ee, int id, const char *val)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
|
|
|
if (!ee) return;
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
ecore_wl2_window_aux_hint_change(wdata->win, id, val);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ecore_evas_wayland_aux_hint_del(Ecore_Evas *ee, int id)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
|
|
|
if (!ee) return;
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
ecore_wl2_window_aux_hint_del(wdata->win, id);
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static Ecore_Evas_Interface_Wayland *
|
2012-12-05 13:15:42 -08:00
|
|
|
_ecore_evas_wl_interface_new(void)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Interface_Wayland *iface;
|
|
|
|
|
|
|
|
iface = calloc(1, sizeof(Ecore_Evas_Interface_Wayland));
|
|
|
|
if (!iface) return NULL;
|
|
|
|
|
|
|
|
iface->base.name = interface_wl_name;
|
|
|
|
iface->base.version = interface_wl_version;
|
|
|
|
|
|
|
|
iface->resize = _ecore_evas_wayland_resize;
|
|
|
|
iface->move = _ecore_evas_wayland_move;
|
2015-09-28 10:42:38 -07:00
|
|
|
/* iface->pointer_set = _ecore_evas_wayland_pointer_set; */
|
2015-09-30 07:58:13 -07:00
|
|
|
iface->type_set = _ecore_evas_wayland_type_set;
|
2016-01-07 12:02:13 -08:00
|
|
|
iface->window2_get = _ecore_evas_wayland_window_get;
|
2017-06-13 09:56:24 -07:00
|
|
|
iface->aux_hint_add = _ecore_evas_wayland_aux_hint_add;
|
|
|
|
iface->aux_hint_change = _ecore_evas_wayland_aux_hint_change;
|
|
|
|
iface->aux_hint_del = _ecore_evas_wayland_aux_hint_del;
|
2012-12-05 13:15:42 -08:00
|
|
|
|
|
|
|
return iface;
|
|
|
|
}
|
2016-11-01 14:20:49 -07:00
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2016-11-01 14:20:49 -07:00
|
|
|
_ecore_evas_wl_common_show(Ecore_Evas *ee)
|
|
|
|
{
|
|
|
|
Evas_Engine_Info_Wayland *einfo;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
if ((!ee) || (ee->visible)) return;
|
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
if (!wdata->sync_done)
|
|
|
|
{
|
|
|
|
wdata->defer_show = EINA_TRUE;
|
|
|
|
return;
|
|
|
|
}
|
2018-03-14 14:03:36 -07:00
|
|
|
ee->visible = 1;
|
2016-11-01 14:20:49 -07:00
|
|
|
|
|
|
|
if (wdata->win)
|
|
|
|
{
|
2017-01-30 08:07:07 -08:00
|
|
|
int fw, fh;
|
|
|
|
|
2020-01-17 14:24:26 -08:00
|
|
|
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
|
2018-01-08 10:42:11 -08:00
|
|
|
if (wdata->win->xdg_set_min_size && wdata->win->xdg_toplevel && wdata->win->pending.min)
|
|
|
|
{
|
2020-01-17 14:24:26 -08:00
|
|
|
wdata->win->xdg_set_min_size(wdata->win->xdg_toplevel, ee->prop.min.w + fw, ee->prop.min.h + fh);
|
2018-01-08 10:42:11 -08:00
|
|
|
wdata->win->pending.min = 0;
|
|
|
|
}
|
|
|
|
if (wdata->win->xdg_set_max_size && wdata->win->xdg_toplevel && wdata->win->pending.max)
|
|
|
|
{
|
2020-01-17 14:24:26 -08:00
|
|
|
wdata->win->xdg_set_max_size(wdata->win->xdg_toplevel, ee->prop.max.w + fw, ee->prop.max.h + fh);
|
2018-01-08 10:42:11 -08:00
|
|
|
wdata->win->pending.max = 0;
|
|
|
|
}
|
2017-08-11 15:43:15 -07:00
|
|
|
if (wdata->win->zxdg_set_min_size && wdata->win->zxdg_toplevel && wdata->win->pending.min)
|
|
|
|
{
|
2020-01-17 14:24:26 -08:00
|
|
|
wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, ee->prop.min.w + fw, ee->prop.min.h + fh);
|
2017-08-11 15:43:15 -07:00
|
|
|
wdata->win->pending.min = 0;
|
|
|
|
}
|
|
|
|
if (wdata->win->zxdg_set_max_size && wdata->win->zxdg_toplevel && wdata->win->pending.max)
|
|
|
|
{
|
2020-01-17 14:24:26 -08:00
|
|
|
wdata->win->zxdg_set_max_size(wdata->win->zxdg_toplevel, ee->prop.max.w + fw, ee->prop.max.h + fh);
|
2017-08-11 15:43:15 -07:00
|
|
|
wdata->win->pending.max = 0;
|
|
|
|
}
|
|
|
|
|
2018-02-12 12:58:01 -08:00
|
|
|
_ecore_evas_wayland_window_update(ee, wdata, ee->alpha);
|
|
|
|
|
2016-11-01 14:20:49 -07:00
|
|
|
ecore_wl2_window_show(wdata->win);
|
|
|
|
einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas);
|
|
|
|
if (einfo)
|
|
|
|
{
|
2018-02-12 12:58:01 -08:00
|
|
|
einfo->info.destination_alpha = ee_needs_alpha(ee);
|
2017-08-14 15:07:31 -07:00
|
|
|
einfo->info.wl2_win = wdata->win;
|
2017-01-11 09:23:53 -08:00
|
|
|
einfo->info.hidden = wdata->win->pending.configure; //EINA_FALSE;
|
2016-12-02 10:58:09 -08:00
|
|
|
einfo->www_avail = !!wdata->win->www_surface;
|
2016-12-02 10:26:50 -08:00
|
|
|
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
|
|
|
|
ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
|
2017-07-25 23:28:02 -07:00
|
|
|
if (ECORE_EVAS_PORTRAIT(ee))
|
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w + fw, ee->h + fh);
|
|
|
|
else
|
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, ee->h + fh, ee->w + fw);
|
2016-11-01 14:20:49 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ee->prop.withdrawn = EINA_FALSE;
|
|
|
|
if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
|
|
|
|
|
|
|
|
ee->should_be_visible = 1;
|
|
|
|
if (ee->func.fn_show) ee->func.fn_show(ee);
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2016-11-01 14:20:49 -07:00
|
|
|
_ecore_evas_wl_common_hide(Ecore_Evas *ee)
|
|
|
|
{
|
|
|
|
Evas_Engine_Info_Wayland *einfo;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
if ((!ee) || (!ee->visible)) return;
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
|
|
|
|
evas_sync(ee->evas);
|
|
|
|
|
|
|
|
einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas);
|
|
|
|
if (einfo)
|
|
|
|
{
|
2016-12-02 10:26:50 -08:00
|
|
|
einfo->info.hidden = EINA_TRUE;
|
2016-11-01 14:20:49 -07:00
|
|
|
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
|
|
|
|
{
|
|
|
|
ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wdata->win)
|
|
|
|
ecore_wl2_window_hide(wdata->win);
|
|
|
|
|
|
|
|
if (ee->prop.override)
|
|
|
|
{
|
|
|
|
ee->prop.withdrawn = EINA_TRUE;
|
|
|
|
if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ee->visible) return;
|
|
|
|
ee->visible = 0;
|
|
|
|
ee->should_be_visible = 0;
|
|
|
|
|
|
|
|
if (ee->func.fn_hide) ee->func.fn_hide(ee);
|
|
|
|
}
|
2016-11-01 14:34:26 -07:00
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2016-11-01 14:34:26 -07:00
|
|
|
_ecore_evas_wl_common_alpha_set(Ecore_Evas *ee, int alpha)
|
|
|
|
{
|
|
|
|
if (ee->in_async_render)
|
|
|
|
{
|
|
|
|
ee->delayed.alpha = alpha;
|
|
|
|
ee->delayed.alpha_changed = EINA_TRUE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
_ecore_evas_wayland_alpha_do(ee, alpha);
|
|
|
|
}
|
2016-11-01 15:15:24 -07:00
|
|
|
|
2017-04-25 09:24:53 -07:00
|
|
|
static void
|
2016-11-01 15:16:07 -07:00
|
|
|
_ecore_evas_wl_common_rotation_set(Ecore_Evas *ee, int rotation, int resize)
|
|
|
|
{
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
if (ee->rotation == rotation) return;
|
|
|
|
|
|
|
|
if (ee->in_async_render)
|
|
|
|
{
|
|
|
|
ee->delayed.rotation = rotation;
|
|
|
|
ee->delayed.rotation_resize = resize;
|
|
|
|
ee->delayed.rotation_changed = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
_rotation_do(ee, rotation, resize);
|
|
|
|
}
|
2016-11-02 11:13:07 -07:00
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_ee_cb_sync_done(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Ecore_Evas *ee;
|
|
|
|
Evas_Engine_Info_Wayland *einfo;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
|
|
|
ee = data;
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
if (wdata->sync_done) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
wdata->sync_done = EINA_TRUE;
|
|
|
|
|
|
|
|
if ((einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas)))
|
|
|
|
{
|
2018-02-12 12:58:01 -08:00
|
|
|
einfo->info.destination_alpha = ee_needs_alpha(ee);
|
2016-11-02 11:13:07 -07:00
|
|
|
einfo->info.rotation = ee->rotation;
|
2017-08-14 15:07:31 -07:00
|
|
|
einfo->info.wl2_win = wdata->win;
|
2016-11-02 11:13:07 -07:00
|
|
|
|
|
|
|
if (wdata->reset_pending)
|
|
|
|
{
|
2018-04-12 11:44:10 -07:00
|
|
|
ee->draw_block = EINA_FALSE;
|
2016-11-02 11:13:07 -07:00
|
|
|
}
|
|
|
|
if (evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
|
|
|
|
{
|
|
|
|
if (wdata->reset_pending && !strcmp(ee->driver, "wayland_egl"))
|
|
|
|
_evas_canvas_image_data_regenerate(wdata->regen_objs);
|
|
|
|
wdata->regen_objs = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
|
|
|
|
wdata->reset_pending = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wdata->defer_show)
|
|
|
|
{
|
|
|
|
wdata->defer_show = EINA_FALSE;
|
2017-03-01 08:43:11 -08:00
|
|
|
_ecore_evas_wl_common_show(ee);
|
2016-11-02 11:13:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
Ecore Evas Wayland: Create the devices during Ecore_Evas setup.
Summary:
When launching an Elementary App using Wayland the elm_config will
automatically connect to the Wayland's display server and all events
regarding seats are lost, since by the time that Ecore_Evas is created
the global events were already dispatched. To fix this problem,
everytime an Ecore_Evas is created, the code must check if there
are any seat capabilities available, if so, the devices will be created.
Reviewers: bdilly, barbieri, cedric, jpeg
Subscribers: devilhorns, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4390
2016-11-13 18:03:56 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_ecore_wl2_devices_setup(Ecore_Evas *ee, Ecore_Wl2_Display *display)
|
|
|
|
{
|
|
|
|
Eina_Bool r = EINA_TRUE;
|
|
|
|
Ecore_Wl2_Input *input;
|
|
|
|
Eina_Iterator *itr = ecore_wl2_display_inputs_get(display);
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(itr, EINA_FALSE);
|
|
|
|
EINA_ITERATOR_FOREACH(itr, input)
|
|
|
|
{
|
|
|
|
EE_Wl_Device *device;
|
|
|
|
Ecore_Wl2_Seat_Capabilities cap;
|
|
|
|
unsigned int id;
|
2018-05-08 11:26:57 -07:00
|
|
|
Eina_Stringshare *name;
|
Ecore Evas Wayland: Create the devices during Ecore_Evas setup.
Summary:
When launching an Elementary App using Wayland the elm_config will
automatically connect to the Wayland's display server and all events
regarding seats are lost, since by the time that Ecore_Evas is created
the global events were already dispatched. To fix this problem,
everytime an Ecore_Evas is created, the code must check if there
are any seat capabilities available, if so, the devices will be created.
Reviewers: bdilly, barbieri, cedric, jpeg
Subscribers: devilhorns, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4390
2016-11-13 18:03:56 -08:00
|
|
|
|
|
|
|
id = ecore_wl2_input_seat_id_get(input);
|
|
|
|
cap = ecore_wl2_input_seat_capabilities_get(input);
|
2018-05-08 11:26:57 -07:00
|
|
|
name = ecore_wl2_input_name_get(input);
|
|
|
|
device = _ecore_evas_wl_common_seat_add(ee, id, name);
|
Ecore Evas Wayland: Create the devices during Ecore_Evas setup.
Summary:
When launching an Elementary App using Wayland the elm_config will
automatically connect to the Wayland's display server and all events
regarding seats are lost, since by the time that Ecore_Evas is created
the global events were already dispatched. To fix this problem,
everytime an Ecore_Evas is created, the code must check if there
are any seat capabilities available, if so, the devices will be created.
Reviewers: bdilly, barbieri, cedric, jpeg
Subscribers: devilhorns, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4390
2016-11-13 18:03:56 -08:00
|
|
|
|
|
|
|
if (!device)
|
|
|
|
{
|
|
|
|
r = EINA_FALSE;
|
|
|
|
break;
|
|
|
|
}
|
2017-01-10 06:44:53 -08:00
|
|
|
|
Ecore Evas Wayland: Create the devices during Ecore_Evas setup.
Summary:
When launching an Elementary App using Wayland the elm_config will
automatically connect to the Wayland's display server and all events
regarding seats are lost, since by the time that Ecore_Evas is created
the global events were already dispatched. To fix this problem,
everytime an Ecore_Evas is created, the code must check if there
are any seat capabilities available, if so, the devices will be created.
Reviewers: bdilly, barbieri, cedric, jpeg
Subscribers: devilhorns, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4390
2016-11-13 18:03:56 -08:00
|
|
|
if (cap & ECORE_WL2_SEAT_CAPABILITIES_KEYBOARD)
|
|
|
|
{
|
2017-01-10 06:44:53 -08:00
|
|
|
device->keyboard =
|
|
|
|
evas_device_add_full(ee->evas, "Keyboard",
|
|
|
|
"A wayland keyboard device",
|
|
|
|
device->seat, NULL,
|
|
|
|
EVAS_DEVICE_CLASS_KEYBOARD,
|
|
|
|
EVAS_DEVICE_SUBCLASS_NONE);
|
|
|
|
|
|
|
|
_ecore_evas_wl_common_device_event_add
|
|
|
|
(ECORE_WL2_EVENT_DEVICE_ADDED, ECORE_WL2_DEVICE_TYPE_KEYBOARD,
|
|
|
|
id, device->keyboard, ee);
|
Ecore Evas Wayland: Create the devices during Ecore_Evas setup.
Summary:
When launching an Elementary App using Wayland the elm_config will
automatically connect to the Wayland's display server and all events
regarding seats are lost, since by the time that Ecore_Evas is created
the global events were already dispatched. To fix this problem,
everytime an Ecore_Evas is created, the code must check if there
are any seat capabilities available, if so, the devices will be created.
Reviewers: bdilly, barbieri, cedric, jpeg
Subscribers: devilhorns, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4390
2016-11-13 18:03:56 -08:00
|
|
|
}
|
|
|
|
if (cap & ECORE_WL2_SEAT_CAPABILITIES_POINTER)
|
|
|
|
{
|
2017-01-10 06:44:53 -08:00
|
|
|
device->pointer =
|
|
|
|
evas_device_add_full(ee->evas, "Mouse",
|
|
|
|
"A wayland pointer device",
|
|
|
|
device->seat, NULL,
|
|
|
|
EVAS_DEVICE_CLASS_MOUSE,
|
|
|
|
EVAS_DEVICE_SUBCLASS_NONE);
|
|
|
|
|
|
|
|
_ecore_evas_wl_common_device_event_add
|
|
|
|
(ECORE_WL2_EVENT_DEVICE_ADDED, ECORE_WL2_DEVICE_TYPE_POINTER,
|
|
|
|
id, device->pointer, ee);
|
Ecore Evas Wayland: Create the devices during Ecore_Evas setup.
Summary:
When launching an Elementary App using Wayland the elm_config will
automatically connect to the Wayland's display server and all events
regarding seats are lost, since by the time that Ecore_Evas is created
the global events were already dispatched. To fix this problem,
everytime an Ecore_Evas is created, the code must check if there
are any seat capabilities available, if so, the devices will be created.
Reviewers: bdilly, barbieri, cedric, jpeg
Subscribers: devilhorns, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4390
2016-11-13 18:03:56 -08:00
|
|
|
}
|
|
|
|
if (cap & ECORE_WL2_SEAT_CAPABILITIES_TOUCH)
|
|
|
|
{
|
2017-01-10 06:44:53 -08:00
|
|
|
device->touch =
|
|
|
|
evas_device_add_full(ee->evas, "Touch",
|
|
|
|
"A wayland touch device",
|
|
|
|
device->seat, NULL,
|
|
|
|
EVAS_DEVICE_CLASS_TOUCH,
|
|
|
|
EVAS_DEVICE_SUBCLASS_NONE);
|
|
|
|
|
|
|
|
_ecore_evas_wl_common_device_event_add
|
|
|
|
(ECORE_WL2_EVENT_DEVICE_ADDED, ECORE_WL2_DEVICE_TYPE_TOUCH,
|
|
|
|
id, device->touch, ee);
|
Ecore Evas Wayland: Create the devices during Ecore_Evas setup.
Summary:
When launching an Elementary App using Wayland the elm_config will
automatically connect to the Wayland's display server and all events
regarding seats are lost, since by the time that Ecore_Evas is created
the global events were already dispatched. To fix this problem,
everytime an Ecore_Evas is created, the code must check if there
are any seat capabilities available, if so, the devices will be created.
Reviewers: bdilly, barbieri, cedric, jpeg
Subscribers: devilhorns, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4390
2016-11-13 18:03:56 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
eina_iterator_free(itr);
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2020-02-10 00:20:18 -08:00
|
|
|
static void
|
|
|
|
_reeval_seat(unsigned int *seat, Ecore_Evas *ee)
|
|
|
|
{
|
|
|
|
if (*seat == 0)
|
|
|
|
*seat = evas_device_seat_id_get(evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_TYPE_SEAT));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
_clear_selection(Ecore_Evas *ee, unsigned int seat, Ecore_Evas_Selection_Buffer selection)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *edata = ee->engine.data;
|
|
|
|
Ecore_Evas_Selection_Callbacks *cbs = &edata->selection_data[selection].callbacks;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_FALSE_RETURN(cbs->cancel);
|
|
|
|
|
|
|
|
cbs->cancel(ee, seat, selection);
|
|
|
|
eina_array_free(cbs->available_types);
|
|
|
|
memset(cbs, 0, sizeof(Ecore_Evas_Selection_Callbacks));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-03-03 04:10:49 -08:00
|
|
|
_store_selection_cbs(Ecore_Evas *ee, unsigned int seat, Ecore_Evas_Selection_Buffer selection, Eina_Array *available_types, Ecore_Evas_Selection_Internal_Delivery delivery, Ecore_Evas_Selection_Internal_Cancel cancel)
|
2020-02-10 00:20:18 -08:00
|
|
|
{
|
|
|
|
Ecore_Evas_Wl_Selection_Data *sdata;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *edata;
|
|
|
|
Ecore_Evas_Selection_Callbacks *cbs;
|
|
|
|
|
|
|
|
edata = ee->engine.data;
|
|
|
|
sdata = &edata->selection_data[selection];
|
|
|
|
cbs = &sdata->callbacks;
|
|
|
|
|
|
|
|
if (cbs->cancel)
|
|
|
|
{
|
|
|
|
_clear_selection(ee, seat, selection);
|
|
|
|
}
|
|
|
|
|
|
|
|
cbs->delivery = delivery;
|
|
|
|
cbs->cancel = cancel;
|
|
|
|
cbs->available_types = available_types;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline Ecore_Wl2_Input*
|
|
|
|
_fetch_input(Ecore_Evas *ee, unsigned int seat)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
|
|
|
|
return ecore_wl2_display_input_find(ecore_wl2_window_display_get(wdata->win), seat);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2020-03-03 04:10:49 -08:00
|
|
|
_ecore_evas_wl_selection_claim(Ecore_Evas *ee, unsigned int seat, Ecore_Evas_Selection_Buffer selection, Eina_Array *available_types, Ecore_Evas_Selection_Internal_Delivery delivery, Ecore_Evas_Selection_Internal_Cancel cancel)
|
2020-02-10 00:20:18 -08:00
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
|
|
|
|
Ecore_Evas_Wl_Selection_Data *data = &wdata->selection_data[selection];
|
|
|
|
char *tmp_array[eina_array_count(available_types) + 1];
|
|
|
|
|
|
|
|
if (selection == ECORE_EVAS_SELECTION_BUFFER_SELECTION_BUFFER)
|
|
|
|
{
|
|
|
|
_store_selection_cbs(ee, seat, selection, available_types, delivery, cancel);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
_reeval_seat(&seat, ee);
|
|
|
|
_store_selection_cbs(ee, seat, selection, available_types, delivery, cancel);
|
|
|
|
|
|
|
|
for (unsigned int i = 0; i < eina_array_count(available_types); ++i)
|
|
|
|
{
|
|
|
|
tmp_array[i] = eina_array_data_get(available_types, i);
|
|
|
|
}
|
|
|
|
tmp_array[eina_array_count(available_types)] = NULL;
|
|
|
|
|
|
|
|
data->sent_serial = ecore_wl2_dnd_selection_set(_fetch_input(ee, seat), (const char**)tmp_array);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static Eina_Future*
|
|
|
|
_ecore_evas_wl_selection_request(Ecore_Evas *ee, unsigned int seat, Ecore_Evas_Selection_Buffer selection, Eina_Array *acceptable_types)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
|
|
|
|
Ecore_Evas_Wl_Selection_Data *data = &wdata->selection_data[selection];
|
|
|
|
Ecore_Wl2_Input *input;
|
|
|
|
Ecore_Wl2_Offer *offer = NULL;
|
|
|
|
Eina_Future *future;
|
|
|
|
|
|
|
|
_reeval_seat(&seat, ee);
|
|
|
|
input = _fetch_input(ee, seat);
|
|
|
|
|
|
|
|
if (data->delivery)
|
|
|
|
{
|
|
|
|
eina_promise_reject(data->delivery, ecore_evas_request_replaced);
|
|
|
|
data->delivery = NULL;
|
|
|
|
}
|
|
|
|
data->delivery = efl_loop_promise_new(efl_main_loop_get());
|
|
|
|
future = eina_future_new(data->delivery);
|
|
|
|
|
|
|
|
if (selection == ECORE_EVAS_SELECTION_BUFFER_DRAG_AND_DROP_BUFFER)
|
|
|
|
{
|
|
|
|
offer = data->offer = wdata->external_offer;
|
|
|
|
}
|
|
|
|
else if (selection == ECORE_EVAS_SELECTION_BUFFER_COPY_AND_PASTE_BUFFER)
|
|
|
|
{
|
|
|
|
offer = data->offer = ecore_wl2_dnd_selection_get(input);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!offer)
|
|
|
|
{
|
|
|
|
eina_promise_reject(data->delivery, ecore_evas_no_selection);
|
|
|
|
data->delivery = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Eina_Array *available_types = ecore_wl2_offer_mimes_get(offer);
|
|
|
|
char *selected_type = NULL;
|
|
|
|
|
|
|
|
for (unsigned int i = 0; i < eina_array_count(available_types) && !selected_type; ++i)
|
|
|
|
{
|
|
|
|
char *available_type = eina_array_data_get(available_types, i);
|
|
|
|
for (unsigned int j = 0; j < eina_array_count(acceptable_types) && !selected_type; ++j)
|
|
|
|
{
|
|
|
|
char *acceptable_type = eina_array_data_get(acceptable_types, j);
|
|
|
|
if (eina_streq(acceptable_type, available_type))
|
|
|
|
{
|
|
|
|
selected_type = available_type;
|
|
|
|
data->later_convert = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *convert_available_type;
|
|
|
|
Eina_Iterator *convertions = eina_content_converter_possible_conversions(available_type);
|
|
|
|
EINA_ITERATOR_FOREACH(convertions, convert_available_type)
|
|
|
|
{
|
|
|
|
if (eina_streq(convert_available_type, acceptable_type))
|
|
|
|
{
|
|
|
|
selected_type = available_type;
|
|
|
|
data->later_convert = acceptable_type;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
eina_iterator_free(convertions);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if (selected_type)
|
|
|
|
{
|
|
|
|
ecore_wl2_offer_receive(offer, selected_type);
|
|
|
|
ecore_wl2_display_flush(ecore_wl2_input_display_get(input));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
eina_promise_reject(data->delivery, ecore_evas_no_matching_type);
|
|
|
|
data->delivery = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return future;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_ecore_evas_wl_selection_has_owner(Ecore_Evas *ee, unsigned int seat, Ecore_Evas_Selection_Buffer selection EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
|
|
|
|
Ecore_Wl2_Input *input;
|
|
|
|
|
|
|
|
_reeval_seat(&seat, ee);
|
|
|
|
input = _fetch_input(ee, seat);
|
|
|
|
|
|
|
|
if (selection == ECORE_EVAS_SELECTION_BUFFER_COPY_AND_PASTE_BUFFER )
|
|
|
|
return !!ecore_wl2_dnd_selection_get(input);
|
|
|
|
else if (selection == ECORE_EVAS_SELECTION_BUFFER_DRAG_AND_DROP_BUFFER)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Wl_Selection_Data *data = &wdata->selection_data[selection];
|
|
|
|
return !!data->offer;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE; //the selection buffer is not supportet in wayland
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_wl_selection_changed(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Event_Seat_Selection *sel = event;
|
|
|
|
Ecore_Evas *ee = data;
|
|
|
|
Ecore_Wl2_Input *input;
|
|
|
|
unsigned int seat = sel->seat;
|
|
|
|
|
|
|
|
_reeval_seat(&seat, ee);
|
|
|
|
input = _fetch_input(ee, seat);
|
|
|
|
if (!ecore_wl2_dnd_selection_get(input))
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
|
|
|
if (ee->func.fn_selection_changed)
|
|
|
|
ee->func.fn_selection_changed(ee, 0, ECORE_EVAS_SELECTION_BUFFER_COPY_AND_PASTE_BUFFER);
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
Eina_Rw_Slice slice;
|
|
|
|
unsigned int written_bytes;
|
|
|
|
} Delayed_Writing;
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_write_to_fd(void *data, Ecore_Fd_Handler *fd_handler)
|
|
|
|
{
|
2020-03-10 07:31:46 -07:00
|
|
|
int fd;
|
2020-02-10 00:20:18 -08:00
|
|
|
Delayed_Writing *slice = data;
|
|
|
|
|
2020-03-10 07:31:46 -07:00
|
|
|
fd = ecore_main_fd_handler_fd_get(fd_handler);
|
|
|
|
if (fd < 0) goto end;
|
|
|
|
|
2020-02-10 00:20:18 -08:00
|
|
|
size_t len = write(fd, slice->slice.mem + slice->written_bytes, slice->slice.len - slice->written_bytes);
|
|
|
|
|
|
|
|
slice->written_bytes += len;
|
|
|
|
if (slice->written_bytes != slice->slice.len)
|
|
|
|
{
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-03-10 07:31:46 -07:00
|
|
|
end:
|
2020-02-10 00:20:18 -08:00
|
|
|
ecore_main_fd_handler_del(fd_handler);
|
|
|
|
free(slice->slice.mem);
|
|
|
|
free(slice);
|
|
|
|
close(fd);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_wl_interaction_send(void *data, int type EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Event_Data_Source_Send *ev = event;
|
|
|
|
Ecore_Evas *ee = data;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
|
|
|
|
Ecore_Evas_Wl_Selection_Data *selection = NULL;
|
|
|
|
Delayed_Writing *forign_slice = calloc(1, sizeof(Delayed_Writing));
|
|
|
|
Ecore_Evas_Selection_Buffer buffer = ECORE_EVAS_SELECTION_BUFFER_LAST;
|
|
|
|
|
|
|
|
if (ev->serial == wdata->selection_data[ECORE_EVAS_SELECTION_BUFFER_COPY_AND_PASTE_BUFFER].sent_serial)
|
|
|
|
buffer = ECORE_EVAS_SELECTION_BUFFER_COPY_AND_PASTE_BUFFER;
|
|
|
|
else if (ev->serial == wdata->selection_data[ECORE_EVAS_SELECTION_BUFFER_DRAG_AND_DROP_BUFFER].sent_serial)
|
|
|
|
{
|
|
|
|
buffer = ECORE_EVAS_SELECTION_BUFFER_DRAG_AND_DROP_BUFFER;
|
|
|
|
ee->drag.accepted = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (buffer == ECORE_EVAS_SELECTION_BUFFER_LAST)
|
|
|
|
{
|
|
|
|
//silent return, this send request was *not* for this window
|
2020-03-10 07:28:01 -07:00
|
|
|
goto end;
|
2020-02-10 00:20:18 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
selection = &wdata->selection_data[buffer];
|
|
|
|
EINA_SAFETY_ON_NULL_GOTO(selection, end);
|
|
|
|
EINA_SAFETY_ON_NULL_GOTO(selection->callbacks.delivery, end);
|
|
|
|
EINA_SAFETY_ON_FALSE_GOTO(selection->callbacks.delivery(ee, ev->seat, buffer, ev->type, &forign_slice->slice), end);
|
|
|
|
ecore_main_fd_handler_add(ev->fd, ECORE_FD_WRITE, _write_to_fd, forign_slice, NULL, NULL);
|
2020-03-10 07:28:01 -07:00
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
2020-02-10 00:20:18 -08:00
|
|
|
end:
|
2020-03-10 07:28:01 -07:00
|
|
|
free(forign_slice);
|
2020-02-10 00:20:18 -08:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_wl_selection_receive(void *data, int type EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Ecore_Evas *ee = data;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
|
|
|
|
Ecore_Wl2_Event_Offer_Data_Ready *ready = event;
|
|
|
|
Ecore_Evas_Selection_Buffer selection = ECORE_EVAS_SELECTION_BUFFER_LAST;
|
|
|
|
|
|
|
|
for (int i = 0; i < ECORE_EVAS_SELECTION_BUFFER_LAST; ++i)
|
|
|
|
{
|
|
|
|
if (wdata->selection_data[i].offer == ready->offer)
|
|
|
|
{
|
|
|
|
selection = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selection == ECORE_EVAS_SELECTION_BUFFER_LAST)
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
|
|
|
//Now deliver the content
|
|
|
|
Eina_Slice slice;
|
|
|
|
|
|
|
|
if (!strncmp(ready->mimetype, "text", strlen("text")))
|
|
|
|
{
|
|
|
|
//ensure that we always have a \0 at the end, there is no assertion that \0 is included here.
|
|
|
|
slice.len = ready->len + 1;
|
|
|
|
slice.mem = eina_memdup((unsigned char*)ready->data, ready->len, EINA_TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
slice.len = ready->len;
|
|
|
|
slice.mem = ready->data;
|
|
|
|
}
|
|
|
|
|
|
|
|
Eina_Content *content = eina_content_new(slice, ready->mimetype);
|
|
|
|
|
|
|
|
if (wdata->selection_data[selection].later_convert)
|
|
|
|
{
|
|
|
|
Eina_Content *tmp = eina_content_convert(content, wdata->selection_data[selection].later_convert);
|
|
|
|
wdata->selection_data[selection].later_convert = NULL;
|
|
|
|
eina_content_free(content);
|
|
|
|
content = tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
eina_promise_resolve(wdata->selection_data[selection].delivery, eina_value_content_init(content));
|
|
|
|
wdata->selection_data[selection].delivery = NULL;
|
|
|
|
eina_content_free(content);
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_wl_selection_dnd_leave(void *data, int type EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Ecore_Evas *ee = data;
|
|
|
|
Eina_Position2D cpos;
|
|
|
|
Eina_Position2D fpos = EINA_POSITION2D(0, 0);
|
|
|
|
Ecore_Wl2_Event_Dnd_Leave *ev = event;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
|
|
|
|
|
|
|
|
if (ee->prop.window != (Ecore_Window)ev->win) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
|
|
|
//evas_output_framespace_get(ee->evas, &fpos.x, &fpos.y, NULL, NULL);
|
|
|
|
ecore_wl2_input_pointer_xy_get(ecore_wl2_display_input_find(ev->display, ev->seat), &cpos.x, &cpos.y);
|
|
|
|
ecore_evas_dnd_leave(data, ev->seat, EINA_POSITION2D(cpos.x - fpos.x, cpos.y - fpos.y));
|
|
|
|
wdata->external_offer = NULL;
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_wl_selection_dnd_motion(void *data, int type EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Ecore_Evas *ee = data;
|
|
|
|
Ecore_Wl2_Event_Dnd_Motion *ev = event;
|
|
|
|
Eina_Position2D fpos = EINA_POSITION2D(0, 0);
|
|
|
|
|
|
|
|
if (ee->prop.window != (Ecore_Window)ev->win) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
|
|
|
evas_output_framespace_get(ee->evas, &fpos.x, &fpos.y, NULL, NULL);
|
|
|
|
ecore_evas_dnd_position_set(data, ev->seat, EINA_POSITION2D(ev->x - fpos.x, ev->y - fpos.y));
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
static Eina_Bool
|
|
|
|
_wl_selection_dnd_enter(void *data, int type EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Ecore_Evas *ee = data;
|
|
|
|
Ecore_Wl2_Event_Dnd_Enter *ev = event;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
|
|
|
|
Eina_Position2D fpos = EINA_POSITION2D(0, 0);
|
|
|
|
|
|
|
|
if (ee->prop.window != (Ecore_Window)ev->win) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
|
|
|
evas_output_framespace_get(ee->evas, &fpos.x, &fpos.y, NULL, NULL);
|
|
|
|
ecore_evas_dnd_enter(data, ev->seat, eina_array_iterator_new(ecore_wl2_offer_mimes_get(ev->offer)), EINA_POSITION2D(ev->x - fpos.x, ev->y - fpos.y));
|
|
|
|
ecore_wl2_offer_mimes_set(ev->offer, ecore_wl2_offer_mimes_get(ev->offer));
|
|
|
|
wdata->external_offer = ev->offer;
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_wl_selection_dnd_drop(void *data, int type EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Ecore_Evas *ee = data;
|
|
|
|
Ecore_Wl2_Event_Dnd_Drop *ev = event;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
|
|
|
|
if (ee->prop.window != (Ecore_Window)ev->win) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
|
|
|
|
if (ee->func.fn_dnd_drop)
|
|
|
|
ee->func.fn_dnd_drop(ee, ev->seat, ecore_evas_dnd_pos_get(ee, ev->seat), "ask");
|
|
|
|
|
|
|
|
ecore_wl2_dnd_drag_end(_fetch_input(ee, ev->seat));
|
|
|
|
wdata->external_offer = NULL;
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
static Eina_Bool
|
|
|
|
_wl_selection_dnd_end(void *data, int type EINA_UNUSED, void *event)
|
|
|
|
{
|
|
|
|
Ecore_Evas *ee = data;
|
|
|
|
Ecore_Wl2_Event_Dnd_End *ev = event;
|
|
|
|
|
|
|
|
if (ee->prop.window != (Ecore_Window)ev->win) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
|
|
|
|
|
|
|
if (ee->drag.free)
|
|
|
|
ee->drag.free(ee, ev->seat, ee->drag.data, ee->drag.accepted);
|
|
|
|
ee->drag.free = NULL;
|
|
|
|
//we got dropped, we should call
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ecore_evas_wl_selection_init(Ecore_Evas *ee)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
|
|
|
|
|
|
|
|
wdata->changed_handler = ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_SELECTION,
|
|
|
|
_wl_selection_changed, ee);
|
|
|
|
wdata->send_handler = ecore_event_handler_add(ECORE_WL2_EVENT_DATA_SOURCE_SEND,
|
|
|
|
_wl_interaction_send, ee);
|
|
|
|
wdata->offer_handler = ecore_event_handler_add(ECORE_WL2_EVENT_OFFER_DATA_READY,
|
|
|
|
_wl_selection_receive, ee);
|
|
|
|
wdata->dnd_leave_handler = ecore_event_handler_add(ECORE_WL2_EVENT_DND_LEAVE,
|
|
|
|
_wl_selection_dnd_leave, ee);
|
|
|
|
wdata->dnd_motion_handler = ecore_event_handler_add(ECORE_WL2_EVENT_DND_MOTION,
|
|
|
|
_wl_selection_dnd_motion, ee);
|
|
|
|
wdata->dnd_enter_handler = ecore_event_handler_add(ECORE_WL2_EVENT_DND_ENTER,
|
|
|
|
_wl_selection_dnd_enter, ee);
|
|
|
|
wdata->dnd_drop_handler = ecore_event_handler_add(ECORE_WL2_EVENT_DND_DROP,
|
|
|
|
_wl_selection_dnd_drop, ee);
|
|
|
|
wdata->dnd_end_handler = ecore_event_handler_add(ECORE_WL2_EVENT_DATA_SOURCE_DROP,
|
|
|
|
_wl_selection_dnd_end, ee);
|
|
|
|
for (int i = 0; i < ECORE_EVAS_SELECTION_BUFFER_LAST; ++i)
|
|
|
|
{
|
|
|
|
wdata->selection_data[i].callbacks.available_types = NULL;
|
|
|
|
wdata->selection_data[i].callbacks.delivery = NULL;
|
|
|
|
wdata->selection_data[i].callbacks.cancel = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2020-03-03 04:10:49 -08:00
|
|
|
_ecore_evas_wl_dnd_start(Ecore_Evas *ee, unsigned int seat, Eina_Array *available_types, Ecore_Evas *drag_rep, Ecore_Evas_Selection_Internal_Delivery delivery, Ecore_Evas_Selection_Internal_Cancel cancel, const char *action EINA_UNUSED)
|
2020-02-10 00:20:18 -08:00
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
|
|
|
|
const char *tmp_array[eina_array_count(available_types) + 1];
|
|
|
|
|
|
|
|
_reeval_seat(&seat, ee);
|
|
|
|
_store_selection_cbs(ee, seat, ECORE_EVAS_SELECTION_BUFFER_DRAG_AND_DROP_BUFFER, available_types, delivery, cancel);
|
|
|
|
|
|
|
|
for (unsigned int i = 0; i < eina_array_count(available_types); ++i)
|
|
|
|
{
|
|
|
|
tmp_array[i] = eina_array_data_get(available_types, i);
|
|
|
|
}
|
|
|
|
tmp_array[eina_array_count(available_types)] = NULL;
|
|
|
|
|
|
|
|
ecore_wl2_dnd_drag_types_set(_fetch_input(ee, seat), (const char**)tmp_array);
|
|
|
|
wdata->selection_data[ECORE_EVAS_SELECTION_BUFFER_DRAG_AND_DROP_BUFFER].sent_serial =
|
|
|
|
ecore_wl2_dnd_drag_start(_fetch_input(ee, seat), _ecore_evas_wayland_window_get(ee), _ecore_evas_wayland_window_get(drag_rep));
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_ecore_evas_wl_dnd_stop(Ecore_Evas *ee, unsigned int seat)
|
|
|
|
{
|
|
|
|
_clear_selection(ee, seat, ECORE_EVAS_SELECTION_BUFFER_DRAG_AND_DROP_BUFFER);
|
|
|
|
_reeval_seat(&seat, ee);
|
|
|
|
ecore_wl2_dnd_drag_end(_fetch_input(ee, seat));
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2017-04-25 08:59:33 -07:00
|
|
|
static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
|
|
|
|
{
|
|
|
|
_ecore_evas_wl_common_free,
|
|
|
|
_ecore_evas_wl_common_callback_resize_set,
|
|
|
|
_ecore_evas_wl_common_callback_move_set,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
_ecore_evas_wl_common_callback_delete_request_set,
|
|
|
|
NULL,
|
|
|
|
_ecore_evas_wl_common_callback_focus_in_set,
|
|
|
|
_ecore_evas_wl_common_callback_focus_out_set,
|
|
|
|
_ecore_evas_wl_common_callback_mouse_in_set,
|
|
|
|
_ecore_evas_wl_common_callback_mouse_out_set,
|
|
|
|
NULL, // sticky_set
|
|
|
|
NULL, // unsticky_set
|
|
|
|
NULL, // pre_render_set
|
|
|
|
NULL, // post_render_set
|
2017-08-07 10:26:41 -07:00
|
|
|
NULL,
|
2017-04-25 08:59:33 -07:00
|
|
|
NULL, // managed_move
|
|
|
|
_ecore_evas_wl_common_resize,
|
|
|
|
_ecore_evas_wl_common_move_resize,
|
|
|
|
_ecore_evas_wl_common_rotation_set,
|
|
|
|
NULL, // shaped_set
|
|
|
|
_ecore_evas_wl_common_show,
|
|
|
|
_ecore_evas_wl_common_hide,
|
2018-06-15 11:17:39 -07:00
|
|
|
NULL, // raise
|
2017-04-25 08:59:33 -07:00
|
|
|
NULL, // lower
|
|
|
|
NULL, // activate
|
|
|
|
_ecore_evas_wl_common_title_set,
|
|
|
|
_ecore_evas_wl_common_name_class_set,
|
|
|
|
_ecore_evas_wl_common_size_min_set,
|
|
|
|
_ecore_evas_wl_common_size_max_set,
|
|
|
|
_ecore_evas_wl_common_size_base_set,
|
|
|
|
_ecore_evas_wl_common_size_step_set,
|
|
|
|
_ecore_evas_wl_common_object_cursor_set,
|
|
|
|
NULL,
|
|
|
|
_ecore_evas_wl_common_layer_set,
|
|
|
|
NULL, // focus set
|
|
|
|
_ecore_evas_wl_common_iconified_set,
|
|
|
|
_ecore_evas_wl_common_borderless_set,
|
|
|
|
NULL, // override set
|
|
|
|
_ecore_evas_wl_common_maximized_set,
|
|
|
|
_ecore_evas_wl_common_fullscreen_set,
|
|
|
|
NULL, // func avoid_damage set
|
|
|
|
_ecore_evas_wl_common_withdrawn_set,
|
|
|
|
NULL, // func sticky set
|
|
|
|
_ecore_evas_wl_common_ignore_events_set,
|
|
|
|
_ecore_evas_wl_common_alpha_set,
|
2018-02-12 12:39:36 -08:00
|
|
|
_ecore_evas_wl_common_alpha_set, // transparent set
|
2017-04-25 08:59:33 -07:00
|
|
|
NULL, // func profiles set
|
|
|
|
NULL, // func profile set
|
|
|
|
NULL, // window group set
|
|
|
|
_ecore_evas_wl_common_aspect_set,
|
|
|
|
NULL, // urgent set
|
|
|
|
NULL, // modal set
|
|
|
|
NULL, // demand attention set
|
2017-06-15 07:42:28 -07:00
|
|
|
_ecore_evas_wl_common_focus_skip_set,
|
2017-04-25 08:59:33 -07:00
|
|
|
NULL, //_ecore_evas_wl_common_render,
|
|
|
|
_ecore_evas_wl_common_screen_geometry_get,
|
|
|
|
_ecore_evas_wl_common_screen_dpi_get,
|
|
|
|
NULL, // func msg parent send
|
|
|
|
NULL, // func msg send
|
|
|
|
|
|
|
|
_ecore_evas_wl_common_pointer_xy_get,
|
|
|
|
NULL, // pointer_warp
|
|
|
|
|
2017-06-09 08:06:05 -07:00
|
|
|
_ecore_evas_wl_common_wm_rot_preferred_rotation_set,
|
|
|
|
_ecore_evas_wl_common_wm_rot_available_rotations_set,
|
|
|
|
_ecore_evas_wl_common_wm_rot_manual_rotation_done_set,
|
|
|
|
_ecore_evas_wl_common_wm_rot_manual_rotation_done,
|
2017-04-25 08:59:33 -07:00
|
|
|
|
|
|
|
NULL, // aux_hints_set
|
|
|
|
|
2017-08-18 12:13:11 -07:00
|
|
|
_ecore_evas_wl_common_animator_register,
|
|
|
|
_ecore_evas_wl_common_animator_unregister,
|
2017-04-25 08:59:33 -07:00
|
|
|
|
2017-08-18 12:13:11 -07:00
|
|
|
_ecore_evas_wl_common_evas_changed,
|
2017-04-25 08:59:33 -07:00
|
|
|
NULL, //fn_focus_device_set
|
|
|
|
NULL, //fn_callback_focus_device_in_set
|
|
|
|
NULL, //fn_callback_focus_device_out_set
|
|
|
|
NULL, //fn_callback_device_mouse_in_set
|
|
|
|
NULL, //fn_callback_device_mouse_out_set
|
|
|
|
_ecore_evas_wl_common_pointer_device_xy_get,
|
2017-05-08 15:03:51 -07:00
|
|
|
_ecore_evas_wl_common_prepare,
|
2017-07-12 14:29:17 -07:00
|
|
|
NULL, //fn_last_tick_get
|
2020-02-10 00:20:18 -08:00
|
|
|
_ecore_evas_wl_selection_claim, //fn_selection_claim
|
|
|
|
_ecore_evas_wl_selection_has_owner, //fn_selection_has_owner
|
|
|
|
_ecore_evas_wl_selection_request, //fn_selection_request
|
|
|
|
_ecore_evas_wl_dnd_start, //fn_dnd_start
|
|
|
|
_ecore_evas_wl_dnd_stop, //fn_dnd_stop
|
2017-04-25 08:59:33 -07:00
|
|
|
};
|
|
|
|
|
2019-10-14 11:12:25 -07:00
|
|
|
static void
|
|
|
|
_ecore_evas_wl_common_win_close(void *data, Ecore_Wl2_Window *win EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Ecore_Evas *ee = data;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
|
|
|
|
|
|
|
|
if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee);
|
|
|
|
|
|
|
|
wdata->win = NULL;
|
|
|
|
}
|
|
|
|
|
2016-11-02 11:13:07 -07:00
|
|
|
Ecore_Evas *
|
2019-04-25 00:56:40 -07:00
|
|
|
_ecore_evas_wl_common_new_internal(const char *disp_name, Ecore_Window parent, int x, int y, int w, int h, Eina_Bool frame, const int *opt, const char *engine_name)
|
2016-11-02 11:13:07 -07:00
|
|
|
{
|
|
|
|
Ecore_Wl2_Display *ewd;
|
2018-08-06 12:18:14 -07:00
|
|
|
Ecore_Wl2_Window *p = (Ecore_Wl2_Window *)parent;
|
2016-11-02 11:13:07 -07:00
|
|
|
Evas_Engine_Info_Wayland *einfo;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
Ecore_Evas_Interface_Wayland *iface;
|
|
|
|
Ecore_Evas *ee = NULL;
|
|
|
|
int method = 0;
|
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
if (!(method = evas_render_method_lookup(engine_name)))
|
|
|
|
{
|
2019-06-04 07:23:29 -07:00
|
|
|
WRN("Render method lookup failed for %s", engine_name);
|
2016-11-02 11:13:07 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ecore_wl2_init())
|
|
|
|
{
|
2019-06-04 07:23:29 -07:00
|
|
|
WRN("Failed to initialize Ecore_Wl2");
|
2016-11-02 11:13:07 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ewd = ecore_wl2_display_connect(disp_name);
|
|
|
|
if (!ewd)
|
|
|
|
{
|
2019-06-04 07:23:29 -07:00
|
|
|
WRN("Failed to connect to Wayland Display %s", disp_name);
|
2016-11-02 11:13:07 -07:00
|
|
|
goto conn_err;
|
|
|
|
}
|
2016-11-08 08:06:36 -08:00
|
|
|
|
2016-11-02 11:13:07 -07:00
|
|
|
if (!(ee = calloc(1, sizeof(Ecore_Evas))))
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate Ecore_Evas");
|
2016-11-08 08:06:36 -08:00
|
|
|
goto ee_err;
|
2016-11-02 11:13:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!(wdata = calloc(1, sizeof(Ecore_Evas_Engine_Wl_Data))))
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate Ecore_Evas_Engine_Wl_Data");
|
2016-11-08 08:22:23 -08:00
|
|
|
goto w_err;
|
2016-11-02 11:13:07 -07:00
|
|
|
}
|
|
|
|
|
2016-10-26 21:33:36 -07:00
|
|
|
if (frame) WRN("draw_frame is now deprecated and will have no effect");
|
|
|
|
|
2016-11-02 11:13:07 -07:00
|
|
|
ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
|
|
|
|
|
|
|
|
_ecore_evas_wl_common_init();
|
|
|
|
|
|
|
|
ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wl_engine_func;
|
|
|
|
ee->engine.data = wdata;
|
|
|
|
|
|
|
|
iface = _ecore_evas_wl_interface_new();
|
|
|
|
ee->engine.ifaces = eina_list_append(ee->engine.ifaces, iface);
|
|
|
|
|
|
|
|
ee->driver = engine_name;
|
|
|
|
if (disp_name) ee->name = strdup(disp_name);
|
|
|
|
|
|
|
|
ee->w = w;
|
|
|
|
ee->h = h;
|
|
|
|
ee->req.x = ee->x;
|
|
|
|
ee->req.y = ee->y;
|
|
|
|
ee->req.w = ee->w;
|
|
|
|
ee->req.h = ee->h;
|
|
|
|
ee->rotation = 0;
|
|
|
|
ee->prop.max.w = 32767;
|
|
|
|
ee->prop.max.h = 32767;
|
|
|
|
ee->prop.layer = 4;
|
|
|
|
ee->prop.request_pos = EINA_FALSE;
|
|
|
|
ee->prop.sticky = EINA_FALSE;
|
|
|
|
ee->prop.withdrawn = EINA_TRUE;
|
|
|
|
ee->alpha = EINA_FALSE;
|
|
|
|
|
|
|
|
/* Wayland egl engine can't async render */
|
2019-10-22 07:59:29 -07:00
|
|
|
if (getenv("ECORE_EVAS_FORCE_SYNC_RENDER") ||
|
|
|
|
!strcmp(engine_name, "wayland_egl"))
|
2016-11-02 11:13:07 -07:00
|
|
|
ee->can_async_render = 0;
|
|
|
|
else
|
|
|
|
ee->can_async_render = 1;
|
|
|
|
|
2018-08-06 12:18:14 -07:00
|
|
|
if (p) ee->alpha = ecore_wl2_window_alpha_get(p);
|
2016-11-02 11:13:07 -07:00
|
|
|
|
|
|
|
wdata->sync_done = EINA_FALSE;
|
|
|
|
wdata->parent = p;
|
|
|
|
wdata->display = ewd;
|
2017-01-11 07:08:43 -08:00
|
|
|
|
2018-06-01 07:13:14 -07:00
|
|
|
wdata->win = ecore_wl2_window_new(ewd, p, x, y, w, h);
|
2019-10-22 07:59:29 -07:00
|
|
|
ecore_wl2_window_close_callback_set(wdata->win,
|
|
|
|
_ecore_evas_wl_common_win_close, ee);
|
2018-07-06 07:16:21 -07:00
|
|
|
ee->prop.window = (Ecore_Window)wdata->win;
|
2019-10-22 07:59:29 -07:00
|
|
|
ee->prop.aux_hint.supported_list =
|
|
|
|
ecore_wl2_window_aux_hints_supported_get(wdata->win);
|
2017-08-04 13:08:42 -07:00
|
|
|
ecore_evas_aux_hint_add(ee, "wm.policy.win.msg.use", "1");
|
2016-11-02 11:13:07 -07:00
|
|
|
|
2018-06-01 07:13:14 -07:00
|
|
|
if (!ecore_evas_evas_new(ee, ee->w, ee->h))
|
2018-04-02 14:55:57 -07:00
|
|
|
{
|
|
|
|
ERR("Can not create Canvas.");
|
|
|
|
goto eng_err;
|
|
|
|
}
|
|
|
|
|
2016-11-02 11:13:07 -07:00
|
|
|
evas_output_method_set(ee->evas, method);
|
|
|
|
|
2017-05-08 15:03:51 -07:00
|
|
|
evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_POST,
|
|
|
|
_ecore_evas_wl_common_render_updates, ee);
|
2016-11-02 11:13:07 -07:00
|
|
|
|
|
|
|
evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE,
|
|
|
|
_ecore_evas_wl_common_render_flush_pre, ee);
|
|
|
|
|
|
|
|
if (ewd->sync_done)
|
|
|
|
{
|
|
|
|
wdata->sync_done = EINA_TRUE;
|
|
|
|
if ((einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas)))
|
|
|
|
{
|
2019-04-25 00:56:40 -07:00
|
|
|
if (opt)
|
|
|
|
{
|
|
|
|
int op;
|
|
|
|
for (op = 0; opt[op]; op++)
|
|
|
|
{
|
|
|
|
if (opt[op] == ECORE_EVAS_OPT_GL_DEPTH)
|
|
|
|
{
|
|
|
|
op++;
|
|
|
|
einfo->depth_bits = opt[op];
|
|
|
|
}
|
|
|
|
else if (opt[op] == ECORE_EVAS_OPT_GL_STENCIL)
|
|
|
|
{
|
|
|
|
op++;
|
|
|
|
einfo->stencil_bits = opt[op];
|
|
|
|
}
|
|
|
|
else if (opt[op] == ECORE_EVAS_OPT_GL_MSAA)
|
|
|
|
{
|
|
|
|
op++;
|
|
|
|
einfo->msaa_bits = opt[op];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-12 12:58:01 -08:00
|
|
|
einfo->info.destination_alpha = ee_needs_alpha(ee);
|
2016-11-02 11:13:07 -07:00
|
|
|
einfo->info.rotation = ee->rotation;
|
|
|
|
einfo->info.depth = 32;
|
2017-08-14 15:07:31 -07:00
|
|
|
einfo->info.wl2_win = wdata->win;
|
2017-01-11 09:23:53 -08:00
|
|
|
einfo->info.hidden = EINA_TRUE;
|
2016-11-02 11:13:07 -07:00
|
|
|
|
|
|
|
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
|
|
|
|
{
|
|
|
|
ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
|
2016-11-08 08:06:36 -08:00
|
|
|
goto eng_err;
|
2016-11-02 11:13:07 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
|
2016-11-08 08:06:36 -08:00
|
|
|
goto eng_err;
|
2016-11-02 11:13:07 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Ecore Evas Wayland: Create the devices during Ecore_Evas setup.
Summary:
When launching an Elementary App using Wayland the elm_config will
automatically connect to the Wayland's display server and all events
regarding seats are lost, since by the time that Ecore_Evas is created
the global events were already dispatched. To fix this problem,
everytime an Ecore_Evas is created, the code must check if there
are any seat capabilities available, if so, the devices will be created.
Reviewers: bdilly, barbieri, cedric, jpeg
Subscribers: devilhorns, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4390
2016-11-13 18:03:56 -08:00
|
|
|
if (!_ecore_wl2_devices_setup(ee, ewd))
|
|
|
|
{
|
|
|
|
ERR("Failed to create the devices");
|
|
|
|
goto eng_err;
|
|
|
|
}
|
|
|
|
|
2017-06-09 08:06:05 -07:00
|
|
|
_ecore_evas_wl_common_wm_rotation_protocol_set(ee);
|
2020-02-10 00:20:18 -08:00
|
|
|
_ecore_evas_wl_selection_init(ee);
|
2017-06-09 08:06:05 -07:00
|
|
|
|
2018-04-02 14:55:57 -07:00
|
|
|
ecore_evas_done(ee, EINA_FALSE);
|
2016-11-02 11:13:07 -07:00
|
|
|
|
|
|
|
wdata->sync_handler =
|
|
|
|
ecore_event_handler_add(ECORE_WL2_EVENT_SYNC_DONE, _ee_cb_sync_done, ee);
|
|
|
|
|
|
|
|
ee_list = eina_list_append(ee_list, ee);
|
|
|
|
|
2018-04-12 11:44:10 -07:00
|
|
|
ee->draw_block = EINA_TRUE;
|
2017-08-18 12:13:11 -07:00
|
|
|
|
2016-11-02 11:13:07 -07:00
|
|
|
return ee;
|
|
|
|
|
2016-11-08 08:06:36 -08:00
|
|
|
eng_err:
|
2016-11-09 14:33:49 -08:00
|
|
|
/* ecore_evas_free() will call ecore_wl2_display_disconnect()
|
2018-02-21 14:39:37 -08:00
|
|
|
* and free(ee), it will also call ecore_wl2_shutdown(), so we
|
|
|
|
* take an extra reference here to keep the count right. */
|
|
|
|
ecore_wl2_init();
|
2016-11-08 08:06:36 -08:00
|
|
|
ecore_evas_free(ee);
|
2016-11-09 14:33:49 -08:00
|
|
|
ee = NULL;
|
2016-11-08 08:06:36 -08:00
|
|
|
w_err:
|
|
|
|
free(ee);
|
|
|
|
ee_err:
|
2016-11-09 14:33:49 -08:00
|
|
|
if (ee) ecore_wl2_display_disconnect(ewd);
|
2016-11-02 11:13:07 -07:00
|
|
|
conn_err:
|
|
|
|
ecore_wl2_shutdown();
|
|
|
|
return NULL;
|
|
|
|
}
|