Re: [PATCH libinput] Add libinput_device_get_context/libinput_seat_get_context
Hi, On 12/02/2014 12:45 AM, Peter Hutterer wrote: Allow retrieval of the libinput context from the seat and the device. Signed-off-by: Peter Hutterer peter.hutte...@who-t.net Looks good. Reviewed-by: Hans de Goede hdego...@redhat.com Regards, Hans --- src/libinput.c | 12 src/libinput.h | 22 ++ test/device.c | 12 3 files changed, 46 insertions(+) diff --git a/src/libinput.c b/src/libinput.c index 96b255a..0d380fa 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -651,6 +651,12 @@ libinput_seat_get_user_data(struct libinput_seat *seat) return seat-user_data; } +LIBINPUT_EXPORT struct libinput * +libinput_seat_get_context(struct libinput_seat *seat) +{ + return seat-libinput; +} + LIBINPUT_EXPORT const char * libinput_seat_get_physical_name(struct libinput_seat *seat) { @@ -1177,6 +1183,12 @@ libinput_device_get_user_data(struct libinput_device *device) return device-user_data; } +LIBINPUT_EXPORT struct libinput * +libinput_device_get_context(struct libinput_device *device) +{ + return libinput_seat_get_context(device-seat); +} + LIBINPUT_EXPORT const char * libinput_device_get_sysname(struct libinput_device *device) { diff --git a/src/libinput.h b/src/libinput.h index d567df4..db56da7 100644 --- a/src/libinput.h +++ b/src/libinput.h @@ -1202,6 +1202,17 @@ libinput_seat_get_user_data(struct libinput_seat *seat); /** * @ingroup seat * + * Get the libinput context from the seat. + * + * @param seat A previously obtained seat + * @return The libinput context for this seat. + */ +struct libinput * +libinput_seat_get_context(struct libinput_seat *seat); + +/** + * @ingroup seat + * * Return the physical name of the seat. For libinput contexts created from * udev, this is always the same value as passed into * libinput_udev_assign_seat() and all seats from that context will have @@ -1291,6 +1302,17 @@ libinput_device_get_user_data(struct libinput_device *device); /** * @ingroup device * + * Get the libinput context from the device. + * + * @param device A previously obtained device + * @return The libinput context for this device. + */ +struct libinput * +libinput_device_get_context(struct libinput_device *device); + +/** + * @ingroup device + * * Get the system name of the device. * * To get the descriptive device name, use libinput_device_get_name(). diff --git a/test/device.c b/test/device.c index 84984f4..28cdb06 100644 --- a/test/device.c +++ b/test/device.c @@ -629,6 +629,17 @@ START_TEST(device_get_udev_handle) } END_TEST +START_TEST(device_context) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_seat *seat; + + ck_assert(dev-libinput == libinput_device_get_context(dev-libinput_device)); + seat = libinput_device_get_seat(dev-libinput_device); + ck_assert(dev-libinput == libinput_seat_get_context(seat)); +} +END_TEST + int main (int argc, char **argv) { litest_add(device:sendevents, device_sendevents_config, LITEST_ANY, LITEST_TOUCHPAD); @@ -650,6 +661,7 @@ int main (int argc, char **argv) litest_add(device:sendevents, device_disable_release_softbutton, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); litest_add(device:sendevents, device_disable_topsoftbutton, LITEST_TOPBUTTONPAD, LITEST_ANY); litest_add(device:id, device_ids, LITEST_ANY, LITEST_ANY); + litest_add_for_device(device:context, device_context, LITEST_SYNAPTICS_CLICKPAD); litest_add(device:udev, device_get_udev_handle, LITEST_ANY, LITEST_ANY); ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston 5/6] xdg-shell: Rewrite documentation
On Sat, Nov 22, 2014 at 12:28:29PM -0800, Jasper St. Pierre wrote: This rewrites basically all of the text inside xdg-shell to be up to date, clearer, and rid of wl_shell and X11 terminology. Thanks for updating this, Jasper! --- protocol/xdg-shell.xml | 256 ++--- 1 file changed, 156 insertions(+), 100 deletions(-) diff --git a/protocol/xdg-shell.xml b/protocol/xdg-shell.xml index 360179d..3359cf7 100644 --- a/protocol/xdg-shell.xml +++ b/protocol/xdg-shell.xml @@ -31,11 +31,15 @@ interface name=xdg_shell version=1 description summary=create desktop-style surfaces - This interface is implemented by servers that provide - desktop-style user interfaces. - - It allows clients to associate a xdg_surface with - a basic surface. + xdg_shell allows clients to turn a wl_surface into a real window + which can be dragged, resized, stacked, and moved around by the + user. Everything about this interface is suited towards traditional + desktop environments. + + Destroying a bound xdg_shell object while there are surfaces + still alive with roles from this interface is illegal and will + result in a protocol error. Make sure to destroy all surfaces + before destroying this object. /description enum name=version @@ -65,33 +69,26 @@ request name=get_xdg_surface description summary=create a shell surface from a surface - Create a shell surface for an existing surface. - - This request gives the surface the role of xdg_surface. If the - surface already has another role, it raises a protocol error. - - Only one shell or popup surface can be associated with a given - surface. + This creates an xdg_surface for the given surface and gives it the + xdg_surface role. See the documentation of xdg_surface for more details. /description I think it should be at least strongly recommended that the client do a round trip after the get_xdg_surface request to check for a configure event, because that way it can make sure to draw its first frame using the states and geometry the compositor might want to specify. This should work fine for both tiling and floating compositors, and will prevent a potential unnecessary redraw and/or missing the first frame. arg name=id type=new_id interface=xdg_surface/ arg name=surface type=object interface=wl_surface/ /request ...snip... request name=ack_configure description summary=ack a configure event -When a configure event is received, a client should then ack it -using the ack_configure request to ensure that the compositor -knows the client has seen the event. - -By this point, the state is confirmed, and the next attach should -contain the buffer drawn for the configure event you are acking. +When a configure event is received, if a client is updating +and redrawing its state in response to the configure event, +then the client needs to make an ack_configure request before +point the commit to mark this next commit as being a +reaction to the configure. + +The compositor might use this information to move a surface +to the top left only when the client has drawn itself for +the maximized or fullscreen state. + +If the client receives multiple configure events before it +can respond to one, it only has to ack the last configure event. /description Right now the only way a tiling compositor can know when it can move a window for a retile operation is if the xdg_surface is in the maximized state, and the client follows the window geometry specified in the configure event must be obeyed by the client requirement for the maximized state (gtk+ does not¹). So I wonder, why not require that the application do an attach + commit sometime soon after acking a configure (I'm not sure how to phrase this precisely)? This way, the compositor can always expect an attach after it sends a configure, so it will be able to move windows around correctly even if they don't handle the maximized state correctly. I think this should be an okay requirement to make because if the compositor sent a configure request, the client almost certainly needs to repaint anyway, and if it really does not, it can just re-attach the already-attached buffer. ¹: https://bugzilla.gnome.org/show_bug.cgi?id=740946 - arg name=serial type=uint summary=a serial to configure for/ + arg name=serial type=uint summary=the serial from the configure event/ /request pgprpqm35oWeH.pgp Description: PGP signature ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH libinput] Introduce non-accelerated motion event vectors
For certain applications (such as FPS games) it is necessary to use non-accelerated motion events (the motion vector that is passed to the acceleration filter) to get a more natural feeling. Supply this information by passing both accelerated and non-accelerated motion vectors to the existing motion event. Note that the non-accelerated motion event is not equivalent to 'raw' events as read from devices. Signed-off-by: Jonas Ådahl jad...@gmail.com --- src/evdev-mt-touchpad-edge-scroll.c | 2 +- src/evdev-mt-touchpad.c | 20 ++ src/evdev-mt-touchpad.h | 4 ++- src/evdev.c | 19 ++ src/libinput-private.h | 4 ++- src/libinput.c | 20 +- src/libinput.h | 30 + test/pointer.c | 52 + 8 files changed, 137 insertions(+), 14 deletions(-) diff --git a/src/evdev-mt-touchpad-edge-scroll.c b/src/evdev-mt-touchpad-edge-scroll.c index 1dca0ea..d68fc68 100644 --- a/src/evdev-mt-touchpad-edge-scroll.c +++ b/src/evdev-mt-touchpad-edge-scroll.c @@ -338,7 +338,7 @@ tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time) } tp_get_delta(t, dx, dy); - tp_filter_motion(tp, dx, dy, time); + tp_filter_motion(tp, dx, dy, NULL, NULL, time); if (fabs(*delta) t-scroll.threshold) continue; diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 8f76ddb..ff76fe2 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -58,13 +58,20 @@ tp_motion_history_offset(struct tp_touch *t, int offset) void tp_filter_motion(struct tp_dispatch *tp, -double *dx, double *dy, uint64_t time) +double *dx, double *dy, +double *dx_noaccel, double *dy_noaccel, +uint64_t time) { struct motion_params motion; motion.dx = *dx * tp-accel.x_scale_coeff; motion.dy = *dy * tp-accel.y_scale_coeff; + if (dx_noaccel) + *dx_noaccel = motion.dx; + if (dy_noaccel) + *dy_noaccel = motion.dy; + if (motion.dx != 0.0 || motion.dy != 0.0) filter_dispatch(tp-device-pointer.filter, motion, tp, time); @@ -426,7 +433,7 @@ tp_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t time) dx /= nchanged; dy /= nchanged; - tp_filter_motion(tp, dx, dy, time); + tp_filter_motion(tp, dx, dy, NULL, NULL, time); evdev_post_scroll(tp-device, time, dx, dy); } @@ -586,6 +593,7 @@ tp_post_events(struct tp_dispatch *tp, uint64_t time) struct tp_touch *t = tp_current_touch(tp); double dx, dy; int filter_motion = 0; + double dx_noaccel, dy_noaccel; /* Only post (top) button events while suspended */ if (tp-device-suspended) { @@ -617,10 +625,12 @@ tp_post_events(struct tp_dispatch *tp, uint64_t time) return; tp_get_delta(t, dx, dy); - tp_filter_motion(tp, dx, dy, time); + tp_filter_motion(tp, dx, dy, dx_noaccel, dy_noaccel, time); - if (dx != 0.0 || dy != 0.0) - pointer_notify_motion(tp-device-base, time, dx, dy); + if (dx != 0.0 || dy != 0.0 || dx_noaccel != 0.0 || dy_noaccel != 0.0) { + pointer_notify_motion(tp-device-base, time, + dx, dy, dx_noaccel, dy_noaccel); + } } static void diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index b2603b4..ea77062 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -276,7 +276,9 @@ tp_set_pointer(struct tp_dispatch *tp, struct tp_touch *t); void tp_filter_motion(struct tp_dispatch *tp, -double *dx, double *dy, uint64_t time); +double *dx, double *dy, +double *dx_noaccel, double *dy_noaccel, +uint64_t time); int tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time); diff --git a/src/evdev.c b/src/evdev.c index 908a8ba..f7d88c4 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -198,6 +198,7 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time) { struct libinput *libinput = device-base.seat-libinput; struct motion_params motion; + double dx_noaccel, dy_noaccel; int32_t cx, cy; int32_t x, y; int slot; @@ -211,8 +212,10 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time) case EVDEV_NONE: return; case EVDEV_RELATIVE_MOTION: - motion.dx = device-rel.dx / ((double)device-dpi / DEFAULT_MOUSE_DPI); - motion.dy = device-rel.dy / ((double)device-dpi / DEFAULT_MOUSE_DPI); + dx_noaccel = device-rel.dx / ((double) device-dpi / +
[PATCH weston v2 2/2] compositor: Implement JSON-timeline logging
From: Pekka Paalanen pekka.paala...@collabora.co.uk Logging is activated and deactivated with the debug key binding 't'. When activated, it creates a new log file, where it records the events. The log file contains events and detailed object information entries in JSON format, and is meant to be parsed in sequence from beginning to the end. The emitted events are mostly related to the output repaint cycle, like when repaint begins, is submitted to GPU, and when it completes on a vblank. This is recorded per-output. Also some per-surface events are recorded, including when surface damage is flushed. To reduce the log size, events refer to objects like outputs and surfaces by id numbers. Detailed object information is emitted only as needed: on the first object occurrence, and afterwards only if weston_timeline_object::force_refresh asks for it. The detailed information for surfaces includes the string returned by weston_surface::get_label. Therefore it is important to set weston_timeline_object::force_refresh = 1 whenever the string would change, so that the new details get recorded. A rudimentary parser and SVG generator can be found at: https://github.com/ppaalanen/wesgr The timeline logs can answer questions including: - How does the compositor repaint cycle work timing-wise? - When was the vblank deadline missed? - What is the latency from surface commit to showing the new content on screen? - How long does it take to process the scenegraph? v2: weston_surface::get_description renamed to get_label. Signed-off-by: Pekka Paalanen pekka.paala...@collabora.co.uk --- Makefile.am | 4 + desktop-shell/shell.c | 28 +++-- src/compositor.c | 40 +++ src/compositor.h | 5 + src/timeline-object.h | 52 + src/timeline.c| 286 ++ src/timeline.h| 62 +++ 7 files changed, 468 insertions(+), 9 deletions(-) create mode 100644 src/timeline-object.h create mode 100644 src/timeline.c create mode 100644 src/timeline.h diff --git a/Makefile.am b/Makefile.am index e942850..d7b909a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -62,6 +62,9 @@ weston_SOURCES = \ src/noop-renderer.c \ src/pixman-renderer.c \ src/pixman-renderer.h \ + src/timeline.c \ + src/timeline.h \ + src/timeline-object.h \ shared/matrix.c \ shared/matrix.h \ shared/zalloc.h \ @@ -150,6 +153,7 @@ westonincludedir = $(includedir)/weston westoninclude_HEADERS =\ src/version.h \ src/compositor.h\ + src/timeline-object.h \ shared/matrix.h \ shared/config-parser.h \ shared/zalloc.h diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index b6f5f78..a7514f7 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -2244,6 +2244,14 @@ set_title(struct shell_surface *shsurf, const char *title) { free(shsurf-title); shsurf-title = strdup(title); + shsurf-surface-timeline.force_refresh = 1; +} + +static void +set_type(struct shell_surface *shsurf, enum shell_surface_type t) +{ + shsurf-type = t; + shsurf-surface-timeline.force_refresh = 1; } static void @@ -2274,6 +2282,7 @@ shell_surface_set_class(struct wl_client *client, free(shsurf-class); shsurf-class = strdup(class); + shsurf-surface-timeline.force_refresh = 1; } static void @@ -2440,7 +2449,7 @@ set_toplevel(struct shell_surface *shsurf) { shell_surface_set_parent(shsurf, NULL); surface_clear_next_states(shsurf); - shsurf-type = SHELL_SURFACE_TOPLEVEL; + set_type(shsurf, SHELL_SURFACE_TOPLEVEL); /* The layer_link is updated in set_surface_type(), * called from configure. */ @@ -2471,7 +2480,7 @@ set_transient(struct shell_surface *shsurf, shsurf-next_state.relative = true; shsurf-state_changed = true; - shsurf-type = SHELL_SURFACE_TOPLEVEL; + set_type(shsurf, SHELL_SURFACE_TOPLEVEL); /* The layer_link is updated in set_surface_type(), * called from configure. */ @@ -2497,7 +2506,7 @@ set_fullscreen(struct shell_surface *shsurf, struct weston_output *output) { shell_surface_set_output(shsurf, output); - shsurf-type = SHELL_SURFACE_TOPLEVEL; + set_type(shsurf, SHELL_SURFACE_TOPLEVEL); shsurf-fullscreen_output = shsurf-output; shsurf-fullscreen.type = method; @@ -2582,7 +2591,7 @@ set_popup(struct shell_surface
[PATCH weston v2 1/2] compositor: add weston_surface_set_label_func()
From: Pekka Paalanen p...@iki.fi When printing out logs from Weston's actions, mainly for debugging, it can be very difficult to identify the different surfaces. Inspecting the configure function pointer is not useful, as the configure functions may live in modules. Add vfunc get_label to weston_surface, which will produce a short, human-readable description of the surface, which allows identifying it better, rather than just looking at the surface size, for instance. Set the label function from most parts of Weston, to identify cursors and drag icons, and panels, backgrounds, screensavers and lock surfaces, and the desktop shell's application surfaces. v2: renamed 'description' to 'label', so we get weston_surface_set_label_func(). Signed-off-by: Pekka Paalanen pekka.paala...@collabora.co.uk --- desktop-shell/input-panel.c | 8 desktop-shell/shell.c | 94 + src/compositor.c| 16 src/compositor.h| 6 +++ src/data-device.c | 19 + src/input.c | 10 + 6 files changed, 153 insertions(+) diff --git a/desktop-shell/input-panel.c b/desktop-shell/input-panel.c index 0b42c2f..ffa3ade 100644 --- a/desktop-shell/input-panel.c +++ b/desktop-shell/input-panel.c @@ -150,6 +150,12 @@ update_input_panels(struct wl_listener *listener, void *data) memcpy(shell-text_input.cursor_rectangle, data, sizeof(pixman_box32_t)); } +static int +input_panel_get_label(struct weston_surface *surface, char *buf, size_t len) +{ + return snprintf(buf, len, input panel); +} + static void input_panel_configure(struct weston_surface *surface, int32_t sx, int32_t sy) { @@ -187,6 +193,7 @@ destroy_input_panel_surface(struct input_panel_surface *input_panel_surface) wl_list_remove(input_panel_surface-link); input_panel_surface-surface-configure = NULL; + weston_surface_set_label_func(input_panel_surface-surface, NULL); weston_view_destroy(input_panel_surface-view); free(input_panel_surface); @@ -228,6 +235,7 @@ create_input_panel_surface(struct desktop_shell *shell, surface-configure = input_panel_configure; surface-configure_private = input_panel_surface; + weston_surface_set_label_func(surface, input_panel_get_label); input_panel_surface-shell = shell; diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 9e8d45a..b6f5f78 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -274,6 +274,31 @@ static void shell_surface_set_parent(struct shell_surface *shsurf, struct weston_surface *parent); +static int +shell_surface_get_label(struct weston_surface *surface, char *buf, size_t len) +{ + struct shell_surface *shsurf; + const char *typestr[] = { + [SHELL_SURFACE_NONE] = unidentified, + [SHELL_SURFACE_TOPLEVEL] = top-level, + [SHELL_SURFACE_POPUP] = popup, + [SHELL_SURFACE_XWAYLAND] = Xwayland, + }; + const char *t, *c; + + shsurf = get_shell_surface(surface); + if (!shsurf) + return snprintf(buf, len, unidentified window); + + t = shsurf-title; + c = shsurf-class; + + return snprintf(buf, len, %s window%s%s%s%s%s, + typestr[shsurf-type], + t ? ' : , t ?: , t ? ' : , + c ? of : , c ?: ); +} + static bool shell_surface_is_top_fullscreen(struct shell_surface *shsurf) { @@ -634,6 +659,12 @@ get_default_output(struct weston_compositor *compositor) struct weston_output, link); } +static int +focus_surface_get_label(struct weston_surface *surface, char *buf, size_t len) +{ + return snprintf(buf, len, focus highlight effect for output %s, + surface-output-name); +} /* no-op func for checking focus surface */ static void @@ -683,6 +714,7 @@ create_focus_surface(struct weston_compositor *ec, surface-configure = focus_surface_configure; surface-output = output; surface-configure_private = fsurf; + weston_surface_set_label_func(surface, focus_surface_get_label); fsurf-view = weston_view_create(surface); if (fsurf-view == NULL) { @@ -2741,6 +2773,33 @@ shell_surface_get_shell(struct shell_surface *shsurf) return shsurf-shell; } +static int +black_surface_get_label(struct weston_surface *surface, char *buf, size_t len) +{ + struct weston_surface *fs_surface = surface-configure_private; + int n; + int rem; + int ret; + + n = snprintf(buf, len, black background surface for ); + if (n 0) + return n; + + rem = (int)len - n; + if (rem 0) + rem = 0; + + if (fs_surface-get_label) + ret = fs_surface-get_label(fs_surface, buf + n, rem); + else + ret = snprintf(buf + n, rem,
Re: [PATCH v1] Added string conversion utility functions
Interesting read.. have some arguments about the raised points.. but lets not go in that direction.. Can you guys suggest to do some changes or shall i drop the patch altogether? if you are happy with current implementation lets live with it.. I noticed bug when weston was not working properly due to improper error handling of strtol in one place, so I thought it would be good idea to fix it wherever it is used (and hence this patch) but seems that it is not always the case :-) BR imran p.s: To me it was really simple to understand that in MOST (=NOT ALL) of the cases str-to-number conversion was done using strtol/strtoul but without proper error handling. I moved it to single place to make the life easier IMHO... On Mon, Dec 1, 2014 at 8:30 PM, Bill Spitzak spit...@gmail.com wrote: On 12/01/2014 04:10 AM, Pekka Paalanen wrote: other = strtol(pid, end, 0); if (end != pid + 10) { weston_log(can't parse lock file %s\n, lockfile); close(fd); errno = EEXIST; return -1; } 'pid' is a fixed size string read in from the lock file, which is converted into a number of type pid_t. Because the number is assumed to be printed by %10d\n, the file should have at least 11 bytes available, and we assume all the 10 characters form a valid number (with leading spaces). It's all just a way to avoid dealing with unexpected EOF when reading the file, and to avoid not knowing in advance how many characters long the number is. This code still wants to parse the whole string as a single number, but it also knows the number will end in a newline instead of nul. It wouldn't be difficult to replace that newline with nul before parsing, if you really want to convert this code to use a helper. But while doing so, you have to ask yourself: does this actually make the code any easier to understand or more correct? I believe you are correct, and this is a good indication that blindly inserting the replacement function is not a good idea. The original code failed if there was a digit at offset 11 (as well as other reasons for failing). The proposed replacement failed if offset 11 was anything other than NUL. This is different. When I said the endptr was not needed, my proposal actually has the exact same mistake. This does bring up a question as to whether the helper function should eat trailing whitespace. But also that you can't drop the wrapper in everywhere. ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 09/17] desktop-shell: Make activate() take a view instead of surface
In preparation for further refactorings. Signed-off-by: Jonas Ådahl jad...@gmail.com --- desktop-shell/exposay.c | 6 +++--- desktop-shell/shell.c | 22 -- desktop-shell/shell.h | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c index a44c1f7..5073a96 100644 --- a/desktop-shell/exposay.c +++ b/desktop-shell/exposay.c @@ -160,7 +160,7 @@ exposay_highlight_surface(struct desktop_shell *shell, shell-exposay.column_current = esurface-column; shell-exposay.cur_output = esurface-eoutput; - activate(shell, view-surface, shell-exposay.seat, false); + activate(shell, view, shell-exposay.seat, false); shell-exposay.focus_current = view; } @@ -544,10 +544,10 @@ exposay_transition_inactive(struct desktop_shell *shell, int switch_focus) * animating back the old state and then immediately transitioning * to the new. */ if (switch_focus shell-exposay.focus_current) - activate(shell, shell-exposay.focus_current-surface, + activate(shell, shell-exposay.focus_current, shell-exposay.seat, true); else if (shell-exposay.focus_prev) - activate(shell, shell-exposay.focus_prev-surface, + activate(shell, shell-exposay.focus_prev, shell-exposay.seat, true); wl_list_for_each(esurface, shell-exposay.surface_list, link) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index aa9c333..f8c2185 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -747,7 +747,8 @@ focus_state_surface_destroy(struct wl_listener *listener, void *data) struct focus_state, surface_destroy_listener); struct desktop_shell *shell; - struct weston_surface *main_surface, *next; + struct weston_surface *main_surface; + struct weston_view *next; struct weston_view *view; main_surface = weston_surface_get_main_surface(state-keyboard_focus); @@ -760,13 +761,13 @@ focus_state_surface_destroy(struct wl_listener *listener, void *data) if (is_focus_view(view)) continue; - next = view-surface; + next = view; break; } /* if the focus was a sub-surface, activate its main surface */ if (main_surface != state-keyboard_focus) - next = main_surface; + next = get_default_view(main_surface); shell = state-seat-compositor-shell_interface.shell; if (next) { @@ -2010,10 +2011,10 @@ busy_cursor_grab_button(struct weston_pointer_grab *base, struct weston_seat *seat = grab-grab.pointer-seat; if (shsurf button == BTN_LEFT state) { - activate(shsurf-shell, shsurf-surface, seat, true); + activate(shsurf-shell, shsurf-view, seat, true); surface_move(shsurf, seat, 0); } else if (shsurf button == BTN_RIGHT state) { - activate(shsurf-shell, shsurf-surface, seat, true); + activate(shsurf-shell, shsurf-view, seat, true); surface_rotate(shsurf, seat); } } @@ -2645,7 +2646,7 @@ set_minimized(struct weston_surface *surface, bool minimized) wl_list_for_each(seat, shell-compositor-seat_list, link) { if (!seat-keyboard) continue; - activate(shsurf-shell, view-surface, seat, true); + activate(shsurf-shell, view, seat, true); } } @@ -4867,9 +4868,10 @@ lower_fullscreen_layer(struct desktop_shell *shell) } void -activate(struct desktop_shell *shell, struct weston_surface *es, +activate(struct desktop_shell *shell, struct weston_view *view, struct weston_seat *seat, bool configure) { + struct weston_surface *es = view-surface; struct weston_surface *main_surface; struct focus_state *state; struct workspace *ws; @@ -4944,7 +4946,7 @@ activate_binding(struct weston_seat *seat, if (get_shell_surface_type(main_surface) == SHELL_SURFACE_NONE) return; - activate(shell, focus_view-surface, seat, true); + activate(shell, focus_view, seat, true); } static void @@ -5376,7 +5378,7 @@ map(struct desktop_shell *shell, struct shell_surface *shsurf, if (shell-locked) break; wl_list_for_each(seat, compositor-seat_list, link) - activate(shell, shsurf-surface, seat, true); + activate(shell, shsurf-view, seat, true); break; case SHELL_SURFACE_POPUP: case SHELL_SURFACE_NONE: @@ -5864,7 +5866,7 @@ switcher_destroy(struct switcher
[PATCH weston 06/17] desktop-shell: Make activate_binding take a view instead of surface
In preparation for further refactoring. Signed-off-by: Jonas Ådahl jad...@gmail.com --- desktop-shell/shell.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 4a0cb99..4b8724c 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -4927,12 +4927,14 @@ is_black_surface (struct weston_surface *es, struct weston_surface **fs_surface) static void activate_binding(struct weston_seat *seat, struct desktop_shell *shell, -struct weston_surface *focus) +struct weston_view *focus_view) { + struct weston_surface *focus; struct weston_surface *main_surface; - if (!focus) + if (!focus_view) return; + focus = focus_view-surface; if (is_black_surface(focus, main_surface)) focus = main_surface; @@ -4945,7 +4947,8 @@ activate_binding(struct weston_seat *seat, } static void -click_to_activate_binding(struct weston_seat *seat, uint32_t time, uint32_t button, +click_to_activate_binding(struct weston_seat *seat, + uint32_t time, uint32_t button, void *data) { if (seat-pointer-grab != seat-pointer-default_grab) @@ -4953,7 +4956,7 @@ click_to_activate_binding(struct weston_seat *seat, uint32_t time, uint32_t butt if (seat-pointer-focus == NULL) return; - activate_binding(seat, data, seat-pointer-focus-surface); + activate_binding(seat, data, seat-pointer-focus); } static void @@ -4964,7 +4967,7 @@ touch_to_activate_binding(struct weston_seat *seat, uint32_t time, void *data) if (seat-touch-focus == NULL) return; - activate_binding(seat, data, seat-touch-focus-surface); + activate_binding(seat, data, seat-touch-focus); } static void -- 1.8.5.1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 01/17] protocol: Improve formatting of input method and text protocols
To make it more readable, add an empty line between each request and event. Also comes with a bonus indentation fix. Signed-off-by: Jonas Ådahl jad...@gmail.com --- protocol/input-method.xml | 28 protocol/text.xml | 30 ++ 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/protocol/input-method.xml b/protocol/input-method.xml index 5fbc6a0..59690d3 100644 --- a/protocol/input-method.xml +++ b/protocol/input-method.xml @@ -1,5 +1,6 @@ ?xml version=1.0 encoding=UTF-8? protocol name=input_method + copyright Copyright © 2012, 2013 Intel Corporation @@ -25,7 +26,6 @@ THIS SOFTWARE. /copyright - interface name=wl_input_method_context version=1 description summary=input method context Corresponds to a text model on input method side. An input method context @@ -43,7 +43,9 @@ and keysym. The text input can then ignore events from the input method which are based on an outdated state (for example after a reset). /description + request name=destroy type=destructor/ + request name=commit_string description summary=commit string Send the commit string text for insertion to the application. @@ -59,6 +61,7 @@ arg name=serial type=uint summary=serial of the latest known text input state/ arg name=text type=string/ /request + request name=preedit_string description summary=pre-edit string Send the pre-edit string text to the application text input. @@ -73,6 +76,7 @@ arg name=text type=string/ arg name=commit type=string/ /request + request name=preedit_styling description summary=pre-edit styling Sets styling information on composing text. The style is applied for @@ -86,6 +90,7 @@ arg name=length type=uint/ arg name=style type=uint/ /request + request name=preedit_cursor description summary=pre-edit cursor Sets the cursor position inside the composing text (as byte offset) @@ -97,16 +102,16 @@ /description arg name=index type=int/ /request + request name=delete_surrounding_text description summary=delete text - - This request will be handled on text_input side as part of a directly following commit_string request. /description arg name=index type=int/ arg name=length type=uint/ /request + request name=cursor_position description summary=set cursor to a new position Sets the cursor and anchor to a new position. Index is the new cursor @@ -122,9 +127,11 @@ arg name=index type=int/ arg name=anchor type=int/ /request + request name=modifiers_map arg name=map type=array/ /request + request name=keysym description summary=keysym Notify when a key event was sent. Key events should not be used for @@ -138,6 +145,7 @@ arg name=state type=uint/ arg name=modifiers type=uint/ /request + request name=grab_keyboard description summary=grab hardware keyboard Allows an input method to receive hardware keyboard input and process @@ -145,8 +153,9 @@ allows input methods which compose multiple key events for inputting text like it is done for CJK languages. /description - arg name=keyboard type=new_id interface=wl_keyboard/ + arg name=keyboard type=new_id interface=wl_keyboard/ /request + request name=key description summary=forward key event Should be used when filtering key events with grab_keyboard. @@ -163,6 +172,7 @@ arg name=key type=uint summary=key from wl_keyboard::key/ arg name=state type=uint summary=state from wl_keyboard::key/ /request + request name=modifiers description summary=forward modifiers event Should be used when filtering key events with grab_keyboard. @@ -177,6 +187,7 @@ arg name=mods_locked type=uint summary=mods_locked from wl_keyboard::modifiers/ arg name=group type=uint summary=group from wl_keyboard::modifiers/ /request + request name=language arg name=serial type=uint summary=serial of the latest known text input state/ arg name=language type=string/ @@ -185,6 +196,7 @@ arg name=serial type=uint summary=serial of the latest known text input state/ arg name=direction type=uint/ /request + event name=surrounding_text description summary=surrounding text event The plain surrounding text around the input position. Cursor is the @@ -197,19 +209,24 @@ arg name=cursor type=uint/ arg name=anchor type=uint/ /event + event name=reset /event + event name=content_type arg name=hint type=uint/ arg name=purpose type=uint/ /event + event name=invoke_action arg name=button type=uint/ arg name=index
[PATCH weston 11/17] compositor: Keep track of what views were activated by clicking
Adds a weston_view_activate() that can be passed an additional active flag WESTON_ACTIVATE_CLICKED, that the shell passes when a view was activated by clicking. This allows shell independent components implement heuristics depending on how a view was activated. Signed-off-by: Jonas Ådahl jad...@gmail.com --- desktop-shell/shell.c | 3 ++- src/compositor.c | 2 ++ src/compositor.h | 13 - src/input.c | 31 +++ 4 files changed, 47 insertions(+), 2 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index abe64f6..aa8f9da 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -4886,7 +4886,7 @@ activate(struct desktop_shell *shell, struct weston_view *view, main_surface = weston_surface_get_main_surface(es); - weston_surface_activate(es, seat); + weston_view_activate(view, seat, flags); state = ensure_focus_state(shell, seat); if (state == NULL) @@ -4966,6 +4966,7 @@ click_to_activate_binding(struct weston_seat *seat, return; activate_binding(seat, data, seat-pointer-focus, +WESTON_ACTIVATE_FLAG_CLICKED | WESTON_ACTIVATE_FLAG_CONFIGURE); } diff --git a/src/compositor.c b/src/compositor.c index 17e930c..790018a 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -4051,6 +4051,8 @@ weston_compositor_init(struct weston_compositor *ec, ec-output_id_pool = 0; + ec-activate_serial = 1; + if (!wl_global_create(display, wl_compositor_interface, 3, ec, compositor_bind)) return -1; diff --git a/src/compositor.h b/src/compositor.h index 4982187..6bcddf5 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -685,6 +685,8 @@ struct weston_compositor { clockid_t presentation_clock; int exit_code; + + unsigned int activate_serial; }; struct weston_buffer { @@ -777,6 +779,8 @@ struct weston_view { struct weston_plane *plane; struct weston_view *parent_view; + unsigned int click_to_activate_serial; + pixman_region32_t clip; float alpha; /* part of geometry, see below */ @@ -972,7 +976,8 @@ enum weston_key_state_update { enum weston_activate_flag { WESTON_ACTIVATE_FLAG_NONE = 0, - WESTON_ACTIVATE_FLAG_CONFIGURE = 1 0, + WESTON_ACTIVATE_FLAG_CLICKED = 1 0, + WESTON_ACTIVATE_FLAG_CONFIGURE = 1 1, }; void @@ -1024,6 +1029,12 @@ weston_spring_done(struct weston_spring *spring); void weston_surface_activate(struct weston_surface *surface, struct weston_seat *seat); + +void +weston_view_activate(struct weston_view *view, +struct weston_seat *seat, +uint32_t flags); + void notify_motion(struct weston_seat *seat, uint32_t time, struct weston_pointer_motion_event *event); diff --git a/src/input.c b/src/input.c index 67f5cf4..d82628c 100644 --- a/src/input.c +++ b/src/input.c @@ -1048,12 +1048,29 @@ notify_motion_absolute(struct weston_seat *seat, pointer-grab-interface-motion(pointer-grab, time, event); } +static unsigned int +peek_next_activate_serial(struct weston_compositor *c) +{ + unsigned serial = c-activate_serial + 1; + + return serial == 0 ? 1 : serial; +} + +static void +inc_activate_serial(struct weston_compositor *c) +{ + if (++c-activate_serial == 0) + ++c-activate_serial; +} + WL_EXPORT void weston_surface_activate(struct weston_surface *surface, struct weston_seat *seat) { struct weston_compositor *compositor = seat-compositor; + inc_activate_serial(compositor); + if (seat-keyboard) { weston_keyboard_set_focus(seat-keyboard, surface); wl_data_device_set_keyboard_focus(seat); @@ -1063,6 +1080,20 @@ weston_surface_activate(struct weston_surface *surface, } WL_EXPORT void +weston_view_activate(struct weston_view *view, +struct weston_seat *seat, +uint32_t flags) +{ + struct weston_compositor *compositor = seat-compositor; + + if (flags WESTON_ACTIVATE_FLAG_CLICKED) { + view-click_to_activate_serial = + peek_next_activate_serial(compositor); + } + weston_surface_activate(view-surface, seat); +} + +WL_EXPORT void notify_button(struct weston_seat *seat, uint32_t time, int32_t button, enum wl_pointer_button_state state) { -- 1.8.5.1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 12/17] libinput: Expose unaccelerated motion deltas in motion event struct
Signed-off-by: Jonas Ådahl jad...@gmail.com --- src/compositor.h | 3 +++ src/libinput-device.c | 7 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/compositor.h b/src/compositor.h index 6bcddf5..b622c97 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -239,6 +239,7 @@ struct weston_output { enum weston_pointer_motion_mask { WESTON_POINTER_MOTION_ABS = 1 0, WESTON_POINTER_MOTION_REL = 1 1, + WESTON_POINTER_MOTION_REL_NOACCEL = 1 2, }; struct weston_pointer_motion_event { @@ -247,6 +248,8 @@ struct weston_pointer_motion_event { wl_fixed_t y; wl_fixed_t dx; wl_fixed_t dy; + wl_fixed_t dx_noaccel; + wl_fixed_t dy_noaccel; }; struct weston_pointer_grab; diff --git a/src/libinput-device.c b/src/libinput-device.c index b815b43..73d28e4 100644 --- a/src/libinput-device.c +++ b/src/libinput-device.c @@ -76,11 +76,16 @@ handle_pointer_motion(struct libinput_device *libinput_device, struct weston_pointer_motion_event event = { 0 }; event = (struct weston_pointer_motion_event) { - .mask = WESTON_POINTER_MOTION_REL, + .mask = WESTON_POINTER_MOTION_REL | + WESTON_POINTER_MOTION_REL_NOACCEL, .dx = wl_fixed_from_double( libinput_event_pointer_get_dx(pointer_event)), .dy = wl_fixed_from_double( libinput_event_pointer_get_dy(pointer_event)), + .dx_noaccel = wl_fixed_from_double( + libinput_event_pointer_get_dx_noaccel(pointer_event)), + .dy_noaccel = wl_fixed_from_double( + libinput_event_pointer_get_dy_noaccel(pointer_event)), }; notify_motion(device-seat, -- 1.8.5.1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 03/17] input: Make pointer grab motion callbacks take an event struct
Instead of only passing absolute pointer coordinates, effectively loosing motion event data, pass a struct that can potentially contain different types of motion events, currently being absolute and relative. A helper function to get resulting absolute coordinates was added for when previous callbacks simply used the (x, y) coordinates. Signed-off-by: Jonas Ådahl jad...@gmail.com --- desktop-shell/exposay.c | 4 ++-- desktop-shell/shell.c | 22 ++ src/compositor-x11.c| 13 --- src/compositor.h| 24 --- src/data-device.c | 4 ++-- src/input.c | 61 - src/libinput-device.c | 15 tests/weston-test.c | 11 ++--- 8 files changed, 115 insertions(+), 39 deletions(-) diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c index dc3fee0..a44c1f7 100644 --- a/desktop-shell/exposay.c +++ b/desktop-shell/exposay.c @@ -340,12 +340,12 @@ exposay_focus(struct weston_pointer_grab *grab) static void exposay_motion(struct weston_pointer_grab *grab, uint32_t time, - wl_fixed_t x, wl_fixed_t y) + struct weston_pointer_motion_event *event) { struct desktop_shell *shell = container_of(grab, struct desktop_shell, exposay.grab_ptr); - weston_pointer_move(grab-pointer, x, y); + weston_pointer_move(grab-pointer, event); exposay_pick(shell, wl_fixed_to_int(grab-pointer-x), diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 8fc6a48..b03dbaf 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -1657,14 +1657,14 @@ constrain_position(struct weston_move_grab *move, int *cx, int *cy) static void move_grab_motion(struct weston_pointer_grab *grab, uint32_t time, -wl_fixed_t x, wl_fixed_t y) +struct weston_pointer_motion_event *event) { struct weston_move_grab *move = (struct weston_move_grab *) grab; struct weston_pointer *pointer = grab-pointer; struct shell_surface *shsurf = move-base.shsurf; int cx, cy; - weston_pointer_move(pointer, x, y); + weston_pointer_move(pointer, event); if (!shsurf) return; @@ -1779,7 +1779,7 @@ struct weston_resize_grab { static void resize_grab_motion(struct weston_pointer_grab *grab, uint32_t time, - wl_fixed_t x, wl_fixed_t y) + struct weston_pointer_motion_event *event) { struct weston_resize_grab *resize = (struct weston_resize_grab *) grab; struct weston_pointer *pointer = grab-pointer; @@ -1788,7 +1788,7 @@ resize_grab_motion(struct weston_pointer_grab *grab, uint32_t time, wl_fixed_t from_x, from_y; wl_fixed_t to_x, to_y; - weston_pointer_move(pointer, x, y); + weston_pointer_move(pointer, event); if (!shsurf) return; @@ -1989,9 +1989,9 @@ busy_cursor_grab_focus(struct weston_pointer_grab *base) static void busy_cursor_grab_motion(struct weston_pointer_grab *grab, uint32_t time, - wl_fixed_t x, wl_fixed_t y) + struct weston_pointer_motion_event *event) { - weston_pointer_move(grab-pointer, x, y); + weston_pointer_move(grab-pointer, event); } static void @@ -3068,18 +3068,20 @@ popup_grab_focus(struct weston_pointer_grab *grab) static void popup_grab_motion(struct weston_pointer_grab *grab, uint32_t time, - wl_fixed_t x, wl_fixed_t y) + struct weston_pointer_motion_event *event) { struct weston_pointer *pointer = grab-pointer; struct wl_resource *resource; + wl_fixed_t x, y; wl_fixed_t sx, sy; if (pointer-focus) { + weston_pointer_motion_to_abs(pointer, event, x, y); weston_view_from_global_fixed(pointer-focus, x, y, pointer-sx, pointer-sy); } - weston_pointer_move(pointer, x, y); + weston_pointer_move(pointer, event); wl_resource_for_each(resource, pointer-focus_resource_list) { weston_view_from_global_fixed(pointer-focus, @@ -4656,7 +4658,7 @@ terminate_binding(struct weston_seat *seat, uint32_t time, uint32_t key, static void rotate_grab_motion(struct weston_pointer_grab *grab, uint32_t time, - wl_fixed_t x, wl_fixed_t y) + struct weston_pointer_motion_event *event) { struct rotate_grab *rotate = container_of(grab, struct rotate_grab, base.grab); @@ -4664,7 +4666,7 @@ rotate_grab_motion(struct weston_pointer_grab *grab, uint32_t time, struct shell_surface *shsurf = rotate-base.shsurf; float cx, cy, dx, dy, cposx, cposy, dposx, dposy, r; - weston_pointer_move(pointer, x, y); + weston_pointer_move(pointer, event); if (!shsurf)
[PATCH weston 04/17] desktop-shell: Add unset_keyboard_focus_for_surface helper
Signed-off-by: Jonas Ådahl jad...@gmail.com --- desktop-shell/shell.c | 36 ++-- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index b03dbaf..2e416e9 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -1356,14 +1356,28 @@ workspace_has_only(struct workspace *ws, struct weston_surface *surface) } static void +unset_keyboard_focus_for_surface(struct weston_surface *surface) +{ + struct weston_compositor *compositor = surface-compositor; + struct weston_seat *seat; + struct weston_surface *focus; + + wl_list_for_each(seat, compositor-seat_list, link) { + if (!seat-keyboard) + continue; + focus = weston_surface_get_main_surface(seat-keyboard-focus); + if (focus == surface) + weston_keyboard_set_focus(seat-keyboard, NULL); + } +} + +static void move_surface_to_workspace(struct desktop_shell *shell, struct shell_surface *shsurf, uint32_t workspace) { struct workspace *from; struct workspace *to; - struct weston_seat *seat; - struct weston_surface *focus; struct weston_view *view; if (workspace == shell-workspaces.current) @@ -1387,14 +1401,7 @@ move_surface_to_workspace(struct desktop_shell *shell, shell_surface_update_child_surface_layers(shsurf); drop_focus_state(shell, from, view-surface); - wl_list_for_each(seat, shell-compositor-seat_list, link) { - if (!seat-keyboard) - continue; - - focus = weston_surface_get_main_surface(seat-keyboard-focus); - if (focus == view-surface) - weston_keyboard_set_focus(seat-keyboard, NULL); - } + unset_keyboard_focus_for_surface(view-surface); weston_view_damage_below(view); } @@ -2610,7 +2617,6 @@ set_minimized(struct weston_surface *surface, uint32_t is_true) struct shell_surface *shsurf; struct workspace *current_ws; struct weston_seat *seat; - struct weston_surface *focus; struct weston_view *view; view = get_default_view(surface); @@ -2628,13 +2634,7 @@ set_minimized(struct weston_surface *surface, uint32_t is_true) weston_layer_entry_insert(shsurf-shell-minimized_layer.view_list, view-layer_link); drop_focus_state(shsurf-shell, current_ws, view-surface); - wl_list_for_each(seat, shsurf-shell-compositor-seat_list, link) { - if (!seat-keyboard) - continue; - focus = weston_surface_get_main_surface(seat-keyboard-focus); - if (focus == view-surface) - weston_keyboard_set_focus(seat-keyboard, NULL); - } + unset_keyboard_focus_for_surface(view-surface); } else { weston_layer_entry_insert(current_ws-layer.view_list, view-layer_link); -- 1.8.5.1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 00/17] Relative pointer motions, locking and confinement
Hi again, At XDC2014 some of us sat down and talked through how pointer locking and related protocols should look like, and this series is more or less work-in-progress result of that discussion. The series contains two parts (and one bonus patch). The bonus patch is the initial white space only patch formatting the input method protocols making it slightly more readable and consistent with other protocol files. The first part (2 - 12) is preparation for the implementation of the new interfaces. The second part (13 - 17) is the introduction, implementation and application of the new protocol interfaces. Accompanied with this series is also a patch to libinput (Introduce non-accelerated motion event vectors), and implementations in GLFW https://github.com/jadahl/glfw/commits/pointer-lock and SDL2 https://bitbucket.org/jadahl/sdl/commits/branch/pointer-lock. In GLFW you can try the wave example, and for SDL, you could try for example ioquake3 or openarena. One of the things we concluded was that relative pointer motions should be treated separately from locking and confinement, so of the second part, patch 13 introduces the new relative pointer object that is an additional interface to the wl_pointer object. Think of it in the same way, as in you get it from a seat, and it emits motion events, only ones with relative motion deltas. One can create as many as one wants, and they don't interfere with each other, just as wl_pointer. It might be better to simply extend wl_seat when stabilizing this protocol, but it's put separately for testing purposes. For details of how the protocol works, please read the protocol XML file. In short, locking and confinement are two locking modes, of which one may only be active at once. From the discussions, there is one difference I can think of and that is that locking/confining an already locked/confined pointer is invalid, instead of queued, as it simplified the implementation quite a lot, and I think for most cases unlocking and then locking again will work good enough. For the cases where such a scenario would break the lock and fail to relock, we could for example change the heuristics the compositor applies to get a better behavior, without making the interface more complex. Please tell if you think queued locking is indeed needed. One thing of the specification is currently not fully implemented as there are some semantical choices that needs to be made and specified before it makes sense to go forward, and that is how to deal with non rectangular locking regions. The current implementation will simply never lock when the union of the input region and the locking region is a non rectangular region. The semantical ambiguity is how to treat motion vectors that cross corners or other borders. Consider the following ASCII art examples: --- --- | ^ | | ^ | |\| |\| | | | | -- or| - | \ | | \ | |\ | |\ | Simply clamping as done where there is no corners or anything would be result in: --- --- | | | | | | | | | | | | -- or| - | ^ || ^ | |\ ||\ | Should these kind of clamping take place or not, or should they be done some other way? Naturally, only clamping to a rectangle is the simplest non-ambiguous way to go and we could simply say that locking is to the largest rectangle within the union of the locking region and the input region, but as input regions can be split, we'd have to deal with that situation as well. Any ideas of the preferable way to deal with the locking regions? Jonas Jonas Ådahl (17): protocol: Improve formatting of input method and text protocols input: Pass axis events through pointer grab interfaces input: Make pointer grab motion callbacks take an event struct desktop-shell: Add unset_keyboard_focus_for_surface helper desktop-shell: Clean up set_minimized a bit desktop-shell: Make activate_binding take a view instead of surface desktop-shell: Track the black surface by its view desktop-shell: Change switcher to track views desktop-shell: Make activate() take a view instead of surface desktop-shell: Pass a flag bitmask instead of bool to activate() compositor: Keep track of what views were activated by clicking libinput: Expose unaccelerated motion deltas in motion event struct Introduce wl_relative_pointer interface Introduce pointer locking and confinement protocol clients: Add API for pointer locking and pointer confinement clients/resizor: Use pointer locking for
[PATCH weston 07/17] desktop-shell: Track the black surface by its view
In preparation for further refactoring. Signed-off-by: Jonas Ådahl jad...@gmail.com --- desktop-shell/shell.c | 23 --- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 4b8724c..7ce951d 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -2777,7 +2777,7 @@ create_black_surface(struct weston_compositor *ec, } surface-configure = black_surface_configure; - surface-configure_private = fs_surface; + surface-configure_private = view; weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1); pixman_region32_fini(surface-opaque); pixman_region32_init_rect(surface-opaque, 0, 0, w, h); @@ -4914,11 +4914,13 @@ black_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy) } static bool -is_black_surface (struct weston_surface *es, struct weston_surface **fs_surface) +is_black_surface(struct weston_view *view, struct weston_view **fs_view) { + struct weston_surface *es = view-surface; + if (es-configure == black_surface_configure) { - if (fs_surface) - *fs_surface = (struct weston_surface *)es-configure_private; + if (fs_view) + *fs_view = (struct weston_view *) es-configure_private; return true; } return false; @@ -4929,21 +4931,20 @@ activate_binding(struct weston_seat *seat, struct desktop_shell *shell, struct weston_view *focus_view) { - struct weston_surface *focus; + struct weston_view *main_view; struct weston_surface *main_surface; if (!focus_view) return; - focus = focus_view-surface; - if (is_black_surface(focus, main_surface)) - focus = main_surface; + if (is_black_surface(focus_view, main_view)) + focus_view = main_view; - main_surface = weston_surface_get_main_surface(focus); + main_surface = weston_surface_get_main_surface(focus_view-surface); if (get_shell_surface_type(main_surface) == SHELL_SURFACE_NONE) return; - activate(shell, focus, seat, true); + activate(shell, focus_view-surface, seat, true); } static void @@ -5813,7 +5814,7 @@ switcher_next(struct switcher *switcher) weston_surface_damage(view-surface); } - if (is_black_surface(view-surface, NULL)) { + if (is_black_surface(view, NULL)) { view-alpha = 0.25; weston_view_geometry_dirty(view); weston_surface_damage(view-surface); -- 1.8.5.1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 10/17] desktop-shell: Pass a flag bitmask instead of bool to activate()
Although it currently only has one available flag, but that'll change. Signed-off-by: Jonas Ådahl jad...@gmail.com --- desktop-shell/exposay.c | 9 ++--- desktop-shell/shell.c | 36 desktop-shell/shell.h | 2 +- src/compositor.h| 5 + 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c index 5073a96..5be92c7 100644 --- a/desktop-shell/exposay.c +++ b/desktop-shell/exposay.c @@ -160,7 +160,8 @@ exposay_highlight_surface(struct desktop_shell *shell, shell-exposay.column_current = esurface-column; shell-exposay.cur_output = esurface-eoutput; - activate(shell, view, shell-exposay.seat, false); + activate(shell, view, shell-exposay.seat, +WESTON_ACTIVATE_FLAG_NONE); shell-exposay.focus_current = view; } @@ -545,10 +546,12 @@ exposay_transition_inactive(struct desktop_shell *shell, int switch_focus) * to the new. */ if (switch_focus shell-exposay.focus_current) activate(shell, shell-exposay.focus_current, -shell-exposay.seat, true); +shell-exposay.seat, +WESTON_ACTIVATE_FLAG_CONFIGURE); else if (shell-exposay.focus_prev) activate(shell, shell-exposay.focus_prev, -shell-exposay.seat, true); +shell-exposay.seat, +WESTON_ACTIVATE_FLAG_CONFIGURE); wl_list_for_each(esurface, shell-exposay.surface_list, link) exposay_animate_out(esurface); diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index f8c2185..abe64f6 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -772,7 +772,8 @@ focus_state_surface_destroy(struct wl_listener *listener, void *data) shell = state-seat-compositor-shell_interface.shell; if (next) { state-keyboard_focus = NULL; - activate(shell, next, state-seat, true); + activate(shell, next, state-seat, +WESTON_ACTIVATE_FLAG_CONFIGURE); } else { if (shell-focus_animation_type == ANIMATION_DIM_LAYER) { if (state-ws-focus_animation) @@ -2011,10 +2012,12 @@ busy_cursor_grab_button(struct weston_pointer_grab *base, struct weston_seat *seat = grab-grab.pointer-seat; if (shsurf button == BTN_LEFT state) { - activate(shsurf-shell, shsurf-view, seat, true); + activate(shsurf-shell, shsurf-view, seat, +WESTON_ACTIVATE_FLAG_CONFIGURE); surface_move(shsurf, seat, 0); } else if (shsurf button == BTN_RIGHT state) { - activate(shsurf-shell, shsurf-view, seat, true); + activate(shsurf-shell, shsurf-view, seat, +WESTON_ACTIVATE_FLAG_CONFIGURE); surface_rotate(shsurf, seat); } } @@ -2646,7 +2649,8 @@ set_minimized(struct weston_surface *surface, bool minimized) wl_list_for_each(seat, shell-compositor-seat_list, link) { if (!seat-keyboard) continue; - activate(shsurf-shell, view, seat, true); + activate(shsurf-shell, view, seat, +WESTON_ACTIVATE_FLAG_CONFIGURE); } } @@ -4869,7 +4873,7 @@ lower_fullscreen_layer(struct desktop_shell *shell) void activate(struct desktop_shell *shell, struct weston_view *view, -struct weston_seat *seat, bool configure) +struct weston_seat *seat, uint32_t flags) { struct weston_surface *es = view-surface; struct weston_surface *main_surface; @@ -4894,7 +4898,8 @@ activate(struct desktop_shell *shell, struct weston_view *view, shsurf = get_shell_surface(main_surface); assert(shsurf); - if (shsurf-state.fullscreen configure) + if (shsurf-state.fullscreen + flags WESTON_ACTIVATE_FLAG_CONFIGURE) shell_configure_fullscreen(shsurf); else restore_all_output_modes(shell-compositor); @@ -4931,7 +4936,8 @@ is_black_surface(struct weston_view *view, struct weston_view **fs_view) static void activate_binding(struct weston_seat *seat, struct desktop_shell *shell, -struct weston_view *focus_view) +struct weston_view *focus_view, +uint32_t flags) { struct weston_view *main_view; struct weston_surface *main_surface; @@ -4959,7 +4965,8 @@ click_to_activate_binding(struct weston_seat *seat, if (seat-pointer-focus == NULL) return; - activate_binding(seat, data, seat-pointer-focus); + activate_binding(seat, data, seat-pointer-focus, +
[PATCH weston 08/17] desktop-shell: Change switcher to track views
Preparation for future refactorings. Signed-off-by: Jonas Ådahl jad...@gmail.com --- desktop-shell/shell.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 7ce951d..aa9c333 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -5775,7 +5775,7 @@ bind_screensaver(struct wl_client *client, struct switcher { struct desktop_shell *shell; - struct weston_surface *current; + struct weston_view *current; struct wl_listener listener; struct weston_keyboard_grab grab; struct wl_array minimized_array; @@ -5785,7 +5785,7 @@ static void switcher_next(struct switcher *switcher) { struct weston_view *view; - struct weston_surface *first = NULL, *prev = NULL, *next = NULL; + struct weston_view *first = NULL, *prev = NULL, *next = NULL; struct shell_surface *shsurf; struct workspace *ws = get_current_workspace(switcher-shell); @@ -5805,10 +5805,10 @@ switcher_next(struct switcher *switcher) shsurf-type == SHELL_SURFACE_TOPLEVEL shsurf-parent == NULL) { if (first == NULL) - first = view-surface; + first = view; if (prev == switcher-current) - next = view-surface; - prev = view-surface; + next = view; + prev = view; view-alpha = 0.25; weston_view_geometry_dirty(view); weston_surface_damage(view-surface); @@ -5831,10 +5831,10 @@ switcher_next(struct switcher *switcher) wl_signal_add(next-destroy_signal, switcher-listener); switcher-current = next; - wl_list_for_each(view, next-views, surface_link) + wl_list_for_each(view, next-surface-views, surface_link) view-alpha = 1.0; - shsurf = get_shell_surface(switcher-current); + shsurf = get_shell_surface(switcher-current-surface); if (shsurf shsurf-state.fullscreen) shsurf-fullscreen.black_view-alpha = 1.0; } @@ -5864,7 +5864,7 @@ switcher_destroy(struct switcher *switcher) } if (switcher-current) - activate(switcher-shell, switcher-current, + activate(switcher-shell, switcher-current-surface, (struct weston_seat *) keyboard-seat, true); wl_list_remove(switcher-listener.link); weston_keyboard_end_grab(keyboard); @@ -5875,7 +5875,7 @@ switcher_destroy(struct switcher *switcher) struct weston_view **minimized; wl_array_for_each(minimized, switcher-minimized_array) { /* with the exception of the current selected */ - if ((*minimized)-surface != switcher-current) { + if ((*minimized)-surface != switcher-current-surface) { weston_layer_entry_remove((*minimized)-layer_link); weston_layer_entry_insert(switcher-shell-minimized_layer.view_list, (*minimized)-layer_link); weston_view_damage_below(*minimized); -- 1.8.5.1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 05/17] desktop-shell: Clean up set_minimized a bit
Signed-off-by: Jonas Ådahl jad...@gmail.com --- desktop-shell/shell.c | 27 +++ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 2e416e9..4a0cb99 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -2612,8 +2612,9 @@ unset_maximized(struct shell_surface *shsurf) } static void -set_minimized(struct weston_surface *surface, uint32_t is_true) +set_minimized(struct weston_surface *surface, bool minimized) { + struct desktop_shell *shell; struct shell_surface *shsurf; struct workspace *current_ws; struct weston_seat *seat; @@ -2623,23 +2624,25 @@ set_minimized(struct weston_surface *surface, uint32_t is_true) if (!view) return; - assert(weston_surface_get_main_surface(view-surface) == view-surface); + assert(weston_surface_get_main_surface(view-surface) == + view-surface); shsurf = get_shell_surface(surface); - current_ws = get_current_workspace(shsurf-shell); + shell = shsurf-shell; + current_ws = get_current_workspace(shell); weston_layer_entry_remove(view-layer_link); -/* hide or show, depending on the state */ - if (is_true) { - weston_layer_entry_insert(shsurf-shell-minimized_layer.view_list, view-layer_link); - drop_focus_state(shsurf-shell, current_ws, view-surface); + if (minimized) { + weston_layer_entry_insert(shell-minimized_layer.view_list, + view-layer_link); + drop_focus_state(shell, current_ws, view-surface); unset_keyboard_focus_for_surface(view-surface); - } - else { - weston_layer_entry_insert(current_ws-layer.view_list, view-layer_link); + } else { + weston_layer_entry_insert(current_ws-layer.view_list, + view-layer_link); - wl_list_for_each(seat, shsurf-shell-compositor-seat_list, link) { + wl_list_for_each(seat, shell-compositor-seat_list, link) { if (!seat-keyboard) continue; activate(shsurf-shell, view-surface, seat, true); @@ -3810,7 +3813,7 @@ xdg_surface_set_minimized(struct wl_client *client, return; /* apply compositor's own minimization logic (hide) */ - set_minimized(shsurf-surface, 1); + set_minimized(shsurf-surface, true); } static const struct xdg_surface_interface xdg_surface_implementation = { -- 1.8.5.1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 02/17] input: Pass axis events through pointer grab interfaces
Don't only send motions and buttons but also axis events through the pointer grab interface. Signed-off-by: Jonas Ådahl jad...@gmail.com --- desktop-shell/exposay.c | 7 +++ desktop-shell/shell.c | 24 src/compositor.h| 2 ++ src/data-device.c | 7 +++ src/input.c | 21 +++-- 5 files changed, 55 insertions(+), 6 deletions(-) diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c index 4b65cbd..dc3fee0 100644 --- a/desktop-shell/exposay.c +++ b/desktop-shell/exposay.c @@ -378,6 +378,12 @@ exposay_button(struct weston_pointer_grab *grab, uint32_t time, uint32_t button, } static void +exposay_axis(struct weston_pointer_grab *grab, +uint32_t time, uint32_t axis, wl_fixed_t value) +{ +} + +static void exposay_pointer_grab_cancel(struct weston_pointer_grab *grab) { struct desktop_shell *shell = @@ -390,6 +396,7 @@ static const struct weston_pointer_grab_interface exposay_ptr_grab = { exposay_focus, exposay_motion, exposay_button, + exposay_axis, exposay_pointer_grab_cancel, }; diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 9e8d45a..8fc6a48 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -1621,6 +1621,12 @@ noop_grab_focus(struct weston_pointer_grab *grab) } static void +noop_grab_axis(struct weston_pointer_grab *grab, + uint32_t time, uint32_t axis, wl_fixed_t value) +{ +} + +static void constrain_position(struct weston_move_grab *move, int *cx, int *cy) { struct shell_surface *shsurf = move-base.shsurf; @@ -1699,6 +1705,7 @@ static const struct weston_pointer_grab_interface move_grab_interface = { noop_grab_focus, move_grab_motion, move_grab_button, + noop_grab_axis, move_grab_cancel, }; @@ -1854,6 +1861,7 @@ static const struct weston_pointer_grab_interface resize_grab_interface = { noop_grab_focus, resize_grab_motion, resize_grab_button, + noop_grab_axis, resize_grab_cancel, }; @@ -2016,6 +2024,7 @@ static const struct weston_pointer_grab_interface busy_cursor_grab_interface = { busy_cursor_grab_focus, busy_cursor_grab_motion, busy_cursor_grab_button, + noop_grab_axis, busy_cursor_grab_cancel, }; @@ -3110,6 +3119,19 @@ popup_grab_button(struct weston_pointer_grab *grab, } static void +popup_grab_axis(struct weston_pointer_grab *grab, + uint32_t time, uint32_t axis, wl_fixed_t value) +{ + struct weston_pointer *pointer = grab-pointer; + struct wl_resource *resource; + struct wl_list *resource_list; + + resource_list = pointer-focus_resource_list; + wl_resource_for_each(resource, resource_list) + wl_pointer_send_axis(resource, time, axis, value); +} + +static void popup_grab_cancel(struct weston_pointer_grab *grab) { popup_grab_end(grab-pointer); @@ -3119,6 +3141,7 @@ static const struct weston_pointer_grab_interface popup_grab_interface = { popup_grab_focus, popup_grab_motion, popup_grab_button, + popup_grab_axis, popup_grab_cancel, }; @@ -4730,6 +4753,7 @@ static const struct weston_pointer_grab_interface rotate_grab_interface = { noop_grab_focus, rotate_grab_motion, rotate_grab_button, + noop_grab_axis, rotate_grab_cancel, }; diff --git a/src/compositor.h b/src/compositor.h index 2bec183..ef1bc0f 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -243,6 +243,8 @@ struct weston_pointer_grab_interface { wl_fixed_t x, wl_fixed_t y); void (*button)(struct weston_pointer_grab *grab, uint32_t time, uint32_t button, uint32_t state); + void (*axis)(struct weston_pointer_grab *grab, +uint32_t time, uint32_t axis, wl_fixed_t value); void (*cancel)(struct weston_pointer_grab *grab); }; diff --git a/src/data-device.c b/src/data-device.c index d28325d..b26ad3e 100644 --- a/src/data-device.c +++ b/src/data-device.c @@ -392,6 +392,12 @@ drag_grab_button(struct weston_pointer_grab *grab, } static void +drag_grab_axis(struct weston_pointer_grab *grab, + uint32_t time, uint32_t axis, wl_fixed_t value) +{ +} + +static void drag_grab_cancel(struct weston_pointer_grab *grab) { struct weston_pointer_drag *drag = @@ -407,6 +413,7 @@ static const struct weston_pointer_grab_interface pointer_drag_grab_interface = drag_grab_focus, drag_grab_motion, drag_grab_button, + drag_grab_axis, drag_grab_cancel, }; diff --git a/src/input.c b/src/input.c index 15ff6ed..f40d44a 100644 --- a/src/input.c +++ b/src/input.c @@ -218,6 +218,19 @@ default_grab_pointer_button(struct weston_pointer_grab *grab, } static void +default_grab_pointer_axis(struct weston_pointer_grab *grab, +
[PATCH weston 13/17] Introduce wl_relative_pointer interface
A wl_relative_pointer object is an extension to the wl_pointer interface only used for emitting relative pointer events. It will only emit events when the parent pointer has focus. To get a relative pointer object, use the get_relative_pointer request of the global wl_relative_pointer_manager object. When stabilizing it might make more sense to just add it to wl_seat instead of having a single use global interface. All interface names are currently prefixed with underscore in order to avoid any future conflicts with stable protocol. Signed-off-by: Jonas Ådahl jad...@gmail.com --- Makefile.am | 7 +- protocol/relative-pointer.xml | 90 + src/compositor.c | 3 + src/compositor.h | 5 ++ src/input.c | 184 +- 5 files changed, 266 insertions(+), 23 deletions(-) create mode 100644 protocol/relative-pointer.xml diff --git a/Makefile.am b/Makefile.am index e942850..860564d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -81,7 +81,9 @@ nodist_weston_SOURCES = \ protocol/presentation_timing-protocol.c \ protocol/presentation_timing-server-protocol.h \ protocol/scaler-protocol.c \ - protocol/scaler-server-protocol.h + protocol/scaler-server-protocol.h \ + protocol/relative-pointer-protocol.c\ + protocol/relative-pointer-server-protocol.h BUILT_SOURCES += $(nodist_weston_SOURCES) @@ -1003,7 +1005,8 @@ EXTRA_DIST += \ protocol/xdg-shell.xml \ protocol/fullscreen-shell.xml \ protocol/presentation_timing.xml\ - protocol/scaler.xml + protocol/scaler.xml \ + protocol/relative-pointer.xml man_MANS = weston.1 weston.ini.5 diff --git a/protocol/relative-pointer.xml b/protocol/relative-pointer.xml new file mode 100644 index 000..f56c912 --- /dev/null +++ b/protocol/relative-pointer.xml @@ -0,0 +1,90 @@ +?xml version=1.0 encoding=UTF-8? +protocol name=relative_pointer + + copyright +Copyright © 2014 Jonas Ådahl + +Permission to use, copy, modify, distribute, and sell this +software and its documentation for any purpose is hereby granted +without fee, provided that the above copyright notice appear in +all copies and that both that copyright notice and this permission +notice appear in supporting documentation, and that the name of +the copyright holders not be used in advertising or publicity +pertaining to distribution of the software without specific, +written prior permission. The copyright holders make no +representations about the suitability of this software for any +purpose. It is provided as is without express or implied +warranty. + +THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN +AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + /copyright + + interface name=_wl_relative_pointer_manager version=1 +description summary=get relative pointer objects + A global interface used for getting the relative pointer object for a + given seat. +/description + +request name=get_relative_pointer + description summary=get a relative pointer object +Create a relative pointer interface for the pointer of the given seat. + +This request only takes effect if the seat has the pointer capability. + /description + + arg name=id type=new_id interface=_wl_relative_pointer/ + arg name=seat type=object interface=wl_seat/ +/request + /interface + + interface name=_wl_relative_pointer version=1 +description summary=relative pointer object + A wl_relative_pointer object is an extension to the wl_pointer interface + only used for emitting relative pointer events. It will only emit events + when the parent pointer has focus. +/description + +request name=release type=destructor + description summary=release the relative pointer object/ +/request + +event name=relative_motion + description summary=relative pointer motion +Relative pointer motion from the pointer of the seat associated with +this object. + +This event contains both the accelerated motion delta and the +non-accelerated motion delta. The non-accelerated delta is, when +applicable, the regular pointer motion delta as it was before having +applied motion
[PATCH weston 17/17] clients/clickdot: Use pointer confinement to confine drawed line
Use pointer confinement to make the line drawing not go outside the drawing area. It is toggled with the right pointer button. Signed-off-by: Jonas Ådahl jad...@gmail.com --- clients/clickdot.c | 32 ++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/clients/clickdot.c b/clients/clickdot.c index 5137ba6..5d019c8 100644 --- a/clients/clickdot.c +++ b/clients/clickdot.c @@ -24,6 +24,7 @@ #include config.h +#include stdbool.h #include stdint.h #include stdio.h #include stdlib.h @@ -61,6 +62,8 @@ struct clickdot { struct input *cursor_timeout_input; int cursor_timeout_fd; struct task cursor_timeout_task; + + bool pointer_confined; }; static void @@ -205,16 +208,31 @@ key_handler(struct window *window, struct input *input, uint32_t time, } static void +toggle_pointer_confine(struct clickdot *clickdot, struct input *input) +{ + if (clickdot-pointer_confined) { + window_unconfine_pointer(clickdot-window); + } else { + window_confine_pointer(clickdot-window, clickdot-widget, + input); + } + + clickdot-pointer_confined = !clickdot-pointer_confined; +} + +static void button_handler(struct widget *widget, struct input *input, uint32_t time, uint32_t button, enum wl_pointer_button_state state, void *data) { struct clickdot *clickdot = data; + bool is_pressed = state == WL_POINTER_BUTTON_STATE_PRESSED; - if (state == WL_POINTER_BUTTON_STATE_PRESSED button == BTN_LEFT) + if (is_pressed button == BTN_LEFT) input_get_position(input, clickdot-dot.x, clickdot-dot.y); - + else if (is_pressed button == BTN_RIGHT) + toggle_pointer_confine(clickdot, input); widget_schedule_redraw(widget); } @@ -282,6 +300,14 @@ cursor_timeout_func(struct task *task, uint32_t events) CURSOR_LEFT_PTR); } +static void +pointer_unconfined(struct window *window, struct input *input, void *data) +{ + struct clickdot *clickdot = data; + + clickdot-pointer_confined = false; +} + static struct clickdot * clickdot_create(struct display *display) { @@ -298,6 +324,8 @@ clickdot_create(struct display *display) window_set_user_data(clickdot-window, clickdot); window_set_keyboard_focus_handler(clickdot-window, keyboard_focus_handler); + window_set_pointer_unconfined_handler(clickdot-window, + pointer_unconfined); widget_set_redraw_handler(clickdot-widget, redraw_handler); widget_set_button_handler(clickdot-widget, button_handler); -- 1.8.5.1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 14/17] Introduce pointer locking and confinement protocol
This patch introduces a new protocol for locking and confining a pointer. It consists of a new global object with two requests; one for locking the surface to a position, one for confining the pointer to a given region. See pointer-lock.xml for details of the protocol. In this patch, only the locking part is fully implemented as in specified in the protocol, while confinement is only implemented for when the union of the passed region and the input region of the confined surface is a single rectangle. Note that the interfaces are prefixed with an underscore in order to avoid future incompatibilities with a future stable interface with an equivalent name. Signed-off-by: Jonas Ådahl jad...@gmail.com --- What should the serial in locked_pointer_set_cursor_position_hint be checked against? It doesn't seem to make sense to use the same method as in pointer_set_cursor. As far as I understand, it should be equal to the last serial sent via that pointer device, but I can't see we do that anywhere else. What am I missing? Makefile.am | 3 + protocol/pointer-lock.xml | 208 src/compositor.c | 4 + src/compositor.h | 21 ++ src/input.c | 589 -- 5 files changed, 806 insertions(+), 19 deletions(-) create mode 100644 protocol/pointer-lock.xml diff --git a/Makefile.am b/Makefile.am index 860564d..8adc343 100644 --- a/Makefile.am +++ b/Makefile.am @@ -82,6 +82,8 @@ nodist_weston_SOURCES = \ protocol/presentation_timing-server-protocol.h \ protocol/scaler-protocol.c \ protocol/scaler-server-protocol.h \ + protocol/pointer-lock-protocol.c\ + protocol/pointer-lock-server-protocol.h \ protocol/relative-pointer-protocol.c\ protocol/relative-pointer-server-protocol.h @@ -1006,6 +1008,7 @@ EXTRA_DIST += \ protocol/fullscreen-shell.xml \ protocol/presentation_timing.xml\ protocol/scaler.xml \ + protocol/pointer-lock.xml \ protocol/relative-pointer.xml man_MANS = weston.1 weston.ini.5 diff --git a/protocol/pointer-lock.xml b/protocol/pointer-lock.xml new file mode 100644 index 000..3233ede --- /dev/null +++ b/protocol/pointer-lock.xml @@ -0,0 +1,208 @@ +?xml version=1.0 encoding=UTF-8? +protocol name=pointer_lock + + copyright +Copyright © 2014 Jonas Ådahl + +Permission to use, copy, modify, distribute, and sell this +software and its documentation for any purpose is hereby granted +without fee, provided that the above copyright notice appear in +all copies and that both that copyright notice and this permission +notice appear in supporting documentation, and that the name of +the copyright holders not be used in advertising or publicity +pertaining to distribution of the software without specific, +written prior permission. The copyright holders make no +representations about the suitability of this software for any +purpose. It is provided as is without express or implied +warranty. + +THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN +AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + /copyright + + interface name=_wl_pointer_lock version=1 +description summary=lock pointer to a surface + The global interface exposing pointer locking functionality. It exposes + two requests; lock_pointer for locking the pointer to its position, and + confine_pointer for locking the pointer to a region. + + The lock_pointer and confine_pointer creates the objects wl_locked_pointer + and wl_confined_pointer respectively, and the client can use these objects + to interact with the lock. + + There may not be another lock of any kind active when requesting a lock, + and if there is, an error will be raised. +/description + +request name=lock_pointer + description summary=lock pointer to a position +The lock_pointer request lets the client disable absolute pointer +movements, locking the pointer to a position. + +There may not be another lock of any kind active when requesting a lock, +and if there is, an error will be raised. + +The intersection of the region passed with this request and the input +region of the surface is used to determine where the pointer must be +in
[PATCH weston 15/17] clients: Add API for pointer locking and pointer confinement
Signed-off-by: Jonas Ådahl jad...@gmail.com --- Makefile.am | 6 +- clients/window.c | 294 +++ clients/window.h | 62 3 files changed, 361 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 8adc343..b32d61e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -449,7 +449,11 @@ nodist_libtoytoolkit_la_SOURCES = \ protocol/presentation_timing-protocol.c \ protocol/presentation_timing-client-protocol.h \ protocol/xdg-shell-protocol.c \ - protocol/xdg-shell-client-protocol.h + protocol/xdg-shell-client-protocol.h\ + protocol/pointer-lock-protocol.c\ + protocol/pointer-lock-client-protocol.h \ + protocol/relative-pointer-protocol.c\ + protocol/relative-pointer-client-protocol.h BUILT_SOURCES += $(nodist_libtoytoolkit_la_SOURCES) diff --git a/clients/window.c b/clients/window.c index 5099004..fd2df82 100644 --- a/clients/window.c +++ b/clients/window.c @@ -23,6 +23,7 @@ #include config.h +#include stdbool.h #include stdint.h #include stdio.h #include stdlib.h @@ -68,6 +69,8 @@ typedef void *EGLContext; #include xdg-shell-client-protocol.h #include text-cursor-position-client-protocol.h #include workspaces-client-protocol.h +#include pointer-lock-client-protocol.h +#include relative-pointer-client-protocol.h #include ../shared/os-compatibility.h #include window.h @@ -91,6 +94,8 @@ struct display { struct text_cursor_position *text_cursor_position; struct workspace_manager *workspace_manager; struct xdg_shell *xdg_shell; + struct _wl_relative_pointer_manager *relative_pointer_manager; + struct _wl_pointer_lock *pointer_lock; EGLDisplay dpy; EGLConfig argb_config; EGLContext argb_ctx; @@ -243,6 +248,8 @@ struct window { window_output_handler_t output_handler; window_state_changed_handler_t state_changed_handler; + window_locked_pointer_motion_handler_t locked_pointer_motion_handler; + struct surface *main_surface; struct xdg_surface *xdg_surface; struct xdg_popup *xdg_popup; @@ -255,6 +262,17 @@ struct window { /* struct surface::link, contains also main_surface */ struct wl_list subsurface_list; + struct _wl_relative_pointer *relative_pointer; + struct _wl_locked_pointer *locked_pointer; + struct input *locked_input; + bool pointer_locked; + locked_pointer_locked_handler_t pointer_locked_handler; + locked_pointer_unlocked_handler_t pointer_unlocked_handler; + confined_pointer_confined_handler_t pointer_confined_handler; + confined_pointer_unconfined_handler_t pointer_unconfined_handler; + + struct _wl_confined_pointer *confined_pointer; + void *user_data; struct wl_list link; }; @@ -4367,6 +4385,43 @@ window_set_state_changed_handler(struct window *window, } void +window_set_pointer_locked_handler(struct window *window, + locked_pointer_locked_handler_t locked) +{ + window-pointer_locked_handler = locked; +} + +void +window_set_pointer_unlocked_handler(struct window *window, + locked_pointer_unlocked_handler_t unlocked) +{ + window-pointer_unlocked_handler = unlocked; +} + +void +window_set_pointer_confined_handler( + struct window *window, confined_pointer_confined_handler_t confined) +{ + window-pointer_confined_handler = confined; +} + +void +window_set_pointer_unconfined_handler( + struct window *window, + confined_pointer_unconfined_handler_t unconfined) +{ + window-pointer_unconfined_handler = unconfined; +} + +void +window_set_locked_pointer_motion_handler( + struct window *window, + window_locked_pointer_motion_handler_t handler) +{ + window-locked_pointer_motion_handler = handler; +} + +void window_set_title(struct window *window, const char *title) { free(window-title); @@ -4408,6 +4463,236 @@ window_damage(struct window *window, int32_t x, int32_t y, } static void +relative_pointer_handle_motion(void *data, struct _wl_relative_pointer *pointer, + uint32_t time, + wl_fixed_t dx, wl_fixed_t dy, + wl_fixed_t dx_noaccel, wl_fixed_t dy_noaccel) +{ + struct input *input = data; + struct window *window = input-pointer_focus; + + if (window-locked_pointer_motion_handler + window-pointer_locked) { + window-locked_pointer_motion_handler( + window, input, time, + wl_fixed_to_double(dx), + wl_fixed_to_double(dy), + window-user_data); + } +} + +static const struct
[PATCH weston 16/17] clients/resizor: Use pointer locking for resizing window
Resizes the window using pointer locking when holding the left pointer button down. The pointer lock cursor position hint is used to warp the pointer to the same position relative to the bottom right corner. Signed-off-by: Jonas Ådahl jad...@gmail.com --- clients/resizor.c | 159 -- 1 file changed, 154 insertions(+), 5 deletions(-) diff --git a/clients/resizor.c b/clients/resizor.c index 19c6eeb..edbdb66 100644 --- a/clients/resizor.c +++ b/clients/resizor.c @@ -22,6 +22,7 @@ #include config.h +#include stdbool.h #include stdint.h #include stdio.h #include stdlib.h @@ -49,6 +50,10 @@ struct resizor { struct spring width; struct spring height; struct wl_callback *frame_callback; + bool pointer_locked; + struct input *locked_input; + float pointer_x; + float pointer_y; }; static void @@ -219,20 +224,158 @@ show_menu(struct resizor *resizor, struct input *input, uint32_t time) } static void +locked_pointer_handle_motion(struct window *window, +struct input *input, +uint32_t time, +float dx, +float dy, +void *data) +{ + struct resizor *resizor = data; + + resizor-width.current += dx; + resizor-width.previous = resizor-width.current; + resizor-width.target = resizor-width.current; + + resizor-height.current += dy; + resizor-height.previous = resizor-height.current; + resizor-height.target = resizor-height.current; + + widget_schedule_resize(resizor-widget, + resizor-width.current, + resizor-height.current); +} + +static void +handle_pointer_locked(struct window *window, struct input *input, void *data) +{ + struct resizor *resizor = data; + + resizor-pointer_locked = true; + input_set_pointer_image(input, CURSOR_BLANK); +} + +static void +handle_pointer_unlocked(struct window *window, struct input *input, void *data) +{ + struct resizor *resizor = data; + + resizor-pointer_locked = false; + input_set_pointer_image(input, CURSOR_LEFT_PTR); +} + +static const struct wl_callback_listener locked_pointer_frame_listener; + +static void +locked_pointer_frame_callback(void *data, + struct wl_callback *callback, + uint32_t time) +{ + struct resizor *resizor = data; + struct wl_surface *surface; + struct rectangle allocation; + float x, y; + + if (resizor-pointer_locked) { + widget_get_allocation(resizor-widget, allocation); + + x = resizor-pointer_x + (allocation.width - allocation.x); + y = resizor-pointer_y + (allocation.height - allocation.y); + + widget_set_locked_pointer_cursor_hint(resizor-widget, x, y); + } + + wl_callback_destroy(callback); + + surface = window_get_wl_surface(resizor-window); + callback = wl_surface_frame(surface); + wl_callback_add_listener(callback, +locked_pointer_frame_listener, +resizor); +} + +static const struct wl_callback_listener locked_pointer_frame_listener = { + locked_pointer_frame_callback +}; + +static void button_handler(struct widget *widget, struct input *input, uint32_t time, uint32_t button, enum wl_pointer_button_state state, void *data) { struct resizor *resizor = data; + struct rectangle allocation; + struct wl_surface *surface; + struct wl_callback *callback; - switch (button) { - case BTN_RIGHT: - if (state == WL_POINTER_BUTTON_STATE_PRESSED) - show_menu(resizor, input, time); - break; + if (button == BTN_RIGHT state == WL_POINTER_BUTTON_STATE_PRESSED) { + show_menu(resizor, input, time); + } else if (button == BTN_LEFT + state == WL_POINTER_BUTTON_STATE_PRESSED) { + window_get_allocation(resizor-window, allocation); + + resizor-width.current = allocation.width; + resizor-width.previous = allocation.width; + resizor-width.target = allocation.width; + + resizor-height.current = allocation.height; + resizor-height.previous = allocation.height; + resizor-height.target = allocation.height; + + window_lock_pointer(resizor-window, input); + window_set_pointer_locked_handler(resizor-window, + handle_pointer_locked); + window_set_pointer_unlocked_handler(resizor-window, + handle_pointer_unlocked); + resizor-locked_input = input; + +
Re: [PATCH weston 00/17] Relative pointer motions, locking and confinement
On Tue, Dec 02, 2014 at 02:44:55PM +, Steven Newbury wrote: On Tue, 2014-12-02 at 21:49 +0800, Jonas Ådahl wrote: Hi again, At XDC2014 some of us sat down and talked through how pointer locking and related protocols should look like, and this series is more or less work-in-progress result of that discussion. The series contains two parts (and one bonus patch). The bonus patch is the initial white space only patch formatting the input method protocols making it slightly more readable and consistent with other protocol files. The first part (2 - 12) is preparation for the implementation of the new interfaces. The second part (13 - 17) is the introduction, implementation and application of the new protocol interfaces. Accompanied with this series is also a patch to libinput (Introduce non-accelerated motion event vectors), and implementations in GLFW https://github.com/jadahl/glfw/commits/pointer-lock and SDL2 https://bitbucket.org/jadahl/sdl/commits/branch/pointer-lock. In I get You do no have access to this repository. from the bitbucket repo. Should be fixed now. Thanks for reporting. Jonas GLFW you can try the wave example, and for SDL, you could try for example ioquake3 or openarena. One of the things we concluded was that relative pointer motions should be treated separately from locking and confinement, so of the second part, patch 13 introduces the new relative pointer object that is an additional interface to the wl_pointer object. Think of it in the same way, as in you get it from a seat, and it emits motion events, only ones with relative motion deltas. One can create as many as one wants, and they don't interfere with each other, just as wl_pointer. It might be better to simply extend wl_seat when stabilizing this protocol, but it's put separately for testing purposes. For details of how the protocol works, please read the protocol XML file. In short, locking and confinement are two locking modes, of which one may only be active at once. From the discussions, there is one difference I can think of and that is that locking/confining an already locked/confined pointer is invalid, instead of queued, as it simplified the implementation quite a lot, and I think for most cases unlocking and then locking again will work good enough. For the cases where such a scenario would break the lock and fail to relock, we could for example change the heuristics the compositor applies to get a better behavior, without making the interface more complex. Please tell if you think queued locking is indeed needed. One thing of the specification is currently not fully implemented as there are some semantical choices that needs to be made and specified before it makes sense to go forward, and that is how to deal with non rectangular locking regions. The current implementation will simply never lock when the union of the input region and the locking region is a non rectangular region. The semantical ambiguity is how to treat motion vectors that cross corners or other borders. Consider the following ASCII art examples: --- --- | ^ | | ^ | |\| |\| | | | | -- or| - | \ | | \ | |\ | |\ | Simply clamping as done where there is no corners or anything would be result in: --- --- | | | | | | | | | | | | -- or| - | ^ || ^ | |\ ||\ | Should these kind of clamping take place or not, or should they be done some other way? Naturally, only clamping to a rectangle is the simplest non-ambiguous way to go and we could simply say that locking is to the largest rectangle within the union of the locking region and the input region, but as input regions can be split, we'd have to deal with that situation as well. Any ideas of the preferable way to deal with the locking regions? Jonas Jonas Ådahl (17): protocol: Improve formatting of input method and text protocols input: Pass axis events through pointer grab interfaces input: Make pointer grab motion callbacks take an event struct desktop-shell: Add unset_keyboard_focus_for_surface helper desktop-shell: Clean up set_minimized a bit desktop-shell: Make activate_binding take a view instead of surface desktop-shell: Track the black surface by its view
Re: [PATCH weston 00/17] Relative pointer motions, locking and confinement
On Tue, 2014-12-02 at 21:49 +0800, Jonas Ådahl wrote: Hi again, At XDC2014 some of us sat down and talked through how pointer locking and related protocols should look like, and this series is more or less work-in-progress result of that discussion. The series contains two parts (and one bonus patch). The bonus patch is the initial white space only patch formatting the input method protocols making it slightly more readable and consistent with other protocol files. The first part (2 - 12) is preparation for the implementation of the new interfaces. The second part (13 - 17) is the introduction, implementation and application of the new protocol interfaces. Accompanied with this series is also a patch to libinput (Introduce non-accelerated motion event vectors), and implementations in GLFW https://github.com/jadahl/glfw/commits/pointer-lock and SDL2 https://bitbucket.org/jadahl/sdl/commits/branch/pointer-lock. In I get You do no have access to this repository. from the bitbucket repo. GLFW you can try the wave example, and for SDL, you could try for example ioquake3 or openarena. One of the things we concluded was that relative pointer motions should be treated separately from locking and confinement, so of the second part, patch 13 introduces the new relative pointer object that is an additional interface to the wl_pointer object. Think of it in the same way, as in you get it from a seat, and it emits motion events, only ones with relative motion deltas. One can create as many as one wants, and they don't interfere with each other, just as wl_pointer. It might be better to simply extend wl_seat when stabilizing this protocol, but it's put separately for testing purposes. For details of how the protocol works, please read the protocol XML file. In short, locking and confinement are two locking modes, of which one may only be active at once. From the discussions, there is one difference I can think of and that is that locking/confining an already locked/confined pointer is invalid, instead of queued, as it simplified the implementation quite a lot, and I think for most cases unlocking and then locking again will work good enough. For the cases where such a scenario would break the lock and fail to relock, we could for example change the heuristics the compositor applies to get a better behavior, without making the interface more complex. Please tell if you think queued locking is indeed needed. One thing of the specification is currently not fully implemented as there are some semantical choices that needs to be made and specified before it makes sense to go forward, and that is how to deal with non rectangular locking regions. The current implementation will simply never lock when the union of the input region and the locking region is a non rectangular region. The semantical ambiguity is how to treat motion vectors that cross corners or other borders. Consider the following ASCII art examples: --- --- | ^ | | ^ | |\| |\| | | | | -- or| - | \ | | \ | |\ | |\ | Simply clamping as done where there is no corners or anything would be result in: --- --- | | | | | | | | | | | | -- or| - | ^ || ^ | |\ ||\ | Should these kind of clamping take place or not, or should they be done some other way? Naturally, only clamping to a rectangle is the simplest non-ambiguous way to go and we could simply say that locking is to the largest rectangle within the union of the locking region and the input region, but as input regions can be split, we'd have to deal with that situation as well. Any ideas of the preferable way to deal with the locking regions? Jonas Jonas Ådahl (17): protocol: Improve formatting of input method and text protocols input: Pass axis events through pointer grab interfaces input: Make pointer grab motion callbacks take an event struct desktop-shell: Add unset_keyboard_focus_for_surface helper desktop-shell: Clean up set_minimized a bit desktop-shell: Make activate_binding take a view instead of surface desktop-shell: Track the black surface by its view desktop-shell: Change switcher to track views desktop-shell: Make activate() take a view instead of surface desktop-shell: Pass a flag bitmask instead of bool to activate() compositor: Keep track of what views were activated by clicking
Re: [PATCH v1] Added string conversion utility functions
On Tue, 2 Dec 2014 15:45:40 +0200 Imran Zaman imran.za...@gmail.com wrote: Interesting read.. have some arguments about the raised points.. but lets not go in that direction.. Can you guys suggest to do some changes or shall i drop the patch altogether? if you are happy with current implementation lets live with it.. I noticed bug when weston was not working properly due to improper error handling of strtol in one place, so I thought it would be good idea to fix it wherever it is used (and hence this patch) but seems that it is not always the case :-) BR imran p.s: To me it was really simple to understand that in MOST (=NOT ALL) of the cases str-to-number conversion was done using strtol/strtoul but without proper error handling. I moved it to single place to make the life easier IMHO... Hi, fixing bugs is always welcome and recommended. If you see a place, where the error checking is wanted/attempted but insufficient, it would be very nice to fix it. However, writing a helper function whose benefit over a direct call to strto*() is only the handling of errno, it might not be worth it in my opinion. Such a case is probably simpler to just fix in place than make it use a helper function. (This might change with libweston, though.) If the helper can assume that the whole given string must be a valid number, I think that would be much more worth it, because it would then hide the end pointer and nul checks. Such a function would be simple to use and make the code where it is used much more obvious. If you want to add error checking to places where there is none to begin with, I think that would be very good, but also should be a separate patch. I don't see any value in adding error checking (by calling a helper) and then ignoring the check result though. It depends on the whole, really, where we strike the balance between generality and simplicity of the helper function API. I think a good next proposal would be to keep your helper functions mostly as is (they are quite thorough), and replace only the call sites where there already is some error checking. Another thing is the return value: your helper functions return success only if the whole string is a valid number (ends in nul). It does not discriminate between conversion errors and converting only a substring successfully. That makes it hard to use for anything where you want to parse only a substring and stop at the first non-digit character. The caller will not know if the number overflowed or if it just found a non-digit character. If a non-digit character is expected, the return value success/fail is completely useless and there is no way to even manually check errno to see if the conversion failed or not. I think this is one thing that Bill tried to explain. This is why the end_ptr argument is useless as it is, because on success it can only point to the end of the string. To make it useful, the success/fail return value needs to be a little different. We have two basic use cases: a) convert a whole string (up to nul-terminator), and b) convert possibly a substring (up to non-digit or nul) and tell where the conversion stopped If you want to make a helper function that is useful for both at the same time, you need to return success when the conversion succeeds, even if it does not end in nul. OTOH, if the caller wants to verify the whole string up to nul, it is not interested in end_ptr, which means that you could check the nul iff end_ptr is not wanted and save the effort from the caller. Then there is the question of negative numbers which you special-cased in convert_strtoul(). I'd rather it followed the stroul() semantics to avoid surprises. When you do return failure like in weston_strtoi(), you should make sure errno communicates the error like strtol() would. That's part of consistency. Finally, you should decide how the equivalent of an empty string parses: is it a failure or does it produce zero? I think you need to look at what majority of the potential callers would expect, and go with that. For instance, in multi-resource.c create_device(), the string to be parsed is A:B. If substring A is actually empty, it leads to the value zero. I don't know if that is an intentional shorthand, but I think it works. Writing tests for the helpers is excellent. The cherry on top would be documentation. Thanks, pq On Mon, Dec 1, 2014 at 8:30 PM, Bill Spitzak spit...@gmail.com wrote: On 12/01/2014 04:10 AM, Pekka Paalanen wrote: other = strtol(pid, end, 0); if (end != pid + 10) { weston_log(can't parse lock file %s\n, lockfile); close(fd); errno = EEXIST; return -1; } 'pid' is a fixed size string read in from the lock file, which is converted into a number of type pid_t. Because the number is assumed to be
Patch: fix weston crash
To produce the bug, build and run: (you don't need the game data to test) https://github.com/clintbellanger/flare-engine/ $ mv ~/.config/flare ~/.config/flare.bak $ ./flare # click 'configure', set full screen mode then click 'ok' # weston will crash and dump core. I've attached a patch which fixes the crashing. I mimicked the code in the block above it without knowing the overall impact, so it needs review from a knowledgeable contributor. diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c index bdfac23..9284a05 100644 --- a/xwayland/window-manager.c +++ b/xwayland/window-manager.c @@ -1326,7 +1326,9 @@ weston_wm_window_handle_state(struct weston_wm_window *window, WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 0, NULL); } else { - shell_interface-set_toplevel(window-shsurf); + if (window-shsurf) +shell_interface-set_toplevel(window-shsurf); + window-width = window-saved_width; window-height = window-saved_height; if (window-frame) ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston 13/17] Introduce wl_relative_pointer interface
Haven't looked at the weston implementation but the protocol bits look pretty good to me. Sounds like what we discussed. --Jason On Tue, Dec 2, 2014 at 5:49 AM, Jonas Ådahl jad...@gmail.com wrote: A wl_relative_pointer object is an extension to the wl_pointer interface only used for emitting relative pointer events. It will only emit events when the parent pointer has focus. To get a relative pointer object, use the get_relative_pointer request of the global wl_relative_pointer_manager object. When stabilizing it might make more sense to just add it to wl_seat instead of having a single use global interface. All interface names are currently prefixed with underscore in order to avoid any future conflicts with stable protocol. Signed-off-by: Jonas Ådahl jad...@gmail.com --- Makefile.am | 7 +- protocol/relative-pointer.xml | 90 + src/compositor.c | 3 + src/compositor.h | 5 ++ src/input.c | 184 +- 5 files changed, 266 insertions(+), 23 deletions(-) create mode 100644 protocol/relative-pointer.xml diff --git a/Makefile.am b/Makefile.am index e942850..860564d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -81,7 +81,9 @@ nodist_weston_SOURCES = \ protocol/presentation_timing-protocol.c \ protocol/presentation_timing-server-protocol.h \ protocol/scaler-protocol.c \ - protocol/scaler-server-protocol.h + protocol/scaler-server-protocol.h \ + protocol/relative-pointer-protocol.c\ + protocol/relative-pointer-server-protocol.h BUILT_SOURCES += $(nodist_weston_SOURCES) @@ -1003,7 +1005,8 @@ EXTRA_DIST += \ protocol/xdg-shell.xml \ protocol/fullscreen-shell.xml \ protocol/presentation_timing.xml\ - protocol/scaler.xml + protocol/scaler.xml \ + protocol/relative-pointer.xml man_MANS = weston.1 weston.ini.5 diff --git a/protocol/relative-pointer.xml b/protocol/relative-pointer.xml new file mode 100644 index 000..f56c912 --- /dev/null +++ b/protocol/relative-pointer.xml @@ -0,0 +1,90 @@ +?xml version=1.0 encoding=UTF-8? +protocol name=relative_pointer + + copyright +Copyright © 2014 Jonas Ådahl + +Permission to use, copy, modify, distribute, and sell this +software and its documentation for any purpose is hereby granted +without fee, provided that the above copyright notice appear in +all copies and that both that copyright notice and this permission +notice appear in supporting documentation, and that the name of +the copyright holders not be used in advertising or publicity +pertaining to distribution of the software without specific, +written prior permission. The copyright holders make no +representations about the suitability of this software for any +purpose. It is provided as is without express or implied +warranty. + +THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN +AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + /copyright + + interface name=_wl_relative_pointer_manager version=1 +description summary=get relative pointer objects + A global interface used for getting the relative pointer object for a + given seat. +/description + +request name=get_relative_pointer + description summary=get a relative pointer object +Create a relative pointer interface for the pointer of the given seat. + +This request only takes effect if the seat has the pointer capability. + /description + + arg name=id type=new_id interface=_wl_relative_pointer/ + arg name=seat type=object interface=wl_seat/ +/request + /interface + + interface name=_wl_relative_pointer version=1 +description summary=relative pointer object + A wl_relative_pointer object is an extension to the wl_pointer interface + only used for emitting relative pointer events. It will only emit events + when the parent pointer has focus. +/description + +request name=release type=destructor + description summary=release the relative pointer object/ +/request Maybe this should be called destroy. I know that we call it release on wl_pointer and friends, but this is something of a historical accident. The problem is that if you
Re: Patch: fix weston crash (inline patch)
On 12/02/2014 12:18 PM, Andrew Engelbrecht wrote: I've attached a patch which fixes the crashing. I mimicked the code in the block above it without knowing the overall impact, so it needs review from a knowledgeable contributor. here's the patch in non-attachment form: diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c index bdfac23..9284a05 100644 --- a/xwayland/window-manager.c +++ b/xwayland/window-manager.c @@ -1326,7 +1326,9 @@ weston_wm_window_handle_state(struct weston_wm_window *window, WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 0, NULL); } else { - shell_interface-set_toplevel(window-shsurf); + if (window-shsurf) + shell_interface-set_toplevel(window-shsurf); + window-width = window-saved_width; window-height = window-saved_height; if (window-frame) ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston 14/17] Introduce pointer locking and confinement protocol
A couple of doc comments below, but the protocol otherwise looks pretty good. Again, I've only glanced at the implementation. On Tue, Dec 2, 2014 at 5:49 AM, Jonas Ådahl jad...@gmail.com wrote: This patch introduces a new protocol for locking and confining a pointer. It consists of a new global object with two requests; one for locking the surface to a position, one for confining the pointer to a given region. See pointer-lock.xml for details of the protocol. In this patch, only the locking part is fully implemented as in specified in the protocol, while confinement is only implemented for when the union of the passed region and the input region of the confined surface is a single rectangle. Note that the interfaces are prefixed with an underscore in order to avoid future incompatibilities with a future stable interface with an equivalent name. Signed-off-by: Jonas Ådahl jad...@gmail.com --- What should the serial in locked_pointer_set_cursor_position_hint be checked against? It doesn't seem to make sense to use the same method as in pointer_set_cursor. As far as I understand, it should be equal to the last serial sent via that pointer device, but I can't see we do that anywhere else. What am I missing? Makefile.am | 3 + protocol/pointer-lock.xml | 208 src/compositor.c | 4 + src/compositor.h | 21 ++ src/input.c | 589 -- 5 files changed, 806 insertions(+), 19 deletions(-) create mode 100644 protocol/pointer-lock.xml diff --git a/Makefile.am b/Makefile.am index 860564d..8adc343 100644 --- a/Makefile.am +++ b/Makefile.am @@ -82,6 +82,8 @@ nodist_weston_SOURCES = \ protocol/presentation_timing-server-protocol.h \ protocol/scaler-protocol.c \ protocol/scaler-server-protocol.h \ + protocol/pointer-lock-protocol.c\ + protocol/pointer-lock-server-protocol.h \ protocol/relative-pointer-protocol.c\ protocol/relative-pointer-server-protocol.h @@ -1006,6 +1008,7 @@ EXTRA_DIST += \ protocol/fullscreen-shell.xml \ protocol/presentation_timing.xml\ protocol/scaler.xml \ + protocol/pointer-lock.xml \ protocol/relative-pointer.xml man_MANS = weston.1 weston.ini.5 diff --git a/protocol/pointer-lock.xml b/protocol/pointer-lock.xml new file mode 100644 index 000..3233ede --- /dev/null +++ b/protocol/pointer-lock.xml @@ -0,0 +1,208 @@ +?xml version=1.0 encoding=UTF-8? +protocol name=pointer_lock + + copyright +Copyright © 2014 Jonas Ådahl + +Permission to use, copy, modify, distribute, and sell this +software and its documentation for any purpose is hereby granted +without fee, provided that the above copyright notice appear in +all copies and that both that copyright notice and this permission +notice appear in supporting documentation, and that the name of +the copyright holders not be used in advertising or publicity +pertaining to distribution of the software without specific, +written prior permission. The copyright holders make no +representations about the suitability of this software for any +purpose. It is provided as is without express or implied +warranty. + +THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN +AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + /copyright + + interface name=_wl_pointer_lock version=1 +description summary=lock pointer to a surface + The global interface exposing pointer locking functionality. It exposes + two requests; lock_pointer for locking the pointer to its position, and + confine_pointer for locking the pointer to a region. + + The lock_pointer and confine_pointer creates the objects wl_locked_pointer + and wl_confined_pointer respectively, and the client can use these objects + to interact with the lock. + + There may not be another lock of any kind active when requesting a lock, + and if there is, an error will be raised. +/description + +request name=lock_pointer + description summary=lock pointer to a position +The lock_pointer request lets the client disable absolute pointer +movements, locking the pointer to a position. + +There may not be another lock of
Re: [PATCH weston 00/17] Relative pointer motions, locking and confinement
On Tue, Dec 2, 2014 at 5:49 AM, Jonas Ådahl jad...@gmail.com wrote: Hi again, At XDC2014 some of us sat down and talked through how pointer locking and related protocols should look like, and this series is more or less work-in-progress result of that discussion. The series contains two parts (and one bonus patch). The bonus patch is the initial white space only patch formatting the input method protocols making it slightly more readable and consistent with other protocol files. The first part (2 - 12) is preparation for the implementation of the new interfaces. The second part (13 - 17) is the introduction, implementation and application of the new protocol interfaces. Accompanied with this series is also a patch to libinput (Introduce non-accelerated motion event vectors), and implementations in GLFW https://github.com/jadahl/glfw/commits/pointer-lock and SDL2 https://bitbucket.org/jadahl/sdl/commits/branch/pointer-lock. In GLFW you can try the wave example, and for SDL, you could try for example ioquake3 or openarena. One of the things we concluded was that relative pointer motions should be treated separately from locking and confinement, so of the second part, patch 13 introduces the new relative pointer object that is an additional interface to the wl_pointer object. Think of it in the same way, as in you get it from a seat, and it emits motion events, only ones with relative motion deltas. One can create as many as one wants, and they don't interfere with each other, just as wl_pointer. It might be better to simply extend wl_seat when stabilizing this protocol, but it's put separately for testing purposes. For details of how the protocol works, please read the protocol XML file. In short, locking and confinement are two locking modes, of which one may only be active at once. From the discussions, there is one difference I can think of and that is that locking/confining an already locked/confined pointer is invalid, instead of queued, as it simplified the implementation quite a lot, and I think for most cases unlocking and then locking again will work good enough. For the cases where such a scenario would break the lock and fail to relock, we could for example change the heuristics the compositor applies to get a better behavior, without making the interface more complex. Please tell if you think queued locking is indeed needed. Yeah, I think this is probably ok. And you're right that it simplifies things substantially. It should be easy enough for compositors to add a little heuristic to make it practical. Let's see how this goes and I think we can probably deal with it later if we want. One thing of the specification is currently not fully implemented as there are some semantical choices that needs to be made and specified before it makes sense to go forward, and that is how to deal with non rectangular locking regions. The current implementation will simply never lock when the union of the input region and the locking region is a non rectangular region. The semantical ambiguity is how to treat motion vectors that cross corners or other borders. Consider the following ASCII art examples: --- --- | ^ | | ^ | |\| |\| | | | | -- or| - | \ | | \ | |\ | |\ | Simply clamping as done where there is no corners or anything would be result in: --- --- | | | | | | | | | | | | -- or| - | ^ || ^ | |\ ||\ | Should these kind of clamping take place or not, or should they be done some other way? Naturally, only clamping to a rectangle is the simplest non-ambiguous way to go and we could simply say that locking is to the largest rectangle within the union of the locking region and the input region, but as input regions can be split, we'd have to deal with that situation as well. Any ideas of the preferable way to deal with the locking regions? First off, I don't think we want to specify this in the protocol. That would be insane. If the client wants it to be particularly predictable, it should use a rectangle. If the client gives a more complex region, It gets what it gets. However, we do need to restrict to the region (that's the point of a confinement) so we can't just take the extents. With that out of the way, I'm not sure what algorithm would be best to use. Basically what we're doing is collision detection and there several algorithms for doing that reasonably efficiently.
Re: [PATCH weston v2 2/2] compositor: Implement JSON-timeline logging
On 12/02/2014 05:45 AM, Pekka Paalanen wrote: From: Pekka Paalanen pekka.paala...@collabora.co.uk + if (!s-get_label || s-get_label(s, d, sizeof(d)) 0) { + d[0] = '\0'; + q = ; + } + + fprintf(ctx-out, { \id\:%u, + \type\:\weston_surface\, + \desc\:%s%s%s%s }\n, + s-timeline.id, q, d[0] ? d : null, q, mainstr); I think you should make an emit(FILE*, const char*) function that prints a quoted string or null, instead of doing this repeatedly. Such a function could also convert non-printable characters to escape sequences. I think also you should ignore strict JSON and not put quotes around the keywords. It makes the output a lot easier to read and most libraries handle it. ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH v1] Added string conversion utility functions
I think the desired function was to fail if there was text after the number, fail on blank strings, and fail on overflow. All of these are somewhat cryptic with strtol. However, writing a helper function whose benefit over a direct call to strto*() is only the handling of errno, it might not be worth it in my opinion. Such a case is probably simpler to just fix in place than make it use a helper function. (This might change with libweston, though.) If the helper can assume that the whole given string must be a valid number, I think that would be much more worth it, because it would then hide the end pointer and nul checks. Such a function would be simple to use and make the code where it is used much more obvious. That I believe was the original intent. For that reason it should not return endptr, as that is useless. If existing code is using endptr that indicates it cannot use the replacement function. The function should do some/all of the following, all of which are clumsy to do with the library functions, and are often attempted by the calling code in sometimes-cryptic ways: - Fail if there is non-whitespace after the number - Fail without crashing if the string pointer is null - Fail if there is no number (all whitespace or zero-length string) - Fail if there is overflow - Don't change errno if it does not fail - Always set errno non-zero if it does fail, or return a different value for each type of failure and don't change errno. - Don't do octal conversion for leading zero, but allow 0x for hex. Maybe use 0o or something for octal if people want it. - Floating point can parse nan and inf including sign - Floating point accepts hex integers (not hex fractions, that would be nice but is much harder. The main point is to make an existing config file not fail if it uses hex for an integer parameter and that parameter is changed to floating point). ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston 14/17] Introduce pointer locking and confinement protocol
On 12/02/2014 05:49 AM, Jonas Ådahl wrote: +request name=lock_pointer + description summary=lock pointer to a position +The lock_pointer request lets the client disable absolute pointer +movements, locking the pointer to a position. + +There may not be another lock of any kind active when requesting a lock, +and if there is, an error will be raised. + +The intersection of the region passed with this request and the input +region of the surface is used to determine where the pointer must be +in order for the lock to activate. It is up to the compositor to warp +the pointer, or require some kind of user interaction for the lock to +activate. If the region is null, then an infinit region is used. + +The request will create a new object wl_locked_pointer which is used to +interact with the lock as well as receive updates about its state. See +the the description of wl_locked_pointer for further information. + +Note that while a locked pointer doesn't move its absolute position, it +may still emit relative motion events via the wl_relative_pointer +object. + /description + + arg name=id type=new_id interface=_wl_locked_pointer/ + arg name=surface type=object interface=wl_surface + summary=surface to lock pointer to/ + arg name=seat type=object interface=wl_seat + summary=seat where the pointer should be locked/ + arg name=region type=object interface=wl_region allow-null=true + summary=region of surface/ +/request - Does this need some id of the triggering event? Mostly to determine if the surface had the pointer focus at the time the request was made. A lock that is lost when the mouse button is released might be nice. It would be used for the slow scrollbar and similar widgets, avoid a round-trip on the release event, and would probably share code with normal mouse-up handling. I think this could be determined based on what type of event triggered the lock. - I am very unclear on what require some kind of user interaction for the lock to activate means. What I expect is that it will work if and only if the surface has the pointer focus. Any user interaction has already happened (ie they may have moved to another surface). Can somebody explain? Or perhaps this is just badly worded. - Do not warp the pointer. The pointer should freeze exactly where it is (even if outside the region), and only client requests to set the cursor position should move it. Any compositor-chosen position may be incorrect and will result in a flicker as the cursor is placed in this wrong position temporarily. - Is the region really necessary? I think it would be easy for a client to see that the cursor has moved out of any desired region and just not do this request. Also this removes any questions about complex regions. +request name=set_cursor_position_hint + description summary=set the pointer cursor position hint Why is this called a hint? This better be a lot stronger than a hint, it is pretty near useless if the cursor does not move to where the client wants. It's true that it sometimes won't work (for instance if the lock has been lost) but if that was the rule *every* request in Wayland would have to be called a hint! It would be really nice if you removed this excess verbage and called this set_cursor_position or even set_position. What happens is the compositor cannot set the position, for instance if it is off-screen? Does it send a motion event saying where it was really placed? +request name=confine_pointer + description summary=confine pointer to a region +The confine_pointer request lets the client confine the pointer cursor +to a given region. I don't think this should be necessary. The plain pointer-lock can be used, and the client uses set_cursor_position to do the confinement. And that removes any questions about complicated regions. +event name=locked + description summary=enter event +Notification that the pointer lock of this seat's pointer is activated. + /description Can't this just be assumed by the fact that you created the pointer lock object and have not gotten the unlocked event yet? +event name=unlocked + description summary=leave event +Notification that the pointer lock of seat's pointer is no longer +active. This object is no defunct and should be destroyed. + /description May want to point out that this is also sent immediately if there is a failure to get the pointer lock. ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH libinput] Introduce non-accelerated motion event vectors
On Tue, Dec 02, 2014 at 09:44:16PM +0800, Jonas Ådahl wrote: For certain applications (such as FPS games) it is necessary to use non-accelerated motion events (the motion vector that is passed to the acceleration filter) to get a more natural feeling. Supply this information by passing both accelerated and non-accelerated motion vectors to the existing motion event. Note that the non-accelerated motion event is not equivalent to 'raw' events as read from devices. ACK to the patch itself, needs more documentation though. Like this sentence which should be in the doc. Signed-off-by: Jonas Ådahl jad...@gmail.com --- src/evdev-mt-touchpad-edge-scroll.c | 2 +- src/evdev-mt-touchpad.c | 20 ++ src/evdev-mt-touchpad.h | 4 ++- src/evdev.c | 19 ++ src/libinput-private.h | 4 ++- src/libinput.c | 20 +- src/libinput.h | 30 + test/pointer.c | 52 + 8 files changed, 137 insertions(+), 14 deletions(-) diff --git a/src/evdev-mt-touchpad-edge-scroll.c b/src/evdev-mt-touchpad-edge-scroll.c index 1dca0ea..d68fc68 100644 --- a/src/evdev-mt-touchpad-edge-scroll.c +++ b/src/evdev-mt-touchpad-edge-scroll.c @@ -338,7 +338,7 @@ tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time) } tp_get_delta(t, dx, dy); - tp_filter_motion(tp, dx, dy, time); + tp_filter_motion(tp, dx, dy, NULL, NULL, time); if (fabs(*delta) t-scroll.threshold) continue; diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 8f76ddb..ff76fe2 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -58,13 +58,20 @@ tp_motion_history_offset(struct tp_touch *t, int offset) void tp_filter_motion(struct tp_dispatch *tp, - double *dx, double *dy, uint64_t time) + double *dx, double *dy, + double *dx_noaccel, double *dy_noaccel, + uint64_t time) { struct motion_params motion; motion.dx = *dx * tp-accel.x_scale_coeff; motion.dy = *dy * tp-accel.y_scale_coeff; + if (dx_noaccel) + *dx_noaccel = motion.dx; + if (dy_noaccel) + *dy_noaccel = motion.dy; + if (motion.dx != 0.0 || motion.dy != 0.0) filter_dispatch(tp-device-pointer.filter, motion, tp, time); @@ -426,7 +433,7 @@ tp_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t time) dx /= nchanged; dy /= nchanged; - tp_filter_motion(tp, dx, dy, time); + tp_filter_motion(tp, dx, dy, NULL, NULL, time); evdev_post_scroll(tp-device, time, dx, dy); } @@ -586,6 +593,7 @@ tp_post_events(struct tp_dispatch *tp, uint64_t time) struct tp_touch *t = tp_current_touch(tp); double dx, dy; int filter_motion = 0; + double dx_noaccel, dy_noaccel; /* Only post (top) button events while suspended */ if (tp-device-suspended) { @@ -617,10 +625,12 @@ tp_post_events(struct tp_dispatch *tp, uint64_t time) return; tp_get_delta(t, dx, dy); - tp_filter_motion(tp, dx, dy, time); + tp_filter_motion(tp, dx, dy, dx_noaccel, dy_noaccel, time); - if (dx != 0.0 || dy != 0.0) - pointer_notify_motion(tp-device-base, time, dx, dy); + if (dx != 0.0 || dy != 0.0 || dx_noaccel != 0.0 || dy_noaccel != 0.0) { + pointer_notify_motion(tp-device-base, time, + dx, dy, dx_noaccel, dy_noaccel); + } } static void diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index b2603b4..ea77062 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -276,7 +276,9 @@ tp_set_pointer(struct tp_dispatch *tp, struct tp_touch *t); void tp_filter_motion(struct tp_dispatch *tp, - double *dx, double *dy, uint64_t time); + double *dx, double *dy, + double *dx_noaccel, double *dy_noaccel, + uint64_t time); int tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time); diff --git a/src/evdev.c b/src/evdev.c index 908a8ba..f7d88c4 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -198,6 +198,7 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time) { struct libinput *libinput = device-base.seat-libinput; struct motion_params motion; + double dx_noaccel, dy_noaccel; int32_t cx, cy; int32_t x, y; int slot; @@ -211,8 +212,10 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time) case EVDEV_NONE: return; case EVDEV_RELATIVE_MOTION: - motion.dx = device-rel.dx / ((double)device-dpi / DEFAULT_MOUSE_DPI); -
[PATCH] doc: Invoke doxygen via the defined make variable.
Invoke doxygen via the autoconf-defined make variable instead of directly. This brings it in line with standard makefile practices. Signed-off-by: Jon A. Cruz j...@osg.samsung.com --- doc/doxygen/Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/doxygen/Makefile.am b/doc/doxygen/Makefile.am index 83622af..f8d636e 100644 --- a/doc/doxygen/Makefile.am +++ b/doc/doxygen/Makefile.am @@ -28,14 +28,14 @@ xml/client/index.xml: $(scanned_src_files_client) wayland.doxygen echo GENERATE_XML=YES; \ echo XML_OUTPUT=xml/client; \ echo INPUT= $(scanned_src_files_client); \ - ) | doxygen - + ) | $(DOXYGEN) - xml/server/index.xml: $(scanned_src_files_server) wayland.doxygen $(AM_V_GEN)$(MKDIR_P) xml/server \ (cat wayland.doxygen; \ echo GENERATE_XML=YES; \ echo XML_OUTPUT=xml/server; \ echo INPUT= $(scanned_src_files_server); \ - ) | doxygen - + ) | $(DOXYGEN) - man/man3/wl_display.3: $(scanned_src_files_client) $(scanned_src_files_server) $(AM_V_GEN)(cat wayland.doxygen; \ @@ -43,7 +43,7 @@ man/man3/wl_display.3: $(scanned_src_files_client) $(scanned_src_files_server) echo MAN_OUTPUT=man; \ echo JAVADOC_AUTOBRIEF=NO; \ echo INPUT= $^; \ - ) | doxygen - + ) | $(DOXYGEN) - # there is no man-local all-local: man/man3/wl_display.3 -- 1.9.1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 2/4] doc: Shut off second set of warnings from generating the man pages
These warnings are a duplicate of the first set --- doc/doxygen/Makefile.am |1 + 1 file changed, 1 insertion(+) diff --git a/doc/doxygen/Makefile.am b/doc/doxygen/Makefile.am index 83622af..fe6f300 100644 --- a/doc/doxygen/Makefile.am +++ b/doc/doxygen/Makefile.am @@ -42,6 +42,7 @@ man/man3/wl_display.3: $(scanned_src_files_client) $(scanned_src_files_server) echo GENERATE_MAN=YES; \ echo MAN_OUTPUT=man; \ echo JAVADOC_AUTOBRIEF=NO; \ + echo WARN_IF_UNDOCUMENTED=NO; \ echo INPUT= $^; \ ) | doxygen - -- 1.7.9.5 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 4/4] doc: Remove duplicated descriptions of wayland objects
This text is a duplicate of the text in the protocol documentation, but the converter mangled it by removing the paragraph breaks and some other errors. Instead replace it with a list of links to the protocol docs. --- doc/publican/protocol-interfaces-to-docbook.xsl | 16 +--- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/doc/publican/protocol-interfaces-to-docbook.xsl b/doc/publican/protocol-interfaces-to-docbook.xsl index 9cf0695..fb1a816 100644 --- a/doc/publican/protocol-interfaces-to-docbook.xsl +++ b/doc/publican/protocol-interfaces-to-docbook.xsl @@ -34,21 +34,15 @@ !-- Interfaces summary -- xsl:template match=interface varlistentry -xsl:attribute name=idprotocol-summary-xsl:value-of select=name()/-xsl:value-of select=@name / -/xsl:attribute -term + term +link linkend=protocol-spec-interface-{@name} xsl:value-of select=@name / xsl:if test=description/@summary - xsl:value-of select=description/@summary / /xsl:if -/term -listitem -para - xsl:value-of select=description/ -/para -/listitem - /varlistentry - +/link + /term +/varlistentry /xsl:template /xsl:stylesheet -- 1.7.9.5 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 1/4] doc: use markdown tildes for code blocks
This requires doxygen 1.8 or newer. I could not figure out how to make configure.ac test the doxygen version number. It appears to be really complex. So it will run with any version of doxygen and the doc output is somewhat mangled. --- src/wayland-client.c | 14 +++--- src/wayland-server.h | 16 src/wayland-util.h | 24 +--- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/wayland-client.c b/src/wayland-client.c index 36380fe..9dddb29 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -1326,12 +1326,12 @@ wl_display_prepare_read_queue(struct wl_display *display, * it will assume the file descriptor is readable and read events from * the fd by calling wl_display_dispatch(). Simplified, we have: * - * \code + * ~~~ * wl_display_dispatch_pending(display); * wl_display_flush(display); * poll(fds, nfds, -1); * wl_display_dispatch(display); - * \endcode + * ~~~ * * There are two races here: first, before blocking in poll(), the fd * could become readable and another thread reads the events. Some of @@ -1346,14 +1346,15 @@ wl_display_prepare_read_queue(struct wl_display *display, * fds in the event loop. * * A correct sequence would be: - * \code + * + * ~~~ * while (wl_display_prepare_read(display) != 0) * wl_display_dispatch_pending(display); * wl_display_flush(display); * poll(fds, nfds, -1); * wl_display_read_events(display); * wl_display_dispatch_pending(display); - * \endcode + * ~~~ * * Here we call wl_display_prepare_read(), which ensures that between * returning from that call and eventually calling @@ -1602,7 +1603,7 @@ wl_display_get_error(struct wl_display *display) * still valid; the client must know if it deleted the object. * \return The error code as defined in the interface specification. * - * \code + * ~~~ * int err = wl_display_get_error(display); * * if (err == EPROTO) { @@ -1611,8 +1612,7 @@ wl_display_get_error(struct wl_display *display) * } * * ... - * - * \endcode + * ~~~ */ WL_EXPORT uint32_t wl_display_get_protocol_error(struct wl_display *display, diff --git a/src/wayland-server.h b/src/wayland-server.h index af2f03d..22185e8 100644 --- a/src/wayland-server.h +++ b/src/wayland-server.h @@ -144,36 +144,36 @@ wl_client_post_no_memory(struct wl_client *client); * listener should be done through provided accessor methods. A listener can * only listen to one signal at a time. * - * \code + * ~~~ * struct wl_listener your_listener; * * your_listener.notify = your_callback_method; * - * // Direct access + * \comment{Direct access} * wl_signal_add(some_object-destroy_signal, your_listener); * - * // Accessor access + * \comment{Accessor access} * wl_event_loop *loop = ...; * wl_event_loop_add_destroy_listener(loop, your_listener); - * \endcode + * ~~~ * * If the listener is part of a larger struct, #wl_container_of can be used * to retrieve a pointer to it: * - * \code + * ~~~ * void your_listener(struct wl_listener *listener, void *data) * { * struct your_data *data; * * your_data = wl_container_of(listener, data, your_member_name); * } - * \endcode + * ~~~ * * If you need to remove a listener from a signal, use wl_list_remove(). * - * \code + * ~~~ * wl_list_remove(your_listener.link); - * \endcode + * ~~~ * * \sa wl_signal */ diff --git a/src/wayland-util.h b/src/wayland-util.h index a4b22b5..d61ce0a 100644 --- a/src/wayland-util.h +++ b/src/wayland-util.h @@ -88,7 +88,8 @@ struct wl_interface { * item_t, and the item member as struct wl_list link. * * The following code will initialize a list: - * \code + * + * ~~~ * struct wl_list foo_list; * * struct item_t { @@ -98,20 +99,21 @@ struct wl_interface { * struct item_t item1, item2, item3; * * wl_list_init(foo_list); - * wl_list_insert(foo_list, item1.link); // Pushes item1 at the head - * wl_list_insert(foo_list, item2.link); // Pushes item2 at the head - * wl_list_insert(item2.link, item3.link); // Pushes item3 after item2 - * \endcode + * wl_list_insert(foo_list, item1.link); \comment{Pushes item1 at the head} + * wl_list_insert(foo_list, item2.link); \comment{Pushes item2 at the head} + * wl_list_insert(item2.link, item3.link); \comment{Pushes item3 after item2} + * ~~~ * * The list now looks like [item2, item3, item1] * * Iterate the list in ascending order: - * \code + * + * ~~~ * item_t *item; * wl_list_for_each(item, foo_list, link) { * Do_something_with_item(item); * } - * \endcode + * ~~~ */ struct wl_list { struct wl_list *prev; @@ -136,10 +138,10 @@ void wl_list_insert_list(struct wl_list *list, struct wl_list *other); * To demonstrate, the following example retrieves a pointer to * `example_container` given only its `destroy_listener` member: * - * \code + * ~~~ * struct example_container { *
[PATCH 3/4] doc: removed redundant dependency
The .tmp file dependency depends on the index.xml file so it does not need to be repeated. --- doc/publican/Makefile.am |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/publican/Makefile.am b/doc/publican/Makefile.am index 9fc4e0b..0b2cd09 100644 --- a/doc/publican/Makefile.am +++ b/doc/publican/Makefile.am @@ -93,12 +93,12 @@ en-US/%API.xml.tmp: $(top_builddir)/doc/doxygen/xml/%/index.xml # WaylandClientAPI.xml: # merge doxygen xml files into one single file, then transform the combined XML file into docbook format -en-US/WaylandClientAPI.xml: en-US/clientAPI.xml.tmp $(top_builddir)/doc/doxygen/xml/client/index.xml $(srcdir)/doxygen-to-publican.xsl +en-US/WaylandClientAPI.xml: en-US/clientAPI.xml.tmp $(srcdir)/doxygen-to-publican.xsl $(AM_V_GEN)$(XSLTPROC) --stringparam which Client $(srcdir)/doxygen-to-publican.xsl \ $(builddir)/en-US/clientAPI.xml.tmp en-US/WaylandClientAPI.xml # WaylandServerAPI.xml: see WaylandClientAPI.xml -en-US/WaylandServerAPI.xml: en-US/serverAPI.xml.tmp $(top_builddir)/doc/doxygen/xml/client/index.xml $(srcdir)/doxygen-to-publican.xsl +en-US/WaylandServerAPI.xml: en-US/serverAPI.xml.tmp $(srcdir)/doxygen-to-publican.xsl $(AM_V_GEN)$(XSLTPROC) --stringparam which Server $(srcdir)/doxygen-to-publican.xsl \ $(builddir)/en-US/serverAPI.xml.tmp en-US/WaylandServerAPI.xml -- 1.7.9.5 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH libinput] Document relative motion normalization
Signed-off-by: Peter Hutterer peter.hutte...@who-t.net --- src/libinput.h | 61 ++ 1 file changed, 61 insertions(+) diff --git a/src/libinput.h b/src/libinput.h index db56da7..5608eaa 100644 --- a/src/libinput.h +++ b/src/libinput.h @@ -124,6 +124,10 @@ extern C { * ddAssigns the logical seat for this device. See * libinput_seat_get_logical_name() * context. Defaults to default./dd + * dtMOUSE_DPI/dt + * ddHW resolution and sampling frequency of a relative pointer device. + * See @ref motion_normalization for details. + * /dd * /dl * * Below is an example udev rule to assign seat1 to a device from vendor @@ -136,6 +140,57 @@ extern C { */ /** + * @page motion_normalization Normalization of relative motion + * + * Most relative input devices generate input in so-called mickeys. A + * mickey is in device-specific units that depend on the resolution + * of the sensor. Most optical mice use sensors with 1000dpi resolution, but + * some devices range from 100dpi to well above 8000dpi. + * + * Without a physical reference point, a relative coordinate cannot be + * interpreted correctly. A delta of 10 mickeys may be a millimeter of + * physical movement or 10 millimeters, depending on the sensor. This + * affects pointer acceleration in libinput and interpretation of relative + * coordinates in callers. + * + * libinput normalizes all relative input to a physical resolution of + * 1000dpi, the same delta from two different devices thus represents the + * same physical movement of those two devices (within sensor error + * margins). + * + * Devices usually do not advertise their resolution and libinput relies on + * the udev property MOUSE_DPI for this information. + * + * The format of the property for single-resolution mice is: + * @code + * MOUSE_DPI=resolution@frequency + * @endcode + * + * The resolution is in dots per inch, the frequency in Hz. + * The format of the property for multi-resolution mice may list multiple + * resolutions and frequencies: + * @code + * MOUSE_DPI=r1@f1 *r2@f2 r3@f3 + * @endcode + * + * The default frequency must be pre-fixed with an asterisk. + * + * For example, these two properties are valid: + * @code + * MOUSE_DPI=800@125 + * MOUSE_DPI=400@125 800@125 *1000@500 5500@500 + * @endcode + * + * The behavior for a malformed property is undefined. + * + * If the property is unset, libinput assumes the resolution is 1000dpi. + * + * Note that HW does not usually provide information about the resolution + * changes, libinput will thus not detect when a resolution changes to the + * non-default value. + */ + +/** * Log priority for internal logging messages. */ enum libinput_log_priority { @@ -468,6 +523,9 @@ libinput_event_pointer_get_time(struct libinput_event_pointer *event); * If a device employs pointer acceleration, the delta returned by this * function is the accelerated delta. * + * Relative motion deltas are normalized to represent those of a device with + * 1000dpi resolution. See @ref motion_normalization for more details. + * * @note It is an application bug to call this function for events other than * @ref LIBINPUT_EVENT_POINTER_MOTION. * @@ -486,6 +544,9 @@ libinput_event_pointer_get_dx(struct libinput_event_pointer *event); * If a device employs pointer acceleration, the delta returned by this * function is the accelerated delta. * + * Relative motion deltas are normalized to represent those of a device with + * 1000dpi resolution. See @ref motion_normalization for more details. + * * @note It is an application bug to call this function for events other than * @ref LIBINPUT_EVENT_POINTER_MOTION. * -- 2.1.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH 1/4] doc: use markdown tildes for code blocks
On 12/02/2014 06:29 PM, Bill Spitzak wrote: This requires doxygen 1.8 or newer. FYI this will cut off support for RHEL6 and corresponding distros such as CentOS and Scientific Linux (I had to track this for my prior day job). On the other hand, RHEL7 is up to Doxygen 1.8.5 so we're good in that regard. (Does there happen to be a page listing what Wayland is supported on/targeting and not?) I could not figure out how to make configure.ac test the doxygen version number. It appears to be really complex. So it will run with any version of doxygen and the doc output is somewhat mangled. I'll take a peek at that. Seems familiar. ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH] doc: Invoke doxygen via the defined make variable.
On Tue, Dec 02, 2014 at 05:54:07PM -0800, Jon A. Cruz wrote: Invoke doxygen via the autoconf-defined make variable instead of directly. This brings it in line with standard makefile practices. Signed-off-by: Jon A. Cruz j...@osg.samsung.com Reviewed-by: Peter Hutterer peter.hutte...@who-t.net Cheers, Peter --- doc/doxygen/Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/doxygen/Makefile.am b/doc/doxygen/Makefile.am index 83622af..f8d636e 100644 --- a/doc/doxygen/Makefile.am +++ b/doc/doxygen/Makefile.am @@ -28,14 +28,14 @@ xml/client/index.xml: $(scanned_src_files_client) wayland.doxygen echo GENERATE_XML=YES; \ echo XML_OUTPUT=xml/client; \ echo INPUT= $(scanned_src_files_client); \ - ) | doxygen - + ) | $(DOXYGEN) - xml/server/index.xml: $(scanned_src_files_server) wayland.doxygen $(AM_V_GEN)$(MKDIR_P) xml/server \ (cat wayland.doxygen; \ echo GENERATE_XML=YES; \ echo XML_OUTPUT=xml/server; \ echo INPUT= $(scanned_src_files_server); \ - ) | doxygen - + ) | $(DOXYGEN) - man/man3/wl_display.3: $(scanned_src_files_client) $(scanned_src_files_server) $(AM_V_GEN)(cat wayland.doxygen; \ @@ -43,7 +43,7 @@ man/man3/wl_display.3: $(scanned_src_files_client) $(scanned_src_files_server) echo MAN_OUTPUT=man; \ echo JAVADOC_AUTOBRIEF=NO; \ echo INPUT= $^; \ - ) | doxygen - + ) | $(DOXYGEN) - # there is no man-local all-local: man/man3/wl_display.3 -- 1.9.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
Re: [PATCH 1/4] doc: use markdown tildes for code blocks
On Tue, Dec 02, 2014 at 06:29:33PM -0800, Bill Spitzak wrote: This requires doxygen 1.8 or newer. I could not figure out how to make configure.ac test the doxygen version number. It appears to be really complex. So it will run with any version of doxygen and the doc output is somewhat mangled. I'm missing the reasoning here: why not leave code/endcode? was this explained in some other thread? Cheers, Peter --- src/wayland-client.c | 14 +++--- src/wayland-server.h | 16 src/wayland-util.h | 24 +--- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/wayland-client.c b/src/wayland-client.c index 36380fe..9dddb29 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -1326,12 +1326,12 @@ wl_display_prepare_read_queue(struct wl_display *display, * it will assume the file descriptor is readable and read events from * the fd by calling wl_display_dispatch(). Simplified, we have: * - * \code + * ~~~ * wl_display_dispatch_pending(display); * wl_display_flush(display); * poll(fds, nfds, -1); * wl_display_dispatch(display); - * \endcode + * ~~~ * * There are two races here: first, before blocking in poll(), the fd * could become readable and another thread reads the events. Some of @@ -1346,14 +1346,15 @@ wl_display_prepare_read_queue(struct wl_display *display, * fds in the event loop. * * A correct sequence would be: - * \code + * + * ~~~ * while (wl_display_prepare_read(display) != 0) * wl_display_dispatch_pending(display); * wl_display_flush(display); * poll(fds, nfds, -1); * wl_display_read_events(display); * wl_display_dispatch_pending(display); - * \endcode + * ~~~ * * Here we call wl_display_prepare_read(), which ensures that between * returning from that call and eventually calling @@ -1602,7 +1603,7 @@ wl_display_get_error(struct wl_display *display) * still valid; the client must know if it deleted the object. * \return The error code as defined in the interface specification. * - * \code + * ~~~ * int err = wl_display_get_error(display); * * if (err == EPROTO) { @@ -1611,8 +1612,7 @@ wl_display_get_error(struct wl_display *display) * } * * ... - * - * \endcode + * ~~~ */ WL_EXPORT uint32_t wl_display_get_protocol_error(struct wl_display *display, diff --git a/src/wayland-server.h b/src/wayland-server.h index af2f03d..22185e8 100644 --- a/src/wayland-server.h +++ b/src/wayland-server.h @@ -144,36 +144,36 @@ wl_client_post_no_memory(struct wl_client *client); * listener should be done through provided accessor methods. A listener can * only listen to one signal at a time. * - * \code + * ~~~ * struct wl_listener your_listener; * * your_listener.notify = your_callback_method; * - * // Direct access + * \comment{Direct access} * wl_signal_add(some_object-destroy_signal, your_listener); * - * // Accessor access + * \comment{Accessor access} * wl_event_loop *loop = ...; * wl_event_loop_add_destroy_listener(loop, your_listener); - * \endcode + * ~~~ * * If the listener is part of a larger struct, #wl_container_of can be used * to retrieve a pointer to it: * - * \code + * ~~~ * void your_listener(struct wl_listener *listener, void *data) * { * struct your_data *data; * * your_data = wl_container_of(listener, data, your_member_name); * } - * \endcode + * ~~~ * * If you need to remove a listener from a signal, use wl_list_remove(). * - * \code + * ~~~ * wl_list_remove(your_listener.link); - * \endcode + * ~~~ * * \sa wl_signal */ diff --git a/src/wayland-util.h b/src/wayland-util.h index a4b22b5..d61ce0a 100644 --- a/src/wayland-util.h +++ b/src/wayland-util.h @@ -88,7 +88,8 @@ struct wl_interface { * item_t, and the item member as struct wl_list link. * * The following code will initialize a list: - * \code + * + * ~~~ * struct wl_list foo_list; * * struct item_t { @@ -98,20 +99,21 @@ struct wl_interface { * struct item_t item1, item2, item3; * * wl_list_init(foo_list); - * wl_list_insert(foo_list, item1.link); // Pushes item1 at the head - * wl_list_insert(foo_list, item2.link); // Pushes item2 at the head - * wl_list_insert(item2.link, item3.link); // Pushes item3 after item2 - * \endcode + * wl_list_insert(foo_list, item1.link); \comment{Pushes item1 at the head} + * wl_list_insert(foo_list, item2.link); \comment{Pushes item2 at the head} + * wl_list_insert(item2.link, item3.link); \comment{Pushes item3 after item2} + * ~~~ * * The list now looks like [item2, item3, item1] * * Iterate the list in ascending order: - * \code + * + * ~~~ * item_t *item; * wl_list_for_each(item, foo_list, link) { * Do_something_with_item(item); * } - * \endcode + * ~~~ */
Re: [PATCH 2/4] doc: Shut off second set of warnings from generating the man pages
On Tue, Dec 02, 2014 at 06:29:34PM -0800, Bill Spitzak wrote: These warnings are a duplicate of the first set --- doc/doxygen/Makefile.am |1 + 1 file changed, 1 insertion(+) diff --git a/doc/doxygen/Makefile.am b/doc/doxygen/Makefile.am index 83622af..fe6f300 100644 --- a/doc/doxygen/Makefile.am +++ b/doc/doxygen/Makefile.am @@ -42,6 +42,7 @@ man/man3/wl_display.3: $(scanned_src_files_client) $(scanned_src_files_server) echo GENERATE_MAN=YES; \ echo MAN_OUTPUT=man; \ echo JAVADOC_AUTOBRIEF=NO; \ + echo WARN_IF_UNDOCUMENTED=NO; \ echo INPUT= $^; \ ) | doxygen - wouldn't it be better to document all bits rather than silencing the warnings? Cheers, Peter ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH 3/4] doc: removed redundant dependency
On Tue, Dec 02, 2014 at 06:29:35PM -0800, Bill Spitzak wrote: The .tmp file dependency depends on the index.xml file so it does not need to be repeated. Reviewed-by: Peter Hutterer peter.hutte...@who-t.net Cheers, Peter --- doc/publican/Makefile.am |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/publican/Makefile.am b/doc/publican/Makefile.am index 9fc4e0b..0b2cd09 100644 --- a/doc/publican/Makefile.am +++ b/doc/publican/Makefile.am @@ -93,12 +93,12 @@ en-US/%API.xml.tmp: $(top_builddir)/doc/doxygen/xml/%/index.xml # WaylandClientAPI.xml: # merge doxygen xml files into one single file, then transform the combined XML file into docbook format -en-US/WaylandClientAPI.xml: en-US/clientAPI.xml.tmp $(top_builddir)/doc/doxygen/xml/client/index.xml $(srcdir)/doxygen-to-publican.xsl +en-US/WaylandClientAPI.xml: en-US/clientAPI.xml.tmp $(srcdir)/doxygen-to-publican.xsl $(AM_V_GEN)$(XSLTPROC) --stringparam which Client $(srcdir)/doxygen-to-publican.xsl \ $(builddir)/en-US/clientAPI.xml.tmp en-US/WaylandClientAPI.xml # WaylandServerAPI.xml: see WaylandClientAPI.xml -en-US/WaylandServerAPI.xml: en-US/serverAPI.xml.tmp $(top_builddir)/doc/doxygen/xml/client/index.xml $(srcdir)/doxygen-to-publican.xsl +en-US/WaylandServerAPI.xml: en-US/serverAPI.xml.tmp $(srcdir)/doxygen-to-publican.xsl $(AM_V_GEN)$(XSLTPROC) --stringparam which Server $(srcdir)/doxygen-to-publican.xsl \ $(builddir)/en-US/serverAPI.xml.tmp en-US/WaylandServerAPI.xml -- 1.7.9.5 ___ 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
Re: [PATCH 4/4] doc: Remove duplicated descriptions of wayland objects
On Tue, Dec 02, 2014 at 06:29:36PM -0800, Bill Spitzak wrote: This text is a duplicate of the text in the protocol documentation, but the converter mangled it by removing the paragraph breaks and some other errors. Instead replace it with a list of links to the protocol docs. Reviewed-by: Peter Hutterer peter.hutte...@who-t.net Cheers, Peter --- doc/publican/protocol-interfaces-to-docbook.xsl | 16 +--- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/doc/publican/protocol-interfaces-to-docbook.xsl b/doc/publican/protocol-interfaces-to-docbook.xsl index 9cf0695..fb1a816 100644 --- a/doc/publican/protocol-interfaces-to-docbook.xsl +++ b/doc/publican/protocol-interfaces-to-docbook.xsl @@ -34,21 +34,15 @@ !-- Interfaces summary -- xsl:template match=interface varlistentry -xsl:attribute name=idprotocol-summary-xsl:value-of select=name()/-xsl:value-of select=@name / -/xsl:attribute -term + term +link linkend=protocol-spec-interface-{@name} xsl:value-of select=@name / xsl:if test=description/@summary - xsl:value-of select=description/@summary / /xsl:if -/term -listitem -para - xsl:value-of select=description/ -/para -/listitem - /varlistentry - +/link + /term +/varlistentry /xsl:template /xsl:stylesheet -- 1.7.9.5 ___ 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] weston: fbdev: remove uneeded semicolon
--- src/compositor-fbdev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c index 138aaab..eb238a2 100644 --- a/src/compositor-fbdev.c +++ b/src/compositor-fbdev.c @@ -811,7 +811,6 @@ session_notify(struct wl_listener *listener, void *data) { struct fbdev_compositor *compositor = data; struct weston_output *output; - if (compositor-base.session_active) { weston_log(entering VT\n); compositor-base.state = compositor-prev_state; @@ -845,7 +844,7 @@ session_notify(struct wl_listener *listener, void *data) compositor-base.output_list, link) { output-repaint_needed = 0; } - }; + } } static void -- 2.1.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH] Weston: fbdev: Remove uneeded semicolon
--- 0001-weston-fbdev-remove-uneeded-semicolon.patch | 33 +++ fd | 116 +++ src/compositor-fbdev.c | 2 +- 3 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 0001-weston-fbdev-remove-uneeded-semicolon.patch create mode 100644 fd diff --git a/0001-weston-fbdev-remove-uneeded-semicolon.patch b/0001-weston-fbdev-remove-uneeded-semicolon.patch new file mode 100644 index 000..dd3b987 --- /dev/null +++ b/0001-weston-fbdev-remove-uneeded-semicolon.patch @@ -0,0 +1,33 @@ +From 708cf1fe9068fb535fa5f1f059ddc7b4ae2ce2d5 Mon Sep 17 00:00:00 2001 +From: nerdopolis bluescreen_aven...@verizon.net +Date: Tue, 2 Dec 2014 21:55:03 -0500 +Subject: [PATCH] weston: fbdev: remove uneeded semicolon + +--- + src/compositor-fbdev.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c +index 138aaab..eb238a2 100644 +--- a/src/compositor-fbdev.c b/src/compositor-fbdev.c +@@ -811,7 +811,6 @@ session_notify(struct wl_listener *listener, void *data) + { + struct fbdev_compositor *compositor = data; + struct weston_output *output; +- + if (compositor-base.session_active) { + weston_log(entering VT\n); + compositor-base.state = compositor-prev_state; +@@ -845,7 +844,7 @@ session_notify(struct wl_listener *listener, void *data) +compositor-base.output_list, link) { + output-repaint_needed = 0; + } +- }; ++ } + } + + static void +-- +2.1.0 + diff --git a/fd b/fd new file mode 100644 index 000..b7fb3ad --- /dev/null +++ b/fd @@ -0,0 +1,116 @@ +src/launcher-util.c:#include launcher-util.h +src/launcher-util.c: if (launcher-logind) +src/launcher-util.c: return weston_logind_open(launcher-logind, path, flags); +src/launcher-util.c: if (launcher-fd == -1) { +src/launcher-util.c: launcher-drm_fd = fd; +src/launcher-util.c: len = send(launcher-fd, message, n, 0); +src/launcher-util.c: len = recvmsg(launcher-fd, msg, MSG_CMSG_CLOEXEC); +src/launcher-util.c: if (launcher-logind) +src/launcher-util.c: return weston_logind_close(launcher-logind, fd); +src/launcher-util.c: if (launcher-logind) +src/launcher-util.c: return weston_logind_restore(launcher-logind); +src/launcher-util.c: if (ioctl(launcher-tty, KDSKBMUTE, 0) +src/launcher-util.c: ioctl(launcher-tty, KDSKBMODE, launcher-kb_mode)) +src/launcher-util.c: if (ioctl(launcher-tty, KDSETMODE, KD_TEXT)) +src/launcher-util.c: drmDropMaster(launcher-drm_fd); +src/launcher-util.c: if (ioctl(launcher-tty, VT_SETMODE, mode) 0) +src/launcher-util.c: len = recv(launcher-fd, ret, sizeof ret, 0); +src/launcher-util.c: launcher-compositor-session_active = 1; +src/launcher-util.c: wl_signal_emit(launcher-compositor-session_signal, +src/launcher-util.c: launcher-compositor); +src/launcher-util.c: launcher-compositor-session_active = 0; +src/launcher-util.c: wl_signal_emit(launcher-compositor-session_signal, +src/launcher-util.c: launcher-compositor); +src/launcher-util.c: struct weston_compositor *compositor = launcher-compositor; +src/launcher-util.c: drmDropMaster(launcher-drm_fd); +src/launcher-util.c: ioctl(launcher-tty, VT_RELDISP, 1); +src/launcher-util.c: ioctl(launcher-tty, VT_RELDISP, VT_ACKACQ); +src/launcher-util.c: drmSetMaster(launcher-drm_fd); +src/launcher-util.c: launcher-tty = dup(tty); +src/launcher-util.c: if (launcher-tty == -1) { +src/launcher-util.c: launcher-tty = open(tty_device, O_RDWR | O_CLOEXEC); +src/launcher-util.c: if (launcher-tty == -1) { +src/launcher-util.c: if (fstat(launcher-tty, buf) == -1 || +src/launcher-util.c: ret = ioctl(launcher-tty, KDGETMODE, kd_mode); +src/launcher-util.c: ioctl(launcher-tty, VT_ACTIVATE, minor(buf.st_rdev)); +src/launcher-util.c: ioctl(launcher-tty, VT_WAITACTIVE, minor(buf.st_rdev)); +src/launcher-util.c: if (ioctl(launcher-tty, KDGKBMODE, launcher-kb_mode)) { +src/launcher-util.c: if (ioctl(launcher-tty, KDSKBMUTE, 1) +src/launcher-util.c: ioctl(launcher-tty, KDSKBMODE, K_OFF)) { +src/launcher-util.c: ret = ioctl(launcher-tty, KDSETMODE, KD_GRAPHICS); +src/launcher-util.c: if (ioctl(launcher-tty, VT_SETMODE, mode) 0) { +src/launcher-util.c: loop = wl_display_get_event_loop(launcher-compositor-wl_display); +src/launcher-util.c: launcher-vt_source = +src/launcher-util.c: if (!launcher-vt_source) +src/launcher-util.c: close(launcher-tty); +src/launcher-util.c: if (launcher-logind) +src/launcher-util.c: return weston_logind_activate_vt(launcher-logind, vt); +src/launcher-util.c: return
[no subject]
I had to resend, because in the first patch I sent I accidentally removed an empty line ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH] doc: Add config check for doxygen 1.8.0+.
Add a config time check for a new enough (1.8.0+) version of doxygen. Signed-off-by: Jon A. Cruz j...@osg.samsung.com --- configure.ac | 8 1 file changed, 8 insertions(+) diff --git a/configure.ac b/configure.ac index 6f8220b..317cdae 100644 --- a/configure.ac +++ b/configure.ac @@ -109,6 +109,14 @@ if test x$enable_documentation = xyes; then AC_MSG_ERROR([Documentation build requested but doxygen not found. Install doxygen or disable the documentation using --disable-documentation]) fi + AC_MSG_CHECKING([for compatible doxygen version]) + doxygen_version=`$DOXYGEN --version` + AS_VERSION_COMPARE([$doxygen_version], [1.8.0], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([Doxygen $doxygen_version too old. Doxygen 1.8+ required for documentation build. Install required doxygen version or disable the documentation using --disable-documentation])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([yes])]) + AC_PATH_PROG(XMLTO, xmlto) if test x$XMLTO = x; then -- 1.9.1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel