comparison src/video/gem/SDL_gemwm.c @ 736:028e03e273c8

Use new C2P routine + corrections for iconification window
author Patrice Mandin <patmandin@gmail.com>
date Wed, 12 Nov 2003 18:49:29 +0000
parents 0ce5a68278fd
children b8d311d90021
comparison
equal deleted inserted replaced
735:abec2a842d11 736:028e03e273c8
24 static char rcsid = 24 static char rcsid =
25 "@(#) $Id$"; 25 "@(#) $Id$";
26 #endif 26 #endif
27 27
28 /* 28 /*
29 * GEM SDL video driver implementation 29 GEM SDL video driver
30 * Window manager functions 30 Window manager functions
31 * 31
32 * Patrice Mandin 32 Patrice Mandin
33 */ 33 */
34 34
35 /* Mint includes */ 35 /* Mint includes */
36 #include <gem.h> 36 #include <gem.h>
37 37
38 #include "SDL_gemwm_c.h" 38 #include "SDL_gemwm_c.h"
39 39
40 /* Defines */ 40 /* Defines */
41 41
42 #define DEBUG_VIDEO_GEM 0
43
42 #define ICONWIDTH 64 44 #define ICONWIDTH 64
43 #define ICONHEIGHT 64 45 #define ICONHEIGHT 64
44 46
45 /* Functions */ 47 /* Functions */
46 48
47 void GEM_SetCaption(_THIS, const char *title, const char *icon) 49 void GEM_SetCaption(_THIS, const char *title, const char *icon)
48 { 50 {
49 short parm[4]; 51 if (title) {
50 const char *new_name;
51
52 new_name = NULL;
53
54 if (title)
55 GEM_title_name = title; 52 GEM_title_name = title;
56 53 GEM_refresh_name = SDL_TRUE;
57 if (icon)
58 GEM_icon_name = icon;
59
60 /* Is window iconified ? */
61 parm[0]=0;
62 if (GEM_wfeatures & (1<<WF_ICONIFY))
63 wind_get(GEM_handle, WF_ICONIFY, &parm[0], &parm[1], &parm[2], &parm[3]);
64
65 if (parm[0]==0) {
66 /* Change window name */
67 if (title)
68 new_name = title;
69 } else {
70 /* Change icon name */
71 if (icon)
72 new_name = icon;
73 } 54 }
74 55
75 parm[0]= ((unsigned long) new_name)>>16; 56 if (icon) {
76 parm[1]= ((unsigned long) new_name) & 65535; 57 GEM_icon_name = icon;
77 58 GEM_refresh_name = SDL_TRUE;
78 if (new_name) {
79 wind_set(GEM_handle, WF_NAME, parm[0], parm[1], 0, 0);
80 } 59 }
81 } 60 }
82 61
83 void GEM_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask) 62 void GEM_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask)
84 { 63 {
85 if ((GEM_wfeatures & (1<<WF_ICONIFY))==0) 64 SDL_Surface *sicon;
65 SDL_Rect bounds;
66
67 #ifdef DEBUG_VIDEO_GEM
68 printf("sdl:video:gem: SetIcon(0x%08x)\n", (long) icon);
69 #endif
70
71 #if 0
72 if ((GEM_wfeatures & (1<<WF_ICONIFY))==0) {
73 #ifdef DEBUG_VIDEO_GEM
74 printf("sdl:video:gem: AES can not iconify windows\n");
75 #endif
86 return; 76 return;
77 }
78 #endif
87 79
88 /* Todo */ 80 if (icon == NULL) {
81 return;
82 }
83
84 /* Convert icon to the screen format */
85 sicon = SDL_CreateRGBSurface(SDL_SWSURFACE, icon->w, icon->h,
86 VDI_bpp, VDI_redmask, VDI_greenmask, VDI_bluemask, 0);
87 if ( sicon == NULL ) {
88 return;
89 }
90
91 bounds.x = 0;
92 bounds.y = 0;
93 bounds.w = icon->w;
94 bounds.h = icon->h;
95 if ( SDL_LowerBlit(icon, &bounds, sicon, &bounds) < 0 ) {
96 SDL_FreeSurface(sicon);
97 return;
98 }
99
100 GEM_icon = sicon;
101
102 #ifdef DEBUG_VIDEO_GEM
103 printf("sdl:video:gem: SetIcon(): done\n");
104 #endif
89 } 105 }
90 106
91 int GEM_IconifyWindow(_THIS) 107 int GEM_IconifyWindow(_THIS)
92 { 108 {
93 short message[8];
94
95 if ((GEM_wfeatures & (1<<WF_ICONIFY))==0) 109 if ((GEM_wfeatures & (1<<WF_ICONIFY))==0)
96 return 0; 110 return 0;
97 111
98 message[0] = WM_ICONIFY; 112 GEM_message[0] = WM_ICONIFY;
99 message[1] = gl_apid; 113 GEM_message[1] = gl_apid;
100 message[2] = 0; 114 GEM_message[2] = 0;
101 message[3] = GEM_handle; 115 GEM_message[3] = GEM_handle;
102 message[4] = 0; 116 GEM_message[4] = 0;
103 message[5] = GEM_desk_h-ICONHEIGHT; 117 GEM_message[5] = GEM_desk_h-ICONHEIGHT;
104 message[6] = ICONWIDTH; 118 GEM_message[6] = ICONWIDTH;
105 message[7] = ICONHEIGHT; 119 GEM_message[7] = ICONHEIGHT;
106 120
107 appl_write(gl_apid, sizeof(message), message); 121 appl_write(gl_apid, sizeof(GEM_message), GEM_message);
108 122
109 return 1; 123 return 1;
110 } 124 }
111 125
112 SDL_GrabMode GEM_GrabInput(_THIS, SDL_GrabMode mode) 126 SDL_GrabMode GEM_GrabInput(_THIS, SDL_GrabMode mode)