static void _ecore_evas_wl_focus_set(Ecore_Evas *ee, int focus __UNUSED__);
static void _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify);
static void _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max);
+static void _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full __UNUSED__);
static int _ecore_evas_wl_render(Ecore_Evas *ee);
static void _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h);
static void _ecore_evas_wl_buffer_new(Ecore_Evas *ee, void **dest);
-static Eina_Bool _ecore_evas_wl_event_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event);
-static Eina_Bool _ecore_evas_wl_event_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event);
-static Eina_Bool _ecore_evas_wl_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event);
-static Eina_Bool _ecore_evas_wl_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event);
static Eina_Bool _ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event);
static Eina_Bool _ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event);
static Eina_Bool _ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event);
/* local variables */
static int _ecore_evas_wl_init_count = 0;
-static Ecore_Event_Handler *_ecore_evas_wl_event_handlers[8];
-static uint32_t _ecore_evas_wl_btn_timestamp;
+static Ecore_Event_Handler *_ecore_evas_wl_event_handlers[4];
+
static const struct wl_shell_surface_listener _ecore_evas_wl_shell_surface_listener =
{
_ecore_evas_wl_handle_configure,
NULL, // func borderless set
NULL, // func override set
_ecore_evas_wl_maximized_set,
- NULL, // func fullscreen set
+ _ecore_evas_wl_fullscreen_set,
NULL, // func avoid_damage set
NULL, // func withdrawn set
NULL, // func sticky set
return ee;
}
-EAPI void
-ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location)
-{
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- if ((!ee) || (!ee->engine.wl.shell_surface)) return;
- wl_shell_surface_resize(ee->engine.wl.shell_surface,
- ecore_wl_input_device_get(),
- _ecore_evas_wl_btn_timestamp, location);
-}
-
/* local functions */
static int
_ecore_evas_wl_init(void)
return _ecore_evas_wl_init_count;
_ecore_evas_wl_event_handlers[0] =
- ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
- _ecore_evas_wl_event_mouse_down, NULL);
- _ecore_evas_wl_event_handlers[1] =
- ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
- _ecore_evas_wl_event_mouse_up, NULL);
- _ecore_evas_wl_event_handlers[2] =
- ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
- _ecore_evas_wl_event_mouse_move, NULL);
- _ecore_evas_wl_event_handlers[3] =
- ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL,
- _ecore_evas_wl_event_mouse_wheel, NULL);
- _ecore_evas_wl_event_handlers[4] =
ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_IN,
_ecore_evas_wl_event_mouse_in, NULL);
- _ecore_evas_wl_event_handlers[5] =
+ _ecore_evas_wl_event_handlers[1] =
ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT,
_ecore_evas_wl_event_mouse_out, NULL);
- _ecore_evas_wl_event_handlers[6] =
+ _ecore_evas_wl_event_handlers[2] =
ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN,
_ecore_evas_wl_event_focus_in, NULL);
- _ecore_evas_wl_event_handlers[7] =
+ _ecore_evas_wl_event_handlers[3] =
ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT,
_ecore_evas_wl_event_focus_out, NULL);
ee->x = x;
ee->y = y;
- wl_shell_surface_move(ee->engine.wl.shell_surface,
- ecore_wl_input_device_get(),
- _ecore_evas_wl_btn_timestamp);
+ if (ee->engine.wl.shell_surface)
+ {
+ wl_shell_surface_move(ee->engine.wl.shell_surface,
+ ecore_wl_input_device_get(),
+ ecore_wl_input_timestamp_get());
+ }
if (ee->func.fn_move) ee->func.fn_move(ee);
}
if (h < 1) h = 1;
if ((ee->w == w) && (ee->h == h)) return;
+ if (ee->prop.min.w > w) w = ee->prop.min.w;
+ else if (w > ee->prop.max.w) w = ee->prop.max.w;
+
+ if (ee->prop.min.h > h) h = ee->prop.min.h;
+ else if (h > ee->prop.max.h) h = ee->prop.max.h;
+
ee->req.w = w;
ee->req.h = h;
ee->engine.wl.shell_surface =
wl_shell_get_shell_surface(ecore_wl_shell_get(), ee->engine.wl.surface);
- /* add configure listener for wayland resize events */
- wl_shell_surface_add_listener(ee->engine.wl.shell_surface,
- &_ecore_evas_wl_shell_surface_listener, ee);
-
/* set toplevel */
wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface);
/* set new engine destination */
evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
+ /* add configure listener for wayland resize events */
+ wl_shell_surface_add_listener(ee->engine.wl.shell_surface,
+ &_ecore_evas_wl_shell_surface_listener, ee);
+
/* flush new buffer fd */
ecore_wl_flush();
if (!ee) return;
if (ee->prop.maximized == max) return;
ee->prop.maximized = max;
- /* FIXME: Implement this in Wayland someshow */
+ /* FIXME: Implement this. Support is in Wayland now */
+}
+
+static void
+_ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full __UNUSED__)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if ((!ee) || (!ee->visible)) return;
+ if (!ee->engine.wl.shell_surface) return;
+ wl_shell_surface_set_fullscreen(ee->engine.wl.shell_surface);
}
static int
}
static Eina_Bool
-_ecore_evas_wl_event_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event)
-{
- Ecore_Evas *ee;
- Ecore_Event_Mouse_Button *ev;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- ev = event;
- _ecore_evas_wl_btn_timestamp = ev->timestamp;
- 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;
- evas_event_feed_mouse_down(ee->evas, ev->buttons, ev->modifiers,
- ev->timestamp, NULL);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_ecore_evas_wl_event_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event)
-{
- Ecore_Evas *ee;
- Ecore_Event_Mouse_Button *ev;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- 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;
- evas_event_feed_mouse_up(ee->evas, ev->buttons, ev->modifiers,
- ev->timestamp, NULL);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_ecore_evas_wl_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event)
-{
- Ecore_Evas *ee;
- Ecore_Event_Mouse_Move *ev;
-
- 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;
- ee->mouse.x = ev->x;
- ee->mouse.y = ev->y;
- evas_event_feed_mouse_move(ee->evas, ev->x, ev->y, ev->timestamp, NULL);
- _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_ecore_evas_wl_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event)
-{
- Ecore_Evas *ee;
- Ecore_Event_Mouse_Wheel *ev;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- 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;
- evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z,
- ev->timestamp, NULL);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
_ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
static void
_ecore_evas_wl_buffer_new(Ecore_Evas *ee, void **dest)
{
+ struct wl_shm *shm;
static unsigned int format;
char tmp[PATH_MAX];
int fd = -1, stride = 0, size = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (dest) *dest = NULL;
-
+ if (!(shm = ecore_wl_shm_get())) return;
if (!format) format = ecore_wl_format_get();
strcpy(tmp, "/tmp/ecore-wayland_shm-XXXXXX");
return evas_object_smart_add(evas, _ecore_evas_wl_smart);
}
-#else
-EAPI Ecore_Evas *
-ecore_evas_wayland_shm_new(const char *disp_name __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, int frame __UNUSED__)
+void
+_ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location)
{
- return NULL;
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if ((!ee) || (!ee->engine.wl.shell_surface)) return;
+ wl_shell_surface_resize(ee->engine.wl.shell_surface,
+ ecore_wl_input_device_get(),
+ ecore_wl_input_timestamp_get(), location);
}
-EAPI void
-ecore_evas_wayland_shm_resize(Ecore_Evas *ee __UNUSED__, int location __UNUSED__)
+void
+_ecore_evas_wayland_shm_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source)
{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ if ((!ee) || (!ee->engine.wl.surface)) return;
+ if ((!source) || (!drag_ee)) return;
+ ecore_wl_drag_start(source, ee->engine.wl.surface, drag_ee->engine.wl.buffer);
+}
+
+#else
+EAPI Ecore_Evas *
+ecore_evas_wayland_shm_new(const char *disp_name __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, int frame __UNUSED__)
+{
+ return NULL;
}
#endif