From 8bd47cf83c88bb5f333cd4c4996a61d76b9b0d1d Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Fri, 6 Apr 2018 12:13:45 -0500 Subject: ecore_wl2: reduce wayland display flushes Clean up various places where we do flushes that we don't need to because some immediately following action is going to cause a flush. Also fix places where we flush without actually doing anything. --- src/lib/ecore_wl2/ecore_wl2_display.c | 3 +-- src/lib/ecore_wl2/ecore_wl2_window.c | 18 +++++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'src/lib/ecore_wl2') diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c b/src/lib/ecore_wl2/ecore_wl2_display.c index 4ee8cd6d59..a216df108a 100644 --- a/src/lib/ecore_wl2/ecore_wl2_display.c +++ b/src/lib/ecore_wl2/ecore_wl2_display.c @@ -359,7 +359,6 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const window->xdg_surface, window->weight.w, window->weight.h); } } - ecore_wl2_display_flush(ewd); event: /* allocate space for event structure */ @@ -663,7 +662,6 @@ _ecore_wl2_shell_bind(Ecore_Wl2_Display *ewd) &_zxdg_shell_listener, ewd); ewd->shell_done = EINA_TRUE; } - ecore_wl2_display_flush(ewd); } static void @@ -681,6 +679,7 @@ _cb_sync_done(void *data, struct wl_callback *cb, uint32_t serial EINA_UNUSED) _ecore_wl2_shell_bind(ewd); wl_callback_destroy(cb); + ecore_wl2_display_flush(ewd); ev = calloc(1, sizeof(Ecore_Wl2_Event_Sync_Done)); if (!ev) return; diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c index dee8b0a972..7010938c40 100644 --- a/src/lib/ecore_wl2/ecore_wl2_window.c +++ b/src/lib/ecore_wl2/ecore_wl2_window.c @@ -621,7 +621,6 @@ ecore_wl2_window_show(Ecore_Wl2_Window *window) } else _configure_complete(window); - ecore_wl2_display_flush(window->display); } EAPI void @@ -1022,6 +1021,7 @@ ecore_wl2_window_title_set(Ecore_Wl2_Window *window, const char *title) eina_stringshare_replace(&window->title, title); if (!window->title) return; + if (!window->xdg_toplevel && !window->xdg_toplevel) return; if (window->xdg_toplevel) xdg_toplevel_set_title(window->xdg_toplevel, window->title); @@ -1037,6 +1037,7 @@ ecore_wl2_window_class_set(Ecore_Wl2_Window *window, const char *clas) eina_stringshare_replace(&window->class, clas); if (!window->class) return; + if (!window->xdg_toplevel && !window->xdg_toplevel) return; if (window->xdg_toplevel) xdg_toplevel_set_app_id(window->xdg_toplevel, window->class); @@ -1361,8 +1362,9 @@ EAPI void ecore_wl2_window_aux_hint_add(Ecore_Wl2_Window *win, int id, const char *hint, const char *val) { if (!win) return; - if ((win->surface) && (win->display->wl.efl_aux_hints)) - efl_aux_hints_add_aux_hint(win->display->wl.efl_aux_hints, win->surface, id, hint, val); + if ((!win->surface) || (!win->display->wl.efl_aux_hints)) return; + + efl_aux_hints_add_aux_hint(win->display->wl.efl_aux_hints, win->surface, id, hint, val); ecore_wl2_display_flush(win->display); } @@ -1370,8 +1372,9 @@ EAPI void ecore_wl2_window_aux_hint_change(Ecore_Wl2_Window *win, int id, const char *val) { if (!win) return; - if ((win->surface) && (win->display->wl.efl_aux_hints)) - efl_aux_hints_change_aux_hint(win->display->wl.efl_aux_hints, win->surface, id, val); + if ((!win->surface) && (!win->display->wl.efl_aux_hints)) return; + + efl_aux_hints_change_aux_hint(win->display->wl.efl_aux_hints, win->surface, id, val); ecore_wl2_display_flush(win->display); } @@ -1379,8 +1382,9 @@ EAPI void ecore_wl2_window_aux_hint_del(Ecore_Wl2_Window *win, int id) { if (!win) return; - if ((win->surface) && (win->display->wl.efl_aux_hints)) - efl_aux_hints_del_aux_hint(win->display->wl.efl_aux_hints, win->surface, id); + if ((!win->surface) || (!win->display->wl.efl_aux_hints)) return; + + efl_aux_hints_del_aux_hint(win->display->wl.efl_aux_hints, win->surface, id); ecore_wl2_display_flush(win->display); } -- cgit v1.2.1