--- a/gntmain.c Wed Apr 24 21:54:50 2019 -0400
+++ b/gntmain.c Thu Apr 25 03:42:09 2019 -0400
@@ -228,7 +228,7 @@
} else if (event == GNT_MOUSE_UP) {
if (button == MOUSE_NONE && y == getmaxy(stdscr) - 1) {
/* Clicked on the taskbar */
- int n = g_list_length(wm->cws->list);
+ int n = g_list_length(gnt_ws_get_list(wm->cws)); int width = getmaxx(stdscr) / n;
gnt_bindable_perform_action_named(GNT_BINDABLE(wm), "switch-window-n", x/width, NULL);
--- a/gntwm.c Wed Apr 24 21:54:50 2019 -0400
+++ b/gntwm.c Thu Apr 25 03:42:09 2019 -0400
@@ -406,6 +406,7 @@
switch_window(GntWM *wm, int direction, gboolean urgent)
GntWidget *w = NULL, *wid = NULL;
if (wm->_list.window || wm->menu)
@@ -420,20 +421,22 @@
w = gnt_ws_get_top_widget(wm->cws);
- orgpos = pos = g_list_index(wm->cws->list, w);
+ list = gnt_ws_get_list(wm->cws); + orgpos = pos = g_list_index(list, w); g_return_if_fail(pos >= 0);
- wid = g_list_last(wm->cws->list)->data;
- pos = g_list_length(wm->cws->list) - 1;
- } else if ((guint)pos >= g_list_length(wm->cws->list)) {
- wid = wm->cws->list->data;
+ wid = g_list_last(list)->data; + pos = g_list_length(list) - 1; + } else if ((guint)pos >= g_list_length(list)) {
- wid = g_list_nth_data(wm->cws->list, pos);
+ wid = g_list_nth_data(list, pos); } while (urgent && !gnt_widget_get_is_urgent(wid) && pos != orgpos);
gnt_wm_raise_window(wm, wid);
@@ -471,8 +474,7 @@
- if ((l = g_list_nth(wm->cws->list, n)) != NULL)
+ if ((l = g_list_nth(gnt_ws_get_list(wm->cws), n)) != NULL) { gnt_wm_raise_window(wm, l->data);
@@ -594,7 +596,7 @@
GntTree *tree = GNT_TREE(wm->windows->tree);
- for (iter = wm->cws->list; iter; iter = iter->next) {
+ for (iter = gnt_ws_get_list(wm->cws); iter; iter = iter->next) { GntBox *box = GNT_BOX(iter->data);
gnt_tree_add_row_last(tree, box,
@@ -606,7 +608,8 @@
for (; ws; ws = ws->next) {
gnt_tree_add_row_last(tree, ws->data,
gnt_tree_create_row(tree, gnt_ws_get_name(GNT_WS(ws->data))), NULL);
- for (iter = GNT_WS(ws->data)->list; iter; iter = iter->next) {
+ for (iter = gnt_ws_get_list(GNT_WS(ws->data)); iter; GntBox *box = GNT_BOX(iter->data);
gnt_tree_add_row_last(tree, box,
@@ -865,7 +868,7 @@
shift_window(GntWM *wm, GntWidget *widget, int dir)
- GList *all = wm->cws->list;
+ GList *all = gnt_ws_get_list(wm->cws); GList *list = g_list_find(all, widget);
@@ -885,7 +888,7 @@
all = g_list_insert(all, widget, pos);
all = g_list_delete_link(all, list);
+ gnt_ws_set_list(wm->cws, all); gnt_ws_draw_taskbar(wm->cws, FALSE);
if (!gnt_ws_is_empty(wm->cws)) {
GntWidget *w = gnt_ws_get_top_widget(wm->cws);
@@ -1682,8 +1685,10 @@
static gint widget_in_workspace(gconstpointer workspace, gconstpointer wid)
GntWS *s = (GntWS *)workspace;
- if (s->list && g_list_find(s->list, wid))
+ GList *list = gnt_ws_get_list(s); + if (list && g_list_find(list, wid)) { @@ -1881,7 +1886,7 @@
- pos = g_list_index(s->list, widget);
+ pos = g_list_index(gnt_ws_get_list(s), widget); gnt_ws_remove_widget(s, widget);
--- a/gntws.c Wed Apr 24 21:54:50 2019 -0400
+++ b/gntws.c Thu Apr 25 03:42:09 2019 -0400
@@ -220,6 +220,22 @@
+gnt_ws_set_list(GntWS *ws, GList *list) + g_return_if_fail(GNT_IS_WS(ws)); +gnt_ws_get_list(GntWS *ws) + g_return_val_if_fail(GNT_IS_WS(ws), NULL); gboolean gnt_ws_is_empty(GntWS *ws)
g_return_val_if_fail(GNT_IS_WS(ws), TRUE);
--- a/gntwsprivate.h Wed Apr 24 21:54:50 2019 -0400
+++ b/gntwsprivate.h Thu Apr 25 03:42:09 2019 -0400
@@ -37,6 +37,9 @@
void gnt_ws_append_widget(GntWS *ws, GntWidget *widget);
void gnt_ws_bring_to_front(GntWS *ws, GntWidget *widget);
+void gnt_ws_set_list(GntWS *ws, GList *list); +GList *gnt_ws_get_list(GntWS *ws); #endif /* GNT_WS_PRIVATE_H */
--- a/wms/irssi.c Wed Apr 24 21:54:50 2019 -0400
+++ b/wms/irssi.c Thu Apr 25 03:42:09 2019 -0400
@@ -240,7 +240,9 @@
const char *name = gnt_widget_get_name(win);
if (!name || !GNT_IS_BOX(win) || !strstr(name, "conversation-window"))
- g_object_set_data(G_OBJECT(win), "irssi-index", GINT_TO_POINTER(g_list_index(wm->cws->list, win)));
+ G_OBJECT(win), "irssi-index", + GINT_TO_POINTER(g_list_index(gnt_ws_get_list(wm->cws), win))); g_timeout_add(0, (GSourceFunc)update_conv_window_title, node);
--- a/wms/s.c Wed Apr 24 21:54:50 2019 -0400
+++ b/wms/s.c Thu Apr 25 03:42:09 2019 -0400
@@ -33,6 +33,8 @@
+#include "gntwsprivate.h" #define GNT_TYPE_S_WM gnt_s_wm_get_type()
G_DECLARE_FINAL_TYPE(GntSWM, gnt_s_wm, GNT, S_WM, GntWM)
@@ -142,7 +144,7 @@
find_widget(GntWM *wm, const char *wname)
- GList *iter = wm->cws->list;
+ GList *iter = gnt_ws_get_list(wm->cws); for (; iter; iter = iter->next) {
GntWidget *widget = iter->data;
const char *name = gnt_widget_get_name(widget);