comparison mcabber/mcabber/main.c @ 2231:387cea2a1a81

Fix resizing with --enable-sigwinch
author Mikael Berthe <mikael@lilotux.net>
date Sun, 15 Nov 2015 17:03:41 +0100
parents 1afa40f1d80d
children f5402d705f67
comparison
equal deleted inserted replaced
2230:f5659f0f9db8 2231:387cea2a1a81
61 61
62 #ifndef WAIT_ANY 62 #ifndef WAIT_ANY
63 # define WAIT_ANY -1 63 # define WAIT_ANY -1
64 #endif 64 #endif
65 65
66 static unsigned int terminate_ui; 66 #ifdef USE_SIGWINCH
67 void sigwinch_resize(void);
68 static bool sigwinch;
69 #endif
70
71 static bool terminate_ui;
67 GMainContext *main_context; 72 GMainContext *main_context;
68 73
69 static struct termios *backup_termios; 74 static struct termios *backup_termios;
70 75
71 char *mcabber_version(void) 76 char *mcabber_version(void)
121 mcabber_terminate("Killed by SIGINT"); 126 mcabber_terminate("Killed by SIGINT");
122 } else if (signum == SIGHUP) { 127 } else if (signum == SIGHUP) {
123 mcabber_terminate("Killed by SIGHUP"); 128 mcabber_terminate("Killed by SIGHUP");
124 #ifdef USE_SIGWINCH 129 #ifdef USE_SIGWINCH
125 } else if (signum == SIGWINCH) { 130 } else if (signum == SIGWINCH) {
126 if (scr_curses_status()) 131 sigwinch = TRUE;
127 ungetch(KEY_RESIZE);
128 #endif 132 #endif
129 } else { 133 } else {
130 scr_LogPrint(LPRINT_LOGNORM, "Caught signal: %d", signum); 134 scr_LogPrint(LPRINT_LOGNORM, "Caught signal: %d", signum);
131 } 135 }
132 } 136 }
553 scr_LogPrint(LPRINT_DEBUG, "Entering into main loop..."); 557 scr_LogPrint(LPRINT_DEBUG, "Entering into main loop...");
554 558
555 while(!terminate_ui) { 559 while(!terminate_ui) {
556 if (g_main_context_iteration(main_context, TRUE) == FALSE) 560 if (g_main_context_iteration(main_context, TRUE) == FALSE)
557 keyboard_activity(); 561 keyboard_activity();
562 #ifdef USE_SIGWINCH
563 if (sigwinch) {
564 sigwinch_resize();
565 sigwinch = FALSE;
566 }
567 #endif
558 if (update_roster) 568 if (update_roster)
559 scr_draw_roster(); 569 scr_draw_roster();
560 scr_do_update(); 570 scr_do_update();
561 } 571 }
562 572