focus border color
This commit is contained in:
+2
-1
@@ -24,7 +24,8 @@
|
|||||||
|
|
||||||
#define ABSINTHE_WINDOW_BORDER_WIDTH 2
|
#define ABSINTHE_WINDOW_BORDER_WIDTH 2
|
||||||
|
|
||||||
static const float bordercolor[4] = {0.88, 0.18, 0.18, 1.0};
|
static const float focused_border_color[4] = {0.88, 0.18, 0.18, 1.0};
|
||||||
|
static const float unfocused_border_color[4] = {0.18, 0.18, 0.18, 1.0};
|
||||||
|
|
||||||
enum absinthe_cursor_mode {
|
enum absinthe_cursor_mode {
|
||||||
ABSINTHE_CURSOR_PASSTHROUGH,
|
ABSINTHE_CURSOR_PASSTHROUGH,
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ void absinthe_toplevel_update_borders_geometry(struct absinthe_toplevel *topleve
|
|||||||
if (toplevel->geometry.width - 2 * bw < 0 || toplevel->geometry.height - 2 * bw < 0)
|
if (toplevel->geometry.width - 2 * bw < 0 || toplevel->geometry.height - 2 * bw < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
wlr_scene_node_set_position(&toplevel->scene_tree->node, toplevel->geometry.x, toplevel->geometry.y);
|
wlr_scene_node_set_position(&toplevel->scene_tree->node, toplevel->geometry.x, toplevel->geometry.y);
|
||||||
wlr_scene_node_set_position(&toplevel->scene_surface->node, bw, bw);
|
wlr_scene_node_set_position(&toplevel->scene_surface->node, bw, bw);
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -1,6 +1,7 @@
|
|||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#include "absinthe-toplevel.h"
|
||||||
|
|
||||||
void focus_toplevel(struct absinthe_toplevel *toplevel)
|
void focus_toplevel(struct absinthe_toplevel *toplevel)
|
||||||
{
|
{
|
||||||
@@ -17,7 +18,10 @@ void focus_toplevel(struct absinthe_toplevel *toplevel)
|
|||||||
|
|
||||||
if (prev_surface) {
|
if (prev_surface) {
|
||||||
struct wlr_xdg_toplevel *prev_toplevel = wlr_xdg_toplevel_try_from_wlr_surface(prev_surface);
|
struct wlr_xdg_toplevel *prev_toplevel = wlr_xdg_toplevel_try_from_wlr_surface(prev_surface);
|
||||||
if (prev_toplevel) wlr_xdg_toplevel_set_activated(prev_toplevel, false);
|
if (prev_toplevel) {
|
||||||
|
wlr_xdg_toplevel_set_activated(prev_toplevel, false);
|
||||||
|
absinthe_toplevel_set_border_color(prev_toplevel->base->data, unfocused_border_color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat);
|
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat);
|
||||||
@@ -25,6 +29,7 @@ void focus_toplevel(struct absinthe_toplevel *toplevel)
|
|||||||
wl_list_remove(&toplevel->link);
|
wl_list_remove(&toplevel->link);
|
||||||
wl_list_insert(&server->toplevels, &toplevel->link);
|
wl_list_insert(&server->toplevels, &toplevel->link);
|
||||||
wlr_xdg_toplevel_set_activated(toplevel->xdg_toplevel, true);
|
wlr_xdg_toplevel_set_activated(toplevel->xdg_toplevel, true);
|
||||||
|
absinthe_toplevel_set_border_color(toplevel, focused_border_color);
|
||||||
|
|
||||||
if (keyboard)
|
if (keyboard)
|
||||||
wlr_seat_keyboard_notify_enter(seat, surface, keyboard->keycodes, keyboard->num_keycodes, &keyboard->modifiers);
|
wlr_seat_keyboard_notify_enter(seat, surface, keyboard->keycodes, keyboard->num_keycodes, &keyboard->modifiers);
|
||||||
|
|||||||
+2
-2
@@ -37,13 +37,13 @@ void xdg_toplevel_map(struct wl_listener *listener, void *data)
|
|||||||
struct absinthe_toplevel *toplevel = wl_container_of(listener, toplevel, map);
|
struct absinthe_toplevel *toplevel = wl_container_of(listener, toplevel, map);
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
toplevel->border[i] = wlr_scene_rect_create(toplevel->scene_tree, 0, 0, bordercolor);
|
toplevel->border[i] = wlr_scene_rect_create(toplevel->scene_tree, 0, 0, unfocused_border_color);
|
||||||
toplevel->border[i]->node.data = toplevel;
|
toplevel->border[i]->node.data = toplevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
toplevel->border_width = ABSINTHE_WINDOW_BORDER_WIDTH;
|
toplevel->border_width = ABSINTHE_WINDOW_BORDER_WIDTH;
|
||||||
|
|
||||||
absinthe_toplevel_set_border_color(toplevel, bordercolor);
|
absinthe_toplevel_set_border_color(toplevel, unfocused_border_color);
|
||||||
absinthe_toplevel_update_borders_geometry(toplevel);
|
absinthe_toplevel_update_borders_geometry(toplevel);
|
||||||
|
|
||||||
toplevel->output = toplevel->server->focused_output;
|
toplevel->output = toplevel->server->focused_output;
|
||||||
|
|||||||
Reference in New Issue
Block a user