src/video/SDL_video.c
changeset 58 bd6b0a910a65
parent 47 45b1c4303f87
child 75 b0ae59d0f3ee
     1.1 --- a/src/video/SDL_video.c	Mon Jun 11 00:08:35 2001 +0000
     1.2 +++ b/src/video/SDL_video.c	Mon Jun 11 06:44:43 2001 +0000
     1.3 @@ -100,10 +100,6 @@
     1.4  };
     1.5  SDL_VideoDevice *current_video = NULL;
     1.6  
     1.7 -/* Places to store title and icon text for the app */
     1.8 -static char *wm_title = NULL;
     1.9 -static char *wm_icon  = NULL;
    1.10 -
    1.11  /* Various local functions */
    1.12  int SDL_VideoInit(const char *driver_name, Uint32 flags);
    1.13  void SDL_VideoQuit(void);
    1.14 @@ -1254,13 +1250,13 @@
    1.15  			free(video->gamma);
    1.16  			video->gamma = NULL;
    1.17  		}
    1.18 -		if ( wm_title != NULL ) {
    1.19 -			free(wm_title);
    1.20 -			wm_title = NULL;
    1.21 +		if ( video->wm_title != NULL ) {
    1.22 +			free(video->wm_title);
    1.23 +			video->wm_title = NULL;
    1.24  		}
    1.25 -		if ( wm_icon != NULL ) {
    1.26 -			free(wm_icon);
    1.27 -			wm_icon = NULL;
    1.28 +		if ( video->wm_icon != NULL ) {
    1.29 +			free(video->wm_icon);
    1.30 +			video->wm_icon = NULL;
    1.31  		}
    1.32  
    1.33  		/* Finish cleaning up video subsystem */
    1.34 @@ -1539,35 +1535,41 @@
    1.35  	SDL_VideoDevice *video = current_video;
    1.36  	SDL_VideoDevice *this  = current_video;
    1.37  
    1.38 -	if ( title ) {
    1.39 -		if ( wm_title ) {
    1.40 -			free(wm_title);
    1.41 +	if ( video ) {
    1.42 +		if ( title ) {
    1.43 +			if ( video->wm_title ) {
    1.44 +				free(video->wm_title);
    1.45 +			}
    1.46 +			video->wm_title = (char *)malloc(strlen(title)+1);
    1.47 +			if ( video->wm_title != NULL ) {
    1.48 +				strcpy(video->wm_title, title);
    1.49 +			}
    1.50  		}
    1.51 -		wm_title = (char *)malloc(strlen(title)+1);
    1.52 -		if ( wm_title != NULL ) {
    1.53 -			strcpy(wm_title, title);
    1.54 +		if ( icon ) {
    1.55 +			if ( video->wm_icon ) {
    1.56 +				free(video->wm_icon);
    1.57 +			}
    1.58 +			video->wm_icon = (char *)malloc(strlen(icon)+1);
    1.59 +			if ( video->wm_icon != NULL ) {
    1.60 +				strcpy(video->wm_icon, icon);
    1.61 +			}
    1.62  		}
    1.63 -	}
    1.64 -	if ( icon ) {
    1.65 -		if ( wm_icon ) {
    1.66 -			free(wm_icon);
    1.67 +		if ( (title || icon) && (video->SetCaption != NULL) ) {
    1.68 +			video->SetCaption(this, video->wm_title,video->wm_icon);
    1.69  		}
    1.70 -		wm_icon = (char *)malloc(strlen(icon)+1);
    1.71 -		if ( wm_icon != NULL ) {
    1.72 -			strcpy(wm_icon, icon);
    1.73 -		}
    1.74 -	}
    1.75 -	if ( (title || icon) && video && (video->SetCaption != NULL) ) {
    1.76 -		video->SetCaption(this, wm_title, wm_icon);
    1.77  	}
    1.78  }
    1.79  void SDL_WM_GetCaption (char **title, char **icon)
    1.80  {
    1.81 -	if ( title ) {
    1.82 -		*title = wm_title;
    1.83 -	}
    1.84 -	if ( icon ) {
    1.85 -		*icon = wm_icon;
    1.86 +	SDL_VideoDevice *video = current_video;
    1.87 +
    1.88 +	if ( video ) {
    1.89 +		if ( title ) {
    1.90 +			*title = video->wm_title;
    1.91 +		}
    1.92 +		if ( icon ) {
    1.93 +			*icon = video->wm_icon;
    1.94 +		}
    1.95  	}
    1.96  }
    1.97