comparison console/libgnt/gntmain.c @ 15424:acc8a838ad94

More closely imitate the input handling of irssi. Hopefully this will fix the excessive CPU usage bug Alver keeps getting.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 27 Jan 2007 16:40:21 +0000
parents 1c0772f7260b
children 0eb7846f9e7e
comparison
equal deleted inserted replaced
15423:c218d8839902 15424:acc8a838ad94
209 setup_io() 209 setup_io()
210 { 210 {
211 int result; 211 int result;
212 channel = g_io_channel_unix_new(STDIN_FILENO); 212 channel = g_io_channel_unix_new(STDIN_FILENO);
213 213
214 #if 0
214 g_io_channel_set_encoding(channel, NULL, NULL); 215 g_io_channel_set_encoding(channel, NULL, NULL);
215 g_io_channel_set_buffered(channel, FALSE); 216 g_io_channel_set_buffered(channel, FALSE);
216 #if 0
217 g_io_channel_set_flags(channel, G_IO_FLAG_NONBLOCK, NULL ); 217 g_io_channel_set_flags(channel, G_IO_FLAG_NONBLOCK, NULL );
218 #endif 218 #endif
219 219
220 result = g_io_add_watch_full(channel, G_PRIORITY_HIGH, 220 result = g_io_add_watch_full(channel, G_PRIORITY_HIGH,
221 (G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_PRI), 221 (G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_PRI),
301 const char *locale; 301 const char *locale;
302 302
303 if (channel) 303 if (channel)
304 return; 304 return;
305 305
306 locale = setlocale(LC_ALL, "");
307
306 setup_io(); 308 setup_io();
307
308 locale = setlocale(LC_ALL, "");
309 309
310 if (locale && (strstr(locale, "UTF") || strstr(locale, "utf"))) 310 if (locale && (strstr(locale, "UTF") || strstr(locale, "utf")))
311 ascii_only = FALSE; 311 ascii_only = FALSE;
312 else 312 else
313 ascii_only = TRUE; 313 ascii_only = TRUE;