Changeset 349
- Timestamp:
- Jan 13, 2004, 11:33:09 PM (18 years ago)
- Location:
- libcaca/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/src/caca_internals.h
r347 r349 74 74 extern unsigned int _caca_width; 75 75 extern unsigned int _caca_height; 76 extern unsigned int _caca_new_width;77 extern unsigned int _caca_new_height;76 extern int _caca_resize; 77 extern int _caca_resize_event; 78 78 79 79 /* Internal libcaca features */ … … 88 88 extern long int x11_event_mask; 89 89 extern int x11_font_width, x11_font_height; 90 extern unsigned int x11_new_width, x11_new_height; 90 91 #endif 91 92 -
libcaca/trunk/src/event.c
r347 r349 263 263 continue; 264 264 265 _caca_new_width = w; 266 _caca_new_height = h; 265 x11_new_width = w; 266 x11_new_height = h; 267 268 if(_caca_resize) 269 continue; 270 271 _caca_resize = 1; 267 272 268 273 return CACA_EVENT_RESIZE; … … 342 347 if(_caca_driver == CACA_DRIVER_NCURSES) 343 348 { 344 int intkey = getch(); 349 int intkey; 350 351 if(_caca_resize_event) 352 { 353 _caca_resize_event = 0; 354 return CACA_EVENT_RESIZE; 355 } 356 357 intkey = getch(); 345 358 if(intkey == ERR) 346 359 return CACA_EVENT_NONE; … … 518 531 { 519 532 int intkey; 533 534 if(_caca_resize_event) 535 { 536 _caca_resize_event = 0; 537 return CACA_EVENT_RESIZE; 538 } 520 539 521 540 if(!SLang_input_pending(0)) -
libcaca/trunk/src/graphics.c
r348 r349 86 86 unsigned int _caca_width = 0; 87 87 unsigned int _caca_height = 0; 88 unsigned int _caca_new_width= 0;89 unsigned int _caca_new_height = 0;88 int _caca_resize = 0; 89 int _caca_resize_event = 0; 90 90 #endif 91 91 … … 167 167 | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask; 168 168 int x11_font_width, x11_font_height; 169 unsigned int x11_new_width, x11_new_height; 169 170 static GC x11_gc; 170 171 static Pixmap x11_pixmap; … … 827 828 DefaultDepth(x11_dpy, 828 829 DefaultScreen(x11_dpy))); 830 831 x11_new_width = x11_new_height = 0; 829 832 } 830 833 else … … 907 910 908 911 _caca_scratch_line = malloc(_caca_width + 1); 909 910 _caca_new_width = _caca_width;911 _caca_new_height = _caca_height;912 912 913 913 _caca_delay = 0; … … 1185 1185 } 1186 1186 1187 if(_caca_width != _caca_new_width || _caca_height != _caca_new_height) 1187 if(_caca_resize) 1188 { 1189 _caca_resize = 0; 1188 1190 caca_handle_resize(); 1191 } 1189 1192 1190 1193 /* Wait until _caca_delay + time of last call */ … … 1215 1218 unsigned int old_height = _caca_height; 1216 1219 1217 _caca_width = _caca_new_width;1218 _caca_height = _caca_new_height;1219 1220 if(_caca_width != old_width)1221 {1222 free(_caca_empty_line);1223 _caca_empty_line = malloc(_caca_width + 1);1224 memset(_caca_empty_line, ' ', _caca_width);1225 _caca_empty_line[_caca_width] = '\0';1226 1227 free(_caca_scratch_line);1228 _caca_scratch_line = malloc(_caca_width + 1);1229 }1230 1231 1220 #if defined(USE_SLANG) 1232 1221 if(_caca_driver == CACA_DRIVER_SLANG) 1233 1222 { 1234 SLsmg_reinit_smg(); 1223 SLtt_get_screen_size(); 1224 _caca_width = SLtt_Screen_Cols; 1225 _caca_height = SLtt_Screen_Rows; 1226 1227 if(_caca_width != old_width || _caca_height != old_height) 1228 SLsmg_reinit_smg(); 1235 1229 } 1236 1230 else … … 1239 1233 if(_caca_driver == CACA_DRIVER_NCURSES) 1240 1234 { 1241 resize_term(_caca_height, _caca_width); 1242 wrefresh(curscr); 1235 struct winsize size; 1236 1237 if(ioctl(fileno(stdout), TIOCGWINSZ, &size) == 0) 1238 { 1239 _caca_width = size.ws_col; 1240 _caca_height = size.ws_row; 1241 resize_term(_caca_height, _caca_width); 1242 wrefresh(curscr); 1243 } 1243 1244 } 1244 1245 else … … 1253 1254 if(_caca_driver == CACA_DRIVER_X11) 1254 1255 { 1256 _caca_width = x11_new_width; 1257 _caca_height = x11_new_height; 1258 1255 1259 XFreePixmap(x11_dpy, x11_pixmap); 1256 1260 free(x11_char); … … 1277 1281 { 1278 1282 /* Dummy */ 1283 } 1284 1285 if(_caca_width != old_width) 1286 { 1287 free(_caca_empty_line); 1288 _caca_empty_line = malloc(_caca_width + 1); 1289 memset(_caca_empty_line, ' ', _caca_width); 1290 _caca_empty_line[_caca_width] = '\0'; 1291 1292 free(_caca_scratch_line); 1293 _caca_scratch_line = malloc(_caca_width + 1); 1279 1294 } 1280 1295 } … … 1336 1351 static RETSIGTYPE sigwinch_handler(int sig) 1337 1352 { 1338 struct winsize size; 1339 1340 #if defined(USE_SLANG) 1341 if(_caca_driver == CACA_DRIVER_SLANG) 1342 { 1343 SLtt_get_screen_size(); 1344 _caca_new_width = SLtt_Screen_Cols; 1345 _caca_new_height = SLtt_Screen_Rows; 1346 } 1347 else 1348 #endif 1349 #if defined(USE_NCURSES) 1350 if(_caca_driver == CACA_DRIVER_NCURSES) 1351 { 1352 if(ioctl(fileno(stdout), TIOCGWINSZ, &size) == 0) 1353 { 1354 _caca_new_width = size.ws_col; 1355 _caca_new_height = size.ws_row; 1356 } 1357 } 1358 else 1359 #endif 1360 { 1361 /* Dummy */ 1362 } 1353 _caca_resize_event = 1; 1363 1354 1364 1355 signal(SIGWINCH, sigwinch_handler);; -
libcaca/trunk/test/event.c
r335 r349 138 138 event & 0x00ffffff); 139 139 break; 140 case CACA_EVENT_RESIZE: 141 caca_printf(x, y, "CACA_EVENT_RESIZE"); 142 break; 140 143 default: 141 144 caca_printf(x, y, "CACA_EVENT_UNKNOWN");
Note: See TracChangeset
for help on using the changeset viewer.