[PATCH] [RFC] desktop-shell: change the alpha of black view in fullscreen mode
hyungwon.hwang7
hyungwon.hwang7 at gmail.com
Fri Dec 4 17:40:14 PST 2015
Hello Bryce,
On 2015년 12월 04일 07:18, Bryce Harrington wrote:
> On Thu, Dec 03, 2015 at 10:33:27PM +0900, Hyungwon Hwang wrote:
>> This patch changes the alpha value of black view in fullscreen mode,
>> when the applications opacity changes.
>>
>> Signed-off-by: Hyungwon Hwang <hyungwon.hwang7 at gmail.com>
>> ---
>> This patch is incomplete, and just a proof of concept. But I want to
>> make this patch as the starting point of discussion related the opacity
>> in fullscreen mode [1]. I tested it with weston-fullscreen.
>
> Thanks for sending this as an RFC, as a follow up to the earlier
> discussion with pq. I notice some of the points he had raised in that
> discussion (e.g. avoiding alpha for letterbox edges, etc.) aren't
> being addressed. In technical terms this patch doesn't look bad but you
> might include a discussion of how the remaining problems would be
> handled?
>
OK. Next time I send RFC, I will clear my opinion. Thanks for your comment.
> Also, don't forget to use your samsung address when sending patches
> (assuming this is for work).
It's my hobby at home.
Best regards,
Hyungwon Hwnag
>
>> 1. Changing the opacity in normal mode.
>> 2. Changing the opacity in fullscreen mode.
>> 3. Changing the opacity in fullscreen mode, but the content is smaller
>> then output.
>> 4. After 1 & 2, switch to another application.
>> 5. After 3, switch to another application.
>>
>> In case of 1 ~ 4, it works fine. But in case of 5, the opacity does
>> not be kept, and it must be fixed. I think that it is also related another
>> issue I stated in PS below.
>>
>> I want to discuss about what stance Weston will be on with this issue
>> : When opacity changes in fullscreen mode, which surface's opacity should
>> be affected.
>>
>> PS. As I made this patch, I found that the opacity resets when the user switch
>> to another application irrespective of fullscreen. It also seemed a little
>> odd to me.
>>
>> Best regards,
>> Hyungwon Hwang
>>
>> [1]
>> http://lists.freedesktop.org/archives/wayland-devel/2015-December/025859.html
>>
>> desktop-shell/shell.c | 36 +++++++++++++++++++++++-------------
>> 1 file changed, 23 insertions(+), 13 deletions(-)
>>
>> diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
>> index 780902d..418c66f 100644
>> --- a/desktop-shell/shell.c
>> +++ b/desktop-shell/shell.c
>> @@ -2767,7 +2767,7 @@ black_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy);
>> static struct weston_view *
>> create_black_surface(struct weston_compositor *ec,
>> struct weston_surface *fs_surface,
>> - float x, float y, int w, int h)
>> + float x, float y, int w, int h, float alpha)
>> {
>> struct weston_surface *surface = NULL;
>> struct weston_view *view;
>> @@ -2783,11 +2783,12 @@ create_black_surface(struct weston_compositor *ec,
>> weston_surface_destroy(surface);
>> return NULL;
>> }
>> + view->alpha = alpha;
>>
>> surface->configure = black_surface_configure;
>> surface->configure_private = fs_surface;
>> weston_surface_set_label_func(surface, black_surface_get_label);
>> - weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1);
>> + weston_surface_set_color(surface, 0.0, 0.0, 0.0, alpha);
>> pixman_region32_fini(&surface->opaque);
>> pixman_region32_init_rect(&surface->opaque, 0, 0, w, h);
>> pixman_region32_fini(&surface->input);
>> @@ -2812,7 +2813,8 @@ shell_ensure_fullscreen_black_view(struct shell_surface *shsurf)
>> shsurf->surface,
>> output->x, output->y,
>> output->width,
>> - output->height);
>> + output->height,
>> + shsurf->view->alpha);
>>
>> weston_view_geometry_dirty(shsurf->fullscreen.black_view);
>> weston_layer_entry_remove(&shsurf->fullscreen.black_view->layer_link);
>> @@ -4717,10 +4719,24 @@ resize_binding(struct weston_pointer *pointer, uint32_t time,
>> }
>>
>> static void
>> +do_adjust_alpha(struct weston_view *view, wl_fixed_t value) {
>> + float step = 0.005;
>> +
>> + view->alpha -= wl_fixed_to_double(value) * step;
>> +
>> + if (view->alpha > 1.0)
>> + view->alpha = 1.0;
>> + if (view->alpha < step)
>> + view->alpha = step;
>> +
>> + weston_view_geometry_dirty(view);
>> + weston_surface_damage(view->surface);
>> +}
>> +
>> +static void
>> surface_opacity_binding(struct weston_pointer *pointer, uint32_t time,
>> uint32_t axis, wl_fixed_t value, void *data)
>> {
>> - float step = 0.005;
>> struct shell_surface *shsurf;
>> struct weston_surface *focus = pointer->focus->surface;
>> struct weston_surface *surface;
>> @@ -4734,15 +4750,9 @@ surface_opacity_binding(struct weston_pointer *pointer, uint32_t time,
>> if (!shsurf)
>> return;
>>
>> - shsurf->view->alpha -= wl_fixed_to_double(value) * step;
>> -
>> - if (shsurf->view->alpha > 1.0)
>> - shsurf->view->alpha = 1.0;
>> - if (shsurf->view->alpha < step)
>> - shsurf->view->alpha = step;
>> -
>> - weston_view_geometry_dirty(shsurf->view);
>> - weston_surface_damage(surface);
>> + do_adjust_alpha(shsurf->view, value);
>> + if (shsurf->fullscreen.black_view)
>> + do_adjust_alpha(shsurf->fullscreen.black_view, value);
>> }
>>
>> static void
>> --
>> 1.9.1
>>
>> _______________________________________________
>> wayland-devel mailing list
>> wayland-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> .
>
More information about the wayland-devel
mailing list