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