@@ -7,9 +7,28 @@ constexpr uint8_t TITLEBAR_HEIGHT = 24;
7
7
constexpr uint32_t TITLEBAR_ACTIVE_COLOR = 0x303030 ;
8
8
constexpr uint32_t TITLEBAR_INACTIVE_COLOR = 0x202020 ;
9
9
constexpr uint8_t BORDER_WIDTH = 1 ;
10
+ constexpr uint8_t EXTENTS_WIDTH = 8 ;
10
11
constexpr uint32_t BORDER_ACTIVE_COLOR = 0x505050 ;
11
12
constexpr uint32_t BORDER_INACTIVE_COLOR = 0x404040 ;
12
13
14
+ static wlr_box border_dimensions (wlr_box& view_dimensions) {
15
+ return {
16
+ .x = EXTENTS_WIDTH,
17
+ .y = EXTENTS_WIDTH,
18
+ .width = view_dimensions.width + (BORDER_WIDTH * 2 ),
19
+ .height = view_dimensions.height + TITLEBAR_HEIGHT + (BORDER_WIDTH * 2 ),
20
+ };
21
+ }
22
+
23
+ static wlr_box extents_dimensions (wlr_box& view_dimensions) {
24
+ return {
25
+ .x = 0 ,
26
+ .y = 0 ,
27
+ .width = view_dimensions.width + (EXTENTS_WIDTH * 2 ) + (BORDER_WIDTH * 2 ),
28
+ .height = view_dimensions.height + TITLEBAR_HEIGHT + (EXTENTS_WIDTH * 2 ) + (BORDER_WIDTH * 2 ),
29
+ };
30
+ }
31
+
13
32
static constexpr std::array<float , 4 > rrggbb_to_floats (uint32_t rrggbb) {
14
33
return std::array<float , 4 >(
15
34
{(float ) (rrggbb >> 16 & 0xff ) / 255 .0f , (float ) (rrggbb >> 8 & 0xff ) / 255 .0f , (float ) (rrggbb & 0xff ) / 255 .0f , 1.0 });
@@ -25,29 +44,43 @@ Ssd::Ssd(View& parent) noexcept : view(parent) {
25
44
auto view_geo = view.get_surface_geometry ();
26
45
titlebar_rect = wlr_scene_rect_create (scene_tree, view_geo.width , TITLEBAR_HEIGHT, titlebar_color.data ());
27
46
titlebar_rect->node .data = new SceneRectData{.type = SceneRectType::TITLEBAR, .parent = &parent};
28
- wlr_scene_node_set_position (&titlebar_rect->node , BORDER_WIDTH, BORDER_WIDTH);
47
+ wlr_scene_node_set_position (&titlebar_rect->node , BORDER_WIDTH + EXTENTS_WIDTH , BORDER_WIDTH + EXTENTS_WIDTH );
29
48
wlr_scene_node_lower_to_bottom (&titlebar_rect->node );
30
49
wlr_scene_node_set_enabled (&titlebar_rect->node , true );
31
50
51
+ auto extents_color = std::array<float , 4 >({0 .0f , 0 .0f , 0 .0f , 0 .0f });
52
+ auto extents_box = extents_dimensions (view_geo);
53
+ extents_rect = wlr_scene_rect_create (scene_tree, extents_box.width , extents_box.height , extents_color.data ());
54
+ extents_rect->node .data = new SceneRectData{.type = SceneRectType::EXTENTS, .parent = &parent};
55
+ wlr_scene_node_set_position (&extents_rect->node , extents_box.x , extents_box.y );
56
+ wlr_scene_node_lower_to_bottom (&extents_rect->node );
57
+ wlr_scene_node_set_enabled (&extents_rect->node , true );
58
+
32
59
auto border_color = rrggbb_to_floats (BORDER_INACTIVE_COLOR);
33
- border_rect = wlr_scene_rect_create (
34
- scene_tree, view_geo .width + get_extra_width (), view_geo .height + get_extra_height () , border_color.data ());
60
+ auto border_box = border_dimensions (view_geo);
61
+ border_rect = wlr_scene_rect_create ( scene_tree, border_box .width , border_box .height , border_color.data ());
35
62
border_rect->node .data = new SceneRectData{.type = SceneRectType::BORDER, .parent = &parent};
36
- wlr_scene_node_set_position (&border_rect->node , 0 , 0 );
63
+ wlr_scene_node_set_position (&border_rect->node , border_box. x , border_box. y );
37
64
wlr_scene_node_lower_to_bottom (&border_rect->node );
38
65
wlr_scene_node_set_enabled (&border_rect->node , true );
39
66
}
40
67
41
68
Ssd::~Ssd () {
42
69
delete static_cast <SceneRectData*>(titlebar_rect->node .data );
43
70
delete static_cast <SceneRectData*>(border_rect->node .data );
71
+ delete static_cast <SceneRectData*>(extents_rect->node .data );
44
72
wlr_scene_node_destroy (&scene_tree->node );
45
73
}
46
74
47
75
void Ssd::update () const {
48
76
auto view_geo = view.get_surface_geometry ();
49
77
wlr_scene_rect_set_size (titlebar_rect, view_geo.width , TITLEBAR_HEIGHT);
50
- wlr_scene_rect_set_size (border_rect, view_geo.width + get_extra_width (), view_geo.height + get_extra_height ());
78
+
79
+ auto border_box = border_dimensions (view_geo);
80
+ wlr_scene_rect_set_size (border_rect, border_box.width , border_box.height );
81
+
82
+ auto extents_box = extents_dimensions (view_geo);
83
+ wlr_scene_rect_set_size (extents_rect, extents_box.width , extents_box.height );
51
84
}
52
85
53
86
void Ssd::set_activated (const bool activated) const {
@@ -67,17 +100,21 @@ wlr_box Ssd::get_geometry() const {
67
100
}
68
101
69
102
uint8_t Ssd::get_vertical_offset () const {
103
+ return TITLEBAR_HEIGHT + BORDER_WIDTH + EXTENTS_WIDTH;
104
+ }
105
+
106
+ uint8_t Ssd::get_visual_vertical_offset () const {
70
107
return TITLEBAR_HEIGHT + BORDER_WIDTH;
71
108
}
72
109
73
110
uint8_t Ssd::get_horizontal_offset () const {
74
- return BORDER_WIDTH;
111
+ return BORDER_WIDTH + EXTENTS_WIDTH ;
75
112
}
76
113
77
114
int32_t Ssd::get_extra_width () const {
78
- return BORDER_WIDTH * 2 ;
115
+ return ( BORDER_WIDTH * 2 ) + (EXTENTS_WIDTH * 2 ) ;
79
116
}
80
117
81
118
int32_t Ssd::get_extra_height () const {
82
- return TITLEBAR_HEIGHT + BORDER_WIDTH * 2 ;
119
+ return TITLEBAR_HEIGHT + ( BORDER_WIDTH * 2 ) + (EXTENTS_WIDTH * 2 ) ;
83
120
}
0 commit comments