mirror of
https://github.com/labwc/labwc.git
synced 2026-02-06 04:06:33 -05:00
config: support setting menu item font
In rc.xml, support <font place="MenuItem"> <name></name> <size></size> </font>
This commit is contained in:
parent
a668f6f73d
commit
3990018bb9
3 changed files with 21 additions and 4 deletions
|
|
@ -46,6 +46,7 @@ Configuration must be wrapped in a <labwc_config> root-node.
|
|||
The font to use for a specific element of a window, menu or OSD.
|
||||
Places can be any of:
|
||||
- ActiveWindow - titlebar of active window
|
||||
- MenuItem - menu item (currently only root menu)
|
||||
If no place attribute is provided, the setting will be applied to all
|
||||
places.
|
||||
|
||||
|
|
@ -53,7 +54,7 @@ Configuration must be wrapped in a <labwc_config> root-node.
|
|||
Describes font name. Default is sans.
|
||||
|
||||
*<theme><font place=""><size>*
|
||||
Font size in pixels. Default is 8.
|
||||
Font size in pixels. Default is 10.
|
||||
|
||||
# KEYBOARD
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,9 @@ struct rcxml {
|
|||
char *theme_name;
|
||||
int corner_radius;
|
||||
char *font_name_activewindow;
|
||||
char *font_name_menuitem;
|
||||
int font_size_activewindow;
|
||||
int font_size_menuitem;
|
||||
struct wl_list keybinds;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ static struct keybind *current_keybind;
|
|||
enum font_place {
|
||||
FONT_PLACE_UNKNOWN = 0,
|
||||
FONT_PLACE_ACTIVEWINDOW,
|
||||
FONT_PLACE_INACTIVEWINDOW,
|
||||
FONT_PLACE_MENUITEM,
|
||||
/* TODO: Add all places based on Openbox's rc.xml */
|
||||
};
|
||||
|
||||
|
|
@ -89,8 +89,10 @@ fill_font(char *nodename, char *content, enum font_place place)
|
|||
*/
|
||||
if (!strcmp(nodename, "name")) {
|
||||
rc.font_name_activewindow = strdup(content);
|
||||
rc.font_name_menuitem = strdup(content);
|
||||
} else if (!strcmp(nodename, "size")) {
|
||||
rc.font_size_activewindow = atoi(content);
|
||||
rc.font_size_menuitem = atoi(content);
|
||||
}
|
||||
break;
|
||||
case FONT_PLACE_ACTIVEWINDOW:
|
||||
|
|
@ -100,6 +102,13 @@ fill_font(char *nodename, char *content, enum font_place place)
|
|||
rc.font_size_activewindow = atoi(content);
|
||||
}
|
||||
break;
|
||||
case FONT_PLACE_MENUITEM:
|
||||
if (!strcmp(nodename, "name")) {
|
||||
rc.font_name_menuitem = strdup(content);
|
||||
} else if (!strcmp(nodename, "size")) {
|
||||
rc.font_size_menuitem = atoi(content);
|
||||
}
|
||||
break;
|
||||
|
||||
/* TODO: implement for all font places */
|
||||
|
||||
|
|
@ -116,8 +125,8 @@ enum_font_place(const char *place)
|
|||
}
|
||||
if (!strcasecmp(place, "ActiveWindow")) {
|
||||
return FONT_PLACE_ACTIVEWINDOW;
|
||||
} else if (!strcasecmp(place, "InactiveWindow")) {
|
||||
return FONT_PLACE_INACTIVEWINDOW;
|
||||
} else if (!strcasecmp(place, "MenuItem")) {
|
||||
return FONT_PLACE_MENUITEM;
|
||||
}
|
||||
return FONT_PLACE_UNKNOWN;
|
||||
}
|
||||
|
|
@ -248,6 +257,7 @@ rcxml_init()
|
|||
rc.xdg_shell_server_side_deco = true;
|
||||
rc.corner_radius = 8;
|
||||
rc.font_size_activewindow = 10;
|
||||
rc.font_size_menuitem = 10;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -281,6 +291,9 @@ post_processing(void)
|
|||
if (!rc.font_name_activewindow) {
|
||||
rc.font_name_activewindow = strdup("sans");
|
||||
}
|
||||
if (!rc.font_name_menuitem) {
|
||||
rc.font_name_menuitem = strdup("sans");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -352,6 +365,7 @@ void
|
|||
rcxml_finish(void)
|
||||
{
|
||||
zfree(rc.font_name_activewindow);
|
||||
zfree(rc.font_name_menuitem);
|
||||
zfree(rc.theme_name);
|
||||
|
||||
struct keybind *k, *k_tmp;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue