[PATCH weston 1/2] desktop-shell: Generate serials for pings in the function that sends them

Quentin Glidic sardemff7+wayland at sardemff7.net
Mon Aug 15 15:24:27 UTC 2016


On 09/07/2016 21:18, Yong Bakos wrote:
> On Jul 8, 2016, at 10:42 AM, Derek Foreman <derekf at osg.samsung.com> wrote:
>>
>> Currently we generate a serial and pass it through a couple of functions.
>>
>> In a future commit I'm going to throttle pings in the leaf function, so
>> generating them there prevents consuming them needlessly.
>>
>> Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
>
> As the commit message states, the serial is only passed through and not
> used within the existing function implementations higher up the call
> stack, so this is
>
> Reviewed-by: Yong Bakos <ybakos at humanoriented.com>

This patch is now superseded by libweston-desktop.

Thanks for the idea anyway. ;-)

Cheers,


>> ---
>> desktop-shell/shell.c | 14 ++++++--------
>> 1 file changed, 6 insertions(+), 8 deletions(-)
>>
>> diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
>> index c72f801..4945bc1 100644
>> --- a/desktop-shell/shell.c
>> +++ b/desktop-shell/shell.c
>> @@ -2112,18 +2112,20 @@ xdg_ping_timeout_handler(void *data)
>> }
>>
>> static void
>> -handle_xdg_ping(struct shell_surface *shsurf, uint32_t serial)
>> +handle_xdg_ping(struct shell_surface *shsurf)
>> {
>> 	struct weston_compositor *compositor = shsurf->shell->compositor;
>> 	struct shell_client *sc = shsurf->owner;
>> 	struct wl_event_loop *loop;
>> 	static const int ping_timeout = 200;
>> +	uint32_t serial;
>>
>> 	if (sc->unresponsive) {
>> 		xdg_ping_timeout_handler(sc);
>> 		return;
>> 	}
>>
>> +	serial = wl_display_next_serial(compositor->wl_display);
>> 	sc->ping_serial = serial;
>> 	loop = wl_display_get_event_loop(compositor->wl_display);
>> 	if (sc->ping_timer == NULL)
>> @@ -2144,7 +2146,7 @@ handle_xdg_ping(struct shell_surface *shsurf, uint32_t serial)
>> }
>>
>> static void
>> -ping_handler(struct weston_surface *surface, uint32_t serial)
>> +ping_handler(struct weston_surface *surface)
>> {
>> 	struct shell_surface *shsurf = get_shell_surface(surface);
>>
>> @@ -2157,7 +2159,7 @@ ping_handler(struct weston_surface *surface, uint32_t serial)
>> 	if (!shsurf->owner)
>> 		return;
>>
>> -	handle_xdg_ping(shsurf, serial);
>> +	handle_xdg_ping(shsurf);
>> }
>>
>> static void
>> @@ -2165,15 +2167,11 @@ handle_pointer_focus(struct wl_listener *listener, void *data)
>> {
>> 	struct weston_pointer *pointer = data;
>> 	struct weston_view *view = pointer->focus;
>> -	struct weston_compositor *compositor;
>> -	uint32_t serial;
>>
>> 	if (!view)
>> 		return;
>>
>> -	compositor = view->surface->compositor;
>> -	serial = wl_display_next_serial(compositor->wl_display);
>> -	ping_handler(view->surface, serial);
>> +	ping_handler(view->surface);
>> }
>>
>> static void
>> --
>> 2.8.1
>>
>> _______________________________________________
>> wayland-devel mailing list
>> wayland-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
>


-- 

Quentin “Sardem FF7” Glidic


More information about the wayland-devel mailing list