Opened 8 years ago

Closed 8 years ago

#6979 closed bug (fixed)

Layout API bugs in Network

Reported by: axeld Owned by: yourpalal
Priority: normal Milestone: R1
Component: Kits/Interface Kit Version: R1/Development
Keywords: Cc:
Blocked By: Blocking: #5524
Has a Patch: no Platform: All


The Network preferences show two different bugs in the current layout API implementation since hrev39834:

  • When switching from a wireless device to an ethernet device, the menu field is hidden, but the window size doesn't change, and the gap is not going away anymore.
  • When launching Network, and an ethernet device is the first in the list, the menu field is hidden, and the insets are still applied even though the complete row is empty. This is a major inconvenience that, IMO, should be considered as a bug.

Change History (4)

comment:1 Changed 8 years ago by axeld

Owner: changed from axeld to yourpalal
Status: newassigned

Maybe yourpalal wants to have a look?

comment:2 in reply to:  1 Changed 8 years ago by yourpalal

Replying to axeld:

Maybe yourpalal wants to have a look?

Will do :)

comment:3 Changed 8 years ago by yourpalal

Blocking: 5524 added
Status: assignedin-progress

After looking into this, I think these two issues are symptoms of a larger one. Basically, in a BGridLayout, empty rows/cols are given no special consideration. Without items adding any constraints to a row or column, the max size for that row/column defaults to B_SIZE_UNLIMITED, which means that it will soak up any extra space in the layout (which is why the row isn't collapsing when the BMenuField is hidden). Also, empty rows and columns still have spacing applied, because they are not considered to be special.

What I'm thinking is to catch empty rows and columns (in BTwoDimensionalLayout) and basically discard them this means for layout purposes, they would take up no space, and not add any spacing. This situation is complicated a bit by the BTwoDimensionalLayout::AlignLayoutWith() feature, but when a layout is aligned with another, this would be disabled (maybe if both have the same empty row or column, we could still discard it). There could be a problem where applications rely on the current behaviour, but this could mostly be worked around by adding a BSpaceLayoutItem to the layout (which is more correct, anyway).

comment:4 Changed 8 years ago by yourpalal

Resolution: fixed
Status: in-progressclosed

Should be fixed in hrev41252. Rows or columns in a BGridLayout are collapsed when they have no min/max constraints other than B_SIZE_UNSET (or no constraints at all). If you want a row or column not to collapse when it is empty, give it a max size of B_SIZE_UNLIMITED (or some other constraint). I haven't tested the network preflet, but duplicating the conditions in a test leads me to believe that this will solve this problem there. BGroupLayout currently uses it's own mechanisms to collapse empty rows/columns (each one only has one item though). Soon I will modify BGroupLayout to be more like BGridLayout in this respect, which will make AlignLayoutWith() work a bit differently (but better, I think). Closing this ticket as 'fixed'

Note: See TracTickets for help on using tickets.