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>
|
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);
|
|
|
|
|
|
|
|
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
|
|
|
|
_ecore_evas_wl_common_move,
|
|
|
|
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,
|
|
|
|
_ecore_evas_wl_common_raise,
|
|
|
|
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,
|
2016-11-22 10:14:03 -08:00
|
|
|
NULL,
|
2016-11-02 11:13:07 -07:00
|
|
|
_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,
|
|
|
|
_ecore_evas_wl_common_transparent_set,
|
|
|
|
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
|
|
|
|
NULL, // focus skip set
|
|
|
|
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
|
|
|
|
|
|
|
|
NULL, // wm_rot_preferred_rotation_set
|
|
|
|
NULL, // wm_rot_available_rotations_set
|
|
|
|
NULL, // wm_rot_manual_rotation_done_set
|
|
|
|
NULL, // wm_rot_manual_rotation_done
|
|
|
|
|
|
|
|
NULL, // aux_hints_set
|
|
|
|
|
|
|
|
NULL, // fn_animator_register
|
|
|
|
NULL, // fn_animator_unregister
|
|
|
|
|
|
|
|
NULL, // fn_evas_changed
|
2016-11-03 07:07:40 -07:00
|
|
|
NULL, //fn_focus_device_set
|
|
|
|
NULL, //fn_callback_focus_device_in_set
|
|
|
|
NULL, //fn_callback_focus_device_out_set
|
2016-11-09 11:54:55 -08:00
|
|
|
NULL, //fn_callback_device_mouse_in_set
|
|
|
|
NULL, //fn_callback_device_mouse_out_set
|
2016-11-21 09:57:05 -08:00
|
|
|
_ecore_evas_wl_common_pointer_device_xy_get,
|
2016-11-02 11:13:07 -07:00
|
|
|
};
|
|
|
|
|
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-01-11 09:23:53 -08:00
|
|
|
static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[13];
|
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);
|
2013-02-27 01:49:23 -08:00
|
|
|
|
|
|
|
/* local function prototypes */
|
|
|
|
static int _ecore_evas_wl_common_render_updates_process(Ecore_Evas *ee, Eina_List *updates);
|
2013-03-25 19:48:23 -07:00
|
|
|
void _ecore_evas_wl_common_render_updates(void *data, Evas *evas EINA_UNUSED, void *event);
|
2013-05-06 10:48:03 -07:00
|
|
|
static void _rotation_do(Ecore_Evas *ee, int rotation, int resize);
|
|
|
|
static void _ecore_evas_wayland_alpha_do(Ecore_Evas *ee, int alpha);
|
|
|
|
static void _ecore_evas_wayland_transparent_do(Ecore_Evas *ee, int transparent);
|
2013-02-27 01:49:23 -08:00
|
|
|
|
|
|
|
/* local functions */
|
2013-11-01 01:41:30 -07:00
|
|
|
static void
|
|
|
|
_ecore_evas_wl_common_state_update(Ecore_Evas *ee)
|
|
|
|
{
|
|
|
|
if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
|
|
|
|
}
|
|
|
|
|
2013-02-27 01:49:23 -08:00
|
|
|
static int
|
|
|
|
_ecore_evas_wl_common_render_updates_process(Ecore_Evas *ee, Eina_List *updates)
|
|
|
|
{
|
|
|
|
int rend = 0;
|
|
|
|
|
2015-10-08 10:37:30 -07:00
|
|
|
if (((ee->visible) && (ee->draw_ok)) ||
|
|
|
|
((ee->should_be_visible) && (ee->prop.fullscreen)) ||
|
|
|
|
((ee->should_be_visible) && (ee->prop.override)))
|
2013-02-27 01:49:23 -08:00
|
|
|
{
|
2015-10-08 10:37:30 -07:00
|
|
|
if (updates)
|
|
|
|
{
|
|
|
|
_ecore_evas_idle_timeout_update(ee);
|
|
|
|
rend = 1;
|
|
|
|
}
|
2013-02-27 01:49:23 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
evas_norender(ee->evas);
|
|
|
|
|
|
|
|
if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
|
|
|
|
|
|
|
|
return rend;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
ee = ecore_event_window_match(ev->window);
|
|
|
|
if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
if (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;
|
|
|
|
ee = ecore_event_window_match(ev->window);
|
|
|
|
if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
if (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;
|
2015-09-30 10:14:26 -07:00
|
|
|
ee = ecore_event_window_match(ev->window);
|
2012-10-08 07:09:53 -07:00
|
|
|
if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
|
2015-09-30 10:14:26 -07:00
|
|
|
if (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;
|
2015-09-30 10:14:26 -07:00
|
|
|
ee = ecore_event_window_match(ev->window);
|
2012-10-08 07:09:53 -07:00
|
|
|
if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
|
2015-09-30 10:14:26 -07:00
|
|
|
if (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;
|
|
|
|
|
|
|
|
einfo->info.wl_display = NULL;
|
|
|
|
einfo->info.wl_surface = NULL;
|
|
|
|
|
|
|
|
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;
|
|
|
|
if (wdata->anim_callback) wl_callback_destroy(wdata->anim_callback);
|
|
|
|
wdata->anim_callback = NULL;
|
|
|
|
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;
|
|
|
|
ecore_evas_manual_render_set(ee, 1);
|
2017-03-02 13:50:24 -08:00
|
|
|
_ee_display_unset(ee);
|
2016-05-05 07:45:59 -07:00
|
|
|
}
|
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
|
|
|
|
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;
|
2017-03-10 12:54:34 -08:00
|
|
|
int nw = 0, nh = 0, fw, fh, pfw, pfh;
|
|
|
|
Eina_Bool 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;
|
|
|
|
ee = ecore_event_window_match(ev->win);
|
|
|
|
if (!ee) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
2013-04-30 12:29:00 -07:00
|
|
|
wdata = ee->engine.data;
|
|
|
|
if (!wdata) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
|
|
|
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;
|
2013-04-30 12:29:00 -07:00
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
nw = ev->w;
|
|
|
|
nh = ev->h;
|
2013-10-31 10:21:33 -07:00
|
|
|
|
2017-03-10 12:54:34 -08:00
|
|
|
pfw = fw = wdata->win->geometry.w - wdata->content.w;
|
|
|
|
pfh = fh = wdata->win->geometry.h - wdata->content.h;
|
2016-04-07 11:14:14 -07:00
|
|
|
|
2015-11-17 15:21:11 -08:00
|
|
|
if ((prev_max != ee->prop.maximized) ||
|
|
|
|
(prev_full != ee->prop.fullscreen))
|
2016-04-07 11:14:14 -07:00
|
|
|
{
|
2017-03-10 12:54:34 -08:00
|
|
|
state_change = EINA_TRUE;
|
2016-04-07 11:14:14 -07:00
|
|
|
_ecore_evas_wl_common_state_update(ee);
|
|
|
|
fw = wdata->win->geometry.w - wdata->content.w;
|
|
|
|
fh = wdata->win->geometry.h - wdata->content.h;
|
|
|
|
}
|
2015-11-17 15:21:11 -08:00
|
|
|
|
2017-03-10 12:54:34 -08:00
|
|
|
if ((!nw) && (!nh))
|
|
|
|
{
|
2017-03-10 13:11:19 -08:00
|
|
|
if (wdata->win->configure_serial && wdata->win->surface &&
|
|
|
|
((!state_change) || ((pfw == fw) && (pfh == fh))))
|
|
|
|
{
|
|
|
|
if (wdata->win->zxdg_configure_ack)
|
|
|
|
wdata->win->zxdg_configure_ack(wdata->win->zxdg_surface,
|
|
|
|
wdata->win->configure_serial);
|
|
|
|
else if (wdata->win->configure_ack)
|
|
|
|
wdata->win->configure_ack(wdata->win->xdg_surface,
|
|
|
|
wdata->win->configure_serial);
|
|
|
|
wdata->win->configure_serial = 0;
|
|
|
|
wl_surface_commit(wdata->win->surface);
|
|
|
|
}
|
2017-03-10 12:54:34 -08:00
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
2017-01-10 08:28:40 -08:00
|
|
|
|
2016-04-07 11:14:14 -07:00
|
|
|
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))
|
2013-11-15 00:11:09 -08:00
|
|
|
_ecore_evas_wl_common_resize(ee, nw, nh);
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
ev = event;
|
|
|
|
ee = ecore_event_window_match(ev->win);
|
|
|
|
if (!ee) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
|
|
|
if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
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 */
|
2013-04-24 11:21:44 -07:00
|
|
|
if (!ee->prop.fullscreen)
|
|
|
|
{
|
2013-09-16 23:37:07 -07:00
|
|
|
/* resize the ecore_wayland window */
|
2015-09-28 10:42:38 -07:00
|
|
|
ecore_wl2_window_resize(wdata->win,
|
|
|
|
ee->req.h + fw, ee->req.w + fh, 0);
|
2013-09-16 23:37:07 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* 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 ecore_wayland window */
|
2015-09-28 10:42:38 -07:00
|
|
|
ecore_wl2_window_resize(wdata->win,
|
|
|
|
ee->req.w, ee->req.h, 0);
|
2013-09-16 23:37:07 -07:00
|
|
|
|
|
|
|
/* resize the canvas */
|
|
|
|
evas_output_size_set(ee->evas, ee->req.w, ee->req.h);
|
|
|
|
evas_output_viewport_set(ee->evas, 0, 0,
|
|
|
|
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 ecore_wayland window */
|
2015-09-28 10:42:38 -07:00
|
|
|
ecore_wl2_window_resize(wdata->win,
|
|
|
|
ee->req.h, ee->req.w, 0);
|
2013-09-16 23:37:07 -07:00
|
|
|
|
|
|
|
/* resize the canvas */
|
|
|
|
evas_output_size_set(ee->evas, ee->req.h, ee->req.w);
|
|
|
|
evas_output_viewport_set(ee->evas, 0, 0,
|
|
|
|
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
|
|
|
/* resize the ecore_wayland window */
|
2015-09-28 10:42:38 -07:00
|
|
|
ecore_wl2_window_resize(wdata->win, ee->w, ee->h, 0);
|
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;
|
|
|
|
|
|
|
|
ee = ecore_event_window_match(ev->window);
|
|
|
|
if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
ee = ecore_event_window_match(ev->window);
|
|
|
|
if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
|
|
|
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;
|
|
|
|
ev->window_id = ee->prop.window;
|
|
|
|
|
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 *
|
2017-01-31 07:29:50 -08:00
|
|
|
_ecore_evas_wl_common_seat_add(Ecore_Evas *ee, unsigned int 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
|
|
|
{
|
|
|
|
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);
|
|
|
|
|
2016-11-16 11:04:02 -08:00
|
|
|
snprintf(buf, sizeof(buf), "seat-%u", id);
|
2017-01-10 06:44:53 -08:00
|
|
|
dev =
|
|
|
|
evas_device_add_full(ee->evas, buf, "Wayland seat", NULL, NULL,
|
|
|
|
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);
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(wdata->devices_list, ll, device)
|
|
|
|
{
|
|
|
|
if (device->id == ev->id)
|
|
|
|
{
|
|
|
|
already_present = EINA_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (already_present)
|
|
|
|
continue;
|
|
|
|
|
2016-11-16 11:04:02 -08:00
|
|
|
if (!_ecore_evas_wl_common_seat_add(ee, ev->id))
|
|
|
|
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;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
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,
|
|
|
|
ECORE_WL2_DEVICE_TYPE_POINTER, ev->id, NULL, 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,
|
|
|
|
ECORE_WL2_DEVICE_TYPE_KEYBOARD, ev->id, NULL, 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,
|
|
|
|
ev->id, NULL, 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;
|
|
|
|
}
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
int
|
|
|
|
_ecore_evas_wl_common_init(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 != 1)
|
|
|
|
return _ecore_evas_wl_init_count;
|
|
|
|
|
|
|
|
_ecore_evas_wl_event_hdls[0] =
|
2015-09-28 10:42:38 -07:00
|
|
|
ecore_event_handler_add(ECORE_EVENT_MOUSE_IN,
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_cb_mouse_in, NULL);
|
|
|
|
_ecore_evas_wl_event_hdls[1] =
|
2015-09-28 10:42:38 -07:00
|
|
|
ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT,
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_cb_mouse_out, NULL);
|
|
|
|
_ecore_evas_wl_event_hdls[2] =
|
2015-09-28 10:42:38 -07:00
|
|
|
ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_IN,
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_cb_focus_in, NULL);
|
|
|
|
_ecore_evas_wl_event_hdls[3] =
|
2015-09-28 10:42:38 -07:00
|
|
|
ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_OUT,
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_cb_focus_out, NULL);
|
|
|
|
_ecore_evas_wl_event_hdls[4] =
|
2015-09-28 10:42:38 -07:00
|
|
|
ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE,
|
2012-10-08 07:09:53 -07:00
|
|
|
_ecore_evas_wl_common_cb_window_configure, NULL);
|
2016-03-24 10:44:21 -07:00
|
|
|
_ecore_evas_wl_event_hdls[5] =
|
|
|
|
ecore_event_handler_add(_ecore_wl2_event_window_www,
|
|
|
|
_ecore_evas_wl_common_cb_www, NULL);
|
|
|
|
_ecore_evas_wl_event_hdls[6] =
|
|
|
|
ecore_event_handler_add(_ecore_wl2_event_window_www_drag,
|
|
|
|
_ecore_evas_wl_common_cb_www_drag, NULL);
|
2016-05-05 07:45:59 -07:00
|
|
|
_ecore_evas_wl_event_hdls[7] =
|
|
|
|
ecore_event_handler_add(ECORE_WL2_EVENT_DISCONNECT,
|
|
|
|
_ecore_evas_wl_common_cb_disconnect, NULL);
|
2016-10-03 08:34:10 -07:00
|
|
|
_ecore_evas_wl_event_hdls[8] =
|
|
|
|
ecore_event_handler_add(ECORE_WL2_EVENT_GLOBAL_ADDED,
|
|
|
|
_ecore_evas_wl_common_cb_global_added, NULL);
|
|
|
|
_ecore_evas_wl_event_hdls[9] =
|
|
|
|
ecore_event_handler_add(ECORE_WL2_EVENT_GLOBAL_REMOVED,
|
|
|
|
_ecore_evas_wl_common_cb_global_removed, NULL);
|
2016-10-04 11:19:51 -07:00
|
|
|
_ecore_evas_wl_event_hdls[10] =
|
|
|
|
ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_NAME_CHANGED,
|
|
|
|
_ecore_evas_wl_common_cb_seat_name_changed, NULL);
|
2016-10-05 06:36:19 -07:00
|
|
|
_ecore_evas_wl_event_hdls[11] =
|
|
|
|
ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_CAPABILITIES_CHANGED,
|
|
|
|
_ecore_evas_wl_common_cb_seat_capabilities_changed,
|
|
|
|
NULL);
|
2017-01-11 09:23:53 -08:00
|
|
|
_ecore_evas_wl_event_hdls[12] =
|
|
|
|
ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE,
|
|
|
|
_ecore_evas_wl_common_cb_window_configure_complete,
|
|
|
|
NULL);
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
_ecore_evas_wl_common_shutdown(void)
|
|
|
|
{
|
|
|
|
unsigned int i = 0;
|
|
|
|
|
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;
|
|
|
|
|
2016-03-24 10:44:21 -07:00
|
|
|
for (i = 0; i < EINA_C_ARRAY_LENGTH(_ecore_evas_wl_event_hdls); i++)
|
2012-10-08 07:09:53 -07:00
|
|
|
{
|
|
|
|
if (_ecore_evas_wl_event_hdls[i])
|
|
|
|
ecore_event_handler_del(_ecore_evas_wl_event_hdls[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
ecore_event_evas_shutdown();
|
|
|
|
|
|
|
|
return _ecore_evas_wl_init_count;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_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);
|
2015-09-28 10:42:38 -07:00
|
|
|
if (wdata->anim_callback) wl_callback_destroy(wdata->anim_callback);
|
2016-05-05 07:45:59 -07:00
|
|
|
ecore_event_handler_del(wdata->sync_handler);
|
2015-09-28 10:42:38 -07:00
|
|
|
if (wdata->win) ecore_wl2_window_free(wdata->win);
|
|
|
|
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_input_event_unregister(ee);
|
|
|
|
|
|
|
|
_ecore_evas_wl_common_shutdown();
|
2015-09-28 10:42:38 -07:00
|
|
|
|
|
|
|
ecore_wl2_shutdown();
|
2012-10-08 07:09:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
|
|
|
|
{
|
2015-09-30 07:58:13 -07:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
2013-11-15 00:11:09 -08:00
|
|
|
int ow, oh;
|
2017-02-19 17:28:27 -08:00
|
|
|
int diff = 0;
|
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-30 07:58:13 -07:00
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
if (!wdata) return;
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
if (w < 1) w = 1;
|
|
|
|
if (h < 1) h = 1;
|
|
|
|
|
|
|
|
ee->req.w = w;
|
|
|
|
ee->req.h = h;
|
2017-03-02 17:27:00 -08:00
|
|
|
|
|
|
|
/* TODO: wayland client can resize the ecore_evas directly.
|
|
|
|
* In the future, we will remove ee->req value in wayland backend */
|
|
|
|
ee->w = w;
|
|
|
|
ee->h = h;
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
if (!ee->prop.fullscreen)
|
|
|
|
{
|
|
|
|
int fw = 0, fh = 0;
|
2015-01-07 11:47:55 -08:00
|
|
|
int maxw = 0, maxh = 0;
|
|
|
|
int minw = 0, minh = 0;
|
|
|
|
double a = 0.0;
|
2015-01-07 10:37:55 -08:00
|
|
|
|
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
|
|
|
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
|
|
|
|
|
2014-01-18 05:26:10 -08:00
|
|
|
if (ECORE_EVAS_PORTRAIT(ee))
|
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
|
|
|
{
|
2015-01-07 11:47:55 -08:00
|
|
|
if (ee->prop.min.w > 0)
|
|
|
|
minw = (ee->prop.min.w - fw);
|
|
|
|
if (ee->prop.min.h > 0)
|
|
|
|
minh = (ee->prop.min.h - fh);
|
|
|
|
if (ee->prop.max.w > 0)
|
|
|
|
maxw = (ee->prop.max.w + fw);
|
|
|
|
if (ee->prop.max.h > 0)
|
|
|
|
maxh = (ee->prop.max.h + fh);
|
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
|
|
|
}
|
2014-01-18 05:26:10 -08:00
|
|
|
else
|
|
|
|
{
|
2015-01-07 11:47:55 -08:00
|
|
|
if (ee->prop.min.w > 0)
|
|
|
|
minw = (ee->prop.min.w - fh);
|
|
|
|
if (ee->prop.min.h > 0)
|
|
|
|
minh = (ee->prop.min.h - fw);
|
|
|
|
if (ee->prop.max.w > 0)
|
|
|
|
maxw = (ee->prop.max.w + fh);
|
|
|
|
if (ee->prop.max.h > 0)
|
|
|
|
maxh = (ee->prop.max.h + fw);
|
2014-01-18 05:26:10 -08:00
|
|
|
}
|
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
|
|
|
|
|
|
|
/* adjust size using aspect */
|
|
|
|
if ((ee->prop.base.w >= 0) && (ee->prop.base.h >= 0))
|
|
|
|
{
|
|
|
|
int bw, bh;
|
|
|
|
|
|
|
|
bw = (w - ee->prop.base.w);
|
|
|
|
bh = (h - ee->prop.base.h);
|
|
|
|
if (bw < 1) bw = 1;
|
|
|
|
if (bh < 1) bh = 1;
|
|
|
|
a = ((double)bw / (double)bh);
|
2016-12-20 05:53:16 -08:00
|
|
|
|
2017-01-06 09:57:46 -08:00
|
|
|
if ((!EINA_FLT_EQ(ee->prop.aspect, 0.0) &&
|
2016-12-20 05:53:16 -08:00
|
|
|
(a < ee->prop.aspect)))
|
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
|
|
|
{
|
|
|
|
if ((h < ee->h) > 0)
|
|
|
|
bw = bh * ee->prop.aspect;
|
|
|
|
else
|
|
|
|
bw = bw / ee->prop.aspect;
|
|
|
|
|
|
|
|
w = bw + ee->prop.base.w;
|
|
|
|
h = bh + ee->prop.base.h;
|
|
|
|
}
|
2017-01-06 09:57:46 -08:00
|
|
|
else if ((!EINA_FLT_EQ(ee->prop.aspect, 0.0)) &&
|
2016-12-20 05:53:16 -08:00
|
|
|
(a > ee->prop.aspect))
|
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
|
|
|
{
|
|
|
|
bw = bh * ee->prop.aspect;
|
|
|
|
w = bw + ee->prop.base.w;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
a = ((double)w / (double)h);
|
2017-01-06 09:57:46 -08:00
|
|
|
if ((!EINA_FLT_EQ(ee->prop.aspect, 0.0)) &&
|
2016-12-20 05:53:16 -08:00
|
|
|
(a < ee->prop.aspect))
|
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
|
|
|
{
|
|
|
|
if ((h < ee->h) > 0)
|
|
|
|
w = h * ee->prop.aspect;
|
|
|
|
else
|
|
|
|
h = w / ee->prop.aspect;
|
|
|
|
}
|
2017-01-06 09:57:46 -08:00
|
|
|
else if ((!EINA_FLT_EQ(ee->prop.aspect, 0.0)) &&
|
2016-12-20 05:53:16 -08:00
|
|
|
(a > ee->prop.aspect))
|
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
|
|
|
w = h * ee->prop.aspect;
|
|
|
|
}
|
|
|
|
|
2015-10-30 12:12:41 -07:00
|
|
|
if (!ee->prop.maximized)
|
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
|
|
|
{
|
2015-10-30 12:12:41 -07:00
|
|
|
/* calc new size using base size & step size */
|
|
|
|
if (ee->prop.step.w > 0)
|
|
|
|
{
|
|
|
|
if (ee->prop.base.w >= 0)
|
|
|
|
w = (ee->prop.base.w +
|
|
|
|
(((w - ee->prop.base.w) / ee->prop.step.w) *
|
|
|
|
ee->prop.step.w));
|
|
|
|
else
|
|
|
|
w = (minw + (((w - minw) / ee->prop.step.w) * ee->prop.step.w));
|
|
|
|
}
|
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
|
|
|
|
2015-10-30 12:12:41 -07:00
|
|
|
if (ee->prop.step.h > 0)
|
|
|
|
{
|
|
|
|
if (ee->prop.base.h >= 0)
|
|
|
|
h = (ee->prop.base.h +
|
|
|
|
(((h - ee->prop.base.h) / ee->prop.step.h) *
|
|
|
|
ee->prop.step.h));
|
|
|
|
else
|
|
|
|
h = (minh + (((h - minh) / ee->prop.step.h) * ee->prop.step.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
|
|
|
}
|
2012-10-08 07:09:53 -07:00
|
|
|
|
2015-01-07 11:47:55 -08:00
|
|
|
if ((maxw > 0) && (w > maxw))
|
|
|
|
w = maxw;
|
|
|
|
else if (w < minw)
|
|
|
|
w = minw;
|
|
|
|
|
|
|
|
if ((maxh > 0) && (h > maxh))
|
|
|
|
h = maxh;
|
|
|
|
else if (h < minh)
|
|
|
|
h = minh;
|
2012-10-08 07:09:53 -07:00
|
|
|
|
2017-03-02 19:44:35 -08:00
|
|
|
ee->w = w;
|
|
|
|
ee->h = h;
|
|
|
|
ee->req.w = w;
|
|
|
|
ee->req.h = h;
|
2017-03-02 17:27:00 -08:00
|
|
|
|
2014-01-18 05:26:10 -08:00
|
|
|
if (ECORE_EVAS_PORTRAIT(ee))
|
2013-11-15 00:11:09 -08:00
|
|
|
{
|
2014-01-18 05:26:10 -08:00
|
|
|
w += fw;
|
|
|
|
h += fh;
|
2013-11-15 00:11:09 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-01-18 05:26:10 -08:00
|
|
|
w += fh;
|
|
|
|
h += fw;
|
2013-11-15 00:11:09 -08:00
|
|
|
}
|
2012-10-08 07:09:53 -07:00
|
|
|
}
|
|
|
|
|
2013-11-15 00:11:09 -08:00
|
|
|
evas_output_size_get(ee->evas, &ow, &oh);
|
2017-02-19 17:28:27 -08: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)
|
2012-10-08 07:09:53 -07:00
|
|
|
{
|
2014-01-18 05:26:10 -08:00
|
|
|
if (ECORE_EVAS_PORTRAIT(ee))
|
2012-10-08 07:09:53 -07:00
|
|
|
{
|
2014-01-18 05:26:10 -08:00
|
|
|
evas_output_size_set(ee->evas, w, h);
|
|
|
|
evas_output_viewport_set(ee->evas, 0, 0, w, h);
|
2012-10-08 07:09:53 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-01-18 05:26:10 -08:00
|
|
|
evas_output_size_set(ee->evas, h, w);
|
|
|
|
evas_output_viewport_set(ee->evas, 0, 0, h, w);
|
2012-10-08 07:09:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2013-11-15 00:11:09 -08:00
|
|
|
if (ee->func.fn_resize) ee->func.fn_resize(ee);
|
2012-10-08 07:09:53 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-01 05:42:23 -07:00
|
|
|
void
|
|
|
|
_ecore_evas_wl_common_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
if (!ee) return;
|
|
|
|
if ((ee->x != x) || (ee->y != y))
|
|
|
|
_ecore_evas_wl_common_move(ee, x, y);
|
|
|
|
if ((ee->w != w) || (ee->h != h))
|
|
|
|
_ecore_evas_wl_common_resize(ee, w, h);
|
|
|
|
}
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
void
|
|
|
|
_ecore_evas_wl_common_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
|
|
|
|
{
|
|
|
|
if (!ee) return;
|
|
|
|
ee->func.fn_resize = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_evas_wl_common_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
|
|
|
|
{
|
|
|
|
if (!ee) return;
|
|
|
|
ee->func.fn_move = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_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;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_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;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_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;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_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;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_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;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_evas_wl_common_move(Ecore_Evas *ee, int x, int y)
|
|
|
|
{
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
if (!ee) return;
|
|
|
|
|
|
|
|
ee->req.x = x;
|
|
|
|
ee->req.y = y;
|
|
|
|
|
|
|
|
if ((ee->x != x) || (ee->y != y))
|
|
|
|
{
|
|
|
|
ee->x = x;
|
|
|
|
ee->y = y;
|
|
|
|
if (ee->func.fn_move) ee->func.fn_move(ee);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-08 03:02:58 -07:00
|
|
|
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;
|
|
|
|
|
2013-07-08 03:02:58 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2015-09-28 10:42:38 -07:00
|
|
|
wdata = ee->engine.data;
|
|
|
|
ecore_wl2_window_pointer_xy_get(wdata->win, x, y);
|
2013-07-08 03:02:58 -07:00
|
|
|
}
|
|
|
|
|
2016-11-21 09:57:05 -08:00
|
|
|
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;
|
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
ecore_wl2_window_pointer_device_xy_get(wdata->win, pointer, x, y);
|
|
|
|
}
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
void
|
|
|
|
_ecore_evas_wl_common_raise(Ecore_Evas *ee)
|
|
|
|
{
|
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) || (!ee->visible)) return;
|
2012-12-05 13:15:42 -08:00
|
|
|
wdata = ee->engine.data;
|
2015-09-28 10:42:38 -07:00
|
|
|
ecore_wl2_window_raise(wdata->win);
|
2012-10-08 07:09:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_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
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_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
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_evas_wl_common_size_min_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.min.w == w) && (ee->prop.min.h == h)) return;
|
|
|
|
ee->prop.min.w = w;
|
|
|
|
ee->prop.min.h = h;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_evas_wl_common_size_max_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.max.w == w) && (ee->prop.max.h == h)) return;
|
|
|
|
ee->prop.max.w = w;
|
|
|
|
ee->prop.max.h = h;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_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;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_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;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
void
|
|
|
|
_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;
|
|
|
|
}
|
|
|
|
|
2012-11-07 08:12:14 -08:00
|
|
|
void
|
2017-01-10 06:44:53 -08:00
|
|
|
_ecore_evas_wl_common_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer EINA_UNUSED, int hot_x EINA_UNUSED, int hot_y EINA_UNUSED)
|
2012-11-07 08:12:14 -08:00
|
|
|
{
|
2015-09-28 10:42:38 -07:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
2014-06-25 10:20:13 -07:00
|
|
|
|
2015-09-28 10:42:38 -07:00
|
|
|
wdata = ee->engine.data;
|
2016-11-22 10:14:03 -08:00
|
|
|
if (obj != _ecore_evas_default_cursor_image_get(ee))
|
|
|
|
ecore_wl2_window_pointer_set(wdata->win, NULL, 0, 0);
|
2012-11-07 08:12:14 -08:00
|
|
|
}
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
void
|
|
|
|
_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
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2013-05-08 15:18:55 -07:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_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 */
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-10-08 07:22:17 -07:00
|
|
|
_ecore_evas_wl_common_pre_render(Ecore_Evas *ee)
|
2012-10-08 07:09:53 -07:00
|
|
|
{
|
|
|
|
int rend = 0;
|
2012-10-08 07:22:17 -07:00
|
|
|
Eina_List *ll = NULL;
|
|
|
|
Ecore_Evas *ee2 = NULL;
|
2012-10-08 07:09:53 -07:00
|
|
|
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2015-01-05 09:13:43 -08:00
|
|
|
if (!ee) return 0;
|
2013-02-27 01:49:23 -08:00
|
|
|
if (ee->in_async_render)
|
|
|
|
{
|
|
|
|
/* EDBG("ee=%p is rendering asynchronously, skip", ee); */
|
|
|
|
return 0;
|
|
|
|
}
|
2012-10-08 07:22:17 -07:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
|
2012-10-08 07:09:53 -07:00
|
|
|
{
|
2012-10-08 07:22:17 -07:00
|
|
|
if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
|
|
|
|
if (ee2->engine.func->fn_render)
|
|
|
|
rend |= ee2->engine.func->fn_render(ee2);
|
|
|
|
if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
|
|
|
|
}
|
2012-10-08 07:09:53 -07:00
|
|
|
|
2013-02-27 01:49:23 -08:00
|
|
|
if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
|
|
|
|
|
2012-10-08 07:22:17 -07:00
|
|
|
return rend;
|
|
|
|
}
|
2012-10-08 07:09:53 -07:00
|
|
|
|
2015-10-16 12:51:06 -07:00
|
|
|
static void
|
|
|
|
_anim_cb_animate(void *data, struct wl_callback *callback, uint32_t serial EINA_UNUSED)
|
|
|
|
{
|
2015-10-20 13:41:28 -07:00
|
|
|
Ecore_Evas *ee = data;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
2015-10-16 12:51:06 -07:00
|
|
|
|
2015-10-20 13:41:28 -07:00
|
|
|
wdata = ee->engine.data;
|
2015-10-16 12:51:06 -07:00
|
|
|
wl_callback_destroy(callback);
|
|
|
|
wdata->anim_callback = NULL;
|
2015-10-20 13:41:28 -07:00
|
|
|
ecore_evas_manual_render_set(ee, 0);
|
2015-10-16 12:51:06 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct wl_callback_listener _anim_listener =
|
|
|
|
{
|
|
|
|
_anim_cb_animate
|
|
|
|
};
|
|
|
|
|
2015-10-20 13:41:28 -07:00
|
|
|
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-09-27 05:50:04 -07:00
|
|
|
struct wl_surface *surf;
|
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;
|
|
|
|
|
|
|
|
surf = einfo->info.wl_surface;
|
2016-09-27 05:50:04 -07:00
|
|
|
if (!surf) return;
|
|
|
|
|
2017-03-03 11:13:14 -08:00
|
|
|
wdata = ee->engine.data;
|
2017-01-10 08:28:40 -08:00
|
|
|
if (wdata->win->pending.configure) return;
|
|
|
|
|
2016-09-27 05:50:04 -07:00
|
|
|
wdata->anim_callback = wl_surface_frame(surf);
|
2015-10-20 13:41:28 -07:00
|
|
|
wl_callback_add_listener(wdata->anim_callback, &_anim_listener, ee);
|
|
|
|
ecore_evas_manual_render_set(ee, 1);
|
2017-01-03 14:40:21 -08:00
|
|
|
|
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-01-04 11:22:46 -08:00
|
|
|
if (wdata->win->zxdg_configure_ack && wdata->win->configure_serial)
|
|
|
|
wdata->win->zxdg_configure_ack(wdata->win->zxdg_surface,
|
|
|
|
wdata->win->configure_serial);
|
|
|
|
else if (wdata->win->configure_ack && wdata->win->configure_serial)
|
2015-12-09 06:38:01 -08:00
|
|
|
wdata->win->configure_ack(wdata->win->xdg_surface,
|
|
|
|
wdata->win->configure_serial);
|
2015-12-10 11:37:33 -08:00
|
|
|
wdata->win->configure_serial = 0;
|
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
|
|
|
|
*/
|
|
|
|
einfo->window.x = wdata->win->geometry.x;
|
|
|
|
einfo->window.y = wdata->win->geometry.y;
|
|
|
|
einfo->window.w = wdata->win->geometry.w;
|
|
|
|
einfo->window.h = wdata->win->geometry.h;
|
|
|
|
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;
|
|
|
|
evas_canvas_pointer_canvas_xy_get(evas, &einfo->x_cursor, &einfo->y_cursor);
|
|
|
|
evas_output_framespace_get(evas, &fx, &fy, NULL, NULL);
|
|
|
|
einfo->x_cursor -= fx;
|
|
|
|
einfo->y_cursor -= fy;
|
|
|
|
wdata->x_rel = wdata->y_rel = 0;
|
|
|
|
einfo->resizing = wdata->win->resizing;
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2013-03-25 19:48:23 -07:00
|
|
|
void
|
2013-02-27 01:49:23 -08:00
|
|
|
_ecore_evas_wl_common_render_updates(void *data, Evas *evas EINA_UNUSED, void *event)
|
2013-01-28 11:45:41 -08:00
|
|
|
{
|
2013-03-25 19:48:23 -07:00
|
|
|
Evas_Event_Render_Post *ev = event;
|
|
|
|
Ecore_Evas *ee = data;
|
2013-01-28 11:45:41 -08:00
|
|
|
|
2013-03-25 19:48:23 -07:00
|
|
|
if (!(ee) || !(ev)) return;
|
2013-01-28 11:45:41 -08:00
|
|
|
|
2013-02-27 01:49:23 -08:00
|
|
|
ee->in_async_render = EINA_FALSE;
|
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.transparent_changed)
|
|
|
|
{
|
|
|
|
_ecore_evas_wayland_transparent_do(ee, ee->delayed.transparent);
|
|
|
|
ee->delayed.transparent_changed = EINA_FALSE;
|
|
|
|
}
|
|
|
|
if (ee->delayed.rotation_changed)
|
|
|
|
{
|
|
|
|
_rotation_do(ee, ee->delayed.rotation, ee->delayed.rotation_resize);
|
|
|
|
ee->delayed.rotation_changed = EINA_FALSE;
|
|
|
|
}
|
2015-10-19 07:42:09 -07:00
|
|
|
|
|
|
|
_ecore_evas_wl_common_render_updates_process(ee, ev->updated_area);
|
2013-01-28 11:45:41 -08:00
|
|
|
}
|
|
|
|
|
2012-10-08 07:22:17 -07:00
|
|
|
void
|
|
|
|
_ecore_evas_wl_common_post_render(Ecore_Evas *ee)
|
|
|
|
{
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-10-08 07:22:17 -07:00
|
|
|
_ecore_evas_idle_timeout_update(ee);
|
|
|
|
if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
_ecore_evas_wl_common_render(Ecore_Evas *ee)
|
|
|
|
{
|
|
|
|
int rend = 0;
|
2013-02-27 01:49:23 -08:00
|
|
|
Eina_List *l;
|
|
|
|
Ecore_Evas *ee2;
|
2013-01-28 12:28:19 -08:00
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
2012-10-17 22:43:07 -07:00
|
|
|
|
2015-01-05 09:13:43 -08:00
|
|
|
if (!ee) return 0;
|
2013-02-27 01:49:23 -08:00
|
|
|
if (!(wdata = ee->engine.data)) return 0;
|
2015-12-11 08:26:24 -08:00
|
|
|
if (!wdata->sync_done) return 0;
|
2013-02-27 01:49:23 -08:00
|
|
|
|
2017-01-10 08:28:40 -08:00
|
|
|
if (wdata->win->pending.configure) return 0;
|
|
|
|
|
2013-02-27 01:49:23 -08:00
|
|
|
/* TODO: handle comp no sync */
|
|
|
|
|
|
|
|
if (ee->in_async_render) return 0;
|
2013-03-20 14:04:16 -07:00
|
|
|
if (!ee->visible)
|
|
|
|
{
|
|
|
|
evas_norender(ee->evas);
|
|
|
|
return 0;
|
|
|
|
}
|
2013-02-27 01:49:23 -08:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ee->sub_ecore_evas, l, ee2)
|
2012-10-08 07:22:17 -07:00
|
|
|
{
|
2013-02-27 01:49:23 -08:00
|
|
|
if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
|
|
|
|
if (ee2->engine.func->fn_render)
|
|
|
|
rend |= ee2->engine.func->fn_render(ee2);
|
|
|
|
if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
|
2012-10-08 07:09:53 -07:00
|
|
|
}
|
2012-10-08 07:22:17 -07:00
|
|
|
|
2013-02-27 01:49:23 -08:00
|
|
|
if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
|
2013-01-28 12:28:19 -08:00
|
|
|
|
2013-02-27 01:49:23 -08:00
|
|
|
if (!ee->can_async_render)
|
2013-01-28 12:28:19 -08:00
|
|
|
{
|
2014-08-22 10:31:09 -07:00
|
|
|
Eina_List *updates;
|
|
|
|
|
|
|
|
updates = evas_render_updates(ee->evas);
|
|
|
|
rend = _ecore_evas_wl_common_render_updates_process(ee, updates);
|
|
|
|
evas_render_updates_free(updates);
|
2013-01-28 12:28:19 -08:00
|
|
|
}
|
2013-03-25 19:48:23 -07:00
|
|
|
else if (evas_render_async(ee->evas))
|
2013-02-27 01:49:23 -08:00
|
|
|
{
|
|
|
|
ee->in_async_render = EINA_TRUE;
|
|
|
|
rend = 1;
|
|
|
|
}
|
2014-08-22 10:31:09 -07:00
|
|
|
else if (ee->func.fn_post_render)
|
|
|
|
ee->func.fn_post_render(ee);
|
2013-02-27 01:49:23 -08:00
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
return rend;
|
|
|
|
}
|
|
|
|
|
2013-11-30 04:14:05 -08:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2012-10-08 07:09:53 -07:00
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-11-25 01:55:32 -08:00
|
|
|
_ecore_evas_wl_common_screen_dpi_get(const Ecore_Evas *ee EINA_UNUSED, int *xdpi, int *ydpi)
|
2012-10-08 07:09:53 -07:00
|
|
|
{
|
|
|
|
int dpi = 0;
|
|
|
|
|
2012-10-17 22:43:07 -07:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
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
|
|
|
|
|
|
|
/* TODO */
|
|
|
|
/* dpi = ecore_wl_dpi_get(); */
|
2012-10-08 07:09:53 -07:00
|
|
|
if (xdpi) *xdpi = dpi;
|
|
|
|
if (ydpi) *ydpi = dpi;
|
|
|
|
}
|
2012-12-05 13:15:42 -08:00
|
|
|
|
2016-11-02 05:41:33 -07:00
|
|
|
static void
|
|
|
|
_ecore_evas_wayland_resize_edge_set(Ecore_Evas *ee, int edge)
|
|
|
|
{
|
|
|
|
Evas_Engine_Info_Wayland *einfo;
|
|
|
|
|
|
|
|
if ((einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas)))
|
|
|
|
einfo->info.edges = edge;
|
|
|
|
}
|
|
|
|
|
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)
|
2012-12-05 13:15:42 -08:00
|
|
|
{
|
2016-11-02 05:41:33 -07:00
|
|
|
_ecore_evas_wayland_resize_edge_set(ee, location);
|
|
|
|
|
|
|
|
if (ECORE_EVAS_PORTRAIT(ee))
|
|
|
|
ecore_wl2_window_resize(wdata->win, ee->w, ee->h, location);
|
|
|
|
else
|
|
|
|
ecore_wl2_window_resize(wdata->win, ee->h, ee->w, location);
|
2012-12-05 13:15:42 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ecore_evas_wayland_move(Ecore_Evas *ee, int x, int y)
|
|
|
|
{
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
|
|
|
|
if (!ee) return;
|
|
|
|
if (!strncmp(ee->driver, "wayland", 7))
|
|
|
|
{
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
if (wdata->win)
|
2015-09-28 10:42:38 -07:00
|
|
|
ecore_wl2_window_move(wdata->win, x, y);
|
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
|
|
|
|
|
|
|
Ecore_Evas_Interface_Wayland *
|
|
|
|
_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;
|
2012-12-05 13:15:42 -08:00
|
|
|
|
|
|
|
return iface;
|
|
|
|
}
|
2016-11-01 14:20:49 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_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;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wdata->win)
|
|
|
|
{
|
2017-01-30 08:07:07 -08:00
|
|
|
int fw, fh;
|
|
|
|
|
|
|
|
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
|
|
|
|
|
2016-11-01 14:20:49 -07:00
|
|
|
ecore_wl2_window_show(wdata->win);
|
|
|
|
ecore_wl2_window_alpha_set(wdata->win, ee->alpha);
|
|
|
|
|
|
|
|
einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas);
|
|
|
|
if (einfo)
|
|
|
|
{
|
2016-12-02 10:58:09 -08:00
|
|
|
einfo->info.wl_surface = ecore_wl2_window_surface_get(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);
|
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w + fw, ee->h + fh);
|
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);
|
|
|
|
|
|
|
|
if (ee->visible) return;
|
|
|
|
ee->visible = 1;
|
|
|
|
ee->should_be_visible = 1;
|
|
|
|
ee->draw_ok = EINA_TRUE;
|
|
|
|
if (ee->func.fn_show) ee->func.fn_show(ee);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_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;
|
|
|
|
ee->draw_ok = EINA_FALSE;
|
|
|
|
|
|
|
|
if (ee->func.fn_hide) ee->func.fn_hide(ee);
|
|
|
|
}
|
2016-11-01 14:34:26 -07:00
|
|
|
|
|
|
|
static void
|
|
|
|
_ecore_evas_wayland_alpha_do(Ecore_Evas *ee, int alpha)
|
|
|
|
{
|
|
|
|
Evas_Engine_Info_Wayland *einfo;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
int fw, fh;
|
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
if (!ee) return;
|
|
|
|
if (ee->alpha == alpha) return;
|
|
|
|
ee->alpha = alpha;
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
if (!wdata->sync_done) return;
|
|
|
|
|
|
|
|
if (wdata->win) ecore_wl2_window_alpha_set(wdata->win, ee->alpha);
|
|
|
|
|
|
|
|
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
|
|
|
|
|
|
|
|
if ((einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas)))
|
|
|
|
{
|
|
|
|
einfo->info.destination_alpha = EINA_TRUE;
|
|
|
|
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
|
|
|
|
ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
|
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w + fw, ee->h + fh);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_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
|
|
|
|
|
|
|
static void
|
|
|
|
_ecore_evas_wayland_transparent_do(Ecore_Evas *ee, int transparent)
|
|
|
|
{
|
|
|
|
Evas_Engine_Info_Wayland *einfo;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
int fw, fh;
|
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
if (!ee) return;
|
|
|
|
if (ee->transparent == transparent) return;
|
|
|
|
ee->transparent = transparent;
|
|
|
|
|
|
|
|
wdata = ee->engine.data;
|
|
|
|
if (!wdata->sync_done) return;
|
|
|
|
|
|
|
|
if (wdata->win)
|
|
|
|
ecore_wl2_window_transparent_set(wdata->win, ee->transparent);
|
|
|
|
|
|
|
|
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
|
|
|
|
|
|
|
|
if ((einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas)))
|
|
|
|
{
|
|
|
|
einfo->info.destination_alpha = EINA_TRUE;
|
|
|
|
if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
|
|
|
|
ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
|
|
|
|
evas_damage_rectangle_add(ee->evas, 0, 0, ee->w + fw, ee->h + fh);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_ecore_evas_wl_common_transparent_set(Ecore_Evas *ee, int transparent)
|
|
|
|
{
|
|
|
|
if (ee->in_async_render)
|
|
|
|
{
|
|
|
|
ee->delayed.transparent = transparent;
|
|
|
|
ee->delayed.transparent_changed = EINA_TRUE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
_ecore_evas_wayland_transparent_do(ee, transparent);
|
|
|
|
}
|
2016-11-01 15:16:07 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_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)))
|
|
|
|
{
|
|
|
|
einfo->info.wl_display = ecore_wl2_display_get(wdata->display);
|
|
|
|
einfo->info.wl_dmabuf = ecore_wl2_display_dmabuf_get(wdata->display);
|
|
|
|
einfo->info.wl_shm = ecore_wl2_display_shm_get(wdata->display);
|
2017-01-10 06:44:53 -08:00
|
|
|
einfo->info.compositor_version =
|
|
|
|
ecore_wl2_display_compositor_version_get(wdata->display);
|
2016-11-02 11:13:07 -07:00
|
|
|
einfo->info.destination_alpha = EINA_TRUE;
|
|
|
|
einfo->info.rotation = ee->rotation;
|
|
|
|
einfo->info.wl_surface = ecore_wl2_window_surface_get(wdata->win);
|
|
|
|
|
|
|
|
if (wdata->reset_pending)
|
|
|
|
{
|
|
|
|
ecore_evas_manual_render_set(ee, 0);
|
|
|
|
}
|
|
|
|
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;
|
|
|
|
|
|
|
|
id = ecore_wl2_input_seat_id_get(input);
|
|
|
|
cap = ecore_wl2_input_seat_capabilities_get(input);
|
2016-11-16 11:04:02 -08:00
|
|
|
device = _ecore_evas_wl_common_seat_add(ee, 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
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2016-11-02 11:13:07 -07:00
|
|
|
Ecore_Evas *
|
|
|
|
_ecore_evas_wl_common_new_internal(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame, const char *engine_name)
|
|
|
|
{
|
|
|
|
Ecore_Wl2_Display *ewd;
|
|
|
|
Ecore_Wl2_Window *p = NULL;
|
|
|
|
Evas_Engine_Info_Wayland *einfo;
|
|
|
|
Ecore_Evas_Engine_Wl_Data *wdata;
|
|
|
|
Ecore_Evas_Interface_Wayland *iface;
|
|
|
|
Ecore_Evas *ee = NULL;
|
|
|
|
int method = 0;
|
2016-10-26 21:33:36 -07:00
|
|
|
int fw = 0, fh = 0;
|
2016-11-02 11:13:07 -07:00
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
if (!(method = evas_render_method_lookup(engine_name)))
|
|
|
|
{
|
|
|
|
ERR("Render method lookup failed for Wayland_Shm");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ecore_wl2_init())
|
|
|
|
{
|
|
|
|
ERR("Failed to initialize Ecore_Wl2");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ewd = ecore_wl2_display_connect(disp_name);
|
|
|
|
if (!ewd)
|
|
|
|
{
|
|
|
|
ERR("Failed to connect to Wayland Display %s", disp_name);
|
|
|
|
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);
|
|
|
|
|
|
|
|
if (w < 1) w = 1;
|
|
|
|
if (h < 1) h = 1;
|
|
|
|
|
|
|
|
ee->x = x;
|
|
|
|
ee->y = y;
|
|
|
|
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 */
|
|
|
|
if (getenv("ECORE_EVAS_FORCE_SYNC_RENDER") || !strcmp(engine_name, "wayland_egl"))
|
|
|
|
ee->can_async_render = 0;
|
|
|
|
else
|
|
|
|
ee->can_async_render = 1;
|
|
|
|
|
|
|
|
if (parent)
|
|
|
|
{
|
|
|
|
p = ecore_wl2_display_window_find(ewd, parent);
|
|
|
|
ee->alpha = ecore_wl2_window_alpha_get(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
wdata->sync_done = EINA_FALSE;
|
|
|
|
wdata->parent = p;
|
|
|
|
wdata->display = ewd;
|
2017-01-11 07:08:43 -08:00
|
|
|
|
2016-11-02 11:13:07 -07:00
|
|
|
wdata->win = ecore_wl2_window_new(ewd, p, x, y, w + fw, h + fh);
|
|
|
|
ee->prop.window = ecore_wl2_window_id_get(wdata->win);
|
|
|
|
|
|
|
|
ee->evas = evas_new();
|
|
|
|
evas_data_attach_set(ee->evas, ee);
|
|
|
|
evas_output_method_set(ee->evas, method);
|
|
|
|
evas_output_size_set(ee->evas, ee->w + fw, ee->h + fh);
|
|
|
|
evas_output_viewport_set(ee->evas, 0, 0, ee->w + fw, ee->h + fh);
|
|
|
|
|
|
|
|
if (ee->can_async_render)
|
|
|
|
evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_POST,
|
|
|
|
_ecore_evas_wl_common_render_updates, ee);
|
|
|
|
|
|
|
|
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)))
|
|
|
|
{
|
|
|
|
einfo->info.wl_display = ecore_wl2_display_get(ewd);
|
|
|
|
einfo->info.destination_alpha = EINA_TRUE;
|
|
|
|
einfo->info.rotation = ee->rotation;
|
|
|
|
einfo->info.depth = 32;
|
|
|
|
einfo->info.wl_surface = ecore_wl2_window_surface_get(wdata->win);
|
|
|
|
einfo->info.wl_dmabuf = ecore_wl2_display_dmabuf_get(ewd);
|
|
|
|
einfo->info.wl_shm = ecore_wl2_display_shm_get(ewd);
|
2017-01-10 06:44:53 -08:00
|
|
|
einfo->info.compositor_version =
|
|
|
|
ecore_wl2_display_compositor_version_get(ewd);
|
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;
|
|
|
|
}
|
|
|
|
|
2016-11-02 11:13:07 -07:00
|
|
|
ee->engine.func->fn_render = _ecore_evas_wl_common_render;
|
|
|
|
|
2017-03-01 10:13:46 -08:00
|
|
|
_ecore_evas_register(ee);
|
2016-11-02 11:13:07 -07:00
|
|
|
ecore_evas_input_event_register(ee);
|
|
|
|
|
|
|
|
ecore_event_window_register(ee->prop.window, ee, ee->evas,
|
|
|
|
(Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
|
|
|
|
(Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
|
|
|
|
(Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
|
|
|
|
(Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
|
|
|
|
_ecore_event_window_direct_cb_set(ee->prop.window,
|
|
|
|
_ecore_evas_input_direct_cb);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
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()
|
|
|
|
* and free(ee) */
|
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;
|
|
|
|
}
|