Re: wl_tablet draft v2
On Sun, Jul 13, 2014 at 12:17 PM, Lyude wrote: >wl_tablet specifications > Version 2 > > General notes: > - Many of the axis values in this are normalized to either 0-65535 or > (-65535)-65535. I would leave the axis values as-is since libinput reports > them as doubles, but since we only have 8 bits of precision we'd lose way > too many values. 65535 seemed like the best choice since it's the maximum > length of a signed short, it's a whole number, it's way higher then the > range of any of the axes (with the exception of X and Y, but these aren't > normalized anyway) and we can do just about any basic arithmetic with it > without having to worry about overflowing. Plus, all we have to do is > multiply the value by 65535 after we get it from libinput. > Speaking of overflow, what's Wayland's stance on whether the compositor or client is responsible for dealing with it? I remember Google mentioned that while working on Android's input driver, they noticed some input devices could be "turned up to 11" and report values beyond the kernel-indicated minimum/maximum. They decided to punt the problem to app developers and documented that an app may e.g. see 110% pressure if that's what the hardware reported. The question is mostly academic since the Wacom kernel driver shouldn't be an offender, but I might as well ask :) > Changes since the last version: > - The surface argument is now only included in the proximity-in events > - wl_tablet_manager has been added. Events no longer have a separate id > argument, and instead rely on wl_tablet objects to differentiate each tablet > from each other. A lot of it was copied from Peter's initial wl_tablet > proposal, but a few additions have been made; I've added an argument for > each of the axis events that a tablet supports to the device_added event. > - Axis changes have been split up into a couple different events > - Added a generic frame event. Because of the different kinds of click > emulations done with tablets, having each event packed into a frame is > convenient. > - All of the starting values for each axis are provided as normal events in > the same frame as a proximity_in event. The same goes for the status of each > button on the tool. This makes the protocol a lot cleaner > > Definitions: > - WL_TABLET_AXIS_MAX = 65535 > - WL_TABLET_AXIS_MIN = (-65535) > > Interfaces: > - wl_tablet > Enumerators: > - wl_tablet_tool_type: > - pen > - eraser > - brush > - pencil > - airbrush > - finger > - mouse > - lens > - wl_tablet_button > - stylus_1 > - stylus_2 > - wl_tablet_button_state > - pressed > - released > > Events: > - proximity_in > Sent when the tool comes into proximity above the client surface, > either by the tool coming into proximity or a tool being > in-proximity and moving to the client surface. If a tablet tool > makes contact with the tablet at the same time that the tool comes > into proximity, the proximity event comes first and the down event > comes afterwards. > A proximity_in event is immediately followed by the following > sequence of events in the same frame: > - motion > - down (if the tool is touching the tablet's surface at the > same time it comes into proximity) > - a button press event for each button held down on the tool > as it comes into proximity > - pressure (if supported by the tablet) > - distance (if supported by the tablet) > - tilt (if supported by the tablet) > This allows a client to get the starting values for all of the axes, > along with the starting coordinates of the tool, and the state of > each button on the tool. > > Arguments: > - Name: id > Type: uint > the id of the tablet sending this event. > > - Name: type > Type: uint > The type of tool that came into proximity, e.g. pen, > airbrush, etc. > > - Name: serial > Type: uint > The serial number of the tool that came into proximity. On > tablets where this isn't provided, this value will always be > 0. > > - Name: surface > Type: object > Interface: wl_surface > The current surface the tablet tool is over > > - Name: time > Type: uint > The time of the event
Re: [PATCH wayland v3] client: add a public function to make a roundtrip on a custom queue
Guilio, Would it be better to name it wl_event_queue_roundtrip and just have it take the wl_event_queue? I guess it is sort-of a wl_display operation, but you could argue it either way. Thoughts? --Jason Ekstrand On Mon, Jul 14, 2014 at 7:15 AM, Giulio Camuffo wrote: > wl_display_roundtrip() works on the default queue. Add a parallel > wl_display_roundtrip_queue(). > --- > > v3: fixed dispatch call in place of dispatch_queue > documented the queue parameter > src/wayland-client.c | 24 +--- > src/wayland-client.h | 2 ++ > 2 files changed, 23 insertions(+), 3 deletions(-) > > diff --git a/src/wayland-client.c b/src/wayland-client.c > index e8aab7e..d2c1b5c 100644 > --- a/src/wayland-client.c > +++ b/src/wayland-client.c > @@ -834,15 +834,16 @@ static const struct wl_callback_listener > sync_listener = { > /** Block until all pending request are processed by the server > * > * \param display The display context object > + * \param queue The queue on which to run the roundtrip > * \return The number of dispatched events on success or -1 on failure > * > * Blocks until the server process all currently issued requests and > - * sends out pending events on all event queues. > + * sends out pending events on the event queue. > * > * \memberof wl_display > */ > WL_EXPORT int > -wl_display_roundtrip(struct wl_display *display) > +wl_display_roundtrip_queue(struct wl_display *display, struct > wl_event_queue *queue) > { > struct wl_callback *callback; > int done, ret = 0; > @@ -851,9 +852,10 @@ wl_display_roundtrip(struct wl_display *display) > callback = wl_display_sync(display); > if (callback == NULL) > return -1; > + wl_proxy_set_queue(callback, queue); > wl_callback_add_listener(callback, &sync_listener, &done); > while (!done && ret >= 0) > - ret = wl_display_dispatch(display); > + ret = wl_display_dispatch_queue(display, queue); > > if (ret == -1 && !done) > wl_callback_destroy(callback); > @@ -861,6 +863,22 @@ wl_display_roundtrip(struct wl_display *display) > return ret; > } > > +/** Block until all pending request are processed by the server > + * > + * \param display The display context object > + * \return The number of dispatched events on success or -1 on failure > + * > + * Blocks until the server process all currently issued requests and > + * sends out pending events on the default event queue. > + * > + * \memberof wl_display > + */ > +WL_EXPORT int > +wl_display_roundtrip(struct wl_display *display) > +{ > + wl_display_roundtrip_queue(display, &display->default_queue); > +} > + > static int > create_proxies(struct wl_proxy *sender, struct wl_closure *closure) > { > diff --git a/src/wayland-client.h b/src/wayland-client.h > index 2a32785..4377207 100644 > --- a/src/wayland-client.h > +++ b/src/wayland-client.h > @@ -163,6 +163,8 @@ int wl_display_dispatch_pending(struct wl_display > *display); > int wl_display_get_error(struct wl_display *display); > > int wl_display_flush(struct wl_display *display); > +int wl_display_roundtrip_queue(struct wl_display *display, > + struct wl_event_queue *queue); > int wl_display_roundtrip(struct wl_display *display); > struct wl_event_queue *wl_display_create_queue(struct wl_display > *display); > > -- > 2.0.1 > > ___ > wayland-devel mailing list > wayland-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/wayland-devel > ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH wayland v3] client: add a public function to make a roundtrip on a custom queue
wl_display_roundtrip() works on the default queue. Add a parallel wl_display_roundtrip_queue(). --- v3: fixed dispatch call in place of dispatch_queue documented the queue parameter src/wayland-client.c | 24 +--- src/wayland-client.h | 2 ++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/wayland-client.c b/src/wayland-client.c index e8aab7e..d2c1b5c 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -834,15 +834,16 @@ static const struct wl_callback_listener sync_listener = { /** Block until all pending request are processed by the server * * \param display The display context object + * \param queue The queue on which to run the roundtrip * \return The number of dispatched events on success or -1 on failure * * Blocks until the server process all currently issued requests and - * sends out pending events on all event queues. + * sends out pending events on the event queue. * * \memberof wl_display */ WL_EXPORT int -wl_display_roundtrip(struct wl_display *display) +wl_display_roundtrip_queue(struct wl_display *display, struct wl_event_queue *queue) { struct wl_callback *callback; int done, ret = 0; @@ -851,9 +852,10 @@ wl_display_roundtrip(struct wl_display *display) callback = wl_display_sync(display); if (callback == NULL) return -1; + wl_proxy_set_queue(callback, queue); wl_callback_add_listener(callback, &sync_listener, &done); while (!done && ret >= 0) - ret = wl_display_dispatch(display); + ret = wl_display_dispatch_queue(display, queue); if (ret == -1 && !done) wl_callback_destroy(callback); @@ -861,6 +863,22 @@ wl_display_roundtrip(struct wl_display *display) return ret; } +/** Block until all pending request are processed by the server + * + * \param display The display context object + * \return The number of dispatched events on success or -1 on failure + * + * Blocks until the server process all currently issued requests and + * sends out pending events on the default event queue. + * + * \memberof wl_display + */ +WL_EXPORT int +wl_display_roundtrip(struct wl_display *display) +{ + wl_display_roundtrip_queue(display, &display->default_queue); +} + static int create_proxies(struct wl_proxy *sender, struct wl_closure *closure) { diff --git a/src/wayland-client.h b/src/wayland-client.h index 2a32785..4377207 100644 --- a/src/wayland-client.h +++ b/src/wayland-client.h @@ -163,6 +163,8 @@ int wl_display_dispatch_pending(struct wl_display *display); int wl_display_get_error(struct wl_display *display); int wl_display_flush(struct wl_display *display); +int wl_display_roundtrip_queue(struct wl_display *display, + struct wl_event_queue *queue); int wl_display_roundtrip(struct wl_display *display); struct wl_event_queue *wl_display_create_queue(struct wl_display *display); -- 2.0.1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH wayland v2] client: add a public function to make a roundtrip on a custom queue
Hi, On 14 July 2014 14:52, Giulio Camuffo wrote: > @@ -851,6 +851,7 @@ wl_display_roundtrip(struct wl_display *display) > callback = wl_display_sync(display); > if (callback == NULL) > return -1; > + wl_proxy_set_queue(callback, queue); > wl_callback_add_listener(callback, &sync_listener, &done); > while (!done && ret >= 0) > ret = wl_display_dispatch(display); > This should be wl_display_dispatch_queue(display, queue). Cheers, Daniel ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH wayland v2] client: add a public function to make a roundtrip on a custom queue
wl_display_roundtrip() works on the default queue. Add a parallel wl_display_roundtrip_queue(). --- v2: fixed stupid mistake src/wayland-client.c | 21 +++-- src/wayland-client.h | 2 ++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/wayland-client.c b/src/wayland-client.c index e8aab7e..e1e5b57 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -837,12 +837,12 @@ static const struct wl_callback_listener sync_listener = { * \return The number of dispatched events on success or -1 on failure * * Blocks until the server process all currently issued requests and - * sends out pending events on all event queues. + * sends out pending events on the event queue. * * \memberof wl_display */ WL_EXPORT int -wl_display_roundtrip(struct wl_display *display) +wl_display_roundtrip_queue(struct wl_display *display, struct wl_event_queue *queue) { struct wl_callback *callback; int done, ret = 0; @@ -851,6 +851,7 @@ wl_display_roundtrip(struct wl_display *display) callback = wl_display_sync(display); if (callback == NULL) return -1; + wl_proxy_set_queue(callback, queue); wl_callback_add_listener(callback, &sync_listener, &done); while (!done && ret >= 0) ret = wl_display_dispatch(display); @@ -861,6 +862,22 @@ wl_display_roundtrip(struct wl_display *display) return ret; } +/** Block until all pending request are processed by the server + * + * \param display The display context object + * \return The number of dispatched events on success or -1 on failure + * + * Blocks until the server process all currently issued requests and + * sends out pending events on the default event queue. + * + * \memberof wl_display + */ +WL_EXPORT int +wl_display_roundtrip(struct wl_display *display) +{ + wl_display_roundtrip_queue(display, &display->default_queue); +} + static int create_proxies(struct wl_proxy *sender, struct wl_closure *closure) { diff --git a/src/wayland-client.h b/src/wayland-client.h index 2a32785..4377207 100644 --- a/src/wayland-client.h +++ b/src/wayland-client.h @@ -163,6 +163,8 @@ int wl_display_dispatch_pending(struct wl_display *display); int wl_display_get_error(struct wl_display *display); int wl_display_flush(struct wl_display *display); +int wl_display_roundtrip_queue(struct wl_display *display, + struct wl_event_queue *queue); int wl_display_roundtrip(struct wl_display *display); struct wl_event_queue *wl_display_create_queue(struct wl_display *display); -- 2.0.1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH wayland] client: add a public function to make a roundtrip on a custom queue
wl_display_roundtrip() works on the default queue. Add a parallel wl_display_roundtrip_queue(). --- src/wayland-client.c | 21 +++-- src/wayland-client.h | 2 ++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/wayland-client.c b/src/wayland-client.c index e8aab7e..35fc2b1 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -837,12 +837,12 @@ static const struct wl_callback_listener sync_listener = { * \return The number of dispatched events on success or -1 on failure * * Blocks until the server process all currently issued requests and - * sends out pending events on all event queues. + * sends out pending events on the event queue. * * \memberof wl_display */ WL_EXPORT int -wl_display_roundtrip(struct wl_display *display) +wl_display_roundtrip_queue(struct wl_display *display, struct wl_event_queue *queue) { struct wl_callback *callback; int done, ret = 0; @@ -851,6 +851,7 @@ wl_display_roundtrip(struct wl_display *display) callback = wl_display_sync(display); if (callback == NULL) return -1; + wl_proxy_set_queue(callback, queue); wl_callback_add_listener(callback, &sync_listener, &done); while (!done && ret >= 0) ret = wl_display_dispatch(display); @@ -861,6 +862,22 @@ wl_display_roundtrip(struct wl_display *display) return ret; } +/** Block until all pending request are processed by the server + * + * \param display The display context object + * \return The number of dispatched events on success or -1 on failure + * + * Blocks until the server process all currently issued requests and + * sends out pending events on the default event queue. + * + * \memberof wl_display + */ +WL_EXPORT int +wl_display_roundtrip(struct wl_display *display) +{ + wl_display_roundtrip_queue(display, display->default_queue); +} + static int create_proxies(struct wl_proxy *sender, struct wl_closure *closure) { diff --git a/src/wayland-client.h b/src/wayland-client.h index 2a32785..4377207 100644 --- a/src/wayland-client.h +++ b/src/wayland-client.h @@ -163,6 +163,8 @@ int wl_display_dispatch_pending(struct wl_display *display); int wl_display_get_error(struct wl_display *display); int wl_display_flush(struct wl_display *display); +int wl_display_roundtrip_queue(struct wl_display *display, + struct wl_event_queue *queue); int wl_display_roundtrip(struct wl_display *display); struct wl_event_queue *wl_display_create_queue(struct wl_display *display); -- 2.0.1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel