src/video/gem/SDL_gemvideo.h
author Patrice Mandin <patmandin@gmail.com>
Sat, 07 Oct 2017 00:10:57 +0200
branchSDL-1.2
changeset 11568 6fbdeeef1935
parent 11564 eb391d3461f1
child 11576 b3255371e439
permissions -rw-r--r--
atari:gem: Store iconified state so we do not have to query system on each frame.
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2012 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 #ifndef _SDL_gemvideo_h
    25 #define _SDL_gemvideo_h
    26 
    27 #include "SDL_mutex.h"
    28 #include "../SDL_sysvideo.h"
    29 
    30 /* The implementation dependent data for the window manager cursor */
    31 struct WMcursor {
    32 	MFORM *mform_p;
    33 };
    34 
    35 /* Hidden "this" pointer for the video functions */
    36 #define _THIS	SDL_VideoDevice *this
    37 
    38 /* Functions prototypes */
    39 void GEM_wind_redraw(_THIS, int winhandle, short *inside);
    40 void GEM_align_work_area(_THIS, short windowid, int clear_pads);
    41 
    42 /* Private display data */
    43 
    44 #define B2S_C2P_1TO2		(1<<0)	/* C2P convert buffer 1 to buffer 2 */
    45 #define B2S_C2P_1TOS		(1<<1)	/* C2P convert buffer 1 to screen */
    46 #define B2S_VROCPYFM_1TOS	(1<<2)	/* vro_cpyfm() buffer 1 to screen */
    47 #define B2S_VROCPYFM_2TOS	(1<<3)	/* vro_cpyfm() buffer 2 to screen */
    48 
    49 #define SDL_NUMMODES	1		/* Fullscreen */
    50 
    51 struct SDL_PrivateVideoData {
    52 	Uint16	buf2scr_ops;		/* Operations to get buffer to screen */
    53 	void *buffer1;				/* Our shadow buffers */
    54 	void *buffer2;
    55 
    56 	/* VDI infos */
    57 	short vdi_handle;			/* VDI handle */
    58 	short full_w, full_h;		/* Fullscreen size */
    59 	short bpp;					/* Colour depth */
    60 	short pixelsize;			/* Bytes per pixel */
    61 	short old_numcolors;		/* Number of colors in saved palette */
    62 	Uint16 pitch;				/* Line length */
    63 	Uint16 format;				/* Screen format */
    64 	void *screen;				/* Screen address */
    65 	Uint32 red, green, blue, alpha;	/* Screen components */
    66 	Uint32 screensize;
    67 	MFDB	dst_mfdb;		/* VDI MFDB for bitblt */
    68 	Uint16 old_palette[256][3];	/* Saved current palette */
    69 	Uint16 cur_palette[256][3];	/* SDL application palette */
    70 								/* Function to set/restore palette */
    71 	void (*setpalette)(_THIS, Uint16 newpal[256][3]);
    72 
    73 	/* GEM infos */
    74 	short ap_id;
    75 	short desk_x, desk_y;		/* Desktop properties */
    76 	short desk_w, desk_h;
    77 	short win_handle;			/* Our window handle */
    78 	int window_type;			/* Window type */
    79 	short work_x, work_y;		/* Window work area x,y,w,h */
    80 	short work_w, work_h;
    81 	const char *title_name;		/* Window title */
    82 	const char *icon_name;		/* Icon title */
    83 	short version;				/* AES version */
    84 	short wfeatures;			/* AES window features */
    85 	SDL_bool refresh_name;		/* Change window title ? */
    86 	SDL_bool window_fulled;		/* Window maximized ? */
    87 	SDL_bool iconified;			/* Window iconified ? */
    88 	SDL_bool mouse_relative;	/* Report relative mouse movement */
    89 	SDL_bool locked;			/* AES locked for fullscreen ? */
    90 	SDL_bool lock_redraw;		/* Prevent redraw till buffers are setup */
    91 	SDL_bool cursor_hidden;		/* Mouse cursor hidden flag */
    92 	short message[8];			/* To self-send an AES message */
    93 	void *menubar;				/* Menu bar save buffer when going fullscreen */
    94 	SDL_bool use_dev_mouse;		/* Use /dev/mouse ? */
    95 	WMcursor *cursor;			/* To restore cursor when leaving/entering window */
    96 	WMcursor *prev_cursor;		/* Previous cursor */
    97 
    98 	SDL_bool fullscreen;		/* Fullscreen or windowed mode ? */
    99 	SDL_Rect *SDL_modelist[SDL_NUMMODES+1];	/* Mode list */
   100 	SDL_Surface *icon;			/* The icon */
   101 };
   102 
   103 /* Hidden structure -> variables names */
   104 #define VDI_handle			(this->hidden->vdi_handle)
   105 #define VDI_w				(this->hidden->full_w)
   106 #define VDI_h				(this->hidden->full_h)
   107 #define VDI_bpp				(this->hidden->bpp)
   108 #define VDI_pixelsize		(this->hidden->pixelsize)
   109 #define VDI_oldnumcolors	(this->hidden->old_numcolors)
   110 #define VDI_oldpalette		(this->hidden->old_palette)
   111 #define VDI_curpalette		(this->hidden->cur_palette)
   112 #define VDI_setpalette		(this->hidden->setpalette)
   113 #define VDI_pitch			(this->hidden->pitch)
   114 #define VDI_format			(this->hidden->format)
   115 #define VDI_screen			(this->hidden->screen)
   116 #define VDI_redmask			(this->hidden->red)
   117 #define VDI_greenmask		(this->hidden->green)
   118 #define VDI_bluemask		(this->hidden->blue)
   119 #define VDI_alphamask		(this->hidden->alpha)
   120 #define VDI_screensize		(this->hidden->screensize)
   121 #define VDI_dst_mfdb		(this->hidden->dst_mfdb)
   122 
   123 #define GEM_ap_id			(this->hidden->ap_id)
   124 #define GEM_desk_x			(this->hidden->desk_x)
   125 #define GEM_desk_y			(this->hidden->desk_y)
   126 #define GEM_desk_w			(this->hidden->desk_w)
   127 #define GEM_desk_h			(this->hidden->desk_h)
   128 #define GEM_handle			(this->hidden->win_handle)
   129 #define GEM_win_type		(this->hidden->window_type)
   130 #define GEM_work_x			(this->hidden->work_x)
   131 #define GEM_work_y			(this->hidden->work_y)
   132 #define GEM_work_w			(this->hidden->work_w)
   133 #define GEM_work_h			(this->hidden->work_h)
   134 #define GEM_title_name		(this->hidden->title_name)
   135 #define GEM_icon_name		(this->hidden->icon_name)
   136 #define GEM_refresh_name	(this->hidden->refresh_name)
   137 #define GEM_version			(this->hidden->version)
   138 #define GEM_wfeatures		(this->hidden->wfeatures)
   139 #define GEM_win_fulled		(this->hidden->window_fulled)
   140 #define GEM_iconified		(this->hidden->iconified)
   141 #define GEM_mouse_relative	(this->hidden->mouse_relative)
   142 #define GEM_locked			(this->hidden->locked)
   143 #define GEM_lock_redraw		(this->hidden->lock_redraw)
   144 #define GEM_cursor_hidden	(this->hidden->cursor_hidden)
   145 #define GEM_message			(this->hidden->message)
   146 #define SDL_modelist		(this->hidden->SDL_modelist)
   147 #define GEM_icon			(this->hidden->icon)
   148 #define GEM_fullscreen		(this->hidden->fullscreen)
   149 #define GEM_menubar			(this->hidden->menubar)
   150 #define GEM_usedevmouse		(this->hidden->use_dev_mouse)
   151 #define GEM_cursor			(this->hidden->cursor)
   152 #define GEM_prev_cursor		(this->hidden->prev_cursor)
   153 
   154 #define GEM_buffer1			(this->hidden->buffer1)
   155 #define GEM_buffer2			(this->hidden->buffer2)
   156 #define GEM_bufops			(this->hidden->buf2scr_ops)
   157 
   158 #define VDI_FBMASK(amask, rmask, gmask, bmask) \
   159 	VDI_alphamask = (amask); \
   160 	VDI_redmask = (rmask); \
   161 	VDI_greenmask = (gmask); \
   162 	VDI_bluemask = (bmask);
   163 
   164 /*
   165 	Possible buffer to screen operations:
   166 
   167 	TC: 8 (chunky),15,16,24,32 bpp
   168 	8I: 8 bpp planes
   169 	FB: screen framebuffer address available
   170 	FS: fullscreen
   171 
   172 	TC, FB, FS:
   173 		- draw to screen
   174 	8I, FB, FS:
   175 		- draw to buffer 1
   176 		- C2P from buffer 1 to screen
   177 
   178 	TC, !FB, FS:
   179 		- draw to buffer 1
   180 		- vro_cpyfm() from buffer 1 to screen
   181 	8I, !FB, FS:
   182 		- draw to buffer 1
   183 		- C2P from buffer 1 to buffer 2
   184 		- vro_cpyfm() from buffer 2 to screen
   185 
   186 	TC, FB, !FS:
   187 		- draw to buffer 1
   188 		- vro_cpyfm() from buffer 1 to screen
   189 	8I, FB, !FS:
   190 		- draw to buffer 1
   191 		- C2P from buffer 1 to buffer 2
   192 		- vro_cpyfm() from buffer 2 to screen
   193 
   194 	TC, !FB, !FS:
   195 		- draw to buffer 1
   196 		- vro_cpyfm() from buffer 1 to screen
   197 	8I, !FB, !FS:
   198 		- draw to buffer 1
   199 		- C2P from buffer 1 to buffer 2
   200 		- vro_cpyfm() from buffer 2 to screen
   201 */
   202 
   203 #endif /* _SDL_gemvideo_h */