Mercurial > pidgin.yaz
comparison finch/libgnt/gntwm.c @ 19109:1cb69ea47a6e
propagate from branch 'im.pidgin.pidgin' (head d2f50519c5ed668dd980277afdc25d71ccb8a852)
to branch 'im.pidgin.soc.2007.finchfeat' (head 6429a075d71b5b1cc70abf9b5d55875f793168c8)
author | Eric Polino <aluink@pidgin.im> |
---|---|
date | Thu, 21 Jun 2007 20:37:57 +0000 |
parents | a1ac8b05ecdb af7b944374ba |
children | 60c6090c0e29 |
comparison
equal
deleted
inserted
replaced
19108:32c479656486 | 19109:1cb69ea47a6e |
---|---|
336 wm->workspaces = NULL; | 336 wm->workspaces = NULL; |
337 wm->name_places = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | 337 wm->name_places = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
338 wm->title_places = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | 338 wm->title_places = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
339 gnt_style_read_workspaces(wm); | 339 gnt_style_read_workspaces(wm); |
340 if (wm->workspaces == NULL) { | 340 if (wm->workspaces == NULL) { |
341 wm->cws = g_object_new(GNT_TYPE_WS, NULL); | 341 wm->cws = gnt_ws_new("default"); |
342 gnt_ws_set_name(wm->cws, "default"); | |
343 gnt_wm_add_workspace(wm, wm->cws); | 342 gnt_wm_add_workspace(wm, wm->cws); |
344 } else { | 343 } else { |
345 wm->cws = wm->workspaces->data; | 344 wm->cws = wm->workspaces->data; |
346 } | 345 } |
347 wm->event_stack = FALSE; | 346 wm->event_stack = FALSE; |
1003 refresh_screen(GntBindable *bindable, GList *null) | 1002 refresh_screen(GntBindable *bindable, GList *null) |
1004 { | 1003 { |
1005 GntWM *wm = GNT_WM(bindable); | 1004 GntWM *wm = GNT_WM(bindable); |
1006 | 1005 |
1007 endwin(); | 1006 endwin(); |
1008 refresh(); | |
1009 curs_set(0); /* endwin resets the cursor to normal */ | |
1010 | 1007 |
1011 g_hash_table_foreach(wm->nodes, (GHFunc)refresh_node, NULL); | 1008 g_hash_table_foreach(wm->nodes, (GHFunc)refresh_node, NULL); |
1012 update_screen(wm); | 1009 update_screen(wm); |
1013 gnt_ws_draw_taskbar(wm->cws, TRUE); | 1010 gnt_ws_draw_taskbar(wm->cws, TRUE); |
1011 curs_set(0); /* endwin resets the cursor to normal */ | |
1014 | 1012 |
1015 return FALSE; | 1013 return FALSE; |
1016 } | 1014 } |
1017 | 1015 |
1018 static gboolean | 1016 static gboolean |
1098 if (wm->_list.window || wm->menu) | 1096 if (wm->_list.window || wm->menu) |
1099 return TRUE; | 1097 return TRUE; |
1100 | 1098 |
1101 list_of_windows(wm, TRUE); | 1099 list_of_windows(wm, TRUE); |
1102 | 1100 |
1101 return TRUE; | |
1102 } | |
1103 | |
1104 static gboolean | |
1105 workspace_new(GntBindable *bindable, GList *null) | |
1106 { | |
1107 GntWM *wm = GNT_WM(bindable); | |
1108 GntWS *ws = gnt_ws_new(NULL); | |
1109 gnt_wm_add_workspace(wm, ws); | |
1110 gnt_wm_switch_workspace(wm, g_list_index(wm->workspaces, ws)); | |
1103 return TRUE; | 1111 return TRUE; |
1104 } | 1112 } |
1105 | 1113 |
1106 static gboolean | 1114 static gboolean |
1107 ignore_keys_start(GntBindable *bindable, GList *n) | 1115 ignore_keys_start(GntBindable *bindable, GList *n) |
1300 "\033" GNT_KEY_CTRL_J, NULL); | 1308 "\033" GNT_KEY_CTRL_J, NULL); |
1301 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-scroll-up", window_scroll_up, | 1309 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-scroll-up", window_scroll_up, |
1302 "\033" GNT_KEY_CTRL_K, NULL); | 1310 "\033" GNT_KEY_CTRL_K, NULL); |
1303 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "help-for-widget", help_for_widget, | 1311 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "help-for-widget", help_for_widget, |
1304 "\033" "/", NULL); | 1312 "\033" "/", NULL); |
1313 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "workspace-new", workspace_new, | |
1314 GNT_KEY_F9, NULL); | |
1305 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "workspace-next", workspace_next, | 1315 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "workspace-next", workspace_next, |
1306 "\033" ">", NULL); | 1316 "\033" ">", NULL); |
1307 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "workspace-prev", workspace_prev, | 1317 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "workspace-prev", workspace_prev, |
1308 "\033" "<", NULL); | 1318 "\033" "<", NULL); |
1309 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-tag", tag_widget, | 1319 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-tag", tag_widget, |
1364 &info, 0); | 1374 &info, 0); |
1365 } | 1375 } |
1366 | 1376 |
1367 return type; | 1377 return type; |
1368 } | 1378 } |
1379 | |
1369 void | 1380 void |
1370 gnt_wm_add_workspace(GntWM *wm, GntWS *ws) | 1381 gnt_wm_add_workspace(GntWM *wm, GntWS *ws) |
1371 { | 1382 { |
1372 wm->workspaces = g_list_append(wm->workspaces, ws); | 1383 wm->workspaces = g_list_append(wm->workspaces, ws); |
1373 } | 1384 } |
1501 if (g_strrstr((gchar *)wid_title, (gchar *)title)) | 1512 if (g_strrstr((gchar *)wid_title, (gchar *)title)) |
1502 return TRUE; | 1513 return TRUE; |
1503 return FALSE; | 1514 return FALSE; |
1504 } | 1515 } |
1505 | 1516 |
1517 #if !GLIB_CHECK_VERSION(2,4,0) | |
1518 typedef struct | |
1519 { | |
1520 GntWM *wm; | |
1521 GntWS *ret; | |
1522 gchar *title; | |
1523 } title_search; | |
1524 | |
1525 static void match_title_search(gpointer key, gpointer value, gpointer search) | |
1526 { | |
1527 title_search *s = search; | |
1528 if (s->ret) | |
1529 return; | |
1530 if (match_title(key, NULL, s->title)) | |
1531 s->ret = g_hash_table_lookup(s->wm->title_places, key); | |
1532 } | |
1533 #endif | |
1534 | |
1506 static GntWS * | 1535 static GntWS * |
1507 new_widget_find_workspace(GntWM *wm, GntWidget *widget, gchar *wid_title) | 1536 new_widget_find_workspace(GntWM *wm, GntWidget *widget, gchar *wid_title) |
1508 { | 1537 { |
1509 GntWS *ret; | 1538 GntWS *ret; |
1510 const gchar *name; | 1539 const gchar *name; |
1540 #if GLIB_CHECK_VERSION(2,4,0) | |
1511 ret = g_hash_table_find(wm->title_places, match_title, wid_title); | 1541 ret = g_hash_table_find(wm->title_places, match_title, wid_title); |
1542 #else | |
1543 title_search *s = NULL; | |
1544 s = g_new0(title_search, 1); | |
1545 s->wm = wm; | |
1546 s->title = wid_title; | |
1547 g_hash_table_foreach(wm->title_places, match_title_search, s); | |
1548 ret = s->ret; | |
1549 #endif | |
1512 if (ret) | 1550 if (ret) |
1513 return ret; | 1551 return ret; |
1514 name = gnt_widget_get_name(widget); | 1552 name = gnt_widget_get_name(widget); |
1515 if (name) | 1553 if (name) |
1516 ret = g_hash_table_lookup(wm->name_places, name); | 1554 ret = g_hash_table_lookup(wm->name_places, name); |
1598 | 1636 |
1599 if (wm->event_stack || node->me == wm->_list.window) { | 1637 if (wm->event_stack || node->me == wm->_list.window) { |
1600 gnt_wm_raise_window(wm, node->me); | 1638 gnt_wm_raise_window(wm, node->me); |
1601 } else { | 1639 } else { |
1602 bottom_panel(node->panel); /* New windows should not grab focus */ | 1640 bottom_panel(node->panel); /* New windows should not grab focus */ |
1641 gnt_widget_set_focus(node->me, FALSE); | |
1603 gnt_widget_set_urgent(node->me); | 1642 gnt_widget_set_urgent(node->me); |
1604 if (wm->cws != ws) | 1643 if (wm->cws != ws) |
1605 gnt_ws_widget_hide(widget, wm->nodes); | 1644 gnt_ws_widget_hide(widget, wm->nodes); |
1606 } | 1645 } |
1607 } | 1646 } |