Changeset 4014 for neercs/trunk
- Timestamp:
- Nov 23, 2009, 11:46:29 AM (11 years ago)
- Location:
- neercs/trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
neercs/trunk/src/configuration.c
r4001 r4014 37 37 int set_delay(const char *argv, struct screen_list *screen_list); 38 38 int set_eyecandy(const char *argv, struct screen_list *screen_list); 39 char* get_window_manager(struct screen_list *screen_list); 40 char* get_cube_duration(struct screen_list *screen_list); 41 char* get_thumbnails(struct screen_list *screen_list); 42 char* get_status_bar(struct screen_list *screen_list); 43 char* get_screensaver_timeout(struct screen_list *screen_list); 44 char* get_autolock_timeout(struct screen_list *screen_list); 45 char* get_lock_on_detach(struct screen_list *screen_list); 46 char* get_socket_dir(struct screen_list *screen_list); 47 char* get_delay(struct screen_list *screen_list); 48 char* get_eyecandy(struct screen_list *screen_list); 39 int set_border(const char *argv, struct screen_list *screen_list); 40 char *get_window_manager(struct screen_list *screen_list); 41 char *get_cube_duration(struct screen_list *screen_list); 42 char *get_thumbnails(struct screen_list *screen_list); 43 char *get_status_bar(struct screen_list *screen_list); 44 char *get_screensaver_timeout(struct screen_list *screen_list); 45 char *get_autolock_timeout(struct screen_list *screen_list); 46 char *get_lock_on_detach(struct screen_list *screen_list); 47 char *get_socket_dir(struct screen_list *screen_list); 48 char *get_delay(struct screen_list *screen_list); 49 char *get_eyecandy(struct screen_list *screen_list); 50 char *get_border(struct screen_list *screen_list); 49 51 50 52 /* Options definition and associated function pointer */ 51 53 struct config_line config_option[] = { 52 {.name = "window_manager",.set = set_window_manager, .get = get_window_manager}, 53 {.name = "eyecandy",.set = set_eyecandy, .get = get_eyecandy}, 54 {.name = "cube_duration",.set = set_cube_duration, .get = get_window_manager}, 55 {.name = "thumbnails",.set = set_thumbnails, .get = get_window_manager}, 56 {.name = "status_bar",.set = set_status_bar, .get = get_window_manager}, 57 {.name = "screensaver_timeout",.set = set_screensaver_timeout, .get = get_window_manager}, 58 {.name = "autolock_timeout",.set = set_autolock_timeout, .get = get_window_manager}, 59 {.name = "lock_on_detach",.set = set_lock_on_detach, .get = get_window_manager}, 60 {.name = "socket_dir",.set = set_socket_dir, .get = get_window_manager}, 61 {.name = "delay",.set = set_delay, .get = NULL}, 62 54 {.name = "window_manager",.set = set_window_manager,.get = 55 get_window_manager}, 56 {.name = "eyecandy",.set = set_eyecandy,.get = get_eyecandy}, 57 {.name = "borders",.set = set_border,.get = get_border}, 58 {.name = "cube_duration",.set = set_cube_duration,.get = 59 get_window_manager}, 60 {.name = "thumbnails",.set = set_thumbnails,.get = get_window_manager}, 61 {.name = "status_bar",.set = set_status_bar,.get = get_window_manager}, 62 {.name = "screensaver_timeout",.set = set_screensaver_timeout,.get = 63 get_window_manager}, 64 {.name = "autolock_timeout",.set = set_autolock_timeout,.get = 65 get_window_manager}, 66 {.name = "lock_on_detach",.set = set_lock_on_detach,.get = 67 get_window_manager}, 68 {.name = "socket_dir",.set = set_socket_dir,.get = get_window_manager}, 69 {.name = "delay",.set = set_delay,.get = NULL}, 70 63 71 {.name = "last",.set = NULL}, 64 72 }; … … 344 352 if (c) 345 353 { 346 c->set((const char *)option->value, screen_list);354 c->set((const char *)option->value, screen_list); 347 355 } 348 356 option = option->next; … … 390 398 screen_list->mini = 0; 391 399 return 0; 392 400 393 401 } 394 402 … … 414 422 { 415 423 if (screen_list->autolock_timeout == 0 || 416 screen_list->autolock_timeout == 417 ((long long unsigned int)0) - 1) 424 screen_list->autolock_timeout == ((long long unsigned int)0) - 1) 418 425 { 419 426 screen_list->autolock_timeout = atoi(argv) * 1000000; … … 443 450 } 444 451 452 int set_border(const char *argv, struct screen_list *screen_list) 453 { 454 if (IS_OPTION("true") || IS_OPTION("1")) 455 screen_list->border_size = 1; 456 else 457 screen_list->border_size = 0; 458 return 0; 459 } 460 445 461 int set_socket_dir(const char *argv, struct screen_list *screen_list) 446 462 { 447 463 screen_list->socket_dir = strdup(argv); 448 464 return 0; 449 465 } 450 466 … … 453 469 screen_list->requested_delay = atoi(argv); 454 470 screen_list->delay = atoi(argv); 455 456 } 457 458 char *get_window_manager(struct screen_list *screen_list)459 { 460 switch (screen_list->wm_type)461 { 462 463 464 465 466 467 468 469 470 471 472 } 473 return NULL; /* Not reached */474 } 475 476 char *get_cube_duration(struct screen_list *screen_list)471 return 0; 472 } 473 474 char *get_window_manager(struct screen_list *screen_list) 475 { 476 switch (screen_list->wm_type) 477 { 478 case WM_FULL: 479 return "full"; 480 case WM_CARD: 481 return "card"; 482 case WM_VSPLIT: 483 return "vsplit"; 484 case WM_HSPLIT: 485 return "hsplit"; 486 default: 487 return "invalid"; 488 } 489 return NULL; /* Not reached */ 490 } 491 492 char *get_cube_duration(struct screen_list *screen_list) 477 493 { 478 494 char *r = malloc(100); 479 sprintf(r, "%f", (float)screen_list->cube.duration /1000000.0f);495 sprintf(r, "%f", (float)screen_list->cube.duration / 1000000.0f); 480 496 return r; 481 497 } 482 498 483 char* get_thumbnails(struct screen_list *screen_list) 484 { 485 if(screen_list->mini) return "yes"; 499 char *get_thumbnails(struct screen_list *screen_list) 500 { 501 if (screen_list->mini) 502 return "yes"; 486 503 return "no"; 487 504 } 488 505 489 char* get_status_bar(struct screen_list *screen_list) 490 { 491 if(screen_list->status) return "yes"; 506 char *get_status_bar(struct screen_list *screen_list) 507 { 508 if (screen_list->status) 509 return "yes"; 492 510 return "no"; 493 511 } 494 512 495 char* get_eyecandy(struct screen_list *screen_list) 496 { 497 if(screen_list->eyecandy) return "yes"; 513 char *get_eyecandy(struct screen_list *screen_list) 514 { 515 if (screen_list->eyecandy) 516 return "yes"; 498 517 return "no"; 499 518 } 500 519 501 char* get_screensaver_timeout(struct screen_list *screen_list) 520 char *get_border(struct screen_list *screen_list) 521 { 522 if (screen_list->border_size) 523 return "yes"; 524 return "no"; 525 } 526 527 char *get_screensaver_timeout(struct screen_list *screen_list) 502 528 { 503 529 char *r = malloc(100); 504 sprintf(r, "%f", (float)screen_list->screensaver_timeout /1000000.0f);505 return r; 506 } 507 508 char *get_autolock_timeout(struct screen_list *screen_list)530 sprintf(r, "%f", (float)screen_list->screensaver_timeout / 1000000.0f); 531 return r; 532 } 533 534 char *get_autolock_timeout(struct screen_list *screen_list) 509 535 { 510 536 char *r = malloc(100); 511 sprintf(r, "%f", (float)screen_list->autolock_timeout /1000000.0f);537 sprintf(r, "%f", (float)screen_list->autolock_timeout / 1000000.0f); 512 538 return r; 513 539 } 514 540 515 char* get_lock_on_detach(struct screen_list *screen_list) 516 { 517 if(screen_list->lock_on_detach) return "yes"; 518 else return "no"; 519 } 520 521 char* get_socket_dir(struct screen_list *screen_list) 541 char *get_lock_on_detach(struct screen_list *screen_list) 542 { 543 if (screen_list->lock_on_detach) 544 return "yes"; 545 else 546 return "no"; 547 } 548 549 char *get_socket_dir(struct screen_list *screen_list) 522 550 { 523 551 return screen_list->socket_dir; 524 552 } 525 553 526 char *get_delay(struct screen_list *screen_list)554 char *get_delay(struct screen_list *screen_list) 527 555 { 528 556 char *r = malloc(100); … … 530 558 return r; 531 559 } 532 533 534 -
neercs/trunk/src/neercs.h
r4000 r4014 148 148 int wm_type; /* Window manager type */ 149 149 int in_bell; /* Bell occuring in a window */ 150 int was_in_bell; 150 151 int dont_update_coords; /* Used by recurrents */ 151 152 int changed; /* Global redraw needed (e.g. adding a screen) */ 152 153 int delay; /* Minimal time between two refresh (ms) */ 153 154 int force_refresh; 155 int command; 154 156 long long unsigned int last_key_time; 155 int command;156 int was_in_bell;157 157 long long unsigned int last_refresh_time; 158 158 … … 178 178 int status; /* Status bar */ 179 179 int help; /* Help */ 180 int border_size; /* Borders */ 180 181 int window_list; /* Window list */ 181 182 int cur_in_list; /* Window list */ -
neercs/trunk/src/screen_list.c
r4000 r4014 60 60 screen_list->status = 1; 61 61 screen_list->eyecandy = 1; 62 screen_list->border_size = 0; 62 63 screen_list->title = NULL; 63 64 screen_list->window_list = 0; -
neercs/trunk/src/screens.c
r3970 r4014 205 205 caca_clear_canvas(screen_list->cv); 206 206 } 207 caca_set_color_ansi(screen_list->cv, CACA_LIGHTRED, CACA_BLACK);208 207 209 208 wm_refresh(screen_list); -
neercs/trunk/src/wm.c
r4008 r4014 86 86 { 87 87 int i; 88 int w = (screen_list->width / screen_list->count) - 1; 89 int h = screen_list->height - 2; 88 int w = 89 (screen_list->width / screen_list->count) - 90 (screen_list->border_size * 2); 91 int h = screen_list->height - (screen_list->border_size * 2); 90 92 91 93 for (i = 0; i < screen_list->count; i++) 92 94 { 93 screen_list->screen[i]->x = (i * w) + 1;94 screen_list->screen[i]->y = 1;95 screen_list->screen[i]->x = (i * w) + screen_list->border_size; 96 screen_list->screen[i]->y = screen_list->border_size; 95 97 screen_list->screen[i]->visible = 1; 96 98 if (i != screen_list->count - 1) … … 109 111 { 110 112 int i; 111 int w = screen_list->width - 2;113 int w = screen_list->width - (screen_list->border_size * 2); 112 114 int h = (screen_list->height) / screen_list->count; 113 115 114 116 for (i = 0; i < screen_list->count; i++) 115 117 { 116 screen_list->screen[i]->x = 1;117 screen_list->screen[i]->y = (i * h) + 1;118 screen_list->screen[i]->x = screen_list->border_size; 119 screen_list->screen[i]->y = (i * h) + (screen_list->border_size); 118 120 screen_list->screen[i]->visible = 1; 119 121 if (i != screen_list->count - 1) 120 122 { 121 resize_screen(screen_list->screen[i], w, h - 2); 123 resize_screen(screen_list->screen[i], w, 124 h - (screen_list->border_size * 2)); 122 125 } 123 126 else 124 127 { 125 128 resize_screen(screen_list->screen[i], 126 w, screen_list->height - i * h - 2); 129 w, 130 screen_list->height - i * h - 131 (screen_list->border_size * 2)); 127 132 } 128 133 } … … 133 138 { 134 139 int i; 135 int w = screen_list->width - 2;136 int h = screen_list->height - 2;140 int w = screen_list->width - (screen_list->border_size * 2); 141 int h = screen_list->height - (screen_list->border_size * 2); 137 142 138 143 for (i = 0; i < screen_list->count; i++) 139 144 { 140 145 screen_list->screen[i]->visible = 0; 141 screen_list->screen[i]->x = 1;142 screen_list->screen[i]->y = 1;146 screen_list->screen[i]->x = screen_list->border_size; 147 screen_list->screen[i]->y = screen_list->border_size; 143 148 144 149 resize_screen(screen_list->screen[i], w, h); … … 172 177 void wm_refresh(struct screen_list *screen_list) 173 178 { 179 /* FIXME : move set_color to a relevant place */ 180 caca_set_color_ansi(screen_list->cv, CACA_LIGHTRED, CACA_BLACK); 181 174 182 switch (screen_list->wm_type) 175 183 { … … 207 215 { 208 216 /* FIXME drawing the box and rewriting the title creates a dirty rectangle 209 * for the title, even when nothing changed, triggering useless traffic 210 * between server and client. 211 */ 217 for the title, even when nothing changed, triggering useless traffic 218 between server and client. */ 219 if (!screen_list->border_size) 220 return; 221 212 222 caca_draw_cp437_box(screen_list->cv, 213 223 screen_list->screen[pty]->x - 1, … … 253 263 } 254 264 } 255 265 256 266 /* Force 'changed' to force redraw */ 257 267 screen_list->screen[screen_list->pty]->changed = 1; … … 381 391 { 382 392 int i; 383 393 384 394 if (!screen_list->cube.in_switch || !screen_list->eyecandy) 385 395 {
Note: See TracChangeset
for help on using the changeset viewer.