4
4
#include " server.hpp"
5
5
6
6
constexpr uint8_t TITLEBAR_HEIGHT = 24 ;
7
- constexpr uint32_t TITLEBAR_COLOR = 0x303030 ;
7
+ constexpr uint32_t TITLEBAR_ACTIVE_COLOR = 0x303030 ;
8
+ constexpr uint32_t TITLEBAR_INACTIVE_COLOR = 0x202020 ;
8
9
constexpr uint8_t BORDER_WIDTH = 1 ;
9
- constexpr uint32_t BORDER_COLOR = 0x505050 ;
10
+ constexpr uint32_t BORDER_ACTIVE_COLOR = 0x505050 ;
11
+ constexpr uint32_t BORDER_INACTIVE_COLOR = 0x404040 ;
10
12
11
- static consteval std::array<float , 4 > rrggbb_to_floats (uint32_t rrggbb) {
13
+ static constexpr std::array<float , 4 > rrggbb_to_floats (uint32_t rrggbb) {
12
14
return std::array<float , 4 >(
13
15
{(float ) (rrggbb >> 16 & 0xff ) / 255 .0f , (float ) (rrggbb >> 8 & 0xff ) / 255 .0f , (float ) (rrggbb & 0xff ) / 255 .0f , 1.0 });
14
16
}
@@ -19,15 +21,15 @@ Ssd::Ssd(View& parent) noexcept : view(parent) {
19
21
wlr_scene_node_set_position (&scene_tree->node , 0 , 0 );
20
22
wlr_scene_node_set_enabled (&scene_tree->node , true );
21
23
22
- auto titlebar_color = rrggbb_to_floats (TITLEBAR_COLOR );
24
+ auto titlebar_color = rrggbb_to_floats (TITLEBAR_INACTIVE_COLOR );
23
25
auto view_geo = view.get_surface_geometry ();
24
26
titlebar_rect = wlr_scene_rect_create (scene_tree, view_geo.width , TITLEBAR_HEIGHT, titlebar_color.data ());
25
27
titlebar_rect->node .data = &parent;
26
28
wlr_scene_node_set_position (&titlebar_rect->node , BORDER_WIDTH, BORDER_WIDTH);
27
29
wlr_scene_node_lower_to_bottom (&titlebar_rect->node );
28
30
wlr_scene_node_set_enabled (&titlebar_rect->node , true );
29
31
30
- auto border_color = rrggbb_to_floats (BORDER_COLOR );
32
+ auto border_color = rrggbb_to_floats (BORDER_INACTIVE_COLOR );
31
33
border_rect = wlr_scene_rect_create (
32
34
scene_tree, view_geo.width + get_extra_width (), view_geo.height + get_extra_height (), border_color.data ());
33
35
wlr_scene_node_set_position (&border_rect->node , 0 , 0 );
@@ -45,6 +47,14 @@ void Ssd::update() const {
45
47
wlr_scene_rect_set_size (border_rect, view_geo.width + get_extra_width (), view_geo.height + get_extra_height ());
46
48
}
47
49
50
+ void Ssd::set_activated (const bool activated) const {
51
+ auto titlebar_color = rrggbb_to_floats (activated ? TITLEBAR_ACTIVE_COLOR : TITLEBAR_INACTIVE_COLOR);
52
+ wlr_scene_rect_set_color (titlebar_rect, titlebar_color.data ());
53
+
54
+ auto border_color = rrggbb_to_floats (activated ? BORDER_ACTIVE_COLOR : BORDER_INACTIVE_COLOR);
55
+ wlr_scene_rect_set_color (border_rect, border_color.data ());
56
+ }
57
+
48
58
wlr_box Ssd::get_geometry () const {
49
59
auto view_geo = view.get_surface_geometry ();
50
60
return {.x = view_geo.x - get_horizontal_offset (),
0 commit comments