[PATCH weston 1/2] desktop-shell: maximize the surface with the kbd focus
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk We don't have focus-follows-mouse, so it makes more sense to maximize or fullscreen the surface that has the keyboard focus, not the one behind the pointer. --- desktop-shell/shell.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 111a7aa..7d85a7b 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -3830,7 +3830,7 @@ move_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *dat static void maximize_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *data) { - struct weston_surface *focus = seat-pointer-focus-surface; + struct weston_surface *focus = seat-keyboard-focus; struct weston_surface *surface; struct shell_surface *shsurf; @@ -3854,7 +3854,7 @@ maximize_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void static void fullscreen_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *data) { - struct weston_surface *focus = seat-pointer-focus-surface; + struct weston_surface *focus = seat-keyboard-focus; struct weston_surface *surface; struct shell_surface *shsurf; -- 1.8.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 2/2] desktop-shell: unfullscreen before (un)maximizing
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk Before maximizing or unmaximizing a window, first tell the client to unfullscreen the window. This fixes a crash in weston because we ended up thinking the surface was fullscreened when it wasn't. --- desktop-shell/shell.c | 4 1 file changed, 4 insertions(+) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 7d85a7b..30bd273 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -3845,6 +3845,10 @@ maximize_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void if (!shell_surface_is_xdg_surface(shsurf)) return; + /* First un-fullscreen if needed */ + if (shsurf-state.fullscreen) + xdg_surface_send_request_unset_fullscreen(shsurf-resource); + if (shsurf-state.maximized) xdg_surface_send_request_unset_maximized(shsurf-resource); else -- 1.8.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: Make safe double remove?
Jonathan Howard jonat...@unbiased.name writes: wl_list_remove changed isn't 100% guaranteed to not break anything, on the other hand there is no guarantee the code does not have the fatal double remove already. We definitely do already have a double-remove bug in Weston as described here: http://lists.freedesktop.org/archives/wayland-devel/2014-January/012891.html I think the proposed change to wl_list_remove would fix that too. Regards, - Neil pgpe_dAD0aq9Y.pgp Description: PGP signature ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH 2/2] compositor: add a masking mechanism to weston_layer
On 01/28/2014 06:36 PM, Giulio Camuffo wrote: 2014-01-28 Ander Conselvan de Oliveira conselv...@gmail.com: On 01/27/2014 09:46 PM, Giulio Camuffo wrote: this adds a mechanism to mask the views belonging to a layer to an arbitrary rect, in the global space. The parts that don't fit in that rect will be clipped away. Implemented in the gl and pixman renderers only for now. --- src/compositor.c | 26 +- src/compositor.h | 7 +++ src/gl-renderer.c | 4 src/pixman-renderer.c | 4 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/compositor.c b/src/compositor.c index 9a269e5..25068b8 100644 [...] diff --git a/src/gl-renderer.c b/src/gl-renderer.c index 0e5afbe..899c280 100644 --- a/src/gl-renderer.c +++ b/src/gl-renderer.c @@ -521,6 +521,10 @@ draw_view(struct weston_view *ev, struct weston_output *output, pixman_region32_intersect(repaint, ev-transform.boundingbox, damage); pixman_region32_subtract(repaint, repaint, ev-clip); + pixman_region32_t mask; + pixman_region32_init_with_extents(mask, ev-layer_link.layer-mask); + pixman_region32_intersect(repaint, repaint, mask); + pixman_region32_fini(mask); There are more things you need to consider in order to clip properly. 1) Opaque region. This is used to avoid rendering obscured parts of surfaces. In compositor_accumulate_damage(), a clip region for each surface is determined as the union of the opaque regions of the surfaces on top of it. That way, the parts of the surface that are covered by other opaque content is not rendered. You can see the effect of this relatively easily. Patch desktop-shell to set a clip for the workspace layer that is smaller than the screen. Then running Weston with the X11 backend (or just make sure you have a software rendered cursor), open a weston-terminal and move it so that it crosses the border of the clipped region. Then move the mouse over the region that should be part of the terminal but is clipped away. Notice how the background is not redrawn properly. In order to fix this, the opaque region used for calculating the surface clip also needs to be clipped. 2) Sprite planes. There's another path through which content can get to the screen. When a view is put on a sprite plane, it complete bypasses the renderer. During the repaint process, the core gives the backend a chance to move views to different planes. At that moment, the backend could configure the sprite plane to clip the surface or just decide to not to use a sprite plane for it. However, it needs the clipping information to make that decision. If I understand correctly, the rpi backend relies heavily on planes. The DRM backend has support for sprite planes too, but it is disabled since it can't work correctly without a patched kernel. You can try it (with a regular kernel) by pressing mod-shift-space followed by 'v'. If you run weston-simple-egl -o, you'll notice the clipping won't work when the surface is in a sprite plane. Given the points above, I believe it would be better to keep the information related to clipping in the weston_view structure. That way the backend and the renderer can be completely unaware of the existence of layers. The clipping information can be propagated from the layers to the views in the beginning of weston_output_repaint() and/or as part of weston_view_update_transform(). What's the difference between using view-layer.mask or using view-mask? I don't seen how the latter helps anything in any way. Besides, if the mask is in the view it should be in view space, but that means adding complexity for no real benefit. What happens if you have a surface with subsurfaces in a layer with a mask? The layer_link for a subsurface is not in any layers, and that causes a crash with your patch. My point was not about writing view-mask instead of view-layer.mask, but that we need to handle all the complexities about clipping in Weston's core. The list of views and the information contained in them is enough for the renderers to produce the correct output. We should avoid making them aware of layers and subsurfaces. Cheers, Ander ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH] dim-layer: fix dimming for unfocused surfaces
On 01/15/2014 10:30 AM, Emilio Pozuelo Monfort wrote: bump On 07/01/14 17:23, poch...@gmail.com wrote: From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk Unfocusing a surface should dim it when dim-layer is enabled, but this got broken in commit 83ffd9. --- desktop-shell/shell.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index f85a269..cca96be 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -4141,6 +4141,7 @@ activate(struct desktop_shell *shell, struct weston_surface *es, struct weston_seat *seat) { struct weston_surface *main_surface; + struct weston_view *main_view; struct focus_state *state; struct workspace *ws; struct weston_surface *old_es; @@ -4162,8 +4163,18 @@ activate(struct desktop_shell *shell, struct weston_surface *es, shsurf = get_shell_surface(main_surface); if (shsurf-state.fullscreen) shell_configure_fullscreen(shsurf); - else + else { + ws = get_current_workspace(shell); + main_view = get_default_view(main_surface); + if (main_view) { + wl_list_remove(main_view-layer_link); + wl_list_insert(ws-layer.view_list, main_view-layer_link); + weston_view_damage_below(main_view); + weston_surface_damage(main_view-surface); + } So you're basically rewriting weston_view_restack() here. Wouldn't a better fix be to move the animation logic below the call to shell_surface_update_layer(), which is the place where the surface is restacked after the commit you mentioned. Cheers, Ander + restore_all_output_modes(shell-compositor); + } if (shell-focus_animation_type != ANIMATION_NONE) { ws = get_current_workspace(shell); ___ 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: [Mesa-dev] What use do swap interval 1 and OML_sync_control divisor and remainder have?
[Just for the sake of argument] 2014-01-28 Pekka Paalanen ppaala...@gmail.com: Hi Ian and Jason On Mon, 27 Jan 2014 12:26:23 -0700 Ian Romanick i...@freedesktop.org wrote: There are a number of theoretical uses, but I don't know that we've ever seen any in the wild. One is video playback. You likely want 30fps there. I would hope that no video player will use swap interval as a means of target timing, because the buffer queueing protocol I'm planning is supposed to be superior for accurately timed video presentation. The protocol will also be usable with EGL provided content, if the EGL implementation can cope with buffers being reserved by the display server for longer than usual. One more argument would be that video players actually don't want 30fps here, and do that only because of constrained resources. Every Smart TV sold nowadays has the motion-interpolation feature, which is (unlike frame-doubling, and at least from the viewpoint of some people) the proper way to display low-fps content on high-fps panels. PC-based video players don't have this feature because nobody so far has written the code that works on anything else than NVidia GPUs. -- Alexander E. Patrakov ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 4/4] compositor: Move view repositioning logic into shell
Remove the listener for output destroy from weston_view and instead iterate views owned by the shell in its own output destroy listener. This simplifies the code a bit since keeping the view listening for the destroy on the right output was a bit complicated. This also removes the function pointer output_destroyed from weston_view. The only user for it was desktop shell, but now this is all handled in shell.c. --- desktop-shell/shell.c | 86 +-- src/compositor.c | 68 src/compositor.h | 8 - 3 files changed, 70 insertions(+), 92 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 888e33b..fb69794 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -2956,8 +2956,6 @@ shell_handle_surface_destroy(struct wl_listener *listener, void *data) static void shell_surface_configure(struct weston_surface *, int32_t, int32_t); -static void -shell_surface_output_destroyed(struct weston_surface *); struct shell_surface * get_shell_surface(struct weston_surface *surface) @@ -2994,7 +2992,6 @@ create_common_surface(void *shell, struct weston_surface *surface, surface-configure = shell_surface_configure; surface-configure_private = shsurf; - surface-output_destroyed = shell_surface_output_destroyed; shsurf-shell = (struct desktop_shell *) shell; shsurf-unresponsive = 0; @@ -4793,19 +4790,6 @@ shell_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy) } } -static void -shell_surface_output_destroyed(struct weston_surface *es) -{ - struct shell_surface *shsurf = get_shell_surface(es); - - assert(shsurf); - - shsurf-saved_position_valid = false; - shsurf-next_state.maximized = false; - shsurf-next_state.fullscreen = false; - shsurf-state_changed = true; -} - static void launch_desktop_shell_process(void *data); static void @@ -5425,11 +5409,81 @@ workspace_move_surface_down_binding(struct weston_seat *seat, uint32_t time, } static void +shell_reposition_view_on_output_destroy(struct weston_view *view) +{ + struct weston_output *output, *first_output; + struct weston_compositor *ec = view-surface-compositor; + struct shell_surface *shsurf; + float x, y; + int visible; + + x = view-geometry.x; + y = view-geometry.y; + + /* At this point the destroyed output is not in the list anymore. +* If the view is still visible somewhere, we leave where it is, +* otherwise, move it to the first output. */ + visible = 0; + wl_list_for_each(output, ec-output_list, link) { + if (pixman_region32_contains_point(output-region, + x, y, NULL)) { + visible = 1; + break; + } + } + + if (!visible) { + first_output = container_of(ec-output_list.next, + struct weston_output, link); + + x = first_output-x + first_output-width / 4; + y = first_output-y + first_output-height / 4; + } + + weston_view_set_position(view, x, y); + + shsurf = get_shell_surface(view-surface); + + if (shsurf) { + shsurf-saved_position_valid = false; + shsurf-next_state.maximized = false; + shsurf-next_state.fullscreen = false; + shsurf-state_changed = true; + } +} + +static void +shell_reposition_views_on_output_destroy(struct shell_output *shell_output) +{ + struct desktop_shell *shell = shell_output-shell; + struct weston_output *output = shell_output-output; + struct weston_layer *layer; + struct weston_view *view; + + /* Move all views in the layers owned by the shell */ + wl_list_for_each(layer, shell-fullscreen_layer.link.prev, link) { + wl_list_for_each(view, layer-view_list, layer_link) { + if (view-output != output) + continue; + + shell_reposition_view_on_output_destroy(view); + } + + /* We don't start from the beggining of the layer list, so +* make sure we don't wrap around it. */ + if (layer == shell-background_layer) + break; + } +} + +static void handle_output_destroy(struct wl_listener *listener, void *data) { struct shell_output *output_listener = container_of(listener, struct shell_output, destroy_listener); + shell_reposition_views_on_output_destroy(output_listener); + wl_list_remove(output_listener-destroy_listener.link); wl_list_remove(output_listener-link); free(output_listener); diff --git a/src/compositor.c b/src/compositor.c index 6ac17e6..15291bd
[PATCH weston 1/4] input: Remove exported function weston_pointer_verify()
Instead, add a compositor signal that an output has been destroyed and handle that case locally in input.c. --- src/compositor.c | 17 ++--- src/compositor.h | 5 +++-- src/input.c | 20 +--- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/compositor.c b/src/compositor.c index 40e4b11..18018b1 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -3170,19 +3170,6 @@ weston_compositor_remove_output(struct weston_compositor *compositor, } } -static void -weston_compositor_verify_pointers(struct weston_compositor *ec) -{ - struct weston_seat *seat; - - wl_list_for_each(seat, ec-seat_list, link) { - if (!seat-pointer) - continue; - - weston_pointer_verify(seat-pointer); - } -} - WL_EXPORT void weston_output_destroy(struct weston_output *output) { @@ -3191,8 +3178,7 @@ weston_output_destroy(struct weston_output *output) weston_compositor_remove_output(output-compositor, output); wl_list_remove(output-link); - weston_compositor_verify_pointers(output-compositor); - + wl_signal_emit(output-compositor-output_destroyed_signal, output); wl_signal_emit(output-destroy_signal, output); free(output-name); @@ -3654,6 +3640,7 @@ weston_compositor_init(struct weston_compositor *ec, wl_signal_init(ec-update_input_panel_signal); wl_signal_init(ec-seat_created_signal); wl_signal_init(ec-output_created_signal); + wl_signal_init(ec-output_destroyed_signal); wl_signal_init(ec-session_signal); ec-session_active = 1; diff --git a/src/compositor.h b/src/compositor.h index 22a485f..ced792f 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -329,6 +329,8 @@ struct weston_pointer { wl_fixed_t x, y; uint32_t button_count; + + struct wl_listener output_destroy_listener; }; @@ -375,8 +377,6 @@ weston_pointer_move(struct weston_pointer *pointer, void weston_pointer_set_default_grab(struct weston_pointer *pointer, const struct weston_pointer_grab_interface *interface); -void -weston_pointer_verify(struct weston_pointer *pointer); struct weston_keyboard * weston_keyboard_create(void); @@ -579,6 +579,7 @@ struct weston_compositor { struct wl_signal seat_created_signal; struct wl_signal output_created_signal; + struct wl_signal output_destroyed_signal; struct wl_event_loop *input_loop; struct wl_event_source *input_loop_source; diff --git a/src/input.c b/src/input.c index 157066c..25ed133 100644 --- a/src/input.c +++ b/src/input.c @@ -438,6 +438,9 @@ weston_pointer_reset_state(struct weston_pointer *pointer) pointer-button_count = 0; } +static void +weston_pointer_handle_output_destroy(struct wl_listener *listener, void *data); + WL_EXPORT struct weston_pointer * weston_pointer_create(struct weston_seat *seat) { @@ -465,6 +468,11 @@ weston_pointer_create(struct weston_seat *seat) pointer-x = wl_fixed_from_int(100); pointer-y = wl_fixed_from_int(100); + pointer-output_destroy_listener.notify = + weston_pointer_handle_output_destroy; + wl_signal_add(seat-compositor-output_destroyed_signal, + pointer-output_destroy_listener); + return pointer; } @@ -478,6 +486,7 @@ weston_pointer_destroy(struct weston_pointer *pointer) wl_list_remove(pointer-focus_resource_listener.link); wl_list_remove(pointer-focus_view_listener.link); + wl_list_remove(pointer-output_destroy_listener.link); free(pointer); } @@ -871,14 +880,19 @@ weston_pointer_move(struct weston_pointer *pointer, wl_fixed_t x, wl_fixed_t y) /** Verify if the pointer is in a valid position and move it if it isn't. */ -WL_EXPORT void -weston_pointer_verify(struct weston_pointer *pointer) +static void +weston_pointer_handle_output_destroy(struct wl_listener *listener, void *data) { - struct weston_compositor *ec = pointer-seat-compositor; + struct weston_pointer *pointer; + struct weston_compositor *ec; struct weston_output *output, *closest = NULL; int x, y, distance, min = INT_MAX; wl_fixed_t fx, fy; + pointer = container_of(listener, struct weston_pointer, + output_destroy_listener); + ec = pointer-seat-compositor; + x = wl_fixed_to_int(pointer-x); y = wl_fixed_to_int(pointer-y); -- 1.8.1.2 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 2/4] compositor: Remove weston_output::move_signal
Since that signal is per output, it is necessary to track in which output a view is in so that the signal is handled properly. Instead, add a compositor wide output moved signal, that is handled by the shell. The shell iterates over the layers it owns to move views appropriately. --- desktop-shell/shell.c | 34 ++ desktop-shell/shell.h | 1 + src/compositor.c | 42 +- src/compositor.h | 2 +- 4 files changed, 41 insertions(+), 38 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index c275543..ae06382 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -5472,6 +5472,37 @@ handle_output_create(struct wl_listener *listener, void *data) } static void +handle_output_move(struct wl_listener *listener, void *data) +{ + struct desktop_shell *shell; + struct weston_output *output; + struct weston_layer *layer; + struct weston_view *view; + float x, y; + + shell = container_of(listener, struct desktop_shell, +output_move_listener); + output = data; + + /* Move all views in the layers owned by the shell */ + wl_list_for_each(layer, shell-fullscreen_layer.link.prev, link) { + wl_list_for_each(view, layer-view_list, layer_link) { + if (view-output != output) + continue; + + x = view-geometry.x + output-move_x; + y = view-geometry.y + output-move_y; + weston_view_set_position(view, x, y); + } + + /* We don't start from the beggining of the layer list, so +* make sure we don't wrap around it. */ + if (layer == shell-background_layer) + break; + } +} + +static void setup_output_destroy_handler(struct weston_compositor *ec, struct desktop_shell *shell) { @@ -5484,6 +5515,9 @@ setup_output_destroy_handler(struct weston_compositor *ec, shell-output_create_listener.notify = handle_output_create; wl_signal_add(ec-output_created_signal, shell-output_create_listener); + + shell-output_move_listener.notify = handle_output_move; + wl_signal_add(ec-output_moved_signal, shell-output_move_listener); } static void diff --git a/desktop-shell/shell.h b/desktop-shell/shell.h index dbb2854..4d4f00a 100644 --- a/desktop-shell/shell.h +++ b/desktop-shell/shell.h @@ -184,6 +184,7 @@ struct desktop_shell { enum animation_type focus_animation_type; struct wl_listener output_create_listener; + struct wl_listener output_move_listener; struct wl_list output_list; char *client; diff --git a/src/compositor.c b/src/compositor.c index 18018b1..ff7ee7b 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -347,26 +347,6 @@ static struct weston_subsurface * weston_surface_to_subsurface(struct weston_surface *surface); static void -weston_view_output_move_handler(struct wl_listener *listener, - void *data) -{ - struct weston_view *ev; - struct weston_output *output = data; - - ev = container_of(listener, struct weston_view, - output_move_listener); - - /* the child window's view-geometry is a relative coordinate to -* parent view, no need to move child_view. */ - if (ev-geometry.parent) - return; - - weston_view_set_position(ev, -ev-geometry.x + output-move_x, -ev-geometry.y + output-move_y); -} - -static void weston_view_output_destroy_handler(struct wl_listener *listener, void *data) { @@ -414,10 +394,8 @@ weston_view_output_destroy_handler(struct wl_listener *listener, if (ev-surface-output_destroyed) ev-surface-output_destroyed(ev-surface); - wl_list_remove(ev-output_move_listener.link); wl_list_remove(ev-output_destroy_listener.link); - wl_list_init(ev-output_move_listener.link); wl_list_init(ev-output_destroy_listener.link); } @@ -456,8 +434,6 @@ weston_view_create(struct weston_surface *surface) view-output = NULL; - view-output_move_listener.notify = weston_view_output_move_handler; - wl_list_init(view-output_move_listener.link); view-output_destroy_listener.notify = weston_view_output_destroy_handler; wl_list_init(view-output_destroy_listener.link); @@ -911,20 +887,14 @@ weston_view_assign_output(struct weston_view *ev) } pixman_region32_fini(region); - if (ev-output_mask != 0) { - wl_list_remove(ev-output_move_listener.link); + if (ev-output_mask != 0)
[PATCH weston 3/4] compositor: Add a visibility switch to weston_layers
Different parts of the shell, such as the workspace implementation, rely on making layers invisible to hide surfaces without discarding the order in which they appear. However, the layers are made invisible by removing them from the compositor's layers list. Instead, add the function weston_layer_show(), which can control the visibility of a layer, while maintaining it in the layers list. That way, it is not necessary to remember the order between layers when making them visible again. This also has the side effect of causing views in a hidden workspace and in an output that has been moved (due to another being unplugged) to be moved correctly. --- desktop-shell/input-panel.c | 6 ++--- desktop-shell/shell.c | 62 - src/compositor.c| 11 src/compositor.h| 4 +++ 4 files changed, 44 insertions(+), 39 deletions(-) diff --git a/desktop-shell/input-panel.c b/desktop-shell/input-panel.c index c08a403..5f0025b 100644 --- a/desktop-shell/input-panel.c +++ b/desktop-shell/input-panel.c @@ -63,8 +63,7 @@ show_input_panels(struct wl_listener *listener, void *data) shell-showing_input_panels = true; if (!shell-locked) - wl_list_insert(shell-panel_layer.link, - shell-input_panel_layer.link); + weston_layer_show(shell-input_panel_layer, 1); wl_list_for_each_safe(ipsurf, next, shell-input_panel.surfaces, link) { @@ -93,8 +92,7 @@ hide_input_panels(struct wl_listener *listener, void *data) shell-showing_input_panels = false; - if (!shell-locked) - wl_list_remove(shell-input_panel_layer.link); + weston_layer_show(shell-input_panel_layer, 0); wl_list_for_each_safe(view, next, shell-input_panel_layer.view_list, layer_link) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index ae06382..888e33b 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -819,13 +819,13 @@ seat_destroyed(struct wl_listener *listener, void *data) } static struct workspace * -workspace_create(void) +workspace_create(struct desktop_shell *shell) { struct workspace *ws = malloc(sizeof *ws); if (ws == NULL) return NULL; - weston_layer_init(ws-layer, NULL); + weston_layer_init(ws-layer, shell-input_panel_layer.link); wl_list_init(ws-focus_list); wl_list_init(ws-seat_destroyed_listener.link); @@ -864,7 +864,7 @@ activate_workspace(struct desktop_shell *shell, unsigned int index) struct workspace *ws; ws = get_workspace(shell, index); - wl_list_insert(shell-panel_layer.link, ws-layer.link); + weston_layer_show(ws-layer, 1); shell-workspaces.current = index; } @@ -994,7 +994,7 @@ finish_workspace_change_animation(struct desktop_shell *shell, workspace_deactivate_transforms(to); shell-workspaces.anim_to = NULL; - wl_list_remove(shell-workspaces.anim_from-layer.link); + weston_layer_show(shell-workspaces.anim_from-layer, 0); } static void @@ -1076,7 +1076,7 @@ animate_workspace_change(struct desktop_shell *shell, wl_list_insert(output-animation_list, shell-workspaces.animation.link); - wl_list_insert(from-layer.link.prev, to-layer.link); + weston_layer_show(to-layer, 1); workspace_translate_in(to, 0); @@ -1090,8 +1090,8 @@ update_workspace(struct desktop_shell *shell, unsigned int index, struct workspace *from, struct workspace *to) { shell-workspaces.current = index; - wl_list_insert(from-layer.link, to-layer.link); - wl_list_remove(from-layer.link); + weston_layer_show(to-layer, 1); + weston_layer_show(from-layer, 0); } static void @@ -1241,9 +1241,6 @@ take_surface_to_workspace_by_seat(struct desktop_shell *shell, if (shell-workspaces.anim_from == to shell-workspaces.anim_to == from) { - wl_list_remove(to-layer.link); - wl_list_insert(from-layer.link.prev, to-layer.link); - reverse_workspace_change_animation(shell, index, from, to); broadcast_current_workspace_state(shell); @@ -3732,19 +3729,15 @@ resume_desktop(struct desktop_shell *shell) terminate_screensaver(shell); - wl_list_remove(shell-lock_layer.link); - wl_list_insert(shell-compositor-cursor_layer.link, - shell-fullscreen_layer.link); - wl_list_insert(shell-fullscreen_layer.link, - shell-panel_layer.link); - if (shell-showing_input_panels) { - wl_list_insert(shell-panel_layer.link, - shell-input_panel_layer.link); - wl_list_insert(shell-input_panel_layer.link, - ws-layer.link); - } else { -
Re: [Mesa-dev] What use do swap interval 1 and OML_sync_control divisor and remainder have?
From the Kronos description: interval is silently clamped to minimum and maximum implementation dependent valuesbefore being stored; these values are defined by EGLConfig attributes EGL_MIN_SWAP_INTERVAL and EGL_MAX_SWAP_INTERVAL respectively. I think wayland egl can just clamp to 0,1 (or even 1,1 though apparently a lot of work has been done to support 0) and this question ignored. On 01/29/2014 08:33 AM, Alexander E. Patrakov wrote: [Just for the sake of argument] 2014-01-28 Pekka Paalanen ppaala...@gmail.com: Hi Ian and Jason On Mon, 27 Jan 2014 12:26:23 -0700 Ian Romanick i...@freedesktop.org wrote: There are a number of theoretical uses, but I don't know that we've ever seen any in the wild. One is video playback. You likely want 30fps there. I would hope that no video player will use swap interval as a means of target timing, because the buffer queueing protocol I'm planning is supposed to be superior for accurately timed video presentation. The protocol will also be usable with EGL provided content, if the EGL implementation can cope with buffers being reserved by the display server for longer than usual. One more argument would be that video players actually don't want 30fps here, and do that only because of constrained resources. Every Smart TV sold nowadays has the motion-interpolation feature, which is (unlike frame-doubling, and at least from the viewpoint of some people) the proper way to display low-fps content on high-fps panels. PC-based video players don't have this feature because nobody so far has written the code that works on anything else than NVidia GPUs. ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH 2/2] compositor: add a masking mechanism to weston_layer
I believe what he is trying to achieve is this display of two desktops on the same screen, such as for previewing desktop switching, or perhaps for an intermediate state of a swipe from one desktop to another: +--+ +---+ | +| | | | | A | |-+ | | +| | B | | | | |-+ | +--+ +---+ DESK 1DESK 2 The surfaces A and B are both large enough that if unclipped they would enter the area of the other desktop. This can't be done by putting a mask into the view stack. However I disagree with exposing the layers for this. First of all these are not layers, both desktops are in effect at the same layer. And it makes no sense for a lower layer (for normal use of layers) to not be clipped by the same clip as a higher layer. I think this could be solved by adding a clip to each view. This would be a pixel-aligned rectangle in output space, though perhaps the object should be designed so it can be expanded to more complex clips in the future. On 01/29/2014 04:28 AM, Ander Conselvan de Oliveira wrote: this adds a mechanism to mask the views belonging to a layer to an arbitrary rect, in the global space. The parts that don't fit in that rect will be clipped away. ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH libinput 2/2] Remove mention of delta coordinates having device specific direction
The event represent pointer motions on a screen, so this information is unnecessary. It could also be confused for meaning the provided coordinate's direction being device specific. Signed-off-by: Jonas Ådahl jad...@gmail.com --- src/libinput.h | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libinput.h b/src/libinput.h index 8d347b9..e2d83bf 100644 --- a/src/libinput.h +++ b/src/libinput.h @@ -363,9 +363,9 @@ libinput_event_pointer_get_time( /** * @ingroup event_pointer * - * Return the delta between the last event and the current event. The axis' - * positive direction is device-specific. For pointer events that are - * not of type LIBINPUT_EVENT_POINTER_MOTION, this function returns 0. + * Return the delta between the last event and the current event. For pointer + * events that are not of type LIBINPUT_EVENT_POINTER_MOTION, this function + * returns 0. * * @note It is an application bug to call this function for events other than * LIBINPUT_EVENT_POINTER_MOTION. @@ -379,9 +379,9 @@ libinput_event_pointer_get_dx( /** * @ingroup event_pointer * - * Return the delta between the last event and the current event. The - * axis' positive direction is device-specific. For pointer events that are - * not of type LIBINPUT_EVENT_POINTER_MOTION, this function returns 0. + * Return the delta between the last event and the current event. For pointer + * events that are not of type LIBINPUT_EVENT_POINTER_MOTION, this function + * returns 0. * * @note It is an application bug to call this function for events other than * LIBINPUT_EVENT_POINTER_MOTION. -- 1.8.3.2 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH libinput 1/2] Replace output screen size callback with transform helpers
Instead of automatically transforming absolute coordinates of touch and pointer events to screen coordinates, the user now uses the corresponding transform helper function. This means the coordinates returned by libinput_event_pointer_get_absolute_x(), libinput_event_pointer_get_absolute_y(), libinput_touch_get_x() and libinput_touch_get_y() has changed from being in output screen coordinate space to being in device specific coordinate space. For example, where one before would call libinput_event_touch_get_x(event), one now calls libinput_event_touch_get_x_transformed(event, output_width). Signed-off-by: Jonas Ådahl jad...@gmail.com --- src/evdev.c| 54 ++-- src/evdev.h| 10 + src/libinput.c | 44 src/libinput.h | 128 + test/litest.c | 11 - 5 files changed, 186 insertions(+), 61 deletions(-) diff --git a/src/evdev.c b/src/evdev.c index 46bd35a..cb83a1f 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -86,6 +86,24 @@ transform_absolute(struct evdev_device *device, int32_t *x, int32_t *y) } } +li_fixed_t +evdev_device_transform_x(struct evdev_device *device, +li_fixed_t x, +uint32_t width) +{ + return (x - device-abs.min_x) * width / + (device-abs.max_x - device-abs.min_x); +} + +li_fixed_t +evdev_device_transform_y(struct evdev_device *device, +li_fixed_t y, +uint32_t height) +{ + return (y - device-abs.min_y) * height / + (device-abs.max_y - device-abs.min_y); +} + static void evdev_flush_pending_event(struct evdev_device *device, uint32_t time) { @@ -242,16 +260,6 @@ evdev_process_touch(struct evdev_device *device, struct input_event *e, uint32_t time) { - struct libinput *libinput = device-base.seat-libinput; - int screen_width; - int screen_height; - - libinput-interface-get_current_screen_dimensions( - device-base, - screen_width, - screen_height, - libinput-user_data); - switch (e-code) { case ABS_MT_SLOT: evdev_flush_pending_event(device, time); @@ -267,16 +275,12 @@ evdev_process_touch(struct evdev_device *device, device-pending_event = EVDEV_ABSOLUTE_MT_UP; break; case ABS_MT_POSITION_X: - device-mt.slots[device-mt.slot].x = - (e-value - device-abs.min_x) * screen_width / - (device-abs.max_x - device-abs.min_x); + device-mt.slots[device-mt.slot].x = e-value; if (device-pending_event == EVDEV_NONE) device-pending_event = EVDEV_ABSOLUTE_MT_MOTION; break; case ABS_MT_POSITION_Y: - device-mt.slots[device-mt.slot].y = - (e-value - device-abs.min_y) * screen_height / - (device-abs.max_y - device-abs.min_y); + device-mt.slots[device-mt.slot].y = e-value; if (device-pending_event == EVDEV_NONE) device-pending_event = EVDEV_ABSOLUTE_MT_MOTION; break; @@ -287,28 +291,14 @@ static inline void evdev_process_absolute_motion(struct evdev_device *device, struct input_event *e) { - struct libinput *libinput = device-base.seat-libinput; - int screen_width; - int screen_height; - - libinput-interface-get_current_screen_dimensions( - device-base, - screen_width, - screen_height, - libinput-user_data); - switch (e-code) { case ABS_X: - device-abs.x = - (e-value - device-abs.min_x) * screen_width / - (device-abs.max_x - device-abs.min_x); + device-abs.x = e-value; if (device-pending_event == EVDEV_NONE) device-pending_event = EVDEV_ABSOLUTE_MOTION; break; case ABS_Y: - device-abs.y = - (e-value - device-abs.min_y) * screen_height / - (device-abs.max_y - device-abs.min_y); + device-abs.y = e-value; if (device-pending_event == EVDEV_NONE) device-pending_event = EVDEV_ABSOLUTE_MOTION; break; diff --git a/src/evdev.h b/src/evdev.h index 58ae552..37c32e5 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -146,6 +146,16 @@ int evdev_device_has_capability(struct evdev_device *device, enum libinput_device_capability capability); +li_fixed_t +evdev_device_transform_x(struct evdev_device *device, +li_fixed_t x, +uint32_t width); + +li_fixed_t
Re: [PATCH libinput 5/5] tools: add a tool for basic event debugging
On Wed, Jan 29, 2014 at 11:55:37AM +1000, Peter Hutterer wrote: Simply prints the various events to make it easier to check what's coming out of libinput. Works for --udev (the default) or for --device /dev/input/event0. Example output: event7DEVICE_ADDEDseat0 default event8DEVICE_ADDEDseat0 default event4POINTER_BUTTON +1.35s 272 pressed event5POINTER_MOTION +2.31s -3.00/ 2.00 Time is displayed relative to the starting time. Note: statically linked for easier debugging, but we don't distribute it (yet) anyway. Signed-off-by: Peter Hutterer peter.hutte...@who-t.net Neat tool! This and the other 4, Reviewed-by: Jonas Ådahl jad...@gmail.com --- Makefile.am | 2 +- configure.ac| 3 +- tools/.gitignore| 1 + tools/Makefile.am | 7 + tools/event-debug.c | 453 5 files changed, 464 insertions(+), 2 deletions(-) create mode 100644 tools/.gitignore create mode 100644 tools/Makefile.am create mode 100644 tools/event-debug.c diff --git a/Makefile.am b/Makefile.am index 07bfcd4..08bf7ce 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,3 @@ -SUBDIRS = src doc test +SUBDIRS = src doc test tools ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} diff --git a/configure.ac b/configure.ac index 7281bb4..44729a9 100644 --- a/configure.ac +++ b/configure.ac @@ -87,5 +87,6 @@ AC_CONFIG_FILES([Makefile src/Makefile src/libinput.pc src/libinput-version.h - test/Makefile]) + test/Makefile + tools/Makefile]) AC_OUTPUT diff --git a/tools/.gitignore b/tools/.gitignore new file mode 100644 index 000..2cdd654 --- /dev/null +++ b/tools/.gitignore @@ -0,0 +1 @@ +event-debug diff --git a/tools/Makefile.am b/tools/Makefile.am new file mode 100644 index 000..9c29f56 --- /dev/null +++ b/tools/Makefile.am @@ -0,0 +1,7 @@ +noinst_PROGRAMS = event-debug + +AM_CPPFLAGS = -I$(top_srcdir)/src + +event_debug_SOURCES = event-debug.c +event_debug_LDADD = ../src/libinput.la +event_debug_LDFLAGS = -static diff --git a/tools/event-debug.c b/tools/event-debug.c new file mode 100644 index 000..53e92b0 --- /dev/null +++ b/tools/event-debug.c @@ -0,0 +1,453 @@ +/* + * Copyright © 2014 Red Hat, Inc. + * + * 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. + */ + +#define _GNU_SOURCE +#include errno.h +#include fcntl.h +#include getopt.h +#include poll.h +#include stdio.h +#include signal.h +#include string.h +#include time.h +#include unistd.h +#include linux/input.h +#include sys/ioctl.h +#include sys/signalfd.h + +#include libinput.h + +static enum { + MODE_UDEV, + MODE_DEVICE, +} mode = MODE_UDEV; +static const char *device; +static const char *seat = seat0; +static struct udev *udev; +uint32_t start_time; + +static void +usage(void) +{ + printf(Usage: %s [--udev [seat]|--device /dev/input/event0]\n +--udev seat Use udev device discovery (default).\n + Specifying a seat ID is optional.\n +--device /path/to/device open the given device only\n, + program_invocation_short_name); +} + +static int +parse_args(int argc, char **argv) +{ + while (1) { + int c; + int option_index = 0; + static struct option opts[] = { + { device, 1, 0, 'd' }, + { udev, 0, 0, 'u' }, + { help, 0, 0, 'h' }, + { 0, 0, 0, 0} + }; + + c = getopt_long(argc, argv, h, opts, option_index); + if (c == -1) + break; + + switch(c) { +
Re: [PATCH libinput 2/2] Remove mention of delta coordinates having device specific direction
On Wed, Jan 29, 2014 at 09:33:12PM +0100, Jonas Ådahl wrote: The event represent pointer motions on a screen, so this information is unnecessary. It could also be confused for meaning the provided coordinate's direction being device specific. Signed-off-by: Jonas Ådahl jad...@gmail.com just for the archives: what I meant with this sentence is that while the positive x/y coordinates are right/down on the screen, there is no guarantee that matches a device's notion of up/down. for example, if you hold a graphics tablet upside down, the positive y direction is actually up on the tablet (if it isn't software-rotated). This is probably obvious anyway, and the extra documentation does little other than adding confusion, so Reviewed-by: Peter Hutterer peter.hutte...@who-t.net. Cheers, Peter --- src/libinput.h | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libinput.h b/src/libinput.h index 8d347b9..e2d83bf 100644 --- a/src/libinput.h +++ b/src/libinput.h @@ -363,9 +363,9 @@ libinput_event_pointer_get_time( /** * @ingroup event_pointer * - * Return the delta between the last event and the current event. The axis' - * positive direction is device-specific. For pointer events that are - * not of type LIBINPUT_EVENT_POINTER_MOTION, this function returns 0. + * Return the delta between the last event and the current event. For pointer + * events that are not of type LIBINPUT_EVENT_POINTER_MOTION, this function + * returns 0. * * @note It is an application bug to call this function for events other than * LIBINPUT_EVENT_POINTER_MOTION. @@ -379,9 +379,9 @@ libinput_event_pointer_get_dx( /** * @ingroup event_pointer * - * Return the delta between the last event and the current event. The - * axis' positive direction is device-specific. For pointer events that are - * not of type LIBINPUT_EVENT_POINTER_MOTION, this function returns 0. + * Return the delta between the last event and the current event. For pointer + * events that are not of type LIBINPUT_EVENT_POINTER_MOTION, this function + * returns 0. * * @note It is an application bug to call this function for events other than * LIBINPUT_EVENT_POINTER_MOTION. -- 1.8.3.2 ___ 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 libinput 1/2] Replace output screen size callback with transform helpers
On Wed, Jan 29, 2014 at 09:33:11PM +0100, Jonas Ådahl wrote: Instead of automatically transforming absolute coordinates of touch and pointer events to screen coordinates, the user now uses the corresponding transform helper function. This means the coordinates returned by libinput_event_pointer_get_absolute_x(), libinput_event_pointer_get_absolute_y(), libinput_touch_get_x() and libinput_touch_get_y() has changed from being in output screen coordinate space to being in device specific coordinate space. For example, where one before would call libinput_event_touch_get_x(event), one now calls libinput_event_touch_get_x_transformed(event, output_width). Signed-off-by: Jonas Ådahl jad...@gmail.com --- src/evdev.c| 54 ++-- src/evdev.h| 10 + src/libinput.c | 44 src/libinput.h | 128 + test/litest.c | 11 - 5 files changed, 186 insertions(+), 61 deletions(-) diff --git a/src/evdev.c b/src/evdev.c index 46bd35a..cb83a1f 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -86,6 +86,24 @@ transform_absolute(struct evdev_device *device, int32_t *x, int32_t *y) } } +li_fixed_t +evdev_device_transform_x(struct evdev_device *device, + li_fixed_t x, + uint32_t width) +{ + return (x - device-abs.min_x) * width / + (device-abs.max_x - device-abs.min_x); +} + +li_fixed_t +evdev_device_transform_y(struct evdev_device *device, + li_fixed_t y, + uint32_t height) +{ + return (y - device-abs.min_y) * height / + (device-abs.max_y - device-abs.min_y); you're mixing coordinate systems here, x and y are in fixed_t but abs.min/max is in normal integers. that breaks if you have a non-zero min. You'll need to convert the rest to li_fixed_t too if you want to keep the integer division. also, should we add a non-zero min for width and height to scale to a screen not the top/left-most? The compositor can just add it afterwards, but it would have to convert to fixed_t as well: x = libinput_event_touch_get_x_transformed(event, screen_width); x += li_fixed_from_int(screen_offset); which is more error prone than something like: x = libinput_event_touch_get_x_transformed(event, screen_offset_x, screen_width); also, is it likely that the caller always has the screen dimensions handy when it comes to processing events? or would an config-style approach work better: libinput_device_set_output_dimensions(device, xoff, yoff, width, height); ... x = libinput_event_touch_get_x_transformed(event); y = libinput_event_touch_get_y_transformed(event); I also suspect that the device-specific dimensions will be rather useless if we don't have a call to get the min/max from each device. which I should be focusing on real soon :) Cheers, Peter +} + static void evdev_flush_pending_event(struct evdev_device *device, uint32_t time) { @@ -242,16 +260,6 @@ evdev_process_touch(struct evdev_device *device, struct input_event *e, uint32_t time) { - struct libinput *libinput = device-base.seat-libinput; - int screen_width; - int screen_height; - - libinput-interface-get_current_screen_dimensions( - device-base, - screen_width, - screen_height, - libinput-user_data); - switch (e-code) { case ABS_MT_SLOT: evdev_flush_pending_event(device, time); @@ -267,16 +275,12 @@ evdev_process_touch(struct evdev_device *device, device-pending_event = EVDEV_ABSOLUTE_MT_UP; break; case ABS_MT_POSITION_X: - device-mt.slots[device-mt.slot].x = - (e-value - device-abs.min_x) * screen_width / - (device-abs.max_x - device-abs.min_x); + device-mt.slots[device-mt.slot].x = e-value; if (device-pending_event == EVDEV_NONE) device-pending_event = EVDEV_ABSOLUTE_MT_MOTION; break; case ABS_MT_POSITION_Y: - device-mt.slots[device-mt.slot].y = - (e-value - device-abs.min_y) * screen_height / - (device-abs.max_y - device-abs.min_y); + device-mt.slots[device-mt.slot].y = e-value; if (device-pending_event == EVDEV_NONE) device-pending_event = EVDEV_ABSOLUTE_MT_MOTION; break; @@ -287,28 +291,14 @@ static inline void evdev_process_absolute_motion(struct evdev_device *device, struct input_event *e) { - struct libinput *libinput = device-base.seat-libinput; - int screen_width; - int screen_height; - - libinput-interface-get_current_screen_dimensions( - device-base, -