[BACK]Return to server.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/server.c between version 1.40 and 1.41

version 1.40, 2009/09/22 12:38:10 version 1.41, 2009/09/23 06:18:47
Line 67 
Line 67 
 void             server_check_window(struct window *);  void             server_check_window(struct window *);
 void             server_check_redraw(struct client *);  void             server_check_redraw(struct client *);
 void             server_set_title(struct client *);  void             server_set_title(struct client *);
 void             server_redraw_locked(struct client *);  
 void             server_check_timers(struct client *);  void             server_check_timers(struct client *);
 void             server_second_timers(void);  void             server_second_timers(void);
 int              server_update_socket(void);  int              server_update_socket(void);
Line 160 
Line 159 
         key_bindings_init();          key_bindings_init();
         utf8_build();          utf8_build();
   
         server_locked = 0;  
         server_password = NULL;  
         server_activity = time(NULL);          server_activity = time(NULL);
   
         start_time = time(NULL);          start_time = time(NULL);
Line 382 
Line 379 
   
         options_free(&global_s_options);          options_free(&global_s_options);
         options_free(&global_w_options);          options_free(&global_w_options);
         if (server_password != NULL)  
                 xfree(server_password);  
   
         return (0);          return (0);
 }  }
Line 541 
Line 536 
         }          }
   
         if (c->flags & CLIENT_REDRAW) {          if (c->flags & CLIENT_REDRAW) {
                 if (server_locked)                  screen_redraw_screen(c, 0);
                         server_redraw_locked(c);  
                 else  
                         screen_redraw_screen(c, 0);  
                 c->flags &= ~CLIENT_STATUS;                  c->flags &= ~CLIENT_STATUS;
         } else {          } else {
                 TAILQ_FOREACH(wp, &c->session->curw->window->panes, entry) {                  TAILQ_FOREACH(wp, &c->session->curw->window->panes, entry) {
Line 581 
Line 573 
         xfree(title);          xfree(title);
 }  }
   
 /* Redraw client when locked. */  
 void  
 server_redraw_locked(struct client *c)  
 {  
         struct screen_write_ctx ctx;  
         struct screen           screen;  
         struct grid_cell        gc;  
         u_int                   colour, xx, yy, i;  
         int                     style;  
   
         xx = c->tty.sx;  
         yy = c->tty.sy - 1;  
         if (xx == 0 || yy == 0)  
                 return;  
         colour = options_get_number(&global_w_options, "clock-mode-colour");  
         style = options_get_number(&global_w_options, "clock-mode-style");  
   
         memcpy(&gc, &grid_default_cell, sizeof gc);  
         colour_set_fg(&gc, colour);  
         gc.attr |= GRID_ATTR_BRIGHT;  
   
         screen_init(&screen, xx, yy, 0);  
   
         screen_write_start(&ctx, NULL, &screen);  
         clock_draw(&ctx, colour, style);  
   
         if (password_failures != 0) {  
                 screen_write_cursormove(&ctx, 0, 0);  
                 screen_write_puts(  
                     &ctx, &gc, "%u failed attempts", password_failures);  
                 if (time(NULL) < password_backoff)  
                         screen_write_puts(&ctx, &gc, "; sleeping");  
         }  
   
         screen_write_stop(&ctx);  
   
         for (i = 0; i < screen_size_y(&screen); i++)  
                 tty_draw_line(&c->tty, &screen, i, 0, 0);  
         screen_redraw_screen(c, 1);  
   
         screen_free(&screen);  
 }  
   
 /* Check for timers on client. */  /* Check for timers on client. */
 void  void
 server_check_timers(struct client *c)  server_check_timers(struct client *c)
Line 836 
Line 785 
                         status_prompt_key(c, key);                          status_prompt_key(c, key);
                         continue;                          continue;
                 }                  }
                 if (server_locked)  
                         continue;  
   
                 /* Check for mouse keys. */                  /* Check for mouse keys. */
                 if (key == KEYC_MOUSE) {                  if (key == KEYC_MOUSE) {
Line 929 
Line 876 
                 tty_cursor(&c->tty, s->cx, s->cy, wp->xoff, wp->yoff);                  tty_cursor(&c->tty, s->cx, s->cy, wp->xoff, wp->yoff);
   
         mode = s->mode;          mode = s->mode;
         if (server_locked)  
                 mode &= ~TTY_NOCURSOR;  
         tty_update_mode(&c->tty, mode);          tty_update_mode(&c->tty, mode);
         tty_reset(&c->tty);          tty_reset(&c->tty);
 }  }
Line 1235 
Line 1180 
 server_second_timers(void)  server_second_timers(void)
 {  {
         struct window           *w;          struct window           *w;
         struct client           *c;  
         struct window_pane      *wp;          struct window_pane      *wp;
         u_int                    i;          u_int                    i;
         int                      xtimeout;          int                      xtimeout;
         struct tm                now, then;  
         static time_t            last_t = 0;  
         time_t                   t;          time_t                   t;
   
         t = time(NULL);          t = time(NULL);
Line 1257 
Line 1199 
                 TAILQ_FOREACH(wp, &w->panes, entry) {                  TAILQ_FOREACH(wp, &w->panes, entry) {
                         if (wp->mode != NULL && wp->mode->timer != NULL)                          if (wp->mode != NULL && wp->mode->timer != NULL)
                                 wp->mode->timer(wp);                                  wp->mode->timer(wp);
                 }  
         }  
   
         if (password_backoff != 0 && t >= password_backoff) {  
                 for (i = 0; i < ARRAY_LENGTH(&clients); i++) {  
                         if ((c = ARRAY_ITEM(&clients, i)) != NULL)  
                                 server_redraw_client(c);  
                 }  
                 password_backoff = 0;  
         }  
   
         /* Check for a minute having passed. */  
         gmtime_r(&t, &now);  
         gmtime_r(&last_t, &then);  
         if (now.tm_min == then.tm_min)  
                 return;  
         last_t = t;  
   
         /* If locked, redraw all clients. */  
         if (server_locked) {  
                 for (i = 0; i < ARRAY_LENGTH(&clients); i++) {  
                         if ((c = ARRAY_ITEM(&clients, i)) != NULL)  
                                 server_redraw_client(c);  
                 }                  }
         }          }
 }  }

Legend:
Removed from v.1.40  
changed lines
  Added in v.1.41