/* monitor is copied above */
}
- if (src->size_given) {
- dst->size_given = TRUE;
- dst->width_num = src->width_num;
- dst->width_denom = src->width_denom;
- dst->height_num = src->height_num;
- dst->height_denom = src->height_denom;
- }
+ dst->width_num = src->width_num;
+ dst->width_denom = src->width_denom;
+ dst->height_num = src->height_num;
+ dst->height_denom = src->height_denom;
}
void config_parse_relative_number(gchar *s, gint *num, gint *denom)
{
xmlNodePtr n, c;
gboolean x_pos_given = FALSE;
- gboolean width_given = FALSE;
if ((n = obt_xml_find_node(app->children, "decor")))
if (!obt_xml_node_contains(n, "default"))
config_parse_relative_number(s,
&settings->width_num,
&settings->width_denom);
- if (settings->width_num > 0 && settings->width_denom >= 0)
- width_given = TRUE;
+ if (settings->width_num <= 0 || settings->width_denom < 0)
+ settings->width_num = settings->width_denom = 0;
g_free(s);
}
}
- if (width_given && (c = obt_xml_find_node(n->children, "height"))) {
- gchar *s = obt_xml_node_string(c);
- config_parse_relative_number(s,
- &settings->height_num,
- &settings->height_denom);
- if (settings->height_num > 0 && settings->height_denom >= 0)
- settings->size_given = TRUE;
- g_free(s);
+ if ((c = obt_xml_find_node(n->children, "height"))) {
+ if (!obt_xml_node_contains(c, "default")) {
+ gchar *s = obt_xml_node_string(c);
+ config_parse_relative_number(s,
+ &settings->height_num,
+ &settings->height_denom);
+ if (settings->height_num <= 0 || settings->height_denom < 0)
+ settings->height_num = settings->height_denom = 0;
+ g_free(s);
+ }
}
}
gint *w, gint *h,
ObAppSettings *settings)
{
- if (!settings || !settings->size_given)
+ if (!settings)
return;
- ob_debug("sizing by per-app settings");
-
- g_assert(settings->width_num > 0);
+ g_assert(settings->width_num >= 0);
g_assert(settings->width_denom >= 0);
- g_assert(settings->height_num > 0);
+ g_assert(settings->height_num >= 0);
g_assert(settings->height_denom >= 0);
- if (!settings->width_denom)
- *w = settings->width_num;
- else {
- *w = screen->width * settings->width_num / settings->width_denom;
- *w = MIN(*w, screen->width);
+ if (settings->width_num) {
+ ob_debug("setting width by per-app settings");
+ if (!settings->width_denom)
+ *w = settings->width_num;
+ else {
+ *w = screen->width * settings->width_num / settings->width_denom;
+ *w = MIN(*w, screen->width);
+ }
}
- if (!settings->height_denom)
- *h = settings->height_num;
- else {
- *h = screen->height * settings->height_num / settings->height_denom;
- *h = MIN(*h, screen->height);
+ if (settings->height_num) {
+ ob_debug("setting height by per-app settings");
+ if (!settings->height_denom)
+ *h = settings->height_num;
+ else {
+ *h = screen->height * settings->height_num / settings->height_denom;
+ *h = MIN(*h, screen->height);
+ }
}
}