Changeset 2784 for neercs


Ignore:
Timestamp:
Aug 27, 2008, 5:03:06 PM (12 years ago)
Author:
Pascal Terjan
Message:
  • Only send title when it has changed
Location:
neercs/trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • neercs/trunk/src/main.c

    r2675 r2784  
    309309            free(screen_list->session_name);
    310310
     311        if(screen_list->title)
     312            free(screen_list->title);
     313
    311314        free(screen_list);
    312315    }
     
    342345    screen_list->help = 0;
    343346    screen_list->status = 1;
     347    screen_list->title = NULL;
    344348    screen_list->window_list = 0;
    345349    screen_list->wm_type = WM_VSPLIT;
  • neercs/trunk/src/neercs.h

    r2673 r2784  
    171171    int window_list;             /* Window list */
    172172    int cur_in_list;             /* Window list */
     173    char *title;                 /* Window title */
    173174
    174175    /* ScreenSaver stuff */
  • neercs/trunk/src/server.c

    r2673 r2784  
    5353}
    5454
    55 static int set_title(const char * title, struct screen_list* screen_list)
     55static int set_title(struct screen_list* screen_list)
    5656{
    5757    char buf[1024];
    5858    int bytes;
     59    char *title;
     60
     61    if(screen_list->attached)
     62    {
     63        if(screen_list->pty < screen_list->count &&
     64           screen_list->screen[screen_list->pty]->title)
     65            title = screen_list->screen[screen_list->pty]->title;
     66        else
     67            title = PACKAGE_STRING;
     68    }
     69
     70    if(screen_list->title)
     71    {
     72        if(!strcmp(screen_list->title, title))
     73            return 0;
     74        free(screen_list->title);
     75    }
     76
     77    screen_list->title = strdup(title);
    5978
    6079    bytes = snprintf(buf, sizeof(buf)-1, "TITLE %s", title);
     
    309328            {
    310329                refresh_screens(screen_list);
    311                 if(screen_list->attached)
    312                 {
    313                     if(screen_list->pty < screen_list->count &&
    314                        screen_list->screen[screen_list->pty]->title)
    315                         set_title(screen_list->screen[screen_list->pty]->title, screen_list);
    316                     else
    317                         set_title(PACKAGE_STRING, screen_list);
    318                 }
     330                set_title(screen_list);
    319331                refresh = 1;
    320332
     
    395407        screen_list->session_name = NULL;
    396408    }
     409
     410    if(screen_list->title)
     411        free(screen_list->title);
    397412
    398413    if(screen_list) {
Note: See TracChangeset for help on using the changeset viewer.