5
5
6
6
constexpr uint8_t TITLEBAR_HEIGHT = 24 ;
7
7
constexpr uint32_t TITLEBAR_COLOR = 0x303030 ;
8
+ constexpr uint8_t BORDER_WIDTH = 1 ;
9
+ constexpr uint32_t BORDER_COLOR = 0x505050 ;
8
10
9
11
static consteval std::array<float , 4 > rrggbb_to_floats (uint32_t rrggbb) {
10
12
return std::array<float , 4 >(
@@ -17,14 +19,18 @@ Ssd::Ssd(View& parent) noexcept : view(parent) {
17
19
wlr_scene_node_set_position (&scene_tree->node , 0 , 0 );
18
20
wlr_scene_node_set_enabled (&scene_tree->node , true );
19
21
20
- auto color = rrggbb_to_floats (TITLEBAR_COLOR);
21
- titlebar_rect = wlr_scene_rect_create (
22
- scene_tree, parent.surface_current .width + get_extra_width (), get_titlebar_height (), color.data ());
22
+ auto titlebar_color = rrggbb_to_floats (TITLEBAR_COLOR);
23
+ auto view_geo = view.get_surface_geometry ();
24
+ titlebar_rect = wlr_scene_rect_create (scene_tree, view_geo.width , TITLEBAR_HEIGHT, titlebar_color.data ());
25
+ wlr_scene_node_set_position (&titlebar_rect->node , BORDER_WIDTH, BORDER_WIDTH);
26
+ wlr_scene_node_lower_to_bottom (&titlebar_rect->node );
23
27
wlr_scene_node_set_enabled (&titlebar_rect->node , true );
24
28
25
- border_rect = wlr_scene_rect_create (scene_tree, parent.surface_current .width + get_extra_width (),
26
- parent.surface_current .height + get_border_width (), color.data ());
27
- wlr_scene_node_set_position (&border_rect->node , 0 , TITLEBAR_HEIGHT);
29
+ auto border_color = rrggbb_to_floats (BORDER_COLOR);
30
+ border_rect = wlr_scene_rect_create (
31
+ scene_tree, view_geo.width + get_extra_width (), view_geo.height + get_extra_height (), border_color.data ());
32
+ wlr_scene_node_set_position (&border_rect->node , 0 , 0 );
33
+ wlr_scene_node_lower_to_bottom (&border_rect->node );
28
34
wlr_scene_node_set_enabled (&border_rect->node , true );
29
35
}
30
36
@@ -34,30 +40,30 @@ Ssd::~Ssd() {
34
40
35
41
void Ssd::update () const {
36
42
auto view_geo = view.get_surface_geometry ();
37
- wlr_scene_rect_set_size (titlebar_rect, view_geo.width + 2 , TITLEBAR_HEIGHT);
38
- wlr_scene_rect_set_size (border_rect, view_geo.width + 2 , view_geo.height + 1 );
43
+ wlr_scene_rect_set_size (titlebar_rect, view_geo.width , TITLEBAR_HEIGHT);
44
+ wlr_scene_rect_set_size (border_rect, view_geo.width + get_extra_width () , view_geo.height + get_extra_height () );
39
45
}
40
46
41
47
wlr_box Ssd::get_geometry () const {
42
48
auto view_geo = view.get_surface_geometry ();
43
- return {.x = view_geo.x - get_border_width (),
44
- .y = view_geo.y - get_titlebar_height (),
49
+ return {.x = view_geo.x - get_horizontal_offset (),
50
+ .y = view_geo.y - get_vertical_offset (),
45
51
.width = view_geo.width + get_extra_width (),
46
52
.height = view_geo.height + get_extra_height ()};
47
53
}
48
54
49
- uint8_t Ssd::get_titlebar_height () const {
50
- return TITLEBAR_HEIGHT;
55
+ uint8_t Ssd::get_vertical_offset () const {
56
+ return TITLEBAR_HEIGHT + BORDER_WIDTH ;
51
57
}
52
58
53
- uint8_t Ssd::get_border_width () const {
54
- return 1 ;
59
+ uint8_t Ssd::get_horizontal_offset () const {
60
+ return BORDER_WIDTH ;
55
61
}
56
62
57
63
int32_t Ssd::get_extra_width () const {
58
- return get_border_width () * 2 ;
64
+ return BORDER_WIDTH * 2 ;
59
65
}
60
66
61
67
int32_t Ssd::get_extra_height () const {
62
- return get_titlebar_height () + get_border_width () ;
68
+ return TITLEBAR_HEIGHT + BORDER_WIDTH * 2 ;
63
69
}
0 commit comments