READ_INT macro.
This commit is contained in:
parent
27ae9d65c8
commit
5f963a1fbc
1 changed files with 20 additions and 45 deletions
|
@ -63,6 +63,11 @@ static RrFont *get_font(RrFont *target, RrFont **default_font,
|
|||
}
|
||||
}
|
||||
|
||||
#define READ_INT(x_resstr, x_var, x_min, x_max, x_def) \
|
||||
if (!read_int(db, x_resstr, & x_var) || \
|
||||
x_var < x_min || x_var > x_max) \
|
||||
x_var = x_def;
|
||||
|
||||
RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
|
||||
gboolean allow_fallback,
|
||||
RrFont *active_window_font, RrFont *inactive_window_font,
|
||||
|
@ -178,51 +183,21 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
|
|||
theme->osd_font_unhilite = get_font(inactive_osd_font, &default_font,inst);
|
||||
|
||||
/* load direct dimensions */
|
||||
if ((!read_int(db, "menu.overlap.x", &theme->menu_overlap_x) &&
|
||||
!read_int(db, "menu.overlap", &theme->menu_overlap_x)) ||
|
||||
theme->menu_overlap_x < -100 || theme->menu_overlap_x > 100)
|
||||
theme->menu_overlap_x = 0;
|
||||
if ((!read_int(db, "menu.overlap.y", &theme->menu_overlap_y) &&
|
||||
!read_int(db, "menu.overlap", &theme->menu_overlap_y)) ||
|
||||
theme->menu_overlap_y < -100 || theme->menu_overlap_y > 100)
|
||||
theme->menu_overlap_y = 0;
|
||||
if (!read_int(db, "window.handle.width", &theme->handle_height) ||
|
||||
theme->handle_height < 0 || theme->handle_height > 100)
|
||||
theme->handle_height = 6;
|
||||
if (!read_int(db, "padding.width", &theme->paddingx) ||
|
||||
theme->paddingx < 0 || theme->paddingx > 100)
|
||||
theme->paddingx = 3;
|
||||
if (!read_int(db, "padding.height", &theme->paddingy) ||
|
||||
theme->paddingy < 0 || theme->paddingy > 100)
|
||||
theme->paddingy = theme->paddingx;
|
||||
if (!read_int(db, "border.width", &theme->fbwidth) ||
|
||||
theme->fbwidth < 0 || theme->fbwidth > 100)
|
||||
theme->fbwidth = 1;
|
||||
/* menu border width inherits from the frame border width */
|
||||
if (!read_int(db, "menu.border.width", &theme->mbwidth) ||
|
||||
theme->mbwidth < 0 || theme->mbwidth > 100)
|
||||
theme->mbwidth = theme->fbwidth;
|
||||
/* osd border width inherits from the frame border width */
|
||||
if (!read_int(db, "osd.border.width", &theme->obwidth) ||
|
||||
theme->obwidth < 0 || theme->obwidth > 100)
|
||||
theme->obwidth = theme->fbwidth;
|
||||
if (!read_int(db, "window.client.padding.width", &theme->cbwidthx) ||
|
||||
theme->cbwidthx < 0 || theme->cbwidthx > 100)
|
||||
theme->cbwidthx = theme->paddingx;
|
||||
if (!read_int(db, "window.client.padding.height", &theme->cbwidthy) ||
|
||||
theme->cbwidthy < 0 || theme->cbwidthy > 100)
|
||||
theme->cbwidthy = theme->cbwidthx;
|
||||
if (!read_int(db, "menu.separator.width", &theme->menu_sep_width) ||
|
||||
theme->menu_sep_width < 1 || theme->menu_sep_width > 100)
|
||||
theme->menu_sep_width = 1;
|
||||
if (!read_int(db, "menu.separator.padding.width",
|
||||
&theme->menu_sep_paddingx) ||
|
||||
theme->menu_sep_paddingx < 0 || theme->menu_sep_paddingx > 100)
|
||||
theme->menu_sep_paddingx = 6;
|
||||
if (!read_int(db, "menu.separator.padding.height",
|
||||
&theme->menu_sep_paddingy) ||
|
||||
theme->menu_sep_paddingy < 0 || theme->menu_sep_paddingy > 100)
|
||||
theme->menu_sep_paddingy = 3;
|
||||
|
||||
/* TODO: Need fallback for menu.overlap */
|
||||
READ_INT("menu.overlap.x", theme->menu_overlap_x, -100, 100, 0);
|
||||
READ_INT("menu.overlap.y", theme->menu_overlap_y, -100, 100, 0);
|
||||
READ_INT("window.handle.width", theme->handle_height, 0, 100, 6);
|
||||
READ_INT("padding.width", theme->paddingx, 0, 100, 3);
|
||||
READ_INT("padding.height", theme->paddingy, 0, 100, theme->paddingx);
|
||||
READ_INT("border.width", theme->fbwidth, 0, 100, 1);
|
||||
READ_INT("menu.border.width", theme->mbwidth, 0, 100, theme->fbwidth);
|
||||
READ_INT("osd.border.width", theme->obwidth, 0, 100, theme->fbwidth);
|
||||
READ_INT("window.client.padding.width", theme->cbwidthx, 0, 100, theme->paddingx);
|
||||
READ_INT("window.client.padding.height", theme->cbwidthy, 0, 100, theme->cbwidthx);
|
||||
READ_INT("menu.separator.width", theme->menu_sep_width, 1, 100, 1);
|
||||
READ_INT("menu.separator.padding.width", theme->menu_sep_paddingx, 0, 100, 6);
|
||||
READ_INT("menu.separator.padding.height", theme->menu_sep_paddingy, 0, 100, 3);
|
||||
|
||||
/* load colors */
|
||||
if (!read_color(db, inst,
|
||||
|
|
Loading…
Reference in a new issue