ecore-wl2: Create new event type for window configure

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2015-09-30 12:03:50 -04:00
parent 324a7e545a
commit bb0f3ab62a
2 changed files with 25 additions and 8 deletions

View File

@ -24,6 +24,7 @@ EAPI int ECORE_WL2_EVENT_DATA_SOURCE_CANCELLED = 0;
EAPI int ECORE_WL2_EVENT_DATA_SOURCE_TARGET = 0;
EAPI int ECORE_WL2_EVENT_DATA_SOURCE_SEND = 0;
EAPI int ECORE_WL2_EVENT_SELECTION_DATA_READY = 0;
EAPI int ECORE_WL2_EVENT_WINDOW_CONFIGURE = 0;
static void
_cb_wl_log_print(const char *format, va_list args)
@ -79,6 +80,7 @@ ecore_wl2_init(void)
ECORE_WL2_EVENT_DATA_SOURCE_TARGET = ecore_event_type_new();
ECORE_WL2_EVENT_DATA_SOURCE_SEND = ecore_event_type_new();
ECORE_WL2_EVENT_SELECTION_DATA_READY = ecore_event_type_new();
ECORE_WL2_EVENT_WINDOW_CONFIGURE = ecore_event_type_new();
}
wl_log_set_handler_server(_cb_wl_log_print);

View File

@ -8,6 +8,25 @@ static void _anim_cb_animate(void *data, struct wl_callback *callback, uint32_t
static Eina_Bool _animator_busy = EINA_FALSE;
static void
_ecore_wl2_window_configure_send(Ecore_Wl2_Window *window, int w, int h, unsigned int edges)
{
Ecore_Wl2_Event_Window_Configure *ev;
ev = calloc(1, sizeof(Ecore_Wl2_Event_Window_Configure));
if (!ev) return;
ev->win = window->id;
ev->event_win = window->id;
ev->x = window->geometry.x;
ev->y = window->geometry.y;
ev->w = w;
ev->h = h;
ev->edges = edges;
ecore_event_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE, ev, NULL, NULL);
}
static void
_wl_shell_surface_cb_ping(void *data EINA_UNUSED, struct wl_shell_surface *shell_surface, unsigned int serial)
{
@ -24,9 +43,7 @@ _wl_shell_surface_cb_configure(void *data, struct wl_shell_surface *shell_surfac
if ((w <= 0) || (h <= 0)) return;
if ((win->geometry.w != w) || (win->geometry.h != h))
{
/* TODO: send configure */
}
_ecore_wl2_window_configure_send(win, w, h, edges);
}
static void
@ -100,9 +117,7 @@ _xdg_surface_cb_configure(void *data, struct xdg_surface *xdg_surface EINA_UNUSE
}
if ((w > 0) && (h > 0))
{
/* TODO: send configure ?? */
}
_ecore_wl2_window_configure_send(win, w, h, 0);
xdg_surface_ack_configure(win->xdg_surface, serial);
}
@ -481,10 +496,10 @@ ecore_wl2_window_resize(Ecore_Wl2_Window *window, int w, int h, int location)
if (window->xdg_surface)
xdg_surface_resize(window->xdg_surface, input->wl.seat,
window->display->serial, location);
input->display->serial, location);
else if (window->wl_shell_surface)
wl_shell_surface_resize(window->wl_shell_surface, input->wl.seat,
window->display->serial, location);
input->display->serial, location);
}
EAPI void