Bring up SSD2092 display/touch, USB NCM, HiDPI XLibre/DWM, and USB charging

This commit is contained in:
Luxferre committed 2026-11-22 15:49:38 +02:00
1 parent 034c1f61b1
commit 9db15e30ce
150 files changed
+2356 -446

No files matched your search

+36 -28
View File
@@ -19,6 +19,7 @@
#include <X11/Xatom.h>
#include <X11/Xresource.h>
#include <X11/Xutil.h>
#include <X11/cursorfont.h>
#include <cairo/cairo-xlib.h>
typedef struct {
@@ -143,8 +144,8 @@ void gemui_theme_defaults(gemui_theme_t *t) {
snprintf(t->name, sizeof(t->name), "GeminuxHelio");
snprintf(t->font_face, sizeof(t->font_face), "Fira Code");
snprintf(t->icon_font_face, sizeof(t->icon_font_face), "DejaVuSansM Nerd Font");
t->base_font_size = 22;
t->dpi = 168;
t->base_font_size = 32;
t->dpi = 192;
gemui_color_parse("#11141a", &t->bg_main);
gemui_color_parse("#161b23", &t->bg_bar);
gemui_color_parse("#1b212b", &t->bg_header);
@@ -232,7 +233,7 @@ static void gemui_apply_xrm_db(XrmDatabase db, gemui_theme_t *t) {
}
if (XrmGetResource(db, "theme.baseFontSize", "Theme.BaseFontSize", &type, &val) && val.addr) {
int sz = atoi(val.addr);
if (sz >= 10 && sz <= 48) t->base_font_size = sz;
if (sz >= 10 && sz <= 64) t->base_font_size = sz;
}
if (XrmGetResource(db, "Xft.dpi", "Xft.Dpi", &type, &val) && val.addr) {
int d = atoi(val.addr);
@@ -342,6 +343,13 @@ gemui_app_t *gemui_create(const char *res_name, const char *title,
unsigned long mask = CWBackPixel | CWEventMask | (fullscreen_override ? CWOverrideRedirect : 0);
app->win = XCreateWindow(dpy, app->root, 0, 0, (unsigned int)w, (unsigned int)h, 0,
CopyFromParent, InputOutput, CopyFromParent, mask, &swa);
{
Cursor cur = XCreateFontCursor(dpy, XC_left_ptr);
if (cur != None) {
XDefineCursor(dpy, app->win, cur);
XFreeCursor(dpy, cur);
}
}
app->gc = XCreateGC(dpy, app->win, 0, NULL);
XClassHint *ch = XAllocClassHint();
@@ -413,7 +421,7 @@ int gemui_width(const gemui_app_t *app) { return app ? app->w : 0; }
int gemui_height(const gemui_app_t *app) { return app ? app->h : 0; }
int gemui_scale_px(const gemui_app_t *app, int logical_px) {
int dpi = app ? app->theme.dpi : 168;
int dpi = app ? app->theme.dpi : 180;
return (logical_px * dpi + 48) / 96;
}
@@ -791,7 +799,7 @@ static int gemui_draw_pango(cairo_t *cr, const char *face, int px_size,
int gemui_draw_text(cairo_t *cr, const gemui_theme_t *t, gemui_rect_t r,
const char *text, int pt_delta, bool bold, int align, gemui_color_t c) {
int px = (t ? t->base_font_size : 22) + pt_delta;
int px = (t ? t->base_font_size : 28) + pt_delta;
char fam[200];
snprintf(fam, sizeof(fam), "%s, %s",
(t && t->font_face[0]) ? t->font_face : "Fira Code",
@@ -801,7 +809,7 @@ int gemui_draw_text(cairo_t *cr, const gemui_theme_t *t, gemui_rect_t r,
int gemui_draw_icon(cairo_t *cr, const gemui_theme_t *t, gemui_rect_t r,
const char *icon_utf8, int pt_delta, int align, gemui_color_t c) {
int px = (t ? t->base_font_size : 22) + pt_delta;
int px = (t ? t->base_font_size : 28) + pt_delta;
const char *iface = (t && t->icon_font_face[0]) ? t->icon_font_face : "DejaVuSansM Nerd Font";
return gemui_draw_pango(cr, iface, px, r, icon_utf8, false, align, c);
}
@@ -810,22 +818,22 @@ void gemui_draw_header(gemui_app_t *app, cairo_t *cr, const char *icon,
const char *title, const char *right_badge) {
if (!app) return;
const gemui_theme_t *t = &app->theme;
int hh = 64;
int hh = 76;
gemui_fill_rect(cr, (gemui_rect_t){0, 0, app->w, hh}, t->bg_header);
gemui_fill_rect(cr, (gemui_rect_t){0, hh - 2, app->w, 2}, t->divider);
int x = 20;
if (icon && icon[0]) {
gemui_draw_icon(cr, t, (gemui_rect_t){x, 6, 44, hh - 12}, icon, 6, GEMUI_ALIGN_CENTER, t->accent);
x += 48;
gemui_draw_icon(cr, t, (gemui_rect_t){x, 6, 52, hh - 12}, icon, 6, GEMUI_ALIGN_CENTER, t->accent);
x += 56;
}
gemui_draw_text(cr, t, (gemui_rect_t){x, 6, app->w - x - 320, hh - 12},
gemui_draw_text(cr, t, (gemui_rect_t){x, 6, app->w - x - 420, hh - 12},
title ? title : "", 4, true, GEMUI_ALIGN_LEFT, t->fg_bright);
if (right_badge && right_badge[0]) {
gemui_rect_t br = {app->w - 300, 12, 280, hh - 24};
gemui_fill_round(cr, br, 10, t->bg_overlay);
gemui_stroke_round(cr, br, 10, 1.5, t->border);
gemui_rect_t br = {app->w - 400, 12, 380, hh - 24};
gemui_fill_round(cr, br, 12, t->bg_overlay);
gemui_stroke_round(cr, br, 12, 1.5, t->border);
gemui_draw_text(cr, t, (gemui_rect_t){br.x + 12, br.y, br.w - 24, br.h},
right_badge, -2, false, GEMUI_ALIGN_CENTER, t->fg_main);
}
@@ -856,15 +864,15 @@ void gemui_draw_toggle(gemui_app_t *app, cairo_t *cr, gemui_rect_t r,
gemui_fill_round(cr, r, 10, t->bg_alt_even);
gemui_stroke_round(cr, r, 10, focused ? 3.0 : 1.5, focused ? t->highlight : t->border);
gemui_draw_text(cr, t, (gemui_rect_t){r.x + 16, r.y, r.w - 128, r.h},
gemui_draw_text(cr, t, (gemui_rect_t){r.x + 16, r.y, r.w - 144, r.h},
label ? label : "", 0, false, GEMUI_ALIGN_LEFT, t->fg_main);
gemui_rect_t pill = {r.x + r.w - 102, r.y + (r.h - 38) / 2, 84, 38};
gemui_fill_round(cr, pill, 19, on ? t->success : t->bg_overlay);
gemui_stroke_round(cr, pill, 19, 1.5, on ? t->success : t->border);
gemui_rect_t pill = {r.x + r.w - 114, r.y + (r.h - 44) / 2, 96, 44};
gemui_fill_round(cr, pill, 22, on ? t->success : t->bg_overlay);
gemui_stroke_round(cr, pill, 22, 1.5, on ? t->success : t->border);
gemui_rect_t knob = {on ? (pill.x + pill.w - 34) : (pill.x + 4), pill.y + 4, 30, 30};
gemui_fill_round(cr, knob, 15, t->fg_bright);
gemui_rect_t knob = {on ? (pill.x + pill.w - 40) : (pill.x + 4), pill.y + 4, 36, 36};
gemui_fill_round(cr, knob, 18, t->fg_bright);
if (hit_id >= 0) {
gemui_hit_add(app, r, hit_id, hit_val);
}
@@ -881,21 +889,21 @@ void gemui_draw_slider(gemui_app_t *app, cairo_t *cr, gemui_rect_t r,
gemui_fill_round(cr, r, 10, t->bg_alt_even);
gemui_stroke_round(cr, r, 10, focused ? 3.0 : 1.5, focused ? t->highlight : t->border);
gemui_draw_text(cr, t, (gemui_rect_t){r.x + 16, r.y + 6, r.w / 2, 32},
gemui_draw_text(cr, t, (gemui_rect_t){r.x + 16, r.y + 8, r.w / 2, 40},
label ? label : "", -1, true, GEMUI_ALIGN_LEFT, t->fg_bright);
if (val_text && val_text[0]) {
gemui_draw_text(cr, t, (gemui_rect_t){r.x + r.w / 2, r.y + 6, r.w / 2 - 16, 32},
gemui_draw_text(cr, t, (gemui_rect_t){r.x + r.w / 2, r.y + 8, r.w / 2 - 16, 40},
val_text, -1, false, GEMUI_ALIGN_RIGHT, t->accent);
}
gemui_rect_t track = {r.x + 16, r.y + r.h - 24, r.w - 32, 12};
gemui_fill_round(cr, track, 6, t->bg_overlay);
gemui_rect_t track = {r.x + 18, r.y + r.h - 24, r.w - 36, 14};
gemui_fill_round(cr, track, 7, t->bg_overlay);
int fw = (int)(track.w * norm_val);
if (fw > 0) {
gemui_fill_round(cr, (gemui_rect_t){track.x, track.y, fw, track.h}, 6, t->accent);
gemui_fill_round(cr, (gemui_rect_t){track.x, track.y, fw, track.h}, 7, t->accent);
}
gemui_rect_t knob = {track.x + fw - 12, track.y - 6, 24, 24};
gemui_fill_round(cr, knob, 12, t->fg_bright);
gemui_rect_t knob = {track.x + fw - 14, track.y - 7, 28, 28};
gemui_fill_round(cr, knob, 14, t->fg_bright);
if (hit_id >= 0) {
gemui_hit_add(app, r, hit_id, hit_val);
}
@@ -935,9 +943,9 @@ void gemui_draw_input(gemui_app_t *app, cairo_t *cr, gemui_rect_t r,
void gemui_draw_toast(gemui_app_t *app, cairo_t *cr) {
if (!app || !app->toast_msg[0]) return;
const gemui_theme_t *t = &app->theme;
int tw = 640;
int tw = 820;
if (tw > app->w - 80) tw = app->w - 80;
gemui_rect_t r = {(app->w - tw) / 2, app->h - 92, tw, 56};
gemui_rect_t r = {(app->w - tw) / 2, app->h - 104, tw, 68};
gemui_fill_round(cr, r, 12, t->bg_toast);
gemui_stroke_round(cr, r, 12, 2.0, t->accent);
gemui_draw_text(cr, t, (gemui_rect_t){r.x + 16, r.y + 4, r.w - 32, r.h - 8},