wayland: derive menu colors from appearance preferences
Menu background colors were hardcoded. Now uses: - scr->select_color for selected item background - scr->menu_item_texture->normal for unselected background - scr->menu_item_texture->dim/light/dark for cascade arrow Text colors already used scr->select_text_color, mtext_color, dtext_color.
This commit is contained in:
parent
40295223c6
commit
4442380d50
|
|
@ -9363,11 +9363,20 @@ static void wl_menu_paint_entry(WMenu *menu, int index, int selected)
|
|||
uint32_t *dst = (uint32_t *)pixman_image_get_data(fb->image);
|
||||
int stride = pixman_image_get_stride(fb->image) / 4;
|
||||
|
||||
/* Background color */
|
||||
/* Background color from appearance preferences */
|
||||
uint32_t bg;
|
||||
if (selected) {
|
||||
bg = 0xFF4A6984;
|
||||
WMColor *sc = scr->select_color;
|
||||
bg = 0xFF000000 | ((uint32_t)WMRedComponentOfColor(sc) >> 8 << 16)
|
||||
| ((uint32_t)WMGreenComponentOfColor(sc) >> 8 << 8)
|
||||
| ((uint32_t)WMBlueComponentOfColor(sc) >> 8);
|
||||
} else {
|
||||
WTexSolid *ts = (WTexSolid *)scr->menu_item_texture;
|
||||
if (ts)
|
||||
bg = 0xFF000000 | ((uint32_t)ts->normal.red >> 8 << 16)
|
||||
| ((uint32_t)ts->normal.green >> 8 << 8)
|
||||
| ((uint32_t)ts->normal.blue >> 8);
|
||||
else
|
||||
bg = 0xFFAEAAAE;
|
||||
}
|
||||
|
||||
|
|
@ -9396,9 +9405,21 @@ static void wl_menu_paint_entry(WMenu *menu, int index, int selected)
|
|||
|
||||
/* Draw cascade arrow for submenus (3D right-pointing triangle matching X11) */
|
||||
if (entry->cascade >= 0) {
|
||||
WTexSolid *aux = (WTexSolid *)scr->menu_item_texture;
|
||||
uint32_t dim_c = 0xFF606060;
|
||||
uint32_t light_c = 0xFFE0E0E0;
|
||||
uint32_t dark_c = 0xFF303030;
|
||||
if (aux) {
|
||||
dim_c = 0xFF000000 | ((uint32_t)aux->dim.red >> 8 << 16)
|
||||
| ((uint32_t)aux->dim.green >> 8 << 8)
|
||||
| ((uint32_t)aux->dim.blue >> 8);
|
||||
light_c = 0xFF000000 | ((uint32_t)aux->light.red >> 8 << 16)
|
||||
| ((uint32_t)aux->light.green >> 8 << 8)
|
||||
| ((uint32_t)aux->light.blue >> 8);
|
||||
dark_c = 0xFF000000 | ((uint32_t)aux->dark.red >> 8 << 16)
|
||||
| ((uint32_t)aux->dark.green >> 8 << 8)
|
||||
| ((uint32_t)aux->dark.blue >> 8);
|
||||
}
|
||||
/* Top edge: dim line from (w-11, y+6) to (w-6, y+h/2-1) */
|
||||
int x0 = w - 11, y0 = y + 6, x1 = w - 6, y1 = y + h / 2 - 1;
|
||||
for (int i = 0; i <= 5; i++) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue