Fix button 15 height and add bottom margin in OSD layout
- Button 15 now extends to match the bottom of buttons 16 and 17 - Increased expanded_height from 350 to 380 for more bottom margin - Button 15 is drawn separately with height spanning two rows https://claude.ai/code/session_01H5sr8TkRyt6U1vdkVZRRvy
+21 −5 · 3 files changed
-
default.cfg+1 −1 -
src/config.c+1 −1 -
src/osd.c+19 −3
@@ -78,7 +78,7 @@ osd_position: 50,50 osd_opacity: 0.67 osd_display_duration: 3000 osd_min_size: 200,100 -osd_expanded_size: 400,350 +osd_expanded_size: 400,380 osd_toggle_button: -1 osd_font_size: 13 @@ -98,7 +98,7 @@ config_t* config_create(void) { config->osd.min_width = 200; config->osd.min_height = 100; config->osd.expanded_width = 400; - config->osd.expanded_height = 350; + config->osd.expanded_height = 380; config->osd.osd_toggle_button = -1; // Disabled by default config->osd.font_size = 13; // Default font size @@ -79,7 +79,7 @@ osd_state_t* osd_create(config_t* config) { osd->min_width = 200; osd->min_height = 100; osd->expanded_width = 400; - osd->expanded_height = 350; + osd->expanded_height = 380; osd->width = osd->min_width; osd->height = osd->min_height; osd->opacity = 0.67f; // 33% transparent = 67% opaque @@ -449,10 +449,11 @@ void osd_redraw(osd_state_t* osd) { start_y += key_height; // Draw main button grid (4 rows x 4 columns) + // Note: Button 15 is drawn separately with extended height for (int row = 1; row < 5; row++) { for (int col = 0; col < 4; col++) { int btn = BUTTON_LAYOUT[row][col]; - if (btn < 0) continue; + if (btn < 0 || btn == 15) continue; // Skip button 15, drawn separately int x = start_x + col * (key_width + grid_padding); int y = start_y + (row - 1) * (key_height + grid_padding); @@ -495,9 +496,24 @@ void osd_redraw(osd_state_t* osd) { } } - // Draw bottom row (buttons 16 and 17 have special layout) + // Draw bottom row (buttons 15, 16, and 17 have special layout) int bottom_y = start_y + 4 * (key_height + grid_padding); + // Button 15 (tall - extends from row 4 down to bottom row) + int btn15_x = start_x + 3 * (key_width + grid_padding); + int btn15_y = start_y + 3 * (key_height + grid_padding); + int btn15_height = 2 * key_height + grid_padding; + XSetForeground(dpy, gc, highlight_color); + XFillRectangle(dpy, win, gc, btn15_x, btn15_y, key_width, btn15_height); + XSetForeground(dpy, gc, fg_color); + XDrawRectangle(dpy, win, gc, btn15_x, btn15_y, key_width - 1, btn15_height - 1); + XDrawString(dpy, win, gc, btn15_x + 5, btn15_y + 15, "15", 2); + if (osd->key_descriptions[15]) { + XSetForeground(dpy, gc, accent_color); + XDrawString(dpy, win, gc, btn15_x + 5, btn15_y + 35, osd->key_descriptions[15], + strlen(osd->key_descriptions[15]) > 10 ? 10 : strlen(osd->key_descriptions[15])); + } + // Button 16 (wide) XSetForeground(dpy, gc, highlight_color); XFillRectangle(dpy, win, gc, start_x, bottom_y, key_width * 2 + grid_padding, key_height);