Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/screen.c @ 2291:0d350e979bde
Don't rebuild the buddylist multiple times before a screen refresh
author | franky |
---|---|
date | Tue, 01 Nov 2016 08:39:07 +0100 |
parents | ece02eb9c81d |
children | f181418db215 |
comparison
equal
deleted
inserted
replaced
2290:71ec41732035 | 2291:0d350e979bde |
---|---|
1793 mainstatusPanel = new_panel(mainstatusWnd); | 1793 mainstatusPanel = new_panel(mainstatusWnd); |
1794 inputPanel = new_panel(inputWnd); | 1794 inputPanel = new_panel(inputWnd); |
1795 | 1795 |
1796 // Build the buddylist at least once, to make sure the special buffer | 1796 // Build the buddylist at least once, to make sure the special buffer |
1797 // is added | 1797 // is added |
1798 buddylist_build(); | 1798 buddylist_defer_build(); |
1799 | 1799 |
1800 // Init prev_chatwidth; this variable will be used to prevent us | 1800 // Init prev_chatwidth; this variable will be used to prevent us |
1801 // from rewrapping buffers when the width doesn't change. | 1801 // from rewrapping buffers when the width doesn't change. |
1802 prev_chatwidth = maxX - Roster_Width - scr_getprefixwidth(); | 1802 prev_chatwidth = maxX - Roster_Width - scr_getprefixwidth(); |
1803 // Wrap existing status buffer lines | 1803 // Wrap existing status buffer lines |
2085 int prefix_length; | 2085 int prefix_length; |
2086 char space[2] = " "; | 2086 char space[2] = " "; |
2087 | 2087 |
2088 // We can reset update_roster | 2088 // We can reset update_roster |
2089 update_roster = FALSE; | 2089 update_roster = FALSE; |
2090 | |
2091 buddylist_build(); | |
2090 | 2092 |
2091 getmaxyx(rosterWnd, maxy, maxx); | 2093 getmaxyx(rosterWnd, maxy, maxx); |
2092 maxx--; // Last char is for vertical border | 2094 maxx--; // Last char is for vertical border |
2093 | 2095 |
2094 cursor_backup = curs_set(0); | 2096 cursor_backup = curs_set(0); |
2536 // Remove the readmark if it is at the end of the buffer | 2538 // Remove the readmark if it is at the end of the buffer |
2537 scr_buffer_readmark(-1); | 2539 scr_buffer_readmark(-1); |
2538 } | 2540 } |
2539 // We should rebuild the buddylist but not everytime | 2541 // We should rebuild the buddylist but not everytime |
2540 if (!(buddylist_get_filter() & 1<<prev_st)) | 2542 if (!(buddylist_get_filter() & 1<<prev_st)) |
2541 buddylist_build(); | 2543 buddylist_defer_build(); |
2542 update_roster = TRUE; | 2544 update_roster = TRUE; |
2543 } | 2545 } |
2544 | 2546 |
2545 // scr_roster_top() | 2547 // scr_roster_top() |
2546 // Go to the first buddy in the buddylist | 2548 // Go to the first buddy in the buddylist |
2660 if (!roster_elt) | 2662 if (!roster_elt) |
2661 roster_elt = roster_add_user(barejid, NULL, NULL, ROSTER_TYPE_USER, | 2663 roster_elt = roster_add_user(barejid, NULL, NULL, ROSTER_TYPE_USER, |
2662 sub_none, -1); | 2664 sub_none, -1); |
2663 // Set a lock to see it in the buddylist | 2665 // Set a lock to see it in the buddylist |
2664 buddy_setflags(BUDDATA(roster_elt), ROSTER_FLAG_LOCK, TRUE); | 2666 buddy_setflags(BUDDATA(roster_elt), ROSTER_FLAG_LOCK, TRUE); |
2665 buddylist_build(); | 2667 buddylist_defer_build(); |
2666 // Jump to the buddy | 2668 // Jump to the buddy |
2667 set_current_buddy(buddy_search_jid(barejid)); | 2669 set_current_buddy(buddy_search_jid(barejid)); |
2668 if (chatmode) { | 2670 if (chatmode) { |
2669 last_activity_buddy = current_buddy; | 2671 last_activity_buddy = current_buddy; |
2670 scr_show_buddy_window(); | 2672 scr_show_buddy_window(); |
2697 gpointer ngroup; | 2699 gpointer ngroup; |
2698 // If buddy is in a folded group, we need to expand it | 2700 // If buddy is in a folded group, we need to expand it |
2699 ngroup = buddy_getgroup(unread_ptr); | 2701 ngroup = buddy_getgroup(unread_ptr); |
2700 if (buddy_getflags(ngroup) & ROSTER_FLAG_HIDE) { | 2702 if (buddy_getflags(ngroup) & ROSTER_FLAG_HIDE) { |
2701 buddy_setflags(ngroup, ROSTER_FLAG_HIDE, FALSE); | 2703 buddy_setflags(ngroup, ROSTER_FLAG_HIDE, FALSE); |
2702 buddylist_build(); | 2704 buddylist_defer_build(); |
2703 } | 2705 } |
2704 } | 2706 } |
2705 | 2707 |
2706 nbuddy = g_list_find(buddylist, unread_ptr); | 2708 nbuddy = g_list_find(buddylist, unread_ptr); |
2707 if (nbuddy) { | 2709 if (nbuddy) { |
2774 status = 0; | 2776 status = 0; |
2775 for (budstate = 0; budstate < imstatus_size-1; budstate++) | 2777 for (budstate = 0; budstate < imstatus_size-1; budstate++) |
2776 if (strchr(filter, imstatus2char[budstate]) || show_all) | 2778 if (strchr(filter, imstatus2char[budstate]) || show_all) |
2777 status |= 1<<budstate; | 2779 status |= 1<<budstate; |
2778 buddylist_set_filter(status); | 2780 buddylist_set_filter(status); |
2779 buddylist_build(); | 2781 buddylist_defer_build(); |
2780 update_roster = TRUE; | 2782 update_roster = TRUE; |
2781 return; | 2783 return; |
2782 } | 2784 } |
2783 | 2785 |
2784 // Display current filter | 2786 // Display current filter |