src/video/gem/SDL_gemwm.c
author Sam Lantinga <slouken@libsdl.org>
Wed, 01 Feb 2006 06:32:25 +0000
changeset 1312 c9b51268668f
parent 1080 1988b04af19b
child 1402 d910939febfa
permissions -rw-r--r--
Updated copyright information and removed rcs id lines (problematic in branch merges)
I batch edited these files, so please let me know if I've accidentally removed anybody's
credit here.
slouken@281
     1
/*
slouken@281
     2
    SDL - Simple DirectMedia Layer
slouken@1312
     3
    Copyright (C) 1997-2006 Sam Lantinga
slouken@281
     4
slouken@281
     5
    This library is free software; you can redistribute it and/or
slouken@1312
     6
    modify it under the terms of the GNU Lesser General Public
slouken@281
     7
    License as published by the Free Software Foundation; either
slouken@1312
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@281
     9
slouken@281
    10
    This library is distributed in the hope that it will be useful,
slouken@281
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@281
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1312
    13
    Lesser General Public License for more details.
slouken@281
    14
slouken@1312
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1312
    16
    License along with this library; if not, write to the Free Software
slouken@1312
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@281
    18
slouken@281
    19
    Sam Lantinga
slouken@281
    20
    slouken@libsdl.org
slouken@281
    21
*/
slouken@281
    22
slouken@281
    23
/*
patmandin@736
    24
	GEM SDL video driver
patmandin@736
    25
	Window manager functions
patmandin@736
    26
patmandin@736
    27
	Patrice Mandin
patmandin@736
    28
*/
slouken@281
    29
slouken@281
    30
/* Mint includes */
slouken@281
    31
#include <gem.h>
slouken@281
    32
slouken@281
    33
#include "SDL_gemwm_c.h"
slouken@281
    34
slouken@281
    35
/* Defines */
slouken@281
    36
slouken@281
    37
#define ICONWIDTH 64
slouken@281
    38
#define ICONHEIGHT 64
slouken@281
    39
slouken@281
    40
/* Functions */
slouken@281
    41
slouken@281
    42
void GEM_SetCaption(_THIS, const char *title, const char *icon)
slouken@281
    43
{
patmandin@736
    44
	if (title) {
slouken@281
    45
		GEM_title_name = title;
patmandin@736
    46
		GEM_refresh_name = SDL_TRUE;
slouken@281
    47
	}
slouken@281
    48
patmandin@736
    49
	if (icon) {
patmandin@736
    50
		GEM_icon_name = icon;
patmandin@736
    51
		GEM_refresh_name = SDL_TRUE;
slouken@281
    52
	}
slouken@281
    53
}
slouken@281
    54
slouken@281
    55
void GEM_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask)
slouken@281
    56
{
patmandin@736
    57
	SDL_Surface *sicon;
patmandin@736
    58
	SDL_Rect bounds;
patmandin@736
    59
patmandin@736
    60
#if 0
patmandin@736
    61
	if ((GEM_wfeatures & (1<<WF_ICONIFY))==0) {
slouken@281
    62
		return;
patmandin@736
    63
	}
patmandin@736
    64
#endif
slouken@281
    65
patmandin@736
    66
	if (icon == NULL) {
patmandin@736
    67
		return;
patmandin@736
    68
	}
patmandin@736
    69
	
patmandin@736
    70
	/* Convert icon to the screen format */
patmandin@736
    71
	sicon = SDL_CreateRGBSurface(SDL_SWSURFACE, icon->w, icon->h,
patmandin@736
    72
		VDI_bpp, VDI_redmask, VDI_greenmask, VDI_bluemask, 0);
patmandin@736
    73
	if ( sicon == NULL ) {
patmandin@736
    74
		return;
patmandin@736
    75
	}
patmandin@736
    76
patmandin@736
    77
	bounds.x = 0;
patmandin@736
    78
	bounds.y = 0;
patmandin@736
    79
	bounds.w = icon->w;
patmandin@736
    80
	bounds.h = icon->h;
patmandin@736
    81
	if ( SDL_LowerBlit(icon, &bounds, sicon, &bounds) < 0 ) {
patmandin@736
    82
		SDL_FreeSurface(sicon);
patmandin@736
    83
		return;
patmandin@736
    84
	}
patmandin@736
    85
patmandin@736
    86
	GEM_icon = sicon;
slouken@281
    87
}
slouken@281
    88
slouken@281
    89
int GEM_IconifyWindow(_THIS)
slouken@281
    90
{
slouken@281
    91
	if ((GEM_wfeatures & (1<<WF_ICONIFY))==0)
slouken@281
    92
		return 0;
slouken@281
    93
patmandin@736
    94
	GEM_message[0] = WM_ICONIFY;
patmandin@736
    95
	GEM_message[1] = gl_apid;
patmandin@736
    96
	GEM_message[2] = 0;
patmandin@736
    97
	GEM_message[3] = GEM_handle;
patmandin@736
    98
	GEM_message[4] = 0;
patmandin@736
    99
	GEM_message[5] = GEM_desk_h-ICONHEIGHT;
patmandin@736
   100
	GEM_message[6] = ICONWIDTH;
patmandin@736
   101
	GEM_message[7] = ICONHEIGHT;
slouken@281
   102
patmandin@736
   103
	appl_write(gl_apid, sizeof(GEM_message), GEM_message);
slouken@281
   104
slouken@281
   105
	return 1;
slouken@281
   106
}
slouken@281
   107
slouken@281
   108
SDL_GrabMode GEM_GrabInput(_THIS, SDL_GrabMode mode)
slouken@281
   109
{
patmandin@1068
   110
	return SDL_GRAB_OFF;
slouken@281
   111
}