Save/restore system palette when application topped/untopped
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401075
This commit is contained in:
parent
5c3476bac3
commit
c939af3952
3 changed files with 35 additions and 17 deletions
|
@ -245,6 +245,9 @@ static int do_messages(_THIS, short *message)
|
||||||
case WM_TOPPED:
|
case WM_TOPPED:
|
||||||
wind_set(message[3],WF_TOP,message[4],0,0,0);
|
wind_set(message[3],WF_TOP,message[4],0,0,0);
|
||||||
SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
|
SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
|
||||||
|
if (VDI_setpalette) {
|
||||||
|
VDI_setpalette(this, VDI_curpalette);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case WM_REDRAW:
|
case WM_REDRAW:
|
||||||
if (!GEM_lock_redraw) {
|
if (!GEM_lock_redraw) {
|
||||||
|
@ -307,6 +310,9 @@ static int do_messages(_THIS, short *message)
|
||||||
case WM_BOTTOMED:
|
case WM_BOTTOMED:
|
||||||
case WM_UNTOPPED:
|
case WM_UNTOPPED:
|
||||||
SDL_PrivateAppActive(0, SDL_APPINPUTFOCUS);
|
SDL_PrivateAppActive(0, SDL_APPINPUTFOCUS);
|
||||||
|
if (VDI_setpalette) {
|
||||||
|
VDI_setpalette(this, VDI_oldpalette);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,6 +106,7 @@ static int GEM_ToggleFullScreen(_THIS, int on);
|
||||||
static void GEM_FreeBuffers(_THIS);
|
static void GEM_FreeBuffers(_THIS);
|
||||||
static void GEM_ClearScreen(_THIS);
|
static void GEM_ClearScreen(_THIS);
|
||||||
static void GEM_ClearRect(_THIS, short *rect);
|
static void GEM_ClearRect(_THIS, short *rect);
|
||||||
|
static void GEM_SetNewPalette(_THIS, Uint16 newpal[256][3]);
|
||||||
static void GEM_LockScreen(_THIS);
|
static void GEM_LockScreen(_THIS);
|
||||||
static void GEM_UnlockScreen(_THIS);
|
static void GEM_UnlockScreen(_THIS);
|
||||||
static void refresh_window(_THIS, int winhandle, short *rect);
|
static void refresh_window(_THIS, int winhandle, short *rect);
|
||||||
|
@ -396,6 +397,8 @@ int GEM_VideoInit(_THIS, SDL_PixelFormat *vformat)
|
||||||
VDI_oldpalette[i][1] = rgb[1];
|
VDI_oldpalette[i][1] = rgb[1];
|
||||||
VDI_oldpalette[i][2] = rgb[2];
|
VDI_oldpalette[i][2] = rgb[2];
|
||||||
}
|
}
|
||||||
|
VDI_setpalette = GEM_SetNewPalette;
|
||||||
|
memcpy(VDI_curpalette,VDI_oldpalette,sizeof(VDI_curpalette));
|
||||||
|
|
||||||
/* Setup screen info */
|
/* Setup screen info */
|
||||||
GEM_title_name = empty_name;
|
GEM_title_name = empty_name;
|
||||||
|
@ -520,6 +523,23 @@ static void GEM_ClearScreen(_THIS)
|
||||||
v_show_c(VDI_handle, 1);
|
v_show_c(VDI_handle, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void GEM_SetNewPalette(_THIS, Uint16 newpal[256][3])
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
short rgb[3];
|
||||||
|
|
||||||
|
if (VDI_oldnumcolors==0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for(i = 0; i < VDI_oldnumcolors; i++) {
|
||||||
|
rgb[0] = newpal[i][0];
|
||||||
|
rgb[1] = newpal[i][1];
|
||||||
|
rgb[2] = newpal[i][2];
|
||||||
|
|
||||||
|
vs_color(VDI_handle, i, rgb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void GEM_LockScreen(_THIS)
|
static void GEM_LockScreen(_THIS)
|
||||||
{
|
{
|
||||||
if (!GEM_locked) {
|
if (!GEM_locked) {
|
||||||
|
@ -1048,9 +1068,9 @@ static int GEM_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
|
||||||
g = colors[i].g;
|
g = colors[i].g;
|
||||||
b = colors[i].b;
|
b = colors[i].b;
|
||||||
|
|
||||||
rgb[0] = (1000 * r) / 255;
|
rgb[0] = VDI_curpalette[i][0] = (1000 * r) / 255;
|
||||||
rgb[1] = (1000 * g) / 255;
|
rgb[1] = VDI_curpalette[i][1] =(1000 * g) / 255;
|
||||||
rgb[2] = (1000 * b) / 255;
|
rgb[2] = VDI_curpalette[i][2] =(1000 * b) / 255;
|
||||||
|
|
||||||
vs_color(VDI_handle, vdi_index[firstcolor+i], rgb);
|
vs_color(VDI_handle, vdi_index[firstcolor+i], rgb);
|
||||||
}
|
}
|
||||||
|
@ -1101,20 +1121,7 @@ void GEM_VideoQuit(_THIS)
|
||||||
|
|
||||||
appl_exit();
|
appl_exit();
|
||||||
|
|
||||||
/* Restore palette */
|
GEM_SetNewPalette(this, VDI_oldpalette);
|
||||||
if (VDI_oldnumcolors) {
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for(i = 0; i < VDI_oldnumcolors; i++) {
|
|
||||||
short rgb[3];
|
|
||||||
|
|
||||||
rgb[0] = VDI_oldpalette[i][0];
|
|
||||||
rgb[1] = VDI_oldpalette[i][1];
|
|
||||||
rgb[2] = VDI_oldpalette[i][2];
|
|
||||||
|
|
||||||
vs_color(VDI_handle, i, rgb);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Close VDI workstation */
|
/* Close VDI workstation */
|
||||||
if (VDI_handle) {
|
if (VDI_handle) {
|
||||||
|
|
|
@ -65,6 +65,9 @@ struct SDL_PrivateVideoData {
|
||||||
short blit_coords[8]; /* Coordinates for bitblt */
|
short blit_coords[8]; /* Coordinates for bitblt */
|
||||||
MFDB src_mfdb, dst_mfdb; /* VDI MFDB for bitblt */
|
MFDB src_mfdb, dst_mfdb; /* VDI MFDB for bitblt */
|
||||||
Uint16 old_palette[256][3]; /* Saved current palette */
|
Uint16 old_palette[256][3]; /* Saved current palette */
|
||||||
|
Uint16 cur_palette[256][3]; /* SDL application palette */
|
||||||
|
/* Function to set/restore palette */
|
||||||
|
void (*setpalette)(_THIS, Uint16 newpal[256][3]);
|
||||||
|
|
||||||
/* GEM infos */
|
/* GEM infos */
|
||||||
short desk_x, desk_y; /* Desktop properties */
|
short desk_x, desk_y; /* Desktop properties */
|
||||||
|
@ -96,6 +99,8 @@ struct SDL_PrivateVideoData {
|
||||||
#define VDI_pixelsize (this->hidden->pixelsize)
|
#define VDI_pixelsize (this->hidden->pixelsize)
|
||||||
#define VDI_oldnumcolors (this->hidden->old_numcolors)
|
#define VDI_oldnumcolors (this->hidden->old_numcolors)
|
||||||
#define VDI_oldpalette (this->hidden->old_palette)
|
#define VDI_oldpalette (this->hidden->old_palette)
|
||||||
|
#define VDI_curpalette (this->hidden->cur_palette)
|
||||||
|
#define VDI_setpalette (this->hidden->setpalette)
|
||||||
#define VDI_pitch (this->hidden->pitch)
|
#define VDI_pitch (this->hidden->pitch)
|
||||||
#define VDI_format (this->hidden->format)
|
#define VDI_format (this->hidden->format)
|
||||||
#define VDI_screen (this->hidden->screen)
|
#define VDI_screen (this->hidden->screen)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue