Changeset 2495 for neercs/trunk
- Timestamp:
- Jun 28, 2008, 1:22:26 PM (14 years ago)
- Location:
- neercs/trunk/src
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
neercs/trunk/src/Makefile.am
r2463 r2495 3 3 4 4 neercs_SOURCES = neercs.h mygetopt.c recurrent.c main.c screens.c term.c \ 5 grab.c effects.c wm.c screensaver.c attach.c configuration.c 5 grab.c effects.c wm.c screensaver.c attach.c configuration.c \ 6 input.c lock.c 6 7 neercs_CFLAGS = @CACA_CFLAGS@ 7 8 neercs_LDADD = @CACA_LIBS@ @UTIL_LIBS@ @PAM_LIBS@ -
neercs/trunk/src/effects.c
r2474 r2495 23 23 #include <sys/wait.h> 24 24 #include <sys/types.h> 25 #include <security/pam_appl.h>26 #include <security/pam_misc.h>27 #include <pwd.h>28 25 29 26 #include "neercs.h" 30 27 31 static int convpam(int num_msg, const struct pam_message **msg, 32 struct pam_response **resp, void *appdata_ptr); 33 34 void draw_thumbnails(cucul_canvas_t *cv, struct screen_list *screen_list) 35 { 36 char const * const *fonts; 37 cucul_dither_t *d; 38 cucul_font_t *f; 39 uint8_t *buf; 40 int i; 41 int miniw, minih; 42 43 if(screen_list->count) 44 { 45 fonts = cucul_get_font_list(); 46 f = cucul_load_font(fonts[0], 0); 47 48 miniw = cucul_get_canvas_width(screen_list->screen[0]->cv) 49 * cucul_get_font_width(f); 50 minih = cucul_get_canvas_height(screen_list->screen[0]->cv) 51 * cucul_get_font_height(f); 52 buf = malloc(4 * miniw * minih); 28 void draw_thumbnails(struct screen_list *screen_list) 29 { 30 char const * const *fonts; 31 cucul_dither_t *d; 32 cucul_font_t *f; 33 uint8_t *buf; 34 int i; 35 int miniw, minih; 36 37 if(screen_list->count) 38 { 39 fonts = cucul_get_font_list(); 40 f = cucul_load_font(fonts[0], 0); 41 42 miniw = cucul_get_canvas_width(screen_list->screen[0]->cv) 43 * cucul_get_font_width(f); 44 minih = cucul_get_canvas_height(screen_list->screen[0]->cv) 45 * cucul_get_font_height(f); 46 buf = malloc(4 * miniw * minih); 53 47 54 48 #if defined(HAVE_ENDIAN_H) 55 49 if(__BYTE_ORDER == __BIG_ENDIAN) 56 50 #else 57 58 59 51 /* This is compile-time optimised with at least -O1 or -Os */ 52 uint32_t const tmp = 0x12345678; 53 if(*(uint8_t const *)&tmp == 0x12) 60 54 #endif 61 62 63 64 65 66 67 68 69 70 71 cucul_dither_bitmap(cv, 20 * i,72 cucul_get_canvas_height(cv) - 6, 19, 6, d, buf);73 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE);74 75 76 cucul_draw_cp437_box(cv,20 * i,77 cucul_get_canvas_height(cv) - 6, 19, 6);78 cucul_printf(cv, 20 * i,79 cucul_get_canvas_height(cv) - 6, "(%i)", i+1);80 81 82 83 84 85 86 55 d = cucul_create_dither(32, miniw, minih, 4 * miniw, 56 0xff0000, 0xff00, 0xff, 0x0); 57 else 58 d = cucul_create_dither(32, miniw, minih, 4 * miniw, 59 0xff00, 0xff0000, 0xff000000, 0x0); 60 61 for(i = 0; i < screen_list->count; i++) 62 { 63 cucul_render_canvas(screen_list->screen[i]->cv, f, buf, 64 miniw, minih, miniw * 4); 65 cucul_dither_bitmap(screen_list->cv, 20 * i, 66 cucul_get_canvas_height(screen_list->cv) - 6, 19, 6, d, buf); 67 cucul_set_color_ansi(screen_list->cv, CUCUL_WHITE, CUCUL_BLUE); 68 69 if(screen_list->pty == i) 70 cucul_draw_cp437_box(screen_list->cv,20 * i, 71 cucul_get_canvas_height(screen_list->cv) - 6, 19, 6); 72 cucul_printf(screen_list->cv, 20 * i, 73 cucul_get_canvas_height(screen_list->cv) - 6, "(%i)", i+1); 74 } 75 76 cucul_free_dither(d); 77 cucul_free_font(f); 78 79 free(buf); 80 } 87 81 88 82 } 89 83 90 84 /* FIXME, make this stuff more configurable */ 91 void draw_status( cucul_canvas_t *cv,struct screen_list *screen_list)92 { 93 int x = 0, y = cucul_get_canvas_height( cv) - 1;94 95 96 cucul_set_color_ansi(cv, CUCUL_BLUE, CUCUL_BLUE);97 cucul_fill_box(cv,98 99 cucul_get_canvas_width(cv), 1, '#');85 void draw_status(struct screen_list *screen_list) 86 { 87 int x = 0, y = cucul_get_canvas_height(screen_list->cv) - 1; 88 89 90 cucul_set_color_ansi(screen_list->cv, CUCUL_BLUE, CUCUL_BLUE); 91 cucul_fill_box(screen_list->cv, 92 x, y, 93 cucul_get_canvas_width(screen_list->cv), 1, '#'); 100 94 101 95 /* Hour */ … … 106 100 sprintf(hour, "%02d:%02d", t->tm_hour, t->tm_min); 107 101 108 cucul_set_color_ansi( cv, CUCUL_LIGHTBLUE, CUCUL_BLUE);109 cucul_printf( cv, x, y,102 cucul_set_color_ansi(screen_list->cv, CUCUL_LIGHTBLUE, CUCUL_BLUE); 103 cucul_printf(screen_list->cv, x, y, 110 104 "["); 111 105 112 cucul_set_color_ansi( cv, CUCUL_DEFAULT, CUCUL_BLUE);113 cucul_printf( cv, x+1, y,106 cucul_set_color_ansi(screen_list->cv, CUCUL_DEFAULT, CUCUL_BLUE); 107 cucul_printf(screen_list->cv, x+1, y, 114 108 hour); 115 cucul_set_color_ansi( cv, CUCUL_LIGHTBLUE, CUCUL_BLUE);116 cucul_printf( cv, x + strlen(hour) + 1, y,109 cucul_set_color_ansi(screen_list->cv, CUCUL_LIGHTBLUE, CUCUL_BLUE); 110 cucul_printf(screen_list->cv, x + strlen(hour) + 1, y, 117 111 "]"); 118 112 x += 7; … … 125 119 sprintf(text, "%d/%d", screen_list->pty+1, screen_list->count); 126 120 x++; 127 cucul_set_color_ansi( cv, CUCUL_LIGHTBLUE, CUCUL_BLUE);128 cucul_printf( cv, x, y, "Window:");129 cucul_set_color_ansi( cv, CUCUL_DEFAULT, CUCUL_BLUE);130 cucul_printf( cv, x+8, y, text);121 cucul_set_color_ansi(screen_list->cv, CUCUL_LIGHTBLUE, CUCUL_BLUE); 122 cucul_printf(screen_list->cv, x, y, "Window:"); 123 cucul_set_color_ansi(screen_list->cv, CUCUL_DEFAULT, CUCUL_BLUE); 124 cucul_printf(screen_list->cv, x+8, y, text); 131 125 x+= 8+strlen(text); 132 126 } … … 155 149 156 150 x++; 157 cucul_set_color_ansi( cv, CUCUL_LIGHTBLUE, CUCUL_BLUE);158 cucul_printf( cv, x, y, "WM:");159 cucul_set_color_ansi( cv, CUCUL_DEFAULT, CUCUL_BLUE);160 cucul_printf( cv, x+4, y, text);151 cucul_set_color_ansi(screen_list->cv, CUCUL_LIGHTBLUE, CUCUL_BLUE); 152 cucul_printf(screen_list->cv, x, y, "WM:"); 153 cucul_set_color_ansi(screen_list->cv, CUCUL_DEFAULT, CUCUL_BLUE); 154 cucul_printf(screen_list->cv, x+4, y, text); 161 155 x+= 4+strlen(text); 162 156 } … … 166 160 char text[256]; 167 161 sprintf(text, "Help: ctrl-a-h"); 168 x = cucul_get_canvas_width( cv) - strlen(text);169 170 cucul_set_color_ansi( cv, CUCUL_DEFAULT, CUCUL_BLUE);171 cucul_printf( cv, x, y, text);172 } 173 174 175 } 176 177 178 void draw_help( cucul_canvas_t *cv,struct screen_list *screen_list)162 x = cucul_get_canvas_width(screen_list->cv) - strlen(text); 163 164 cucul_set_color_ansi(screen_list->cv, CUCUL_DEFAULT, CUCUL_BLUE); 165 cucul_printf(screen_list->cv, x, y, text); 166 } 167 168 169 } 170 171 172 void draw_help(struct screen_list *screen_list) 179 173 { 180 174 int w = 65, h = 20; 181 int x = (cucul_get_canvas_width( cv) - w) / 2;182 int y = (cucul_get_canvas_height( cv) - h) / 2;183 184 185 cucul_set_color_ansi( cv, CUCUL_BLUE, CUCUL_BLUE);186 cucul_fill_box( cv,175 int x = (cucul_get_canvas_width(screen_list->cv) - w) / 2; 176 int y = (cucul_get_canvas_height(screen_list->cv) - h) / 2; 177 178 179 cucul_set_color_ansi(screen_list->cv, CUCUL_BLUE, CUCUL_BLUE); 180 cucul_fill_box(screen_list->cv, 187 181 x, y, 188 182 w, h, '#'); 189 cucul_set_color_ansi( cv, CUCUL_DEFAULT, CUCUL_BLUE);190 cucul_draw_cp437_box( cv,183 cucul_set_color_ansi(screen_list->cv, CUCUL_DEFAULT, CUCUL_BLUE); 184 cucul_draw_cp437_box(screen_list->cv, 191 185 x, y, 192 186 w, h); … … 194 188 x+=2; 195 189 y++; 196 cucul_printf( cv,197 (cucul_get_canvas_width( cv) - strlen(PACKAGE_STRING)) / 2,190 cucul_printf(screen_list->cv, 191 (cucul_get_canvas_width(screen_list->cv) - strlen(PACKAGE_STRING)) / 2, 198 192 y-1, 199 193 PACKAGE_STRING); 200 cucul_printf(cv, x, y++, "Copyright (c) 2006-2008 "); 201 cucul_printf(cv, x, y++, " Sam Hocevar <sam@zoy.org>"); 202 cucul_printf(cv, x, y++, " Jean-Yves Lamoureux <jylam@lnxscene.org>"); 203 cucul_printf(cv, x, y++, " Pascal Terjan <pterjan@linuxfr.org>"); 204 cucul_printf(cv, x, y++, ""); 205 cucul_printf(cv, x, y++, ""); 206 cucul_printf(cv, x, y++, "All shortcuts are in format 'ctrl-a-X' where X is :"); 207 cucul_printf(cv, x, y++, "n:\t Next window"); 208 cucul_printf(cv, x, y++, "p:\t Previous window"); 209 cucul_printf(cv, x, y++, "w:\t Switch window manager"); 210 cucul_printf(cv, x, y++, "c:\t Create new window"); 211 cucul_printf(cv, x, y++, "m:\t Thumbnails"); 212 cucul_printf(cv, x, y++, "d:\t Detach"); 213 cucul_printf(cv, x, y++, "k:\t Close window and kill associated process"); 214 cucul_printf(cv, x, y++, "h:\t This help"); 215 cucul_printf(cv, x, y++, ""); 216 cucul_printf(cv, x, y++, ""); 217 cucul_printf(cv, x, y++, "See http://libcaca.zoy.org/wiki/neercs for more informations"); 218 } 219 220 221 void draw_lock(cucul_canvas_t *cv, struct screen_list *screen_list) 222 { 223 unsigned int i; 224 char buffer[1024]; 225 gethostname(buffer, sizeof(buffer)-1); 226 227 int w = 65, h = 20; 228 int x = (cucul_get_canvas_width(cv) - w) / 2; 229 int y = (cucul_get_canvas_height(cv) - h) / 2; 230 231 232 cucul_set_color_ansi(cv, CUCUL_BLUE, CUCUL_BLUE); 233 cucul_fill_box(cv, 234 x, y, 235 w, h, '#'); 236 cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_BLUE); 237 cucul_draw_cp437_box(cv, 238 x, y, 239 w, h); 240 241 x+=2; 242 y++; 243 cucul_printf(cv, 244 (cucul_get_canvas_width(cv) - strlen(PACKAGE_STRING " locked")) / 2, 245 y-1, 246 PACKAGE_STRING " locked"); 247 248 cucul_printf(cv, x, y++, "Please type in your password for %s@%s :", getenv("USER"), buffer); 249 y+=2; 250 251 x = (cucul_get_canvas_width(cv)/2) - ((strlen(screen_list->lockpass) / 2) + strlen("Password : ")); 252 cucul_printf(cv, x, y, "Password : "); 253 x+=strlen("Password : "); 254 for(i=0; i<strlen(screen_list->lockpass); i++) 255 { 256 cucul_put_str(cv, x, y, "*"); 257 x++; 258 } 259 260 261 if(strlen(screen_list->lockmsg)) 262 { 263 x = ((cucul_get_canvas_width(cv) - w) / 2) + (strlen(screen_list->lockmsg)); 264 y+=2; 265 cucul_set_color_ansi(cv, CUCUL_RED, CUCUL_BLUE); 266 cucul_printf(cv, x, y, "Error : %s", screen_list->lockmsg); 267 } 268 } 269 270 271 272 /* FIXME, handle this without assuming this is a password auth */ 273 static int convpam(int num_msg, const struct pam_message **msg, 274 struct pam_response **resp, void *appdata_ptr) 275 { 276 277 struct pam_response *aresp; 278 int i; 279 aresp = calloc(num_msg, sizeof(*aresp)); 280 281 for (i = 0; i < num_msg; ++i) 282 { 283 switch(msg[i]->msg_style) 284 { 285 case PAM_PROMPT_ECHO_ON: 286 case PAM_PROMPT_ECHO_OFF: 287 aresp[i].resp = strdup(appdata_ptr); 288 aresp[i].resp_retcode = 0; 289 break; 290 case PAM_ERROR_MSG: 291 break; 292 default : 293 printf("Unknow message type from PAM\n"); 294 break; 295 } 296 } 297 298 *resp = aresp; 299 return (PAM_SUCCESS); 300 } 301 302 303 int validate_lock(struct screen_list *screen_list, char *user, char *pass) 304 { 305 int ret; 306 pam_handle_t *pamh=NULL; 307 char buffer[100]; 308 const char *service="neercs"; 309 struct pam_conv conv = { 310 convpam, 311 pass, 312 }; 313 314 ret = pam_start(service, user, &conv, &pamh); 315 if(ret!=PAM_SUCCESS) 316 return 0; 317 pam_set_item(pamh, PAM_RUSER, user); 318 319 ret = gethostname(buffer, sizeof(buffer)-1); 320 if (ret) 321 { 322 perror("failed to look up hostname"); 323 ret = pam_end(pamh, PAM_ABORT); 324 sprintf(screen_list->lockmsg, "Can't get hostname"); 325 pam_end(pamh, PAM_SUCCESS); 326 return 0; 327 } 328 329 ret = pam_set_item(pamh, PAM_RHOST, buffer); 330 if(ret!=PAM_SUCCESS) 331 { 332 sprintf(screen_list->lockmsg, "Can't set hostname"); 333 pam_end(pamh, PAM_SUCCESS); 334 return 0; 335 } 336 337 ret = pam_authenticate(pamh, 0); 338 if(ret!=PAM_SUCCESS) 339 { 340 sprintf(screen_list->lockmsg, "Can't authenticate"); 341 pam_end(pamh, PAM_SUCCESS); 342 return 0; 343 } 344 345 ret = pam_end(pamh, PAM_SUCCESS); 346 return 1; 347 } 194 cucul_printf(screen_list->cv, x, y++, "Copyright (c) 2006-2008 "); 195 cucul_printf(screen_list->cv, x, y++, " Sam Hocevar <sam@zoy.org>"); 196 cucul_printf(screen_list->cv, x, y++, " Jean-Yves Lamoureux <jylam@lnxscene.org>"); 197 cucul_printf(screen_list->cv, x, y++, " Pascal Terjan <pterjan@linuxfr.org>"); 198 cucul_printf(screen_list->cv, x, y++, ""); 199 cucul_printf(screen_list->cv, x, y++, ""); 200 cucul_printf(screen_list->cv, x, y++, "All shortcuts are in format 'ctrl-a-X' where X is :"); 201 cucul_printf(screen_list->cv, x, y++, "n:\t Next window"); 202 cucul_printf(screen_list->cv, x, y++, "p:\t Previous window"); 203 cucul_printf(screen_list->cv, x, y++, "w:\t Switch window manager"); 204 cucul_printf(screen_list->cv, x, y++, "c:\t Create new window"); 205 cucul_printf(screen_list->cv, x, y++, "m:\t Thumbnails"); 206 cucul_printf(screen_list->cv, x, y++, "d:\t Detach"); 207 cucul_printf(screen_list->cv, x, y++, "k:\t Close window and kill associated process"); 208 cucul_printf(screen_list->cv, x, y++, "h:\t This help"); 209 cucul_printf(screen_list->cv, x, y++, ""); 210 cucul_printf(screen_list->cv, x, y++, ""); 211 cucul_printf(screen_list->cv, x, y++, "See http://libcaca.zoy.org/wiki/neercs for more informations"); 212 } 213 348 214 349 215 … … 391 257 ((s->orig_h/2) - s->h/2); 392 258 } 393 394 259 return 1; 395 260 } -
neercs/trunk/src/main.c
r2493 r2495 79 79 int main(int argc, char **argv) 80 80 { 81 static cucul_canvas_t *cv = NULL;82 static caca_display_t *dp = NULL;83 81 struct screen_list *screen_list = NULL; 84 struct recurrent_list *recurrent_list = NULL;85 82 struct passwd *user_info; 86 char * default_shell = NULL, *user_path = NULL, *session_name = NULL;87 int i, w, h,args, s=0;83 char *user_path = NULL, *session_name = NULL; 84 int i, args, s=0; 88 85 int eof = 0, refresh = 1, command = 0; 89 86 long long unsigned int last_key_time = 0; 90 int lock_offset = 0;91 87 int mainret = 0; 92 88 int attach = 0, forceattach = 0; … … 94 90 int nb_to_grab = 0; 95 91 96 default_shell = getenv("SHELL"); 92 screen_list = create_screen_list(); 93 screen_list->default_shell = getenv("SHELL"); 97 94 98 95 args = argc -1; 99 if( default_shell == NULL && args <= 0)96 if(screen_list->default_shell == NULL && args <= 0) 100 97 { 101 98 fprintf(stderr, "Environment variable SHELL not set and no arguments given. kthxbye.\n"); … … 114 111 } 115 112 116 /* Create screen list */ 117 screen_list = (struct screen_list*) malloc(sizeof(struct screen_list)); 118 if(!screen_list) 113 114 115 screen_list->recurrent_list = (struct recurrent_list*) malloc(sizeof(struct recurrent_list)); 116 screen_list->recurrent_list->recurrent = (struct recurrent**) malloc(sizeof(struct recurrent*)); 117 if(!screen_list->recurrent_list->recurrent) 119 118 { 120 119 fprintf(stderr, "Can't allocate memory at %s:%d\n", __FUNCTION__, __LINE__); 121 120 return -1; 122 121 } 123 screen_list->screen = (struct screen**) malloc(sizeof(sizeof(struct screen*))); 124 if(!screen_list->screen) 125 { 126 fprintf(stderr, "Can't allocate memory at %s:%d\n", __FUNCTION__, __LINE__); 127 return -1; 128 } 129 130 screen_list->count = 0; 131 screen_list->mini = 1; 132 screen_list->help = 0; 133 screen_list->status = 1; 134 screen_list->wm_type = WM_VSPLIT; 135 screen_list->in_bell = 0; 136 screen_list->pty = screen_list->prevpty = 0; 137 screen_list->dont_update_coords = 0; 138 screen_list->screensaver_timeout = (60) * 1000000; 139 screen_list->screensaver_data = NULL; 140 screen_list->in_screensaver = 0; 141 screen_list->locked = 0; 142 screen_list->attached = 1; 143 screen_list->socket = 0; 144 screen_list->socket_dir = NULL; 145 screen_list->socket_path = NULL; 146 screen_list->session_name = NULL; 147 memset(screen_list->lockmsg, 0, 1024); 148 memset(screen_list->lockpass, 0, 1024); 149 150 recurrent_list = (struct recurrent_list*) malloc(sizeof(struct recurrent_list)); 151 recurrent_list->recurrent = (struct recurrent**) malloc(sizeof(struct recurrent*)); 152 if(!recurrent_list->recurrent) 153 { 154 fprintf(stderr, "Can't allocate memory at %s:%d\n", __FUNCTION__, __LINE__); 155 return -1; 156 } 157 recurrent_list->count = 0; 122 screen_list->recurrent_list->count = 0; 158 123 159 124 for(;;) … … 299 264 300 265 /* Create main canvas and associated caca window */ 301 cv = cucul_create_canvas(0, 0);302 dp = caca_create_display(cv);303 if(! dp)266 screen_list->cv = cucul_create_canvas(0, 0); 267 screen_list->dp = caca_create_display(screen_list->cv); 268 if(!screen_list->dp) 304 269 return 1; 305 caca_set_cursor(dp, 1); 306 307 w = cucul_get_canvas_width(cv); 308 h = cucul_get_canvas_height(cv); 309 310 screen_list->width = cucul_get_canvas_width(cv); 311 screen_list->height = cucul_get_canvas_height(cv) - ((screen_list->mini*6) + (screen_list->status)); 270 caca_set_cursor(screen_list->dp, 1); 271 272 screen_list->width = cucul_get_canvas_width(screen_list->cv); 273 screen_list->height = cucul_get_canvas_height(screen_list->cv) - ((screen_list->mini*6) + (screen_list->status)); 312 274 313 275 if(nb_to_grab == 0 && s == argc -1) 314 276 { 315 add_screen(screen_list, create_screen(w, h, default_shell)); 277 add_screen(screen_list, 278 create_screen(screen_list->width, 279 screen_list->height, 280 screen_list->default_shell)); 316 281 } 317 282 … … 319 284 for(i=0; i<nb_to_grab; i++) 320 285 { 321 add_screen(screen_list,create_screen_grab( w, h, to_grab[i]));286 add_screen(screen_list,create_screen_grab(screen_list->width, screen_list->height, to_grab[i])); 322 287 } 323 288 free(to_grab); … … 326 291 for(i=0; i<(argc-1) - s; i++) 327 292 { 328 add_screen(screen_list, create_screen( w, h, argv[i+s+1]));293 add_screen(screen_list, create_screen(screen_list->width, screen_list->height, argv[i+s+1])); 329 294 } 330 295 331 296 /* Windows are in a temporary state, resize them to the right dimensions */ 332 update_windows_props( cv,screen_list);297 update_windows_props(screen_list); 333 298 334 299 last_key_time = get_us(); … … 340 305 int ret = 0; 341 306 307 /* Read program output */ 342 308 refresh |= update_screens_contents(screen_list); 343 309 344 refresh |= read_socket(screen_list, cv, &dp); 310 /* If screen was attached, read its output */ 311 refresh |= read_socket(screen_list, screen_list->cv, &screen_list->dp); 345 312 346 313 /* No more screens, exit */ … … 352 319 /* Get events, if any */ 353 320 if(screen_list->attached) 354 ret = caca_get_event( dp, CACA_EVENT_ANY, &ev, 0);321 ret = caca_get_event(screen_list->dp, CACA_EVENT_ANY, &ev, 0); 355 322 else 356 323 sleep(1); … … 359 326 { 360 327 unsigned int c = caca_get_event_key_ch(&ev); 328 char *str = NULL; 329 int size = 0; 330 /* CTRL-A has been pressed before, handle this as a command */ 361 331 if(command) 362 332 { 363 333 command = 0; 364 365 switch(c) 366 { 367 case 0x01: //CACA_KEY_CTRL_A: 368 screen_list->pty ^= screen_list->prevpty; 369 screen_list->prevpty ^= screen_list->pty; 370 screen_list->pty ^= screen_list->prevpty; 371 refresh = 1; 372 break; 373 case 'm': 374 case 0x0d: //CACA_KEY_CTRL_M: 375 screen_list->mini = !screen_list->mini; 376 refresh = 1; 377 break; 378 case 'n': 379 case ' ': 380 case '\0': 381 case 0x0e: //CACA_KEY_CTRL_N: 382 screen_list->prevpty = screen_list->pty; 383 screen_list->pty = (screen_list->pty + 1) % screen_list->count; 384 refresh = 1; 385 break; 386 case 'p': 387 case 0x10: //CACA_KEY_CTRL_P: 388 screen_list->prevpty = screen_list->pty; 389 screen_list->pty = (screen_list->pty + screen_list->count - 1) % screen_list->count; 390 refresh = 1; 391 break; 392 case 'c': 393 case 0x03: //CACA_KEY_CTRL_C: 394 screen_list->prevpty = screen_list->pty; 395 screen_list->pty = 396 add_screen(screen_list, create_screen(w, h, default_shell)); 397 refresh = 1; 398 break; 399 case 'w': 400 case 0x17: //CACA_KEY_CTRL_W: 401 screen_list->wm_type = (screen_list->wm_type==(WM_MAX-1)? 402 screen_list->wm_type=0: 403 screen_list->wm_type+1); 404 refresh = 1; 405 break; 406 case 0x0b: //CACA_KEY_CTRL_K: 407 add_recurrent(recurrent_list, close_screen_recurrent, cv); 408 refresh = 1; 409 break; 410 case 'x': 411 case 0x18: //CACA_KEY_CTRL_X: 412 memset(screen_list->lockpass, 0, 1024); 413 screen_list->locked = 1; 414 lock_offset = 0; 415 refresh = 1; 416 break; 417 case 'h': 418 case 0x08: //CACA_KEY_CTRL_H: 419 screen_list->help = !screen_list->help; 420 refresh = 1; 421 break; 422 case 'd': 423 case 0x04: //CACA_KEY_CTRL_D: 424 detach(screen_list, dp); 425 break; 426 } 334 refresh |= handle_command_input(screen_list, c); 427 335 } 428 336 else 429 337 { 430 338 /* Not in command mode */ 431 339 last_key_time = get_us(); 432 caca_set_cursor(dp, 1); 433 340 caca_set_cursor(screen_list->dp, 1); 341 342 /* Kill screensaver */ 434 343 if(screen_list->in_screensaver) 435 344 { 436 screensaver_kill( cv, dp,screen_list);345 screensaver_kill(screen_list); 437 346 screen_list->in_screensaver = 0; 438 347 refresh = 1; 439 348 continue; 440 349 } 441 else if(screen_list->locked) 442 { 443 if(c==0x08) 444 { 445 if(lock_offset) 446 { 447 screen_list->lockpass[lock_offset-1] = 0; 448 lock_offset--; 449 } 450 } 451 else if(c==0x0d) // RETURN 452 { 453 memset(screen_list->lockmsg, 0, 1024); 454 if(validate_lock(screen_list, getenv("USER"), screen_list->lockpass)) 455 { 456 memset(screen_list->lockpass, 0, 1024); 457 screen_list->locked = 0; 458 lock_offset = 0; 459 refresh = 1; 460 } 461 else 462 { 463 memset(screen_list->lockpass, 0, 1024); 464 lock_offset = 0; 465 refresh = 1; 466 } 467 } 468 else 469 { 470 if(lock_offset < 1023) 471 { 472 screen_list->lockpass[lock_offset++] = c; 473 screen_list->lockpass[lock_offset] = 0; 474 } 475 } 476 } 350 /* Handle lock window */ 351 if(screen_list->locked) 352 refresh |= update_lock(c, screen_list); 477 353 else 478 354 { … … 481 357 case 0x01: //CACA_KEY_CTRL_A: 482 358 command = 1; break; 483 case CACA_KEY_UP:484 write(screen_list->screen[screen_list->pty]->fd, "\x1b[A", 3); break;485 case CACA_KEY_DOWN:486 write(screen_list->screen[screen_list->pty]->fd, "\x1b[B", 3); break;487 case CACA_KEY_RIGHT:488 write(screen_list->screen[screen_list->pty]->fd, "\x1b[C", 3); break;489 case CACA_KEY_LEFT:490 write(screen_list->screen[screen_list->pty]->fd, "\x1b[D", 3); break;491 case CACA_KEY_PAGEUP:492 write(screen_list->screen[screen_list->pty]->fd, "\x1b[5~", 4); break;493 case CACA_KEY_PAGEDOWN:494 write(screen_list->screen[screen_list->pty]->fd, "\x1b[6~", 4); break;495 case CACA_KEY_HOME:496 write(screen_list->screen[screen_list->pty]->fd, "\x1b[1~", 4); break;497 case CACA_KEY_INSERT:498 write(screen_list->screen[screen_list->pty]->fd, "\x1b[2~", 4); break;499 case CACA_KEY_DELETE:500 write(screen_list->screen[screen_list->pty]->fd, "\x1b[3~", 4); break;501 case CACA_KEY_END:502 write(screen_list->screen[screen_list->pty]->fd, "\x1b[4~", 4); break;503 case CACA_KEY_F1:504 write(screen_list->screen[screen_list->pty]->fd, "\x1b[11~", 5); break;505 case CACA_KEY_F2:506 write(screen_list->screen[screen_list->pty]->fd, "\x1b[12~", 5); break;507 case CACA_KEY_F3:508 write(screen_list->screen[screen_list->pty]->fd, "\x1b[13~", 5); break;509 case CACA_KEY_F4:510 write(screen_list->screen[screen_list->pty]->fd, "\x1b[14~", 5); break;511 case CACA_KEY_F5:512 write(screen_list->screen[screen_list->pty]->fd, "\x1b[15~", 5); break;513 case CACA_KEY_F6:514 write(screen_list->screen[screen_list->pty]->fd, "\x1b[16~", 5); break;515 case CACA_KEY_F7:516 write(screen_list->screen[screen_list->pty]->fd, "\x1b[17~", 5); break;517 case CACA_KEY_F8:518 write(screen_list->screen[screen_list->pty]->fd, "\x1b[18~", 5); break;519 case CACA_KEY_F9:520 write(screen_list->screen[screen_list->pty]->fd, "\x1b[19~", 5); break;521 case CACA_KEY_F10:522 write(screen_list->screen[screen_list->pty]->fd, "\x1b[20~", 5); break;523 case CACA_KEY_F11:524 write(screen_list->screen[screen_list->pty]->fd, "\x1b[21~", 5); break;525 case CACA_KEY_F12:526 write(screen_list->screen[screen_list->pty]->fd, "\x1b[22~", 5); break;527 528 359 case CACA_KEY_ESCAPE: 529 360 if(screen_list->help) … … 534 365 } 535 366 default: 536 write(screen_list->screen[screen_list->pty]->fd, &c, 1); break; 367 /* Normal key, convert it if needed */ 368 str = convert_input_ansi(&c, &size); 369 write(screen_list->screen[screen_list->pty]->fd, str, size); 370 break; 537 371 } 538 372 } 539 373 } 540 374 } 375 /* Window resized */ 541 376 else if(ret && (caca_get_event_type(&ev) & CACA_EVENT_RESIZE)) 542 377 { 543 update_windows_props( cv,screen_list);544 cucul_clear_canvas( cv);378 update_windows_props(screen_list); 379 cucul_clear_canvas(screen_list->cv); 545 380 refresh = 1; 546 381 } 382 /* Window closed */ 547 383 else if(ret && (caca_get_event_type(&ev) & CACA_EVENT_QUIT)) 548 384 { … … 551 387 } 552 388 553 /* Recurrent functions */ 554 for(i=0; i<recurrent_list->count; i++) 555 { 556 if(recurrent_list->recurrent[i]->function) 557 { 558 refresh |= recurrent_list->recurrent[i]->function(screen_list, 559 recurrent_list->recurrent[i], 560 recurrent_list->recurrent[i]->user, 561 get_us()); 562 } 563 } 564 /* Delete recurrent functions */ 565 for(i=0; i<recurrent_list->count; i++) 566 { 567 if(recurrent_list->recurrent[i]->kill_me) 568 { 569 remove_recurrent(recurrent_list, i); 570 i = 0; 571 } 572 } 389 /* Launch reccurents if any */ 390 refresh |= handle_recurrents(screen_list); 573 391 574 392 /* Resfresh screen */ … … 577 395 /* No need to refresh */ 578 396 } 397 /* Draw lock window */ 579 398 else if(screen_list->locked) 580 399 { 581 draw_lock( cv,screen_list);400 draw_lock(screen_list); 582 401 refresh = 1; 583 402 } … … 587 406 (get_us() - last_key_time < screen_list->screensaver_timeout)) 588 407 { 589 refresh_screens( cv,screen_list);408 refresh_screens(screen_list); 590 409 if(screen_list->screen[screen_list->pty]->title) 591 caca_set_display_title( dp, screen_list->screen[screen_list->pty]->title);410 caca_set_display_title(screen_list->dp, screen_list->screen[screen_list->pty]->title); 592 411 else 593 caca_set_display_title( dp, PACKAGE_STRING);412 caca_set_display_title(screen_list->dp, PACKAGE_STRING); 594 413 refresh = 1; 595 414 … … 599 418 { 600 419 if(!screen_list->in_screensaver) 601 screensaver_init( cv, dp,screen_list);420 screensaver_init(screen_list); 602 421 screen_list->in_screensaver = 1; 603 422 604 caca_set_cursor( dp, 0);605 draw_screensaver( cv, dp,screen_list);423 caca_set_cursor(screen_list->dp, 0); 424 draw_screensaver(screen_list); 606 425 refresh = 1; 607 426 } … … 611 430 if(refresh) 612 431 { 613 caca_refresh_display( dp);432 caca_refresh_display(screen_list->dp); 614 433 refresh = 0; 615 434 } … … 624 443 625 444 /* Clean up */ 626 if( dp)627 caca_free_display( dp);628 cucul_free_canvas( cv);445 if(screen_list->dp) 446 caca_free_display(screen_list->dp); 447 cucul_free_canvas(screen_list->cv); 629 448 for(i = 0; i < screen_list->count; i++) 630 449 { … … 657 476 free(screen_list); 658 477 659 for(i=0; i< recurrent_list->count; i++)660 { 661 remove_recurrent( recurrent_list, i);478 for(i=0; i<screen_list->recurrent_list->count; i++) 479 { 480 remove_recurrent(screen_list->recurrent_list, i); 662 481 i = 0; 663 482 } 664 483 665 if( recurrent_list->recurrent) free(recurrent_list->recurrent);666 if( recurrent_list) free(recurrent_list);484 if(screen_list->recurrent_list->recurrent) free(screen_list->recurrent_list->recurrent); 485 if(screen_list->recurrent_list) free(screen_list->recurrent_list); 667 486 668 487 return mainret; 488 } 489 490 491 492 493 struct screen_list *create_screen_list(void) 494 { 495 496 struct screen_list *screen_list = NULL; 497 498 /* Create screen list */ 499 screen_list = (struct screen_list*) malloc(sizeof(struct screen_list)); 500 if(!screen_list) 501 { 502 fprintf(stderr, "Can't allocate memory at %s:%d\n", __FUNCTION__, __LINE__); 503 return NULL; 504 } 505 screen_list->screen = (struct screen**) malloc(sizeof(sizeof(struct screen*))); 506 if(!screen_list->screen) 507 { 508 fprintf(stderr, "Can't allocate memory at %s:%d\n", __FUNCTION__, __LINE__); 509 free(screen_list); 510 return NULL; 511 } 512 513 screen_list->count = 0; 514 screen_list->mini = 1; 515 screen_list->help = 0; 516 screen_list->status = 1; 517 screen_list->wm_type = WM_VSPLIT; 518 screen_list->in_bell = 0; 519 screen_list->pty = screen_list->prevpty = 0; 520 screen_list->dont_update_coords = 0; 521 screen_list->screensaver_timeout = (60) * 1000000; 522 screen_list->screensaver_data = NULL; 523 screen_list->in_screensaver = 0; 524 screen_list->locked = 0; 525 screen_list->lock_offset = 0; 526 screen_list->attached = 1; 527 screen_list->socket = 0; 528 screen_list->socket_dir = NULL; 529 screen_list->socket_path = NULL; 530 screen_list->session_name = NULL; 531 screen_list->default_shell = NULL; 532 533 screen_list->recurrent_list = NULL; 534 screen_list->cv = NULL; 535 screen_list->dp = NULL; 536 537 memset(screen_list->lockmsg, 0, 1024); 538 memset(screen_list->lockpass, 0, 1024); 539 540 return screen_list; 669 541 } 670 542 -
neercs/trunk/src/neercs.h
r2488 r2495 80 80 /* Lock */ 81 81 int locked; 82 int lock_offset; 82 83 char lockpass[1024]; 83 84 char lockmsg[1024]; … … 99 100 100 101 struct option *config; 101 102 char *default_shell; 103 struct recurrent_list *recurrent_list; 104 105 cucul_canvas_t *cv; 106 caca_display_t *dp; 102 107 }; 103 108 … … 123 128 124 129 130 struct screen_list *create_screen_list(void); 125 131 126 132 int create_pty(char *cmd, unsigned int w, unsigned int h, int *cpid); … … 131 137 int set_tty_size(int fd, unsigned int w, unsigned int h); 132 138 int update_terms(struct screen_list* screen_list); 133 void refresh_screens( cucul_canvas_t *cv,struct screen_list *screen_list);139 void refresh_screens(struct screen_list *screen_list); 134 140 int update_screens_contents(struct screen_list* screen_list); 135 141 long long get_us(void); … … 150 156 151 157 /* Window managers */ 152 void update_windows_props( cucul_canvas_t *cv,struct screen_list *screen_list);153 void update_windows_props_cards( cucul_canvas_t *cv,struct screen_list *screen_list);154 void update_windows_props_hsplit( cucul_canvas_t *cv,struct screen_list *screen_list);155 void update_windows_props_full( cucul_canvas_t *cv,struct screen_list *screen_list);156 void update_windows_props_vsplit( cucul_canvas_t *cv,struct screen_list *screen_list);158 void update_windows_props(struct screen_list *screen_list); 159 void update_windows_props_cards(struct screen_list *screen_list); 160 void update_windows_props_hsplit(struct screen_list *screen_list); 161 void update_windows_props_full(struct screen_list *screen_list); 162 void update_windows_props_vsplit(struct screen_list *screen_list); 157 163 158 164 /* Effects and addons */ 159 void draw_thumbnails(cucul_canvas_t *cv, struct screen_list *screen_list); 160 void draw_status(cucul_canvas_t *cv, struct screen_list *screen_list); 161 void draw_help(cucul_canvas_t *cv, struct screen_list *screen_list); 162 void draw_lock(cucul_canvas_t *cv, struct screen_list *screen_list); 165 void draw_thumbnails(struct screen_list *screen_list); 166 void draw_status(struct screen_list *screen_list); 167 void draw_help(struct screen_list *screen_list); 168 void draw_lock(struct screen_list *screen_list); 169 int update_lock(int c, struct screen_list *screen_list); 163 170 int validate_lock(struct screen_list *screen_list, char *user, char *pass); 164 171 165 172 int close_screen_recurrent(struct screen_list*, struct recurrent* rec, void *user, long long unsigned int t); 166 173 174 /* Input to ANSI */ 175 void *convert_input_ansi(unsigned int *c, int *size); 176 int handle_command_input(struct screen_list*screen_list, unsigned int c); 177 167 178 168 179 /* Screensavers */ 169 void screensaver_init(cucul_canvas_t *cv, 170 caca_display_t *dp, 171 struct screen_list *screen_list); 172 void screensaver_kill(cucul_canvas_t *cv, 173 caca_display_t *dp, 174 struct screen_list *screen_list); 175 176 void draw_screensaver(cucul_canvas_t *cv, 177 caca_display_t *dp, 178 struct screen_list *screen_list); 179 void screensaver_flying_toasters(cucul_canvas_t *cv, 180 caca_display_t *dp, 181 struct screen_list *screen_list); 182 183 void screensaver_flying_toasters_init(cucul_canvas_t *cv, 184 caca_display_t *dp, 185 struct screen_list *screen_list); 186 187 void screensaver_flying_toasters_kill(cucul_canvas_t *cv, 188 caca_display_t *dp, 189 struct screen_list *screen_list); 180 void screensaver_init(struct screen_list *screen_list); 181 void screensaver_kill(struct screen_list *screen_list); 182 183 void draw_screensaver(struct screen_list *screen_list); 184 void screensaver_flying_toasters(struct screen_list *screen_list); 185 186 void screensaver_flying_toasters_init(struct screen_list *screen_list); 187 188 void screensaver_flying_toasters_kill(struct screen_list *screen_list); 190 189 191 190 192 191 193 192 /* Recurrents */ 193 int handle_recurrents(struct screen_list* screen_list); 194 194 int add_recurrent(struct recurrent_list *list, 195 195 int (*function)(struct screen_list*, struct recurrent* rec, void *user, long long unsigned int t), -
neercs/trunk/src/recurrent.c
r2473 r2495 29 29 30 30 #include "neercs.h" 31 32 33 int handle_recurrents(struct screen_list* screen_list) 34 { 35 int refresh = 0, i; 36 /* Recurrent functions */ 37 for(i=0; i<screen_list->recurrent_list->count; i++) 38 { 39 if(screen_list->recurrent_list->recurrent[i]->function) 40 { 41 refresh |= screen_list->recurrent_list->recurrent[i]->function(screen_list, 42 screen_list->recurrent_list->recurrent[i], 43 screen_list->recurrent_list->recurrent[i]->user, 44 get_us()); 45 } 46 } 47 /* Delete recurrent functions */ 48 for(i=0; i<screen_list->recurrent_list->count; i++) 49 { 50 if(screen_list->recurrent_list->recurrent[i]->kill_me) 51 { 52 remove_recurrent(screen_list->recurrent_list, i); 53 i = 0; 54 } 55 } 56 return refresh; 57 } 58 31 59 32 60 /* Add recurrent function. It will be called at each main loop iteration, unless it is removed */ -
neercs/trunk/src/screens.c
r2478 r2495 173 173 174 174 175 void refresh_screens(cucul_canvas_t *cv, 176 struct screen_list *screen_list) 175 void refresh_screens(struct screen_list *screen_list) 177 176 { 178 177 int i; … … 180 179 if(!screen_list->count) return; 181 180 182 screen_list->width = cucul_get_canvas_width( cv);183 screen_list->height = cucul_get_canvas_height( cv) - (screen_list->mini*6);181 screen_list->width = cucul_get_canvas_width(screen_list->cv); 182 screen_list->height = cucul_get_canvas_height(screen_list->cv) - (screen_list->mini*6); 184 183 185 184 if(!screen_list->dont_update_coords) 186 update_windows_props( cv,screen_list);187 188 cucul_set_color_ansi( cv, CUCUL_DEFAULT, CUCUL_DEFAULT);189 cucul_clear_canvas( cv);190 cucul_set_color_ansi( cv, CUCUL_LIGHTRED, CUCUL_BLACK);185 update_windows_props(screen_list); 186 187 cucul_set_color_ansi(screen_list->cv, CUCUL_DEFAULT, CUCUL_DEFAULT); 188 cucul_clear_canvas(screen_list->cv); 189 cucul_set_color_ansi(screen_list->cv, CUCUL_LIGHTRED, CUCUL_BLACK); 191 190 192 191 for(i = screen_list->count - 1; i >=0; i--) … … 194 193 if(i!=screen_list->pty && screen_list->screen[i]->visible) 195 194 { 196 cucul_blit( cv,195 cucul_blit(screen_list->cv, 197 196 screen_list->screen[i]->x, 198 197 screen_list->screen[i]->y, 199 198 screen_list->screen[i]->cv, NULL); 200 199 201 cucul_draw_cp437_box( cv,200 cucul_draw_cp437_box(screen_list->cv, 202 201 screen_list->screen[i]->x - 1, 203 202 screen_list->screen[i]->y - 1, … … 205 204 screen_list->screen[i]->h + 2); 206 205 if(screen_list->screen[i]->title) 207 cucul_printf( cv,206 cucul_printf(screen_list->cv, 208 207 screen_list->screen[i]->x, 209 208 screen_list->screen[i]->y - 1, … … 214 213 } 215 214 216 cucul_blit( cv,215 cucul_blit(screen_list->cv, 217 216 screen_list->screen[screen_list->pty]->x, 218 217 screen_list->screen[screen_list->pty]->y, … … 221 220 if(screen_list->screen[screen_list->pty]->bell) 222 221 { 223 cucul_set_color_ansi( cv, CUCUL_RED, CUCUL_BLACK);222 cucul_set_color_ansi(screen_list->cv, CUCUL_RED, CUCUL_BLACK); 224 223 screen_list->screen[screen_list->pty]->bell = 0; 225 224 screen_list->in_bell--; … … 227 226 else 228 227 { 229 cucul_set_color_ansi( cv, CUCUL_LIGHTGREEN, CUCUL_BLACK);230 } 231 232 cucul_draw_cp437_box( cv,228 cucul_set_color_ansi(screen_list->cv, CUCUL_LIGHTGREEN, CUCUL_BLACK); 229 } 230 231 cucul_draw_cp437_box(screen_list->cv, 233 232 screen_list->screen[screen_list->pty]->x - 1, 234 233 screen_list->screen[screen_list->pty]->y - 1, … … 238 237 if(screen_list->screen[screen_list->pty]->title) 239 238 { 240 cucul_printf( cv,239 cucul_printf(screen_list->cv, 241 240 screen_list->screen[screen_list->pty]->x, 242 241 screen_list->screen[screen_list->pty]->y - 1, … … 246 245 } 247 246 248 cucul_gotoxy( cv,247 cucul_gotoxy(screen_list->cv, 249 248 screen_list->screen[screen_list->pty]->x + 250 249 cucul_get_cursor_x(screen_list->screen[screen_list->pty]->cv), … … 255 254 if(screen_list->mini) 256 255 { 257 draw_thumbnails( cv,screen_list);256 draw_thumbnails(screen_list); 258 257 } 259 258 if(screen_list->status) 260 259 { 261 draw_status( cv,screen_list);260 draw_status(screen_list); 262 261 } 263 262 if(screen_list->help) 264 263 { 265 draw_help( cv,screen_list);264 draw_help(screen_list); 266 265 } 267 266 } -
neercs/trunk/src/screensaver.c
r2448 r2495 31 31 32 32 33 void screensaver_init(cucul_canvas_t *cv, 34 caca_display_t *dp, 35 struct screen_list *screen_list) 33 void screensaver_init(struct screen_list *screen_list) 36 34 { 37 35 38 screensaver_flying_toasters_init( cv, dp,screen_list);36 screensaver_flying_toasters_init(screen_list); 39 37 } 40 38 41 void screensaver_kill(cucul_canvas_t *cv, 42 caca_display_t *dp, 43 struct screen_list *screen_list) 39 void screensaver_kill(struct screen_list *screen_list) 44 40 { 45 41 46 screensaver_flying_toasters_kill( cv, dp,screen_list);42 screensaver_flying_toasters_kill(screen_list); 47 43 } 48 44 49 void draw_screensaver(cucul_canvas_t *cv, 50 caca_display_t *dp, 51 struct screen_list *screen_list) 45 void draw_screensaver(struct screen_list *screen_list) 52 46 { 53 screensaver_flying_toasters( cv, dp,screen_list);47 screensaver_flying_toasters(screen_list); 54 48 } 55 49 … … 93 87 }; 94 88 95 void screensaver_flying_toasters_init(cucul_canvas_t *cv, 96 caca_display_t *dp, 97 struct screen_list *screen_list) 89 void screensaver_flying_toasters_init(struct screen_list *screen_list) 98 90 { 99 91 struct flying_toaster *flying_toaster; 100 int w = cucul_get_canvas_width( cv);101 int h = cucul_get_canvas_height( cv);92 int w = cucul_get_canvas_width(screen_list->cv); 93 int h = cucul_get_canvas_height(screen_list->cv); 102 94 int i; 103 95 … … 132 124 } 133 125 134 void screensaver_flying_toasters_kill(cucul_canvas_t *cv, 135 caca_display_t *dp, 136 struct screen_list *screen_list) 126 void screensaver_flying_toasters_kill(struct screen_list *screen_list) 137 127 { 138 128 struct flying_toaster *flying_toaster = screen_list->screensaver_data; … … 146 136 } 147 137 148 void screensaver_flying_toasters(cucul_canvas_t *cv, 149 caca_display_t *dp, 150 struct screen_list *screen_list) 138 void screensaver_flying_toasters(struct screen_list *screen_list) 151 139 { 152 140 struct flying_toaster *d = screen_list->screensaver_data; … … 154 142 if(!d) return; 155 143 156 w = cucul_get_canvas_width( cv);157 h = cucul_get_canvas_height( cv);144 w = cucul_get_canvas_width(screen_list->cv); 145 h = cucul_get_canvas_height(screen_list->cv); 158 146 159 147 160 cucul_set_color_ansi( cv, CUCUL_WHITE, CUCUL_BLACK);161 cucul_clear_canvas( cv);148 cucul_set_color_ansi(screen_list->cv, CUCUL_WHITE, CUCUL_BLACK); 149 cucul_clear_canvas(screen_list->cv); 162 150 163 151 … … 165 153 for(i = 0; i < COUNT; i++) 166 154 { 167 cucul_blit( cv, d->x[i]/PRECISION, d->y[i]/PRECISION, d->toaster[d->s[i]/PRECISION], NULL);155 cucul_blit(screen_list->cv, d->x[i]/PRECISION, d->y[i]/PRECISION, d->toaster[d->s[i]/PRECISION], NULL); 168 156 169 157 d->x[i]-=40; -
neercs/trunk/src/wm.c
r2445 r2495 47 47 } 48 48 49 void update_windows_props( cucul_canvas_t *cv,struct screen_list *screen_list)49 void update_windows_props(struct screen_list *screen_list) 50 50 { 51 51 if(!screen_list->count) return; … … 54 54 { 55 55 case WM_CARD: 56 update_windows_props_cards( cv,screen_list);56 update_windows_props_cards(screen_list); 57 57 break; 58 58 case WM_HSPLIT: 59 update_windows_props_hsplit( cv,screen_list);59 update_windows_props_hsplit(screen_list); 60 60 break; 61 61 case WM_VSPLIT: 62 update_windows_props_vsplit( cv,screen_list);62 update_windows_props_vsplit(screen_list); 63 63 break; 64 64 case WM_FULL: 65 65 default: 66 update_windows_props_full( cv,screen_list);66 update_windows_props_full(screen_list); 67 67 break; 68 68 } 69 69 } 70 70 71 void update_windows_props_hsplit( cucul_canvas_t *cv,struct screen_list *screen_list)71 void update_windows_props_hsplit(struct screen_list *screen_list) 72 72 { 73 73 int i; … … 92 92 } 93 93 94 void update_windows_props_vsplit( cucul_canvas_t *cv,struct screen_list *screen_list)94 void update_windows_props_vsplit(struct screen_list *screen_list) 95 95 { 96 96 int i; … … 116 116 117 117 118 void update_windows_props_full( cucul_canvas_t *cv,struct screen_list *screen_list)118 void update_windows_props_full(struct screen_list *screen_list) 119 119 { 120 120 int i; … … 135 135 136 136 137 void update_windows_props_cards( cucul_canvas_t *cv,struct screen_list *screen_list)137 void update_windows_props_cards(struct screen_list *screen_list) 138 138 { 139 139 int i;
Note: See TracChangeset
for help on using the changeset viewer.