Mercurial > pidgin
comparison console/libgnt/gntmain.c @ 14390:d4a26ada1971
[gaim-migrate @ 17096]
Give a bit more control to the window-manager about the size/position of
a window. Also, give the WM an opportunity to do its thing when the window
changes something (eg. title, 'urgency').
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Thu, 31 Aug 2006 06:39:20 +0000 |
parents | f4af666fafe3 |
children | 8375ecb6152b |
comparison
equal
deleted
inserted
replaced
14389:746d535e9053 | 14390:d4a26ada1971 |
---|---|
79 | 79 |
80 static GntWM wm = | 80 static GntWM wm = |
81 { | 81 { |
82 NULL, /* new_window */ | 82 NULL, /* new_window */ |
83 NULL, /* close_window */ | 83 NULL, /* close_window */ |
84 NULL, /* window_resize_confirm */ | |
84 NULL, /* window_resized */ | 85 NULL, /* window_resized */ |
86 NULL, /* window_move_confirm */ | |
87 NULL, /* window_moved */ | |
88 NULL, /* window_update */ | |
85 NULL, /* key_pressed */ | 89 NULL, /* key_pressed */ |
86 NULL, /* mouse clicked */ | 90 NULL, /* mouse clicked */ |
87 bring_on_top, /* give_focus */ | 91 bring_on_top, /* give_focus */ |
88 NULL, /* uninit */ | 92 NULL, /* uninit */ |
89 list_all_windows, /* window_list */ | 93 list_all_windows, /* window_list */ |
227 | 231 |
228 if (w == ordered->data) { | 232 if (w == ordered->data) { |
229 /* This is the current window in focus */ | 233 /* This is the current window in focus */ |
230 color = GNT_COLOR_TITLE; | 234 color = GNT_COLOR_TITLE; |
231 GNT_WIDGET_UNSET_FLAGS(w, GNT_WIDGET_URGENT); | 235 GNT_WIDGET_UNSET_FLAGS(w, GNT_WIDGET_URGENT); |
236 if (wm.window_update) { | |
237 GntNode *node = g_hash_table_lookup(nodes, w); | |
238 wm.window_update(node->panel, w); | |
239 } | |
232 } else if (GNT_WIDGET_IS_FLAG_SET(w, GNT_WIDGET_URGENT)) { | 240 } else if (GNT_WIDGET_IS_FLAG_SET(w, GNT_WIDGET_URGENT)) { |
233 /* This is a window with the URGENT hint set */ | 241 /* This is a window with the URGENT hint set */ |
234 color = GNT_COLOR_URGENT; | 242 color = GNT_COLOR_URGENT; |
235 } else { | 243 } else { |
236 color = GNT_COLOR_NORMAL; | 244 color = GNT_COLOR_NORMAL; |
1143 | 1151 |
1144 if (ordered && ordered->data == widget) | 1152 if (ordered && ordered->data == widget) |
1145 return; | 1153 return; |
1146 | 1154 |
1147 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_URGENT); | 1155 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_URGENT); |
1156 | |
1157 if (wm.window_update) { | |
1158 GntNode *node = g_hash_table_lookup(nodes, widget); | |
1159 wm.window_update(node->panel, widget); | |
1160 } | |
1161 | |
1148 draw_taskbar(FALSE); | 1162 draw_taskbar(FALSE); |
1149 } | 1163 } |
1150 | 1164 |
1151 void gnt_quit() | 1165 void gnt_quit() |
1152 { | 1166 { |
1164 { | 1178 { |
1165 if (widget->parent == NULL) | 1179 if (widget->parent == NULL) |
1166 { | 1180 { |
1167 GntNode *node = g_hash_table_lookup(nodes, widget); | 1181 GntNode *node = g_hash_table_lookup(nodes, widget); |
1168 if (!node) | 1182 if (!node) |
1183 return; | |
1184 | |
1185 if (wm.window_resize_confirm && !wm.window_resize_confirm(widget, &width, &height)) | |
1169 return; | 1186 return; |
1170 | 1187 |
1171 hide_panel(node->panel); | 1188 hide_panel(node->panel); |
1172 gnt_widget_set_size(widget, width, height); | 1189 gnt_widget_set_size(widget, width, height); |
1173 gnt_widget_draw(widget); | 1190 gnt_widget_draw(widget); |
1181 } | 1198 } |
1182 | 1199 |
1183 void gnt_screen_move_widget(GntWidget *widget, int x, int y) | 1200 void gnt_screen_move_widget(GntWidget *widget, int x, int y) |
1184 { | 1201 { |
1185 GntNode *node = g_hash_table_lookup(nodes, widget); | 1202 GntNode *node = g_hash_table_lookup(nodes, widget); |
1203 | |
1204 if (wm.window_move_confirm && !wm.window_move_confirm(widget, &x, &y)) | |
1205 return; | |
1206 | |
1186 gnt_widget_set_position(widget, x, y); | 1207 gnt_widget_set_position(widget, x, y); |
1187 move_panel(node->panel, y, x); | 1208 move_panel(node->panel, y, x); |
1209 | |
1210 if (wm.window_moved) | |
1211 wm.window_moved(node->panel, widget); | |
1212 | |
1188 update_screen(NULL); | 1213 update_screen(NULL); |
1189 } | 1214 } |
1190 | 1215 |
1191 void gnt_screen_rename_widget(GntWidget *widget, const char *text) | 1216 void gnt_screen_rename_widget(GntWidget *widget, const char *text) |
1192 { | 1217 { |
1193 gnt_box_set_title(GNT_BOX(widget), text); | 1218 gnt_box_set_title(GNT_BOX(widget), text); |
1194 gnt_widget_draw(widget); | 1219 gnt_widget_draw(widget); |
1220 | |
1221 if (wm.window_update) { | |
1222 GntNode *node = g_hash_table_lookup(nodes, widget); | |
1223 wm.window_update(node->panel, widget); | |
1224 } | |
1225 | |
1195 draw_taskbar(FALSE); | 1226 draw_taskbar(FALSE); |
1196 } | 1227 } |
1197 | 1228 |