feat: add text glow animation with sinusoidal color cycling and alt-tab bold font rendering
This commit is contained in:
+20
-9
@@ -8,6 +8,7 @@
|
||||
#include "client.h"
|
||||
#include "config.h"
|
||||
#include "util.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
@@ -57,20 +58,27 @@ void decorations_render_title_bar(Client *client, bool focused)
|
||||
}
|
||||
|
||||
Display *dpy = dwn->display;
|
||||
const ColorScheme *colors = config_get_colors();
|
||||
int title_height = config_get_title_height();
|
||||
int border = client->border_width;
|
||||
const ColorScheme *colors = config_get_colors();
|
||||
|
||||
unsigned long bg_color = client_get_animated_title_color(client);
|
||||
unsigned long fg_color = adjust_color_for_background(colors->title_focused_fg, bg_color);
|
||||
Workspace *ws = workspace_get(client->workspace);
|
||||
bool is_focused = (ws != NULL && ws->focused == client);
|
||||
unsigned long bg_color = is_focused ? colors->title_focused_bg : colors->title_unfocused_bg;
|
||||
unsigned long fg_color = client->taskbar_color;
|
||||
fg_color = adjust_color_for_background(fg_color, bg_color);
|
||||
|
||||
XSetForeground(dpy, dwn->gc, bg_color);
|
||||
XFillRectangle(dpy, client->frame, dwn->gc,
|
||||
border, border,
|
||||
client->width, title_height);
|
||||
|
||||
if (client->title[0] != '\0' && dwn->xft_font != NULL) {
|
||||
int text_y = border + (title_height + dwn->xft_font->ascent) / 2;
|
||||
bool is_alt_tab_selection = (dwn->is_alt_tabbing && dwn->alt_tab_client == client);
|
||||
XftFont *title_font = (is_alt_tab_selection && dwn->xft_font_bold != NULL) ?
|
||||
dwn->xft_font_bold : dwn->xft_font;
|
||||
|
||||
if (client->title[0] != '\0' && title_font != NULL) {
|
||||
int text_y = border + (title_height + title_font->ascent) / 2;
|
||||
int text_x = border + BUTTON_PADDING;
|
||||
|
||||
int max_width = client->width - 3 * (BUTTON_SIZE + BUTTON_PADDING) - 2 * BUTTON_PADDING;
|
||||
@@ -82,7 +90,7 @@ void decorations_render_title_bar(Client *client, bool focused)
|
||||
display_title[sizeof(display_title) - 4] = '\0';
|
||||
|
||||
XGlyphInfo extents;
|
||||
XftTextExtentsUtf8(dpy, dwn->xft_font,
|
||||
XftTextExtentsUtf8(dpy, title_font,
|
||||
(const FcChar8 *)display_title, strlen(display_title), &extents);
|
||||
int text_width = extents.xOff;
|
||||
|
||||
@@ -100,7 +108,7 @@ void decorations_render_title_bar(Client *client, bool focused)
|
||||
display_title[cut] = '\0';
|
||||
title_truncated = true;
|
||||
|
||||
XftTextExtentsUtf8(dpy, dwn->xft_font,
|
||||
XftTextExtentsUtf8(dpy, title_font,
|
||||
(const FcChar8 *)display_title, strlen(display_title), &extents);
|
||||
text_width = extents.xOff;
|
||||
}
|
||||
@@ -122,7 +130,7 @@ void decorations_render_title_bar(Client *client, bool focused)
|
||||
XftColorAllocValue(dpy, DefaultVisual(dpy, dwn->screen),
|
||||
dwn->colormap, &render_color, &xft_color);
|
||||
|
||||
XftDrawStringUtf8(xft_draw, &xft_color, dwn->xft_font,
|
||||
XftDrawStringUtf8(xft_draw, &xft_color, title_font,
|
||||
text_x, text_y,
|
||||
(const FcChar8 *)display_title, strlen(display_title));
|
||||
|
||||
@@ -162,7 +170,10 @@ void decorations_render_buttons(Client *client, bool focused)
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned long bg_color = client_get_animated_title_color(client);
|
||||
const ColorScheme *colors = config_get_colors();
|
||||
Workspace *ws = workspace_get(client->workspace);
|
||||
bool is_focused = (ws != NULL && ws->focused == client);
|
||||
unsigned long bg_color = is_focused ? colors->title_focused_bg : colors->title_unfocused_bg;
|
||||
|
||||
XSetForeground(dpy, dwn->gc, bg_color);
|
||||
XFillRectangle(dpy, client->frame, dwn->gc, close_x, button_y, BUTTON_SIZE, BUTTON_SIZE);
|
||||
|
||||
Reference in New Issue
Block a user