Skip to content

Commit 653f016

Browse files
thankyouverycoolIdanHo
authored andcommitted
LibGUI+Apps: Adjust Splitter spacings
Different thread highlights between widgets lead to different visual weights between splitters, even when they have the same width or height. This means some splitters look best at odd sizes while others even. This sets the default spacing to the most commonly used, depending on orientation, and adjusts spacing for a few apps based on the new paint rect. The most consistent look across apps requires some manual tweaking occassionally. Knurlheads, use your discretion!
1 parent fe864af commit 653f016

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

Userland/Applications/Help/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
100100
auto toolbar = TRY(toolbar_container->try_add<GUI::Toolbar>());
101101

102102
auto splitter = TRY(widget->try_add<GUI::HorizontalSplitter>());
103-
splitter->layout()->set_spacing(5);
103+
splitter->layout()->set_spacing(4);
104104

105105
auto manual_model = ManualModel::create();
106106

Userland/Demos/WidgetGallery/GalleryGML/BasicsTab.gml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
}
1212

1313
@GUI::HorizontalSplitter {
14-
layout: @GUI::HorizontalBoxLayout {}
14+
layout: @GUI::HorizontalBoxLayout {
15+
spacing: 4
16+
}
1517

1618
@GUI::Frame {
1719
name: "label_frame"

Userland/DevTools/HackStudio/HackStudioWidget.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ HackStudioWidget::HackStudioWidget(String path_to_project)
9191
auto& toolbar_container = add<GUI::ToolbarContainer>();
9292

9393
auto& outer_splitter = add<GUI::HorizontalSplitter>();
94-
outer_splitter.layout()->set_spacing(5);
94+
outer_splitter.layout()->set_spacing(4);
9595

9696
auto& left_hand_splitter = outer_splitter.add<GUI::VerticalSplitter>();
97-
left_hand_splitter.layout()->set_spacing(5);
97+
left_hand_splitter.layout()->set_spacing(6);
9898
left_hand_splitter.set_fixed_width(150);
9999
create_project_tab(left_hand_splitter);
100100
m_project_tree_view_context_menu = create_project_tree_view_context_menu();
@@ -110,7 +110,6 @@ HackStudioWidget::HackStudioWidget(String path_to_project)
110110
m_diff_viewer = m_right_hand_stack->add<DiffViewer>();
111111

112112
m_editors_splitter = m_right_hand_stack->add<GUI::VerticalSplitter>();
113-
m_editors_splitter->layout()->set_spacing(5);
114113
m_editors_splitter->layout()->set_margins({ 3, 0, 0 });
115114
add_new_editor(*m_editors_splitter);
116115

Userland/Libraries/LibGUI/Splitter.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ Splitter::Splitter(Orientation orientation)
2727
set_background_role(ColorRole::Button);
2828
set_layout<BoxLayout>(orientation);
2929
set_fill_with_background_color(true);
30-
layout()->set_spacing(3);
30+
if (m_orientation == Gfx::Orientation::Horizontal)
31+
layout()->set_spacing(3);
32+
else
33+
layout()->set_spacing(4);
3134
}
3235

3336
Splitter::~Splitter()

0 commit comments

Comments
 (0)