Task 3: placement sizes are max(bucket default, content minimum) so the outer border encloses each widget's content

27 widgets (18 dialogs, 2 calendars, 3 views, 4 choosers) get larger defaults via MIN_SIZES in widgets/tools/gen_registry.py, applied in default_size() and regenerated into widgets/common/registry.h. Verified live under Xvfb (dialogs sweep, 28 widgets, screenshots): 15 of the 18 originally-overflowing dialogs now fit at placement time (e.g. GtkAboutDialog 520x260, TPageSetupDialog 320x400, TColorDialog 520x300, picture dialogs 480x240). Three are internal draw-layout collisions, not placement size: TFindDialog Direction label overlaps Find Next, GtkFileChooserDialog Name header overlaps the path field, TFontDialog caption overlaps OK/Cancel (its lists expand to fill the dialog height).
This commit is contained in:
cnmcdee committed 2026-12-02 05:10:27 +00:00
1 parent f78a3e5ce6
commit 56a34bb1cf
2 files changed
+62 -13

No files matched your search

+2 -2
View File
@@ -1179,8 +1179,8 @@ inline const int kWidgetSection[kWidgetCount] = {
};
// Default placement size (w, h) per widget type.
inline const int kWidgetDefaultW[kWidgetCount] = { 300, 180, 200, 150, 300, 200, 300, 200, 300, 200, 150, 150, 200, 200, 200, 150, 150, 150, 300, 200, 300, 260, 180, 180, 300, 200, 200, 180, 180, 180, 200, 200, 150, 300, 200, 200, 200, 150, 300, 200, 200, 200, 260, 260, 200, 200, 200, 200, 200, 200, 180, 200, 180, 150, 200, 260, 150, 200, 200, 200, 150, 200, 300, 150, 260, 200, 200, 180, 200, 200, 200, 300, 180, 150, 150, 200, 180, 150, 180, 300, 180, 180, 180, 180, 300, 150, 150, 260, 260, 260, 180, 150, 260, 150, 150, 150, 200, 260, 200, 200, 150, 300, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 300, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 300, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 150, 150, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 150, 150, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 150, 150, 200, 150, 150, 150, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 150, 200, 260, 200, 200, 150, 150, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 180, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 150, 150, 180, 300, 200, 300, 150, 150, 150, 150, 200, 150, 300, 200, 180, 180, 200, 200, 180, 200, 180, 260, 180, 150, 200, 180, 180, 300, 150, 200, 300, 300, 200, 200, 200, 200, 200, 180, 180, 200, 260, 200, 180, 260, 260, 300, 300, 260, 300, 200, 200, 200, 200, 200, 300, 300, 180, 150, 150, 300, 300, 300, 180, 200, 300, 200, 260, 260, 150, 150, 200, 200, 180, 260, 260, 300, 180, 200, 150, 200, 200, 200, 260, 150, 180, 320, 320 };
inline const int kWidgetDefaultH[kWidgetCount] = { 220, 30, 90, 36, 220, 90, 220, 90, 220, 90, 36, 36, 90, 90, 90, 36, 36, 36, 220, 90, 220, 180, 30, 30, 220, 90, 90, 30, 30, 30, 90, 90, 36, 220, 90, 90, 90, 36, 220, 90, 90, 90, 180, 180, 90, 90, 90, 90, 90, 90, 30, 90, 30, 36, 90, 180, 36, 90, 90, 90, 36, 90, 220, 36, 180, 90, 90, 30, 90, 90, 90, 220, 30, 36, 36, 90, 30, 36, 30, 220, 30, 30, 30, 30, 220, 36, 36, 180, 180, 180, 30, 36, 180, 36, 36, 36, 90, 180, 90, 90, 36, 220, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 220, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 220, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 36, 36, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 36, 36, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 36, 36, 90, 36, 36, 36, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 36, 90, 180, 90, 90, 36, 36, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 30, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 36, 36, 30, 220, 90, 220, 36, 36, 36, 36, 90, 36, 220, 90, 30, 30, 90, 90, 30, 90, 30, 180, 30, 36, 90, 30, 30, 220, 36, 90, 220, 220, 90, 90, 90, 90, 90, 30, 30, 90, 180, 90, 30, 180, 180, 220, 220, 180, 220, 90, 90, 90, 90, 90, 220, 220, 30, 36, 36, 220, 220, 220, 30, 90, 220, 90, 180, 180, 36, 36, 90, 90, 30, 180, 180, 220, 30, 90, 36, 90, 90, 90, 180, 36, 30, 200, 200 };
inline const int kWidgetDefaultW[kWidgetCount] = { 520, 180, 200, 150, 300, 320, 300, 200, 320, 200, 150, 150, 260, 200, 200, 150, 150, 150, 340, 340, 300, 260, 180, 180, 300, 200, 200, 180, 180, 180, 200, 200, 150, 360, 340, 200, 200, 150, 340, 340, 200, 200, 260, 260, 200, 200, 200, 200, 200, 200, 180, 200, 180, 150, 200, 260, 150, 200, 200, 200, 150, 200, 300, 150, 260, 200, 200, 180, 200, 200, 200, 360, 180, 150, 150, 200, 180, 150, 180, 300, 180, 180, 180, 180, 320, 150, 150, 260, 260, 260, 180, 150, 260, 150, 150, 150, 200, 320, 200, 200, 150, 300, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 300, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 300, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 150, 150, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 150, 150, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 150, 150, 200, 150, 150, 150, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 150, 200, 260, 200, 200, 150, 150, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 180, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 150, 150, 180, 300, 260, 320, 150, 150, 150, 150, 200, 150, 520, 200, 180, 180, 200, 200, 180, 200, 180, 260, 180, 150, 200, 180, 180, 380, 150, 200, 320, 300, 200, 200, 200, 200, 200, 180, 180, 200, 320, 200, 180, 260, 260, 300, 480, 260, 320, 200, 200, 200, 200, 200, 320, 300, 180, 150, 150, 360, 300, 480, 180, 200, 360, 200, 260, 260, 150, 150, 200, 200, 180, 360, 260, 340, 180, 200, 150, 200, 200, 200, 260, 150, 180, 320, 320 };
inline const int kWidgetDefaultH[kWidgetCount] = { 260, 30, 90, 36, 220, 240, 220, 90, 280, 90, 36, 36, 200, 90, 90, 36, 36, 36, 240, 260, 220, 180, 30, 30, 220, 90, 90, 30, 30, 30, 90, 90, 36, 240, 260, 90, 90, 36, 240, 260, 90, 90, 180, 180, 90, 90, 90, 90, 90, 90, 30, 90, 30, 36, 90, 180, 36, 90, 90, 90, 36, 90, 220, 36, 180, 90, 90, 30, 90, 90, 90, 300, 30, 36, 36, 90, 30, 36, 30, 220, 30, 30, 30, 30, 300, 36, 36, 180, 180, 180, 30, 36, 180, 36, 36, 36, 90, 200, 90, 90, 36, 220, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 220, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 220, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 36, 36, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 36, 36, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 36, 36, 90, 36, 36, 36, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 36, 90, 180, 90, 90, 36, 36, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 30, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 36, 36, 30, 220, 200, 280, 36, 36, 36, 36, 90, 36, 300, 90, 30, 30, 90, 90, 30, 90, 30, 180, 30, 36, 90, 30, 30, 260, 36, 90, 420, 220, 90, 90, 90, 90, 90, 30, 30, 90, 200, 90, 30, 180, 180, 220, 240, 180, 400, 90, 90, 90, 90, 90, 300, 220, 30, 36, 36, 260, 220, 240, 30, 90, 260, 90, 180, 180, 36, 36, 90, 90, 30, 200, 180, 280, 30, 90, 36, 90, 90, 90, 180, 36, 30, 200, 200 };
inline int index_of(const std::string& name) {
for (int i = 0; i < kWidgetCount; ++i)
+60 -11
View File
@@ -18,26 +18,75 @@ from sections import SECTIONS, ASSIGNMENT, section_of, validate # noqa: E402
from widget_count import component_names # noqa: E402
# Task 3 — content minimum sizes (w, h) per widget type, measured from
# the widget's fixed content (drawn text rows, columns, grids, action bars).
# Placement uses max(bucket default, content minimum) so the outer border
# encloses the contents at placement time. Values verified live under Xvfb.
MIN_SIZES = {
# Dialogs: fixed stacked content + action bar needs more than 300x220.
"GtkAboutDialog": (520, 260),
"GtkAssistant": (320, 280),
"GtkColorChooserDialog": (340, 240),
"GtkFileChooserDialog": (360, 240),
"GtkFontChooserDialog": (340, 240),
"GtkPrintUnixDialog": (360, 300),
"GtkShortcutsWindow": (320, 300),
"TCalendarDialog": (320, 280),
"TColorDialog": (520, 300),
"TFindDialog": (380, 260),
"TFontDialog": (320, 420),
"TOpenPictureDialog": (480, 240),
"TPageSetupDialog": (320, 400),
"TPrintDialog": (320, 300),
"TReplaceDialog": (360, 260),
"TSavePictureDialog": (480, 240),
"TSelectDirectoryDialog": (360, 260),
"TTaskDialog": (340, 280),
# Calendars: fixed 7x6 date grid needs more than 200x90.
"GtkCalendar": (260, 200),
"TCalendar": (260, 200),
# Views/lists: fixed columns spill past the right edge at 260 wide.
"GtkTreeView": (320, 200),
"TListView": (320, 200),
"TStringGrid": (360, 200),
# Chooser widgets: same fixed content as their dialog counterparts.
"GtkAppChooserWidget": (320, 240),
"GtkColorChooserWidget": (340, 260),
"GtkFileChooserWidget": (340, 260),
"GtkFontChooserWidget": (340, 260),
}
def default_size(name):
"""Sensible default placement size (w, h) for a widget type."""
"""Sensible default placement size (w, h) for a widget type.
Task 3: the placement size is max(bucket default, content minimum),
so the outer border encloses the widget's fixed contents at placement
time instead of the contents spilling past a too-small border.
"""
n = name.lower()
if "spreadsheet" in n or "graph" in n:
return (320, 200)
if "dialog" in n or "window" in n or "assistant" in n or n.endswith("form"):
return (300, 220)
if any(k in n for k in ("treeview", "listview", "grid", "columnview",
base = (320, 200)
elif "dialog" in n or "window" in n or "assistant" in n or n.endswith("form"):
base = (300, 220)
elif any(k in n for k in ("treeview", "listview", "grid", "columnview",
"shelltree", "shelllist", "drawgrid", "stringgrid",
"textview", "memo", "notebook", "pagecontrol",
"tabcontrol", "stack")):
return (260, 180)
if any(k in n for k in ("button", "check", "radio", "toggle", "switch",
base = (260, 180)
elif any(k in n for k in ("button", "check", "radio", "toggle", "switch",
"updown", "spin")):
return (150, 36)
if any(k in n for k in ("label", "entry", "edit", "combo", "scale",
base = (150, 36)
elif any(k in n for k in ("label", "entry", "edit", "combo", "scale",
"slider", "scrollbar", "separator", "statusbar",
"search", "progressbar", "levelbar")):
return (180, 30)
return (200, 90)
base = (180, 30)
else:
base = (200, 90)
mn = MIN_SIZES.get(name)
if mn:
return (max(base[0], mn[0]), max(base[1], mn[1]))
return base
HEADER = """// GENERATED by tools/gen_registry.py — do not edit by hand.