--- a/gntbox.c Tue Apr 09 00:08:44 2019 +0000
+++ b/gntbox.c Mon Apr 08 03:30:52 2019 -0400
@@ -82,8 +82,7 @@
g_list_foreach(box->list, (GFunc)gnt_widget_draw, NULL);
- if (box->title && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER))
+ if (box->title && gnt_widget_get_has_border(widget)) { char *title = g_strdup(box->title);
@@ -662,7 +661,7 @@
GntWidget *w = GNT_WIDGET(b);
b->title = g_strdup(title);
- if (w->window && !GNT_WIDGET_IS_FLAG_SET(w, GNT_WIDGET_NO_BORDER)) {
+ if (w->window && gnt_widget_get_has_border(w)) { /* Erase the old title */
get_title_thingies(b, prev, &pos, &right);
@@ -691,10 +690,7 @@
GntWidget *widget = GNT_WIDGET(box);
- if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER))
+ int pos = gnt_widget_get_has_border(widget) ? 1 : 0; find_focusable_widget(box);
--- a/gntbutton.c Tue Apr 09 00:08:44 2019 +0000
+++ b/gntbutton.c Mon Apr 08 03:30:52 2019 -0400
@@ -66,8 +66,9 @@
gnt_util_get_text_bound(button->priv->text,
&widget->priv.width, &widget->priv.height);
- if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER))
+ if (gnt_widget_get_has_border(widget)) { widget->priv.height += 2;
--- a/gnttree.c Tue Apr 09 00:08:44 2019 +0000
+++ b/gnttree.c Mon Apr 08 03:30:52 2019 -0400
@@ -111,8 +111,9 @@
#define WIDTH(i) (tree->columns[i].width_ratio ? tree->columns[i].width_ratio : tree->columns[i].width)
gnt_widget_get_size(GNT_WIDGET(tree), &width, NULL);
- if (!GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(tree), GNT_WIDGET_NO_BORDER))
+ if (gnt_widget_get_has_border(GNT_WIDGET(tree))) { width -= 1; /* Exclude the scrollbar from the calculation */
for (i = 0, total = 0; i < tree->ncol ; i++) {
if (tree->columns[i].flags & GNT_TREE_COLUMN_INVISIBLE)
@@ -428,10 +429,7 @@
if (!GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(tree), GNT_WIDGET_MAPPED))
- if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER))
+ pos = gnt_widget_get_has_border(widget) ? 1 : 0; @@ -642,7 +640,7 @@
GntTree *tree = GNT_TREE(widget);
- width = 1 + 2 * (!GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(tree), GNT_WIDGET_NO_BORDER));
+ width = gnt_widget_get_has_border(GNT_WIDGET(tree)) ? 3 : 1; for (i = 0; i < tree->ncol; i++)
if (!COLUMN_INVISIBLE(tree, i)) {
width = width + tree->columns[i].width;
@@ -766,8 +764,10 @@
if (tree->top != tree->root)
int dist = get_distance(tree->top, tree->current);
- row = get_prev_n(tree->top, widget->priv.height - 1 -
- tree->show_title * 2 - 2 * (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER) == 0));
+ widget->priv.height - 1 - tree->show_title * 2 - + (gnt_widget_get_has_border(widget) ? 2 : 0)); @@ -896,9 +896,7 @@
} else if (event == GNT_LEFT_MOUSE_DOWN) {
GntTree *tree = GNT_TREE(widget);
- if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER))
+ int pos = gnt_widget_get_has_border(widget) ? 1 : 0; pos = y - widget->priv.y - pos;
@@ -1173,16 +1171,18 @@
GntWidget *widget = GNT_WIDGET(tree);
widget->priv.height = rows;
- if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER))
+ if (gnt_widget_get_has_border(widget)) { widget->priv.height += 2;
int gnt_tree_get_visible_rows(GntTree *tree)
GntWidget *widget = GNT_WIDGET(tree);
int ret = widget->priv.height;
- if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER))
+ if (gnt_widget_get_has_border(widget)) { @@ -1522,7 +1522,7 @@
int gnt_tree_get_selection_visible_line(GntTree *tree)
return get_distance(tree->top, tree->current) +
- !!(GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(tree), GNT_WIDGET_NO_BORDER));
+ !gnt_widget_get_has_border(GNT_WIDGET(tree)); void gnt_tree_change_text(GntTree *tree, gpointer key, int colno, const char *text)
@@ -1791,7 +1791,7 @@
- twidth = 1 + 2 * (!GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(tree), GNT_WIDGET_NO_BORDER));
+ twidth = gnt_widget_get_has_border(GNT_WIDGET(tree)) ? 3 : 1; for (i = 0; i < tree->ncol; i++) {
if (tree->columns[i].flags & GNT_TREE_COLUMN_FIXED_SIZE)
widths[i] = tree->columns[i].width;
--- a/wms/s.c Tue Apr 09 00:08:44 2019 +0000
+++ b/wms/s.c Mon Apr 08 03:30:52 2019 -0400
@@ -61,7 +61,7 @@
- if (GNT_WIDGET_IS_FLAG_SET(win, GNT_WIDGET_NO_BORDER | GNT_WIDGET_TRANSIENT))
+ if (!gnt_widget_get_has_border(win) || gnt_widget_get_transient(win)) gnt_widget_get_size(win, &w, &h);
@@ -163,8 +163,7 @@
/* This might be a place to bring up a context menu */
- if (event != GNT_LEFT_MOUSE_DOWN ||
- GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER))
+ if (event != GNT_LEFT_MOUSE_DOWN || !gnt_widget_get_has_border(widget)) gnt_widget_get_position(widget, &x, &y);