Re: [PATCH 1/4] Popup var inspector size requisition code rework



Dodji Seketeli <dodji seketeli org> a écrit:

>>> Now that we are doing this on the scrolled window (the container)
>>> rather than on the popup variable inspector itself, it seems to me
>>> that it is the height of the scrolled window that we want to stay
>>> smaller than max_height, not necessarily the height of its child
>>> widget, or am I missing something ?
>>> 
>>> FWIW, I have tested the code snipped below and it seems to behave
>>> fine, unless I have missed a corner case:
>>> 
>>>             // If the height of the container is too big so that
>>>             // it overflows the max usable height, clip it.
>>>             if (req.height > max_height) {
>>>                 req->height = max_height;
>>>             } else {
>>>                 req->height = child_req.height;
>>>             }
>>
>> No, that would let it grow past the max_height.
>>
>> As an example, lets say that the container itself thinks it should be 20
>> pixels high, the child widget thinks it should be 600 pixels high, and
>> we've calculated that the max_heigh is 400. When we check if
>> (req.height > max_height), we are checking if (20 > 400), which is
>> false. But we should really be comparing the child widget's height
>> request here.
>
> My understanding is that size_request on the container (the call to
> Gtk::ScrolledWindow::on_size_request at the beginning of the function)
> should invoke the size_request function of its children and of all the
> relevant visual elements that contribute to its size.  So by default, we
> should not have 20 pixels high for the container when its child is
> requesting 600.  We should at least have 600 pixels for the container as
> well.

After looking at the code of gtk+ again, I think you are correct.  If
the scroll bar policy is *not* GTK_POLICY_NEVER then the size of the
child of the child element is not taken in account by the size_request
call.  And then yes, we need to do what you are doing.  So this hunk is
OK by me and I have committed the patch.

Thanks!

-- 
		Dodji


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]