[PATCH weston v3] libweston: Position layers in an absolute way

Quentin Glidic sardemff7+wayland at sardemff7.net
Sat Dec 17 13:02:26 UTC 2016


On 05/12/2016 16:48, Quentin Glidic wrote:
> On 05/12/2016 16:29, Pekka Paalanen wrote:
>> On Mon, 11 Jul 2016 11:29:40 +0200
>> Quentin Glidic <sardemff7+wayland at sardemff7.net> wrote:
>>
>>> From: Quentin Glidic <sardemff7+git at sardemff7.net>
 >>> [snip]
>>> + */
>>> +WL_EXPORT void
>>> +weston_layer_set_position(struct weston_layer *layer,
>>> +              enum weston_layer_position position)
>>> +{
>>> +    struct weston_layer *below;
>>> +
>>> +    layer->position = position;
>>> +    wl_list_for_each_reverse(below, &layer->compositor->layer_list, 
>>> link) {
>>> +        if (below->position >= layer->position) {
>>> +            wl_list_insert(&below->link, &layer->link);
>>> +            return;
>>> +        }
>>> +    }
>>> +    wl_list_insert(layer->compositor->layer_list.next, &layer->link);
>>
>> I think this should not have .next, should it? Now it's adding the new
>> layer below the top-most layer when it should become the top-most
>> layer, no?
> 
> Honestly I cannot remember why I used .next here… I vaguely remember 
> something like layers are not ordered as one would think, but that’s 
> all. I will try to re-figure it out.
> 

FTR, you were right. It’s a leftover from one of the first version of 
this code. It did not cause any issue because this branch only triggers 
for the fade layer, so the list is empty, then the fade layer 
subsequently acts as a catch-all.


-- 

Quentin “Sardem FF7” Glidic


More information about the wayland-devel mailing list