[PATCH weston] compositor-rpi: Fix input initialization
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk The input initialization code assumes the outputs have already been initialized; thus create the outputs first. This fixes a segfault upon startup. It is also what the drm and fbdev backends do. --- src/compositor-rpi.c | 19 --- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c index 399090d..e7c0e0d 100644 --- a/src/compositor-rpi.c +++ b/src/compositor-rpi.c @@ -527,13 +527,6 @@ rpi_compositor_create(struct wl_display *display, int *argc, char *argv[], weston_log(Dispmanx planes are %s buffered.\n, compositor-single_buffer ? single : double); - if (udev_input_init(compositor-input, - compositor-base, - compositor-udev, seat0) != 0) { - weston_log(Failed to initialize udev input.\n); - goto out_launcher; - } - for (key = KEY_F1; key KEY_F9; key++) weston_compositor_add_key_binding(compositor-base, key, MODIFIER_CTRL | MODIFIER_ALT, @@ -549,19 +542,23 @@ rpi_compositor_create(struct wl_display *display, int *argc, char *argv[], bcm_host_init(); if (rpi_renderer_create(compositor-base, param-renderer) 0) - goto out_udev_input; + goto out_launcher; if (rpi_output_create(compositor, param-output_transform) 0) goto out_renderer; + if (udev_input_init(compositor-input, + compositor-base, + compositor-udev, seat0) != 0) { + weston_log(Failed to initialize udev input.\n); + goto out_renderer; + } + return compositor-base; out_renderer: compositor-base.renderer-destroy(compositor-base); -out_udev_input: - udev_input_destroy(compositor-input); - out_launcher: weston_launcher_destroy(compositor-base.launcher); -- 1.8.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston v2] dim-layer: fix dimming for unfocused surfaces
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 | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 30bd273..3087042 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -4250,14 +4250,14 @@ activate(struct desktop_shell *shell, struct weston_surface *es, else restore_all_output_modes(shell-compositor); + /* Update the surface’s layer. This brings it to the top of the stacking +* order as appropriate. */ + shell_surface_update_layer(shsurf); + if (shell-focus_animation_type != ANIMATION_NONE) { ws = get_current_workspace(shell); animate_focus_change(shell, ws, get_default_view(old_es), get_default_view(es)); } - - /* Update the surface’s layer. This brings it to the top of the stacking -* order as appropriate. */ - shell_surface_update_layer(shsurf); } /* no-op func for checking black surface */ -- 1.8.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston] desktop-shell: Properly handle lowered fullscreen surfaces
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk lower_fullscreen_surface() was removing fullscreen surfaces from the fullscreen layer and inserting them in the normal workspace layer. However, those fullscreen surfaces were never put back in the fullscreen layer, causing bugs such as unrelated surfaces being drawn between a fullscreen surface and its black view. Change the lower_fullscreen_surface() logic so that it lowers fullscreen surfaces to the workspace layer *and* hides the black views. Make this reversible by re-configuring the lowered fullscreen surface: when it is re-configured, the black view will be shown again and the surface will be restacked in the fullscreen layer. https://bugs.freedesktop.org/show_bug.cgi?id=73575 https://bugs.freedesktop.org/show_bug.cgi?id=74221 https://bugs.freedesktop.org/show_bug.cgi?id=74222 --- desktop-shell/exposay.c | 8 +++ desktop-shell/shell.c | 56 + desktop-shell/shell.h | 5 + 3 files changed, 42 insertions(+), 27 deletions(-) diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c index fe7a3a7..f09224f 100644 --- a/desktop-shell/exposay.c +++ b/desktop-shell/exposay.c @@ -141,7 +141,7 @@ exposay_highlight_surface(struct desktop_shell *shell, shell-exposay.row_current = esurface-row; shell-exposay.column_current = esurface-column; - activate(shell, view-surface, shell-exposay.seat); + activate(shell, view-surface, shell-exposay.seat, false); shell-exposay.focus_current = view; } @@ -283,8 +283,6 @@ exposay_layout(struct desktop_shell *shell) if (shell-exposay.focus_current == esurface-view) highlight = esurface; - set_alpha_if_fullscreen(get_shell_surface(view-surface)); - exposay_animate_in(esurface); i++; @@ -502,10 +500,10 @@ 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-surface, -shell-exposay.seat); +shell-exposay.seat, true); else if (shell-exposay.focus_prev) activate(shell, shell-exposay.focus_prev-surface, -shell-exposay.seat); +shell-exposay.seat, true); 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 3087042..a8a0537 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -173,6 +173,7 @@ struct shell_surface { struct { bool maximized; bool fullscreen; + bool lowered; /* fullscreen but lowered, see lower_fullscreen_layer() */ bool relative; } state, next_state; /* surface states */ bool state_changed; @@ -223,13 +224,6 @@ struct shell_seat { } popup_grab; }; -void -set_alpha_if_fullscreen(struct shell_surface *shsurf) -{ - if (shsurf shsurf-state.fullscreen) - shsurf-fullscreen.black_view-alpha = 0.25; -} - static struct desktop_shell * shell_surface_get_shell(struct shell_surface *shsurf); @@ -611,7 +605,7 @@ 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); + activate(shell, next, state-seat, true); } else { if (shell-focus_animation_type == ANIMATION_DIM_LAYER) { if (state-ws-focus_animation) @@ -1762,10 +1756,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); + activate(shsurf-shell, shsurf-surface, seat, true); surface_move(shsurf, seat); } else if (shsurf button == BTN_RIGHT state) { - activate(shsurf-shell, shsurf-surface, seat); + activate(shsurf-shell, shsurf-surface, seat, true); surface_rotate(shsurf, seat); } } @@ -2036,7 +2030,7 @@ shell_surface_calculate_layer_link (struct shell_surface *shsurf) switch (shsurf-type) { case SHELL_SURFACE_POPUP: case SHELL_SURFACE_TOPLEVEL: - if (shsurf-state.fullscreen) { + if (shsurf-state.fullscreen !shsurf-state.lowered) { return shsurf-shell-fullscreen_layer.view_list; } else if (shsurf-parent) { /* Move the surface to its parent layer so @@ -2533,6 +2527,8 @@
[PATCH weston] Fullscreen surfaces
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk Hi, The following patch fixes a bunch of issues related to fullscreen surfaces. From my testing, this makes fullscreen clients behave much better. We still have the following problem, but it is not a regression. I am not sure how to fix it without regressing other situations. Have a fullscreen client and launch a new client, it won't appear in the front but behind the fullscreen client. https://bugs.freedesktop.org/show_bug.cgi?id=74219 Emilio Pozuelo Monfort (1): desktop-shell: Properly handle lowered fullscreen surfaces desktop-shell/exposay.c | 8 +++ desktop-shell/shell.c | 56 + desktop-shell/shell.h | 5 + 3 files changed, 42 insertions(+), 27 deletions(-) -- 1.8.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[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
[PATCH weston] desktop-shell: initialize children link
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk Since commit 9046d2, when destroying a surface, we remove all the links from its children. But when the child surfaces are destroyed, those links will be removed again, but since they were not properly initialized, weston will crash. Call shell_surface_set_parent instead which removes the link and sets parent while also initializing the link, thus avoiding this crash. --- desktop-shell/shell.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index c275543..111a7aa 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -2927,10 +2927,8 @@ destroy_shell_surface(struct shell_surface *shsurf) weston_view_destroy(shsurf-view); wl_list_remove(shsurf-children_link); - wl_list_for_each_safe(child, next, shsurf-children_list, children_link) { - wl_list_remove(child-children_link); - child-parent = NULL; - } + wl_list_for_each_safe(child, next, shsurf-children_list, children_link) + shell_surface_set_parent(child, NULL); wl_list_remove(shsurf-link); free(shsurf); -- 1.8.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH] alt-tab: highlight the currently selected view
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- desktop-shell/shell.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 13a42e1..3cb82a1 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -3987,12 +3987,23 @@ struct alt_tab_preview { static void alt_tab_next(struct alt_tab *alt_tab) { + struct alt_tab_preview *preview, *current; + alt_tab-current = alt_tab-current-next; /* Make sure we're not pointing to the list header e.g. after * cycling through the whole list. */ if (alt_tab-current-next == alt_tab-preview_list.next) alt_tab-current = alt_tab-current-next; + + current = wl_container_of(alt_tab-current, current, link); + + /* Highlight the currently selected view */ + wl_list_for_each(preview, alt_tab-preview_list, link) { + preview-view-alpha = (current == preview) ? 1.0 : 0.25; + weston_view_geometry_dirty(preview-view); + weston_surface_damage(preview-view-surface); + } } static void -- 1.8.5.2 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 2/3] switcher: change keybinding to mod+esc
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk To avoid conflicts with the new alt+tab. --- 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 3d0836d..cc7d8dc 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -5278,7 +5278,7 @@ switcher_key(struct weston_keyboard_grab *grab, struct switcher *switcher = container_of(grab, struct switcher, grab); enum wl_keyboard_key_state state = state_w; - if (key == KEY_TAB state == WL_KEYBOARD_KEY_STATE_PRESSED) + if (key == KEY_ESC state == WL_KEYBOARD_KEY_STATE_PRESSED) switcher_next(switcher); } @@ -5727,7 +5727,7 @@ shell_add_bindings(struct weston_compositor *ec, struct desktop_shell *shell) weston_compositor_add_button_binding(ec, BTN_RIGHT, mod, rotate_binding, NULL); - weston_compositor_add_key_binding(ec, KEY_TAB, mod, switcher_binding, + weston_compositor_add_key_binding(ec, KEY_ESC, mod, switcher_binding, shell); weston_compositor_add_key_binding(ec, KEY_F9, mod, backlight_binding, ec); -- 1.8.5.2 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 1/3] Bring alt-tab back to life
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- desktop-shell/shell.c | 251 ++ 1 file changed, 251 insertions(+) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 96e31a1..3d0836d 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -3964,6 +3964,254 @@ terminate_binding(struct weston_seat *seat, uint32_t time, uint32_t key, wl_display_terminate(compositor-wl_display); } +struct alt_tab { + struct desktop_shell *shell; + struct weston_keyboard_grab grab; + + struct wl_list *current; + + struct wl_list preview_list; +}; + +struct alt_tab_preview { + struct alt_tab *alt_tab; + + struct weston_view *view; + struct weston_transform transform; + + struct wl_listener listener; + + struct wl_list link; +}; + +static void +alt_tab_next(struct alt_tab *alt_tab) +{ + alt_tab-current = alt_tab-current-next; + + /* Make sure we're not pointing to the list header e.g. after +* cycling through the whole list. */ + if (alt_tab-current-next == alt_tab-preview_list.next) + alt_tab-current = alt_tab-current-next; +} + +static void +alt_tab_destroy(struct alt_tab *alt_tab) +{ + struct alt_tab_preview *preview, *next; + struct weston_keyboard *keyboard = alt_tab-grab.keyboard; + + if (alt_tab-current alt_tab-current != alt_tab-preview_list) { + preview = wl_container_of(alt_tab-current, preview, link); + + activate(alt_tab-shell, preview-view-surface, +(struct weston_seat *) keyboard-seat); + } + + wl_list_for_each_safe(preview, next, alt_tab-preview_list, link) { + wl_list_remove(preview-link); + wl_list_remove(preview-listener.link); + weston_view_destroy(preview-view); + free(preview); + } + + weston_keyboard_end_grab(keyboard); + if (keyboard-input_method_resource) + keyboard-grab = keyboard-input_method_grab; + + free(alt_tab); +} + +static void +alt_tab_handle_surface_destroy(struct wl_listener *listener, void *data) +{ + struct alt_tab_preview *preview = + container_of(listener, struct alt_tab_preview, listener); + struct alt_tab *alt_tab = preview-alt_tab; + int advance = 0; + + /* If the preview that we're removing is the currently selected one, +* we want to move to the next one. So we move to -prev and then +* call _next() after removing the preview. */ + if (alt_tab-current == preview-link) { + alt_tab-current = alt_tab-current-prev; + advance = 1; + } + + wl_list_remove(preview-listener.link); + wl_list_remove(preview-link); + + free(preview); + + if (advance) + alt_tab_next(alt_tab); + + /* If the last preview goes away, stop the alt-tab */ + if (wl_list_empty(alt_tab-current)) + alt_tab_destroy(alt_tab); +} + +static void +alt_tab_key(struct weston_keyboard_grab *grab, + uint32_t time, uint32_t key, uint32_t state_w) +{ + struct alt_tab *alt_tab = container_of(grab, struct alt_tab, grab); + enum wl_keyboard_key_state state = state_w; + + if (key == KEY_TAB state == WL_KEYBOARD_KEY_STATE_PRESSED) + alt_tab_next(alt_tab); +} + +static void +alt_tab_modifier(struct weston_keyboard_grab *grab, uint32_t serial, +uint32_t mods_depressed, uint32_t mods_latched, +uint32_t mods_locked, uint32_t group) +{ + struct alt_tab *alt_tab = container_of(grab, struct alt_tab, grab); + struct weston_seat *seat = (struct weston_seat *) grab-keyboard-seat; + + if ((seat-modifier_state MODIFIER_ALT) == 0) + alt_tab_destroy(alt_tab); +} + +static void +alt_tab_cancel(struct weston_keyboard_grab *grab) +{ + struct alt_tab *alt_tab = container_of(grab, struct alt_tab, grab); + + alt_tab_destroy(alt_tab); +} + +static const struct weston_keyboard_grab_interface alt_tab_grab = { + alt_tab_key, + alt_tab_modifier, + alt_tab_cancel, +}; + +static int +view_for_alt_tab(struct weston_view *view) +{ + struct shell_surface *shsurf = get_shell_surface(view-surface); + if (!shsurf) + return 0; + + if (shsurf-parent) + return 0; + + if (view != get_default_view(view-surface)) + return 0; + + return 1; +} + +static void +alt_tab_binding(struct weston_seat *seat, uint32_t time, uint32_t key, + void *data) +{ + struct alt_tab *alt_tab; + struct desktop_shell *shell = data; + struct weston_output *output = get_default_output(shell-compositor); + struct workspace *ws; + struct weston_view *view; + int num_surfaces = 0; + int x, y, side, margin; + +
[PATCH 0/3] alt-tab redux
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk Hi Kristian, I know you said in your alt-tab removal commit that we would reintroduce it again in 1.5. I'm just sending this here now to have it on list, but waiting for 1.4 to be released is fine with me. In this series I'm not removing the old switcher. I don't think there's any harm in keeping both together, as long as they can coexist. With the change to mod-esc, that's the case now (that fixes the `alt-tab leaves views around' bug you were seeing with modifier=alt as there were then two alt-tab modifiers and that didn't work out very well). Also note that e.g. gnome-shell has both alt-tab and alt-esc (and alt-` which we don't have). But if you still the old switcher should be removed when we merge this, I won't complain! There are some cosmetic improvements I would like to make (e.g. making the selected window more obvious via prelight or something) but I'll send those later on when I actually have them. Cheers, Emilio Emilio Pozuelo Monfort (3): Bring alt-tab back to life switcher: change keybinding to mod+esc alt-tab: switch binding to mod+tab desktop-shell/shell.c | 254 +- 1 file changed, 252 insertions(+), 2 deletions(-) -- 1.8.5.2 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 3/3] alt-tab: switch binding to mod+tab
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk So it uses the same modifier than the rest of the bindings, for consistency's sake. --- desktop-shell/shell.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index cc7d8dc..13a42e1 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -5691,9 +5691,6 @@ shell_add_bindings(struct weston_compositor *ec, struct desktop_shell *shell) weston_compositor_add_key_binding(ec, KEY_BACKSPACE, MODIFIER_CTRL | MODIFIER_ALT, terminate_binding, ec); - weston_compositor_add_key_binding(ec, KEY_TAB, - MODIFIER_ALT, - alt_tab_binding, shell); weston_compositor_add_button_binding(ec, BTN_LEFT, 0, click_to_activate_binding, shell); @@ -5729,6 +5726,8 @@ shell_add_bindings(struct weston_compositor *ec, struct desktop_shell *shell) weston_compositor_add_key_binding(ec, KEY_ESC, mod, switcher_binding, shell); + weston_compositor_add_key_binding(ec, KEY_TAB, mod, alt_tab_binding, + shell); weston_compositor_add_key_binding(ec, KEY_F9, mod, backlight_binding, ec); weston_compositor_add_key_binding(ec, KEY_BRIGHTNESSDOWN, 0, -- 1.8.5.2 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 2/2] exposay: set an alpha on fullscreen surfaces
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk This makes the desktop background actually draw when there is a fullscreen surface and we go to exposay. --- I'm not sure if this one is right, but it does the trick... If this is not too hacky I could split set_alpha_if_fullscreen() into is_fullscreen() and set_alpha() and do the right thing from exposay.c if that is preferred. desktop-shell/exposay.c | 2 ++ desktop-shell/shell.c | 7 +++ desktop-shell/shell.h | 3 +++ 3 files changed, 12 insertions(+) diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c index f409aa3..01bf0b1 100644 --- a/desktop-shell/exposay.c +++ b/desktop-shell/exposay.c @@ -286,6 +286,8 @@ exposay_layout(struct desktop_shell *shell) if (shell-exposay.focus_current == esurface-view) highlight = esurface; + set_alpha_if_fullscreen(get_shell_surface(view-surface)); + exposay_animate_in(esurface); i++; diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index f85a269..4cc23d5 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -222,6 +222,13 @@ struct shell_seat { } popup_grab; }; +void +set_alpha_if_fullscreen(struct shell_surface *shsurf) +{ + if (shsurf shsurf-state.fullscreen) + shsurf-fullscreen.black_view-alpha = 0.25; +} + static struct desktop_shell * shell_surface_get_shell(struct shell_surface *shsurf); diff --git a/desktop-shell/shell.h b/desktop-shell/shell.h index 7a8194d..8ef550f 100644 --- a/desktop-shell/shell.h +++ b/desktop-shell/shell.h @@ -188,6 +188,9 @@ struct desktop_shell { char *client; }; +void +set_alpha_if_fullscreen(struct shell_surface *shsurf); + struct weston_output * get_default_output(struct weston_compositor *compositor); -- 1.8.5.2 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 1/2] exposay: fix infinite loop with fullscreen surfaces
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk We were calling exposay_highlight_surface() inside a wl_list_for_each loop for a layer, but exposay_highlight_surface() calls activate() which calls shell_surface_update_layer(), which removes the surface from its layer and reinserts it, causing an infinite loop. Call exposay_highlight_surface() outside the for_each to avoid this. https://bugs.freedesktop.org/show_bug.cgi?id=72404 --- desktop-shell/exposay.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c index 81da00a..f409aa3 100644 --- a/desktop-shell/exposay.c +++ b/desktop-shell/exposay.c @@ -187,7 +187,7 @@ exposay_layout(struct desktop_shell *shell) struct weston_compositor *compositor = shell-compositor; struct weston_output *output = get_default_output(compositor); struct weston_view *view; - struct exposay_surface *esurface; + struct exposay_surface *esurface, *highlight = NULL; int w, h; int i; int last_row_removed = 0; @@ -284,13 +284,16 @@ exposay_layout(struct desktop_shell *shell) esurface-height = view-surface-height * esurface-scale; if (shell-exposay.focus_current == esurface-view) - exposay_highlight_surface(shell, esurface); + highlight = esurface; exposay_animate_in(esurface); i++; } + if (highlight) + exposay_highlight_surface(shell, highlight); + weston_compositor_schedule_repaint(shell-compositor); return EXPOSAY_LAYOUT_ANIMATE_TO_OVERVIEW; -- 1.8.5.2 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH] dim-layer: fix dimming for unfocused surfaces
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); + } + restore_all_output_modes(shell-compositor); + } if (shell-focus_animation_type != ANIMATION_NONE) { ws = get_current_workspace(shell); -- 1.8.5.2 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH] Make the default desktop shell client configurable
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk The default can be set by passing WESTON_SHELL_CLIENT as an argument to configure, similarly to WESTON_NATIVE_BACKEND. --- configure.ac | 9 + man/Makefile.am| 1 + man/weston.ini.man | 3 ++- src/shell.c| 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index a460d3b..bd8ff44 100644 --- a/configure.ac +++ b/configure.ac @@ -35,6 +35,8 @@ LT_INIT([disable-static]) AC_ARG_VAR([WESTON_NATIVE_BACKEND], [Set the native backend to use, if Weston is not running under Wayland nor X11. @:@default=drm-backend.so@:@]) +AC_ARG_VAR([WESTON_SHELL_CLIENT], + [Set the default desktop shell client to load if none is specified in weston.ini. @:@default=weston-desktop-shell@:@]) PKG_PROG_PKG_CONFIG() @@ -456,6 +458,13 @@ AC_MSG_NOTICE([Weston's native backend: $WESTON_NATIVE_BACKEND]) AC_DEFINE_UNQUOTED([WESTON_NATIVE_BACKEND], [$WESTON_NATIVE_BACKEND], [The default backend to load, if not wayland nor x11.]) +if test x$WESTON_SHELL_CLIENT = x; then + WESTON_SHELL_CLIENT=weston-desktop-shell +fi +AC_MSG_NOTICE([Weston's default desktop shell client: $WESTON_SHELL_CLIENT]) +AC_DEFINE_UNQUOTED([WESTON_SHELL_CLIENT], [$WESTON_SHELL_CLIENT], + [The default desktop shell client to load.]) + AC_ARG_ENABLE(demo-clients, AS_HELP_STRING([--enable-demo-clients], [install demo clients built with weston]),, diff --git a/man/Makefile.am b/man/Makefile.am index e4abd8c..5fb030a 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -7,6 +7,7 @@ endif MAN_SUBSTS = \ -e 's|__weston_native_backend__|$(WESTON_NATIVE_BACKEND)|g' \ -e 's|__weston_modules_dir__|$(pkglibdir)|g' \ + -e 's|__weston_shell_client__|$(WESTON_SHELL_CLIENT)|g' \ -e 's|__version__|$(PACKAGE_VERSION)|g' SUFFIXES = .1 .5 .7 .man diff --git a/man/weston.ini.man b/man/weston.ini.man index cc88ca8..6be90bf 100644 --- a/man/weston.ini.man +++ b/man/weston.ini.man @@ -141,7 +141,8 @@ The entries that can appear in this section are: .TP 7 .BI client= file sets the path for the shell client to run. If not specified -weston-desktop-shell is launched (string). +.I __weston_shell_client__ +is launched (string). .TP 7 .BI background-image= file sets the path for the background image file (string). diff --git a/src/shell.c b/src/shell.c index 605f090..7146aad 100644 --- a/src/shell.c +++ b/src/shell.c @@ -541,7 +541,7 @@ shell_configuration(struct desktop_shell *shell) section = weston_config_get_section(shell-compositor-config, shell, NULL, NULL); weston_config_section_get_string(section, -client, s, LIBEXECDIR /weston-desktop-shell); +client, s, LIBEXECDIR / WESTON_SHELL_CLIENT); shell-client = s; weston_config_section_get_string(section, binding-modifier, s, super); -- 1.8.4.rc3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 2/2] exposay: properly go away when the modifier is pressed
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk We no longer receive an exposay_binding() call while exposay is in-flight as we have grabbed the keyboard, so we need to listen on the modifiers callback for the modifier press and release. --- src/shell.c | 31 +++ 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/shell.c b/src/shell.c index 6ba1f10..2e0e44d 100644 --- a/src/shell.c +++ b/src/shell.c @@ -220,6 +220,9 @@ struct desktop_shell { int row_current; int column_current; + + bool mod_pressed; + bool mod_invalid; } exposay; uint32_t binding_modifier; @@ -5367,6 +5370,29 @@ exposay_modifier(struct weston_keyboard_grab *grab, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group) { + struct desktop_shell *shell = + container_of(grab, struct desktop_shell, exposay.grab_kbd); + struct weston_seat *seat = (struct weston_seat *) grab-keyboard-seat; + + /* We want to know when mod has been pressed and released. +* FIXME: There is a problem here: if mod is pressed, then a key +* is pressed and released, then mod is released, we will treat that +* as if only mod had been pressed and released. */ + if (seat-modifier_state) { + if (seat-modifier_state == shell-binding_modifier) + shell-exposay.mod_pressed = true; + } else { + shell-exposay.mod_invalid = true; + } + } else { + if (shell-exposay.mod_pressed !shell-exposay.mod_invalid) + exposay_set_state(shell, EXPOSAY_TARGET_CANCEL, seat); + + shell-exposay.mod_invalid = false; + shell-exposay.mod_pressed = false; + } + + return; } static void @@ -5512,10 +5538,7 @@ exposay_binding(struct weston_seat *seat, enum weston_keyboard_modifier modifier { struct desktop_shell *shell = data; - if (shell-exposay.state_target == EXPOSAY_TARGET_OVERVIEW) - exposay_set_state(shell, EXPOSAY_TARGET_CANCEL, seat); - else - exposay_set_state(shell, EXPOSAY_TARGET_OVERVIEW, seat); + exposay_set_state(shell, EXPOSAY_TARGET_OVERVIEW, seat); } static void -- 1.8.4.rc3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 1/2] input: don't run modifier bindings when the kbd is grabbed
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk We don't want bindings to be run while the keyboard is grabbed. Otherwise the binding handler may grab the keyboard too, making the old grab go away without even being cancelled. --- src/bindings.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/bindings.c b/src/bindings.c index fb758d1..fe21ed6 100644 --- a/src/bindings.c +++ b/src/bindings.c @@ -293,6 +293,9 @@ weston_compositor_run_modifier_binding(struct weston_compositor *compositor, { struct weston_binding *b; + if (seat-keyboard-grab != seat-keyboard-default_grab) + return; + wl_list_for_each(b, compositor-modifier_binding_list, link) { weston_modifier_binding_handler_t handler = b-handler; -- 1.8.4.rc3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Prevent multiple keybindings from running simultaneously
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk The first patch here prevents modifier keybindings from running while the keyboard is grabbed. This can be seen by going to alt-tab and then pressing mod before releasing alt. That will call the exposay binding handler which will then start exposay and take the keyboard grab, and alt-tab will never notice what happened as its grab has gone away without cancel being called, causing alt-tab to leave views around. We could solve this in other ways depending on what behaviour we actually want. E.g. we could call weston_keyboard_grab_interface.cancel for the previous grab when weston_keyboard_start_grab() is called. The second patch makes exposay work after the above change. Previously exposay relied on its binding handler being called even when it had the keyboard grab. Now that that no longer happens, we listen on the modifiers() handler for mod to be pressed and released. The current code properly notices when another modifier is pressed before or after mod (e.g. press mod, press shift, release shift, release mod) but doesn't notice non-modifier keys (press mod, press a, release a, release mod will cancel exposay though it shouldn't). Suggestions on how to best do this are appreciated. Emilio Pozuelo Monfort (2): input: don't run modifier bindings when the kbd is grabbed exposay: properly go away when the modifier is pressed src/bindings.c | 3 +++ src/shell.c| 31 +++ 2 files changed, 30 insertions(+), 4 deletions(-) -- 1.8.4.rc3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 2/2] exposay: properly go away when the modifier is pressed
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk We no longer receive an exposay_binding() call while exposay is in-flight as we have grabbed the keyboard, so we need to listen on the modifiers callback for the modifier press and release. --- Sorry, I tweaked the braces before sending and missed one. Fixed and verified now. --- src/shell.c | 31 +++ 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/shell.c b/src/shell.c index 6ba1f10..2084ed6 100644 --- a/src/shell.c +++ b/src/shell.c @@ -220,6 +220,9 @@ struct desktop_shell { int row_current; int column_current; + + bool mod_pressed; + bool mod_invalid; } exposay; uint32_t binding_modifier; @@ -5367,6 +5370,29 @@ exposay_modifier(struct weston_keyboard_grab *grab, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group) { + struct desktop_shell *shell = + container_of(grab, struct desktop_shell, exposay.grab_kbd); + struct weston_seat *seat = (struct weston_seat *) grab-keyboard-seat; + + /* We want to know when mod has been pressed and released. +* FIXME: There is a problem here: if mod is pressed, then a key +* is pressed and released, then mod is released, we will treat that +* as if only mod had been pressed and released. */ + if (seat-modifier_state) { + if (seat-modifier_state == shell-binding_modifier) { + shell-exposay.mod_pressed = true; + } else { + shell-exposay.mod_invalid = true; + } + } else { + if (shell-exposay.mod_pressed !shell-exposay.mod_invalid) + exposay_set_state(shell, EXPOSAY_TARGET_CANCEL, seat); + + shell-exposay.mod_invalid = false; + shell-exposay.mod_pressed = false; + } + + return; } static void @@ -5512,10 +5538,7 @@ exposay_binding(struct weston_seat *seat, enum weston_keyboard_modifier modifier { struct desktop_shell *shell = data; - if (shell-exposay.state_target == EXPOSAY_TARGET_OVERVIEW) - exposay_set_state(shell, EXPOSAY_TARGET_CANCEL, seat); - else - exposay_set_state(shell, EXPOSAY_TARGET_OVERVIEW, seat); + exposay_set_state(shell, EXPOSAY_TARGET_OVERVIEW, seat); } static void -- 1.8.4.rc3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH] exposay: provide a cancel func to the ptr grab iface
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk Fixes a crash when cancel is called while exposay is in progress. --- src/shell.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/src/shell.c b/src/shell.c index f102e9a..6ba1f10 100644 --- a/src/shell.c +++ b/src/shell.c @@ -5275,10 +5275,20 @@ exposay_button(struct weston_pointer_grab *grab, uint32_t time, uint32_t button, shell-exposay.clicked = NULL; } +static void +exposay_pointer_grab_cancel(struct weston_pointer_grab *grab) +{ + struct desktop_shell *shell = + container_of(grab, struct desktop_shell, exposay.grab_ptr); + + exposay_set_state(shell, EXPOSAY_TARGET_CANCEL, shell-exposay.seat); +} + static const struct weston_pointer_grab_interface exposay_ptr_grab = { noop_grab_focus, exposay_motion, exposay_button, + exposay_pointer_grab_cancel, }; static int -- 1.8.4.rc3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH] shell: don't crash if a pointer's focus is null
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk It's possible for a pointer's focus to be null, e.g. because the focus surface has been bestroyed. Prevent a crash when that happens and a client takes too long to respond to a ping. Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- src/shell.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shell.c b/src/shell.c index 82c3cd8..ce8e9dd 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1861,7 +1861,8 @@ ping_timeout_handler(void *data) shsurf-unresponsive = 1; wl_list_for_each(seat, shsurf-surface-compositor-seat_list, link) - if (seat-pointer-focus-surface == shsurf-surface) + if (seat-pointer-focus + seat-pointer-focus-surface == shsurf-surface) set_busy_cursor(shsurf, seat-pointer); return 1; -- 1.8.4.rc3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel