Mercurial > pidgin.yaz
comparison finch/libgnt/gntwm.c @ 16472:4ea517cb7ceb
Show an activity message when a window in the non-current workspace is flagged urgent
author | Richard Nelson <wabz@pidgin.im> |
---|---|
date | Sat, 28 Apr 2007 05:12:18 +0000 |
parents | 596c970076df |
children | 5acee0788697 |
comparison
equal
deleted
inserted
replaced
16471:596c970076df | 16472:4ea517cb7ceb |
---|---|
53 | 53 |
54 static gboolean write_already(gpointer data); | 54 static gboolean write_already(gpointer data); |
55 static int write_timeout; | 55 static int write_timeout; |
56 static time_t last_active_time; | 56 static time_t last_active_time; |
57 static gboolean idle_update; | 57 static gboolean idle_update; |
58 static GList *act = NULL; /* list of WS with unseen activitiy */ | |
58 | 59 |
59 static GList * | 60 static GList * |
60 g_list_bring_to_front(GList *list, gpointer data) | 61 g_list_bring_to_front(GList *list, gpointer data) |
61 { | 62 { |
62 list = g_list_remove(list, data); | 63 list = g_list_remove(list, data); |
84 dst = node->window; | 85 dst = node->window; |
85 shadow = gnt_widget_has_shadow(widget) ? 1 : 0; | 86 shadow = gnt_widget_has_shadow(widget) ? 1 : 0; |
86 copywin(src, dst, node->scroll, 0, 0, 0, getmaxy(dst) - 1, getmaxx(dst) - 1, 0); | 87 copywin(src, dst, node->scroll, 0, 0, 0, getmaxy(dst) - 1, getmaxx(dst) - 1, 0); |
87 } | 88 } |
88 | 89 |
90 static void | |
91 update_act_msg() | |
92 { | |
93 GntWidget *label; | |
94 GList *iter; | |
95 static GntWidget *message = NULL; | |
96 GString *text = g_string_new("act: "); | |
97 if (message) | |
98 gnt_widget_destroy(message); | |
99 if (g_list_length(act) == 0) | |
100 return; | |
101 for (iter = act; iter; iter = iter->next) { | |
102 GntWS *ws = iter->data; | |
103 g_string_sprintfa(text, "%s, ", gnt_ws_get_name(ws)); | |
104 } | |
105 g_string_erase(text, text->len - 2, 2); | |
106 message = gnt_vbox_new(FALSE); | |
107 label = gnt_label_new_with_format(text->str, GNT_TEXT_FLAG_BOLD | GNT_TEXT_FLAG_HIGHLIGHT); | |
108 GNT_WIDGET_UNSET_FLAGS(GNT_BOX(message), GNT_WIDGET_CAN_TAKE_FOCUS); | |
109 GNT_WIDGET_SET_FLAGS(GNT_BOX(message), GNT_WIDGET_TRANSIENT); | |
110 gnt_box_add_widget(GNT_BOX(message), label); | |
111 gnt_widget_set_name(message, "wm-message"); | |
112 gnt_widget_set_position(message, 0, 0); | |
113 gnt_widget_draw(message); | |
114 g_string_free(text, TRUE); | |
115 } | |
89 static gboolean | 116 static gboolean |
90 update_screen(GntWM *wm) | 117 update_screen(GntWM *wm) |
91 { | 118 { |
92 if (wm->menu) { | 119 if (wm->menu) { |
93 GntMenu *top = wm->menu; | 120 GntMenu *top = wm->menu; |
956 | 983 |
957 static gboolean | 984 static gboolean |
958 workspace_list(GntBindable *b, GList *params) | 985 workspace_list(GntBindable *b, GList *params) |
959 { | 986 { |
960 GntWM *wm = GNT_WM(b); | 987 GntWM *wm = GNT_WM(b); |
961 GntWidget *tree, *win; | |
962 | 988 |
963 if (wm->_list.window || wm->menu) | 989 if (wm->_list.window || wm->menu) |
964 return TRUE; | 990 return TRUE; |
965 | 991 |
966 list_of_windows(wm, TRUE); | 992 list_of_windows(wm, TRUE); |
1175 wm->cws = s; | 1201 wm->cws = s; |
1176 gnt_ws_show(wm->cws, wm->nodes); | 1202 gnt_ws_show(wm->cws, wm->nodes); |
1177 | 1203 |
1178 gnt_ws_draw_taskbar(wm->cws, TRUE); | 1204 gnt_ws_draw_taskbar(wm->cws, TRUE); |
1179 update_screen(wm); | 1205 update_screen(wm); |
1180 if (wm->cws->ordered) | 1206 if (wm->cws->ordered) { |
1181 gnt_widget_set_focus(wm->cws->ordered->data, TRUE); | 1207 gnt_widget_set_focus(wm->cws->ordered->data, TRUE); |
1208 gnt_wm_raise_window(wm, wm->cws->ordered->data); | |
1209 } | |
1210 | |
1211 if (act && g_list_find(act, wm->cws)) { | |
1212 act = g_list_remove(act, wm->cws); | |
1213 update_act_msg(); | |
1214 } | |
1182 return TRUE; | 1215 return TRUE; |
1183 } | 1216 } |
1184 | 1217 |
1185 gboolean | 1218 gboolean |
1186 gnt_wm_switch_workspace_prev(GntWM *wm) | 1219 gnt_wm_switch_workspace_prev(GntWM *wm) |
1705 | 1738 |
1706 if (ws == wm->cws || GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_TRANSIENT)) { | 1739 if (ws == wm->cws || GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_TRANSIENT)) { |
1707 gnt_wm_copy_win(widget, node); | 1740 gnt_wm_copy_win(widget, node); |
1708 update_screen(wm); | 1741 update_screen(wm); |
1709 gnt_ws_draw_taskbar(wm->cws, FALSE); | 1742 gnt_ws_draw_taskbar(wm->cws, FALSE); |
1743 } else if (ws != wm->cws && GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_URGENT)) { | |
1744 if (!act || (act && !g_list_find(act, ws))) | |
1745 act = g_list_prepend(act, ws); | |
1746 update_act_msg(); | |
1710 } | 1747 } |
1711 } | 1748 } |
1712 | 1749 |
1713 gboolean gnt_wm_process_click(GntWM *wm, GntMouseEvent event, int x, int y, GntWidget *widget) | 1750 gboolean gnt_wm_process_click(GntWM *wm, GntMouseEvent event, int x, int y, GntWidget *widget) |
1714 { | 1751 { |