Commit 058af532 authored by Patrice Mandin's avatar Patrice Mandin

Use new C2P routine + corrections for iconification window

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40737
parent b0055272
...@@ -219,6 +219,11 @@ static int do_messages(_THIS, short *message) ...@@ -219,6 +219,11 @@ static int do_messages(_THIS, short *message)
/* Send an internal deactivate event */ /* Send an internal deactivate event */
SDL_PrivateAppActive(0, SDL_APPACTIVE|SDL_APPINPUTFOCUS); SDL_PrivateAppActive(0, SDL_APPACTIVE|SDL_APPINPUTFOCUS);
} }
/* Update window title */
if (GEM_refresh_name && GEM_icon_name) {
wind_set(GEM_handle,WF_NAME,(short)(((unsigned long)GEM_icon_name)>>16),(short)(((unsigned long)GEM_icon_name) & 0xffff),0,0);
GEM_refresh_name = SDL_FALSE;
}
break; break;
case WM_UNICONIFY: case WM_UNICONIFY:
wind_set(message[3],WF_UNICONIFY,message[4],message[5],message[6],message[7]); wind_set(message[3],WF_UNICONIFY,message[4],message[5],message[6],message[7]);
...@@ -227,6 +232,10 @@ static int do_messages(_THIS, short *message) ...@@ -227,6 +232,10 @@ static int do_messages(_THIS, short *message)
/* Send an internal activate event */ /* Send an internal activate event */
SDL_PrivateAppActive(1, SDL_APPACTIVE); SDL_PrivateAppActive(1, SDL_APPACTIVE);
} }
if (GEM_refresh_name && GEM_title_name) {
wind_set(GEM_handle,WF_NAME,(short)(((unsigned long)GEM_title_name)>>16),(short)(((unsigned long)GEM_title_name) & 0xffff),0,0);
GEM_refresh_name = SDL_FALSE;
}
break; break;
case WM_SIZED: case WM_SIZED:
wind_set (message[3], WF_CURRXYWH, message[4], message[5], message[6], message[7]); wind_set (message[3], WF_CURRXYWH, message[4], message[5], message[6], message[7]);
......
...@@ -43,6 +43,8 @@ static char rcsid = ...@@ -43,6 +43,8 @@ static char rcsid =
/* Defines */ /* Defines */
/*#define DEBUG_VIDEO_GEM 1*/
#define MAXCURWIDTH 16 #define MAXCURWIDTH 16
#define MAXCURHEIGHT 16 #define MAXCURHEIGHT 16
...@@ -102,36 +104,46 @@ WMcursor *GEM_CreateWMCursor(_THIS, ...@@ -102,36 +104,46 @@ WMcursor *GEM_CreateWMCursor(_THIS,
new_mform->mf_fg = 0; new_mform->mf_fg = 0;
new_mform->mf_bg = 1; new_mform->mf_bg = 1;
for (i=0;i<MAXCURHEIGHT;i++) for (i=0;i<MAXCURHEIGHT;i++) {
{
new_mform->mf_mask[i]=0; new_mform->mf_mask[i]=0;
new_mform->mf_data[i]=0; new_mform->mf_data[i]=0;
} }
if (w<=8) { if (w<=8) {
for (i=0;i<h;i++) for (i=0;i<h;i++) {
{
new_mform->mf_mask[i]= mask[i]<<8; new_mform->mf_mask[i]= mask[i]<<8;
new_mform->mf_data[i]= data[i]<<8; new_mform->mf_data[i]= data[i]<<8;
} }
} else { } else {
for (i=0;i<h;i++) for (i=0;i<h;i++) {
{
new_mform->mf_mask[i]= mask[i<<1]<<8 | mask[(i<<1)+1]; new_mform->mf_mask[i]= mask[i<<1]<<8 | mask[(i<<1)+1];
new_mform->mf_data[i]= data[i<<1]<<8 | data[(i<<1)+1]; new_mform->mf_data[i]= data[i<<1]<<8 | data[(i<<1)+1];
} }
} }
#ifdef DEBUG_VIDEO_GEM
for (i=0; i<h ;i++) {
printf("sdl:video:gem: cursor, line %d = 0x%04x\n", i, new_mform->mf_mask[i]);
}
printf("sdl:video:gem: CreateWMCursor(): done\n");
#endif
return cursor; return cursor;
} }
int GEM_ShowWMCursor(_THIS, WMcursor *cursor) int GEM_ShowWMCursor(_THIS, WMcursor *cursor)
{ {
/*
if (cursor == NULL) { if (cursor == NULL) {
graf_mouse(M_OFF, NULL); graf_mouse(M_OFF, NULL);
} else if (cursor->mform_p) { } else if (cursor->mform_p) {
graf_mouse(USER_DEF, cursor->mform_p); graf_mouse(USER_DEF, cursor->mform_p);
} }
*/
#ifdef DEBUG_VIDEO_GEM
printf("sdl:video:gem: ShowWMCursor(0x%08x)\n", (long) cursor);
#endif
return 1; return 1;
} }
......
This diff is collapsed.
...@@ -39,37 +39,49 @@ void GEM_wind_redraw(_THIS, int winhandle, short *inside); ...@@ -39,37 +39,49 @@ void GEM_wind_redraw(_THIS, int winhandle, short *inside);
/* Private display data */ /* Private display data */
#define B2S_C2P_1TO2 (1<<0) /* C2P convert buffer 1 to buffer 2 */
#define B2S_C2P_1TOS (1<<1) /* C2P convert buffer 1 to screen */
#define B2S_VROCPYFM_1TOS (1<<2) /* vro_cpyfm() buffer 1 to screen */
#define B2S_VROCPYFM_2TOS (1<<3) /* vro_cpyfm() buffer 2 to screen */
#define SDL_NUMMODES 1 /* Fullscreen */ #define SDL_NUMMODES 1 /* Fullscreen */
struct SDL_PrivateVideoData { struct SDL_PrivateVideoData {
Uint16 buf2scr_ops; /* Operations to get buffer to screen */
void *buffer1; /* Our shadow buffers */
void *buffer2;
/* VDI infos */ /* VDI infos */
short vdi_handle; /* VDI handle */ short vdi_handle; /* VDI handle */
short full_w, full_h; /* Fullscreen size */ short full_w, full_h; /* Fullscreen size */
int bpp; /* Colour depth */ short bpp; /* Colour depth */
int pixelsize; /* Bytes per pixel */ short pixelsize; /* Bytes per pixel */
Uint16 old_numcolors; /* Number of colors in saved palette */ short old_numcolors; /* Number of colors in saved palette */
Uint16 old_palette[256][3]; /* Saved current palette */
Uint16 pitch; /* Line length */ Uint16 pitch; /* Line length */
int format; /* Screen format */ Uint16 format; /* Screen format */
void *screen; /* Screen address */ void *screen; /* Screen address */
Uint32 red, green, blue, alpha; /* Screen components */ Uint32 red, green, blue, alpha; /* Screen components */
Uint32 screensize; Uint32 screensize;
MFDB src_mfdb, dst_mfdb; /* VDI MFDB for bitblt */
short blit_coords[8]; /* Coordinates for bitblt */ short blit_coords[8]; /* Coordinates for bitblt */
MFDB src_mfdb, dst_mfdb; /* VDI MFDB for bitblt */
Uint16 old_palette[256][3]; /* Saved current palette */
/* GEM infos */ /* GEM infos */
short desk_x, desk_y; /* Desktop properties */ short desk_x, desk_y; /* Desktop properties */
short desk_w, desk_h; short desk_w, desk_h;
short win_handle; /* Our window handle */ short win_handle; /* Our window handle */
void *buffer; /* Our shadow buffer */
int window_type; /* Window type */ int window_type; /* Window type */
const char *title_name; /* Window title */ const char *title_name; /* Window title */
const char *icon_name; /* Icon title */ const char *icon_name; /* Icon title */
short version; /* AES version */ short version; /* AES version */
short wfeatures; /* AES window features */ short wfeatures; /* AES window features */
SDL_bool refresh_name; /* Change window title ? */
SDL_bool window_fulled; /* Window maximized ? */ SDL_bool window_fulled; /* Window maximized ? */
SDL_bool mouse_relative; /* Report relative mouse movement */ SDL_bool mouse_relative; /* Report relative mouse movement */
SDL_bool locked; /* AES locked for fullscreen ? */ SDL_bool locked; /* AES locked for fullscreen ? */
short message[8]; /* To self-send an AES message */
SDL_Rect *SDL_modelist[SDL_NUMMODES+1]; /* Mode list */ SDL_Rect *SDL_modelist[SDL_NUMMODES+1]; /* Mode list */
SDL_Surface *icon; /* The icon */
}; };
/* Hidden structure -> variables names */ /* Hidden structure -> variables names */
...@@ -97,15 +109,66 @@ struct SDL_PrivateVideoData { ...@@ -97,15 +109,66 @@ struct SDL_PrivateVideoData {
#define GEM_desk_w (this->hidden->desk_w) #define GEM_desk_w (this->hidden->desk_w)
#define GEM_desk_h (this->hidden->desk_h) #define GEM_desk_h (this->hidden->desk_h)
#define GEM_handle (this->hidden->win_handle) #define GEM_handle (this->hidden->win_handle)
#define GEM_buffer (this->hidden->buffer)
#define GEM_win_type (this->hidden->window_type) #define GEM_win_type (this->hidden->window_type)
#define GEM_title_name (this->hidden->title_name) #define GEM_title_name (this->hidden->title_name)
#define GEM_icon_name (this->hidden->icon_name) #define GEM_icon_name (this->hidden->icon_name)
#define GEM_refresh_name (this->hidden->refresh_name)
#define GEM_version (this->hidden->version) #define GEM_version (this->hidden->version)
#define GEM_wfeatures (this->hidden->wfeatures) #define GEM_wfeatures (this->hidden->wfeatures)
#define GEM_win_fulled (this->hidden->window_fulled) #define GEM_win_fulled (this->hidden->window_fulled)
#define GEM_mouse_relative (this->hidden->mouse_relative) #define GEM_mouse_relative (this->hidden->mouse_relative)
#define GEM_locked (this->hidden->locked) #define GEM_locked (this->hidden->locked)
#define GEM_message (this->hidden->message)
#define SDL_modelist (this->hidden->SDL_modelist) #define SDL_modelist (this->hidden->SDL_modelist)
#define GEM_icon (this->hidden->icon)
#define GEM_buffer1 (this->hidden->buffer1)
#define GEM_buffer2 (this->hidden->buffer2)
#define GEM_bufops (this->hidden->buf2scr_ops)
#define VDI_FBMASK(amask, rmask, gmask, bmask) \
VDI_alphamask = (amask); \
VDI_redmask = (rmask); \
VDI_greenmask = (gmask); \
VDI_bluemask = (bmask);
/*
Possible buffer to screen operations:
TC: 8 (chunky),15,16,24,32 bpp
8I: 8 bpp planes
FB: screen framebuffer address available
FS: fullscreen
TC, FB, FS:
- draw to screen
8I, FB, FS:
- draw to buffer 1
- C2P from buffer 1 to screen
TC, !FB, FS:
- draw to buffer 1
- vro_cpyfm() from buffer 1 to screen
8I, !FB, FS:
- draw to buffer 1
- C2P from buffer 1 to buffer 2
- vro_cpyfm() from buffer 2 to screen
TC, FB, !FS:
- draw to buffer 1
- vro_cpyfm() from buffer 1 to screen
8I, FB, !FS:
- draw to buffer 1
- C2P from buffer 1 to buffer 2
- vro_cpyfm() from buffer 2 to screen
TC, !FB, !FS:
- draw to buffer 1
- vro_cpyfm() from buffer 1 to screen
8I, !FB, !FS:
- draw to buffer 1
- C2P from buffer 1 to buffer 2
- vro_cpyfm() from buffer 2 to screen
*/
#endif /* _SDL_gemvideo_h */ #endif /* _SDL_gemvideo_h */
...@@ -26,11 +26,11 @@ static char rcsid = ...@@ -26,11 +26,11 @@ static char rcsid =
#endif #endif
/* /*
* GEM SDL video driver implementation GEM SDL video driver
* Window manager functions Window manager functions
*
* Patrice Mandin Patrice Mandin
*/ */
/* Mint includes */ /* Mint includes */
#include <gem.h> #include <gem.h>
...@@ -39,6 +39,8 @@ static char rcsid = ...@@ -39,6 +39,8 @@ static char rcsid =
/* Defines */ /* Defines */
#define DEBUG_VIDEO_GEM 0
#define ICONWIDTH 64 #define ICONWIDTH 64
#define ICONHEIGHT 64 #define ICONHEIGHT 64
...@@ -46,65 +48,77 @@ static char rcsid = ...@@ -46,65 +48,77 @@ static char rcsid =
void GEM_SetCaption(_THIS, const char *title, const char *icon) void GEM_SetCaption(_THIS, const char *title, const char *icon)
{ {
short parm[4]; if (title) {
const char *new_name;
new_name = NULL;
if (title)
GEM_title_name = title; GEM_title_name = title;
GEM_refresh_name = SDL_TRUE;
}
if (icon) if (icon) {
GEM_icon_name = icon; GEM_icon_name = icon;
GEM_refresh_name = SDL_TRUE;
}
}
void GEM_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask)
{
SDL_Surface *sicon;
SDL_Rect bounds;
/* Is window iconified ? */ #ifdef DEBUG_VIDEO_GEM
parm[0]=0; printf("sdl:video:gem: SetIcon(0x%08x)\n", (long) icon);
if (GEM_wfeatures & (1<<WF_ICONIFY)) #endif
wind_get(GEM_handle, WF_ICONIFY, &parm[0], &parm[1], &parm[2], &parm[3]);
#if 0
if (parm[0]==0) { if ((GEM_wfeatures & (1<<WF_ICONIFY))==0) {
/* Change window name */ #ifdef DEBUG_VIDEO_GEM
if (title) printf("sdl:video:gem: AES can not iconify windows\n");
new_name = title; #endif
} else { return;
/* Change icon name */
if (icon)
new_name = icon;
} }
#endif
parm[0]= ((unsigned long) new_name)>>16; if (icon == NULL) {
parm[1]= ((unsigned long) new_name) & 65535; return;
}
if (new_name) { /* Convert icon to the screen format */
wind_set(GEM_handle, WF_NAME, parm[0], parm[1], 0, 0); sicon = SDL_CreateRGBSurface(SDL_SWSURFACE, icon->w, icon->h,
VDI_bpp, VDI_redmask, VDI_greenmask, VDI_bluemask, 0);
if ( sicon == NULL ) {
return;
} }
}
void GEM_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask) bounds.x = 0;
{ bounds.y = 0;
if ((GEM_wfeatures & (1<<WF_ICONIFY))==0) bounds.w = icon->w;
bounds.h = icon->h;
if ( SDL_LowerBlit(icon, &bounds, sicon, &bounds) < 0 ) {
SDL_FreeSurface(sicon);
return; return;
}
/* Todo */ GEM_icon = sicon;
#ifdef DEBUG_VIDEO_GEM
printf("sdl:video:gem: SetIcon(): done\n");
#endif
} }
int GEM_IconifyWindow(_THIS) int GEM_IconifyWindow(_THIS)
{ {
short message[8];
if ((GEM_wfeatures & (1<<WF_ICONIFY))==0) if ((GEM_wfeatures & (1<<WF_ICONIFY))==0)
return 0; return 0;
message[0] = WM_ICONIFY; GEM_message[0] = WM_ICONIFY;
message[1] = gl_apid; GEM_message[1] = gl_apid;
message[2] = 0; GEM_message[2] = 0;
message[3] = GEM_handle; GEM_message[3] = GEM_handle;
message[4] = 0; GEM_message[4] = 0;
message[5] = GEM_desk_h-ICONHEIGHT; GEM_message[5] = GEM_desk_h-ICONHEIGHT;
message[6] = ICONWIDTH; GEM_message[6] = ICONWIDTH;
message[7] = ICONHEIGHT; GEM_message[7] = ICONHEIGHT;
appl_write(gl_apid, sizeof(message), message); appl_write(gl_apid, sizeof(GEM_message), GEM_message);
return 1; return 1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment