diff options
-rw-r--r-- | src/lib/ecore_wl2/Ecore_Wl2.h | 12 | ||||
-rw-r--r-- | src/lib/ecore_wl2/ecore_wl2_private.h | 3 | ||||
-rw-r--r-- | src/lib/ecore_wl2/ecore_wl2_window.c | 14 | ||||
-rw-r--r-- | src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c | 19 |
4 files changed, 46 insertions, 2 deletions
diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index 240ec82..b706b4c 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h | |||
@@ -737,6 +737,18 @@ EAPI const char *ecore_wl2_display_name_get(const Ecore_Wl2_Display *display); | |||
737 | EAPI Ecore_Wl2_Window *ecore_wl2_window_new(Ecore_Wl2_Display *display, Ecore_Wl2_Window *parent, int x, int y, int w, int h); | 737 | EAPI Ecore_Wl2_Window *ecore_wl2_window_new(Ecore_Wl2_Display *display, Ecore_Wl2_Window *parent, int x, int y, int w, int h); |
738 | 738 | ||
739 | /** | 739 | /** |
740 | * Set a callback to be caleld just before the window is closed and freed | ||
741 | * | ||
742 | * @param window The window to listen to for a xdg toplevel close callback | ||
743 | * @param cb The callback function to call being passed data and window | ||
744 | * @param data The Data pointer to pass as data to the callback | ||
745 | * | ||
746 | * @ingroup Ecore_Wl2_Window_Group | ||
747 | * @since 1.24 | ||
748 | */ | ||
749 | EAPI void ecore_wl2_window_close_callback_set(Ecore_Wl2_Window *window, void (*cb) (void *data, Ecore_Wl2_Window *win), void *data); | ||
750 | |||
751 | /** | ||
740 | * Get the wl_surface which belongs to this window | 752 | * Get the wl_surface which belongs to this window |
741 | * | 753 | * |
742 | * @param window The Ecore_Wl2_Window to get the surface of | 754 | * @param window The Ecore_Wl2_Window to get the surface of |
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h index 4d8420f..1f4eaad 100644 --- a/src/lib/ecore_wl2/ecore_wl2_private.h +++ b/src/lib/ecore_wl2/ecore_wl2_private.h | |||
@@ -191,6 +191,9 @@ struct _Ecore_Wl2_Window | |||
191 | struct zxdg_toplevel_v6 *zxdg_toplevel; | 191 | struct zxdg_toplevel_v6 *zxdg_toplevel; |
192 | struct zxdg_popup_v6 *zxdg_popup; | 192 | struct zxdg_popup_v6 *zxdg_popup; |
193 | 193 | ||
194 | void (*cb_close) (void *data, Ecore_Wl2_Window *win); | ||
195 | void *cb_close_data; | ||
196 | |||
194 | Eina_Stringshare *uuid; | 197 | Eina_Stringshare *uuid; |
195 | 198 | ||
196 | void (*xdg_configure_ack)(struct xdg_surface *surface, uint32_t serial); | 199 | void (*xdg_configure_ack)(struct xdg_surface *surface, uint32_t serial); |
diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c index 71c74f3..9793833 100644 --- a/src/lib/ecore_wl2/ecore_wl2_window.c +++ b/src/lib/ecore_wl2/ecore_wl2_window.c | |||
@@ -264,7 +264,11 @@ _xdg_toplevel_cb_close(void *data, struct xdg_toplevel *xdg_toplevel EINA_UNUSED | |||
264 | 264 | ||
265 | win = data; | 265 | win = data; |
266 | if (!win) return; | 266 | if (!win) return; |
267 | 267 | if (win->cb_close) | |
268 | { | ||
269 | win->cb_close(win->cb_close_data, win); | ||
270 | win->cb_close = NULL; | ||
271 | } | ||
268 | ecore_wl2_window_free(win); | 272 | ecore_wl2_window_free(win); |
269 | } | 273 | } |
270 | 274 | ||
@@ -568,6 +572,14 @@ ecore_wl2_window_new(Ecore_Wl2_Display *display, Ecore_Wl2_Window *parent, int x | |||
568 | return win; | 572 | return win; |
569 | } | 573 | } |
570 | 574 | ||
575 | EAPI void | ||
576 | ecore_wl2_window_close_callback_set(Ecore_Wl2_Window *window, void (*cb) (void *data, Ecore_Wl2_Window *win), void *data) | ||
577 | { | ||
578 | EINA_SAFETY_ON_NULL_RETURN(window); | ||
579 | window->cb_close = cb; | ||
580 | window->cb_close_data = data; | ||
581 | } | ||
582 | |||
571 | EAPI struct wl_surface * | 583 | EAPI struct wl_surface * |
572 | ecore_wl2_window_surface_get(Ecore_Wl2_Window *window) | 584 | ecore_wl2_window_surface_get(Ecore_Wl2_Window *window) |
573 | { | 585 | { |
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c index 7696125..a71802b 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c | |||
@@ -1438,7 +1438,12 @@ _ecore_evas_wl_common_free(Ecore_Evas *ee) | |||
1438 | if (wdata->frame) ecore_wl2_window_frame_callback_del(wdata->frame); | 1438 | if (wdata->frame) ecore_wl2_window_frame_callback_del(wdata->frame); |
1439 | wdata->frame = NULL; | 1439 | wdata->frame = NULL; |
1440 | ecore_event_handler_del(wdata->sync_handler); | 1440 | ecore_event_handler_del(wdata->sync_handler); |
1441 | if (wdata->win) ecore_wl2_window_free(wdata->win); | 1441 | if (wdata->win) |
1442 | { | ||
1443 | ecore_wl2_window_close_callback_set(wdata->win, NULL, NULL); | ||
1444 | ecore_wl2_window_free(wdata->win); | ||
1445 | wdata->win = NULL; | ||
1446 | } | ||
1442 | ecore_wl2_display_disconnect(wdata->display); | 1447 | ecore_wl2_display_disconnect(wdata->display); |
1443 | 1448 | ||
1444 | EINA_LIST_FREE(wdata->devices_list, device) | 1449 | EINA_LIST_FREE(wdata->devices_list, device) |
@@ -2466,6 +2471,17 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func = | |||
2466 | NULL, //fn_last_tick_get | 2471 | NULL, //fn_last_tick_get |
2467 | }; | 2472 | }; |
2468 | 2473 | ||
2474 | static void | ||
2475 | _ecore_evas_wl_common_win_close(void *data, Ecore_Wl2_Window *win EINA_UNUSED) | ||
2476 | { | ||
2477 | Ecore_Evas *ee = data; | ||
2478 | Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data; | ||
2479 | |||
2480 | if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee); | ||
2481 | |||
2482 | wdata->win = NULL; | ||
2483 | } | ||
2484 | |||
2469 | Ecore_Evas * | 2485 | Ecore_Evas * |
2470 | _ecore_evas_wl_common_new_internal(const char *disp_name, Ecore_Window parent, int x, int y, int w, int h, Eina_Bool frame, const int *opt, const char *engine_name) | 2486 | _ecore_evas_wl_common_new_internal(const char *disp_name, Ecore_Window parent, int x, int y, int w, int h, Eina_Bool frame, const int *opt, const char *engine_name) |
2471 | { | 2487 | { |
@@ -2553,6 +2569,7 @@ _ecore_evas_wl_common_new_internal(const char *disp_name, Ecore_Window parent, i | |||
2553 | wdata->display = ewd; | 2569 | wdata->display = ewd; |
2554 | 2570 | ||
2555 | wdata->win = ecore_wl2_window_new(ewd, p, x, y, w, h); | 2571 | wdata->win = ecore_wl2_window_new(ewd, p, x, y, w, h); |
2572 | ecore_wl2_window_close_callback_set(wdata->win, _ecore_evas_wl_common_win_close, ee); | ||
2556 | ee->prop.window = (Ecore_Window)wdata->win; | 2573 | ee->prop.window = (Ecore_Window)wdata->win; |
2557 | ee->prop.aux_hint.supported_list = ecore_wl2_window_aux_hints_supported_get(wdata->win); | 2574 | ee->prop.aux_hint.supported_list = ecore_wl2_window_aux_hints_supported_get(wdata->win); |
2558 | ecore_evas_aux_hint_add(ee, "wm.policy.win.msg.use", "1"); | 2575 | ecore_evas_aux_hint_add(ee, "wm.policy.win.msg.use", "1"); |