Having an invalid serial number is quite useful - for example, we can have protocol requests that optionally take a serial number or 0 instead of having two similar requests.
Signed-off-by: Derek Foreman <der...@osg.samsung.com> --- Well, let's see where this goes ;) I've seen a few times now when having an invalid serial number would be helpful, is it too late to do this? Are we going to break anything? Anything currently doing math on serial numbers can be wrong by one if one of the serial numbers has wrapped around - this probably doesn't matter? I do wonder if we should have a wl_serial_compare() as part of wayland but the semantics are tricky (a big serial and a small serial may actually have happened quite close to eachother if the small happened after a wrap around). I think the usual comparisons of interest are equality and "is A less than B within (arbitrary distance to compensate for wrap-around)". I think strcmp() like semantics won't necessarily be good here because we don't usually need something to tell us "b happened before a", more "these almost certainly happened in the order specified in the function call". Where do we go from here? src/wayland-server.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wayland-server.c b/src/wayland-server.c index 0f04f66..e9e02a6 100644 --- a/src/wayland-server.c +++ b/src/wayland-server.c @@ -826,7 +826,7 @@ wl_display_create(void) wl_signal_init(&display->destroy_signal); display->id = 1; - display->serial = 0; + display->serial = 1; wl_array_init(&display->additional_shm_formats); @@ -979,6 +979,9 @@ wl_display_next_serial(struct wl_display *display) { display->serial++; + if (display->serial == 0) + display->serial++; + return display->serial; } -- 2.5.3 _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel