Work in progress on multi-display support:
* Added display parameter to many internal functions so video modes can be set on displays that aren't the public current one. * The fullscreen mode is associated with fullscreen windows - not displays, so different windows more naturally have a mode associated with them based on their width and height. It's no longer necessary to specify a fullscreen mode, a default one will be picked automatically for fullscreen windows. --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404241
This commit is contained in:
parent
3e860cdcf9
commit
1cd715e9db
29 changed files with 446 additions and 485 deletions
|
@ -50,7 +50,8 @@ extern "C" {
|
||||||
* \sa SDL_GetDesktopDisplayMode()
|
* \sa SDL_GetDesktopDisplayMode()
|
||||||
* \sa SDL_GetCurrentDisplayMode()
|
* \sa SDL_GetCurrentDisplayMode()
|
||||||
* \sa SDL_GetClosestDisplayMode()
|
* \sa SDL_GetClosestDisplayMode()
|
||||||
* \sa SDL_SetDisplayMode()
|
* \sa SDL_SetWindowDisplayMode()
|
||||||
|
* \sa SDL_GetWindowDisplayMode()
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -427,23 +428,25 @@ extern DECLSPEC SDL_DisplayMode *SDLCALL SDL_GetClosestDisplayMode(const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Set the display mode used when a fullscreen window is visible
|
* \brief Set the display mode used when a fullscreen window is visible
|
||||||
* on the currently selected display.
|
* on the currently selected display. By default the window's
|
||||||
|
* dimensions and the desktop format and refresh rate are used.
|
||||||
*
|
*
|
||||||
* \param mode The mode to use, or NULL for the desktop mode.
|
* \param mode The mode to use, or NULL for the default mode.
|
||||||
*
|
*
|
||||||
* \return 0 on success, or -1 if setting the display mode failed.
|
* \return 0 on success, or -1 if setting the display mode failed.
|
||||||
*
|
*
|
||||||
* \sa SDL_SetWindowFullscreen()
|
* \sa SDL_SetWindowFullscreen()
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_SetFullscreenDisplayMode(const SDL_DisplayMode
|
extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_WindowID windowID,
|
||||||
|
const SDL_DisplayMode
|
||||||
* mode);
|
* mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Fill in information about the display mode used when a fullscreen
|
* \brief Fill in information about the display mode used when a fullscreen
|
||||||
* window is visible on the currently selected display.
|
* window is visible on the currently selected display.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GetFullscreenDisplayMode(SDL_DisplayMode *
|
extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_WindowID windowID,
|
||||||
mode);
|
SDL_DisplayMode * mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Set the palette entries for indexed display modes.
|
* \brief Set the palette entries for indexed display modes.
|
||||||
|
@ -680,7 +683,7 @@ extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_WindowID windowID);
|
||||||
*
|
*
|
||||||
* \return 0 on success, or -1 if setting the display mode failed.
|
* \return 0 on success, or -1 if setting the display mode failed.
|
||||||
*
|
*
|
||||||
* \sa SDL_SetFullscreenDisplayMode()
|
* \sa SDL_WindowDisplayMode()
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_WindowID windowID,
|
extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_WindowID windowID,
|
||||||
int fullscreen);
|
int fullscreen);
|
||||||
|
|
|
@ -482,7 +482,6 @@ SDL_Surface *
|
||||||
SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
|
SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
|
||||||
{
|
{
|
||||||
SDL_DisplayMode desktop_mode;
|
SDL_DisplayMode desktop_mode;
|
||||||
SDL_DisplayMode mode;
|
|
||||||
int window_x = SDL_WINDOWPOS_UNDEFINED;
|
int window_x = SDL_WINDOWPOS_UNDEFINED;
|
||||||
int window_y = SDL_WINDOWPOS_UNDEFINED;
|
int window_y = SDL_WINDOWPOS_UNDEFINED;
|
||||||
Uint32 window_flags;
|
Uint32 window_flags;
|
||||||
|
@ -552,7 +551,6 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
|
||||||
window_flags |= SDL_WINDOW_BORDERLESS;
|
window_flags |= SDL_WINDOW_BORDERLESS;
|
||||||
}
|
}
|
||||||
GetEnvironmentWindowPosition(width, height, &window_x, &window_y);
|
GetEnvironmentWindowPosition(width, height, &window_x, &window_y);
|
||||||
SDL_SetFullscreenDisplayMode(NULL);
|
|
||||||
SDL_VideoWindow =
|
SDL_VideoWindow =
|
||||||
SDL_CreateWindow(wm_title, window_x, window_y, width, height,
|
SDL_CreateWindow(wm_title, window_x, window_y, width, height,
|
||||||
window_flags);
|
window_flags);
|
||||||
|
@ -611,14 +609,14 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mode.format = desired_format;
|
|
||||||
mode.w = width;
|
|
||||||
mode.h = height;
|
|
||||||
mode.refresh_rate = 0;
|
|
||||||
|
|
||||||
/* Set the desired display mode */
|
/* Set up the desired display mode */
|
||||||
if (flags & SDL_FULLSCREEN) {
|
if (flags & SDL_FULLSCREEN) {
|
||||||
if (SDL_SetFullscreenDisplayMode(&mode) < 0) {
|
SDL_DisplayMode mode;
|
||||||
|
|
||||||
|
SDL_zero(mode);
|
||||||
|
mode.format = desired_format;
|
||||||
|
if (SDL_SetWindowDisplayMode(SDL_VideoWindow, &mode) < 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,30 +113,39 @@ SDL_GetGamma(float *red, float *green, float *blue)
|
||||||
return succeeded;
|
return succeeded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
SDL_UninitializedVideo()
|
||||||
|
{
|
||||||
|
SDL_SetError("Video subsystem has not been initialized");
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SDL_SetGammaRamp(const Uint16 * red, const Uint16 * green,
|
SDL_SetGammaRampForDisplay(SDL_VideoDisplay * display, const Uint16 * red, const Uint16 * green, const Uint16 * blue)
|
||||||
const Uint16 * blue)
|
|
||||||
{
|
{
|
||||||
SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
||||||
int succeeded;
|
int succeeded;
|
||||||
|
|
||||||
|
if (!_this) {
|
||||||
|
SDL_UninitializedVideo();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Lazily allocate the gamma tables */
|
/* Lazily allocate the gamma tables */
|
||||||
if (!SDL_CurrentDisplay.gamma) {
|
if (!display->gamma) {
|
||||||
SDL_GetGammaRamp(NULL, NULL, NULL);
|
if (SDL_GetGammaRampForDisplay(display, NULL, NULL, NULL) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill the gamma table with the new values */
|
/* Fill the gamma table with the new values */
|
||||||
if (red) {
|
if (red) {
|
||||||
SDL_memcpy(&SDL_CurrentDisplay.gamma[0 * 256], red,
|
SDL_memcpy(&display->gamma[0 * 256], red, 256 * sizeof(*display->gamma));
|
||||||
256 * sizeof(*SDL_CurrentDisplay.gamma));
|
|
||||||
}
|
}
|
||||||
if (green) {
|
if (green) {
|
||||||
SDL_memcpy(&SDL_CurrentDisplay.gamma[1 * 256], green,
|
SDL_memcpy(&display->gamma[1 * 256], green, 256 * sizeof(*display->gamma));
|
||||||
256 * sizeof(*SDL_CurrentDisplay.gamma));
|
|
||||||
}
|
}
|
||||||
if (blue) {
|
if (blue) {
|
||||||
SDL_memcpy(&SDL_CurrentDisplay.gamma[2 * 256], blue,
|
SDL_memcpy(&display->gamma[2 * 256], blue, 256 * sizeof(*display->gamma));
|
||||||
256 * sizeof(*SDL_CurrentDisplay.gamma));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try to set the gamma ramp in the driver */
|
/* Try to set the gamma ramp in the driver */
|
||||||
|
@ -144,7 +153,7 @@ SDL_SetGammaRamp(const Uint16 * red, const Uint16 * green,
|
||||||
if (_this && _this->SetDisplayGammaRamp) {
|
if (_this && _this->SetDisplayGammaRamp) {
|
||||||
if (SDL_GetFocusWindow()) {
|
if (SDL_GetFocusWindow()) {
|
||||||
succeeded =
|
succeeded =
|
||||||
_this->SetDisplayGammaRamp(_this, SDL_CurrentDisplay.gamma);
|
_this->SetDisplayGammaRamp(_this, display, display->gamma);
|
||||||
} else {
|
} else {
|
||||||
succeeded = 0;
|
succeeded = 0;
|
||||||
}
|
}
|
||||||
|
@ -155,50 +164,73 @@ SDL_SetGammaRamp(const Uint16 * red, const Uint16 * green,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SDL_GetGammaRamp(Uint16 * red, Uint16 * green, Uint16 * blue)
|
SDL_SetGammaRamp(const Uint16 * red, const Uint16 * green, const Uint16 * blue)
|
||||||
|
{
|
||||||
|
SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
||||||
|
if (!_this) {
|
||||||
|
SDL_UninitializedVideo();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return SDL_SetGammaRampForDisplay(&SDL_CurrentDisplay, red, green, blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SDL_GetGammaRampForDisplay(SDL_VideoDisplay * display, Uint16 * red, Uint16 * green, Uint16 * blue)
|
||||||
{
|
{
|
||||||
SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
||||||
|
|
||||||
/* Lazily allocate the gamma table */
|
if (!_this) {
|
||||||
if (!SDL_CurrentDisplay.gamma) {
|
SDL_UninitializedVideo();
|
||||||
size_t rampsize = (3 * 256 * sizeof(*SDL_CurrentDisplay.gamma));
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
SDL_CurrentDisplay.gamma = SDL_malloc(rampsize * 2);
|
/* Lazily allocate the gamma table */
|
||||||
if (!SDL_CurrentDisplay.gamma) {
|
if (!display->gamma) {
|
||||||
|
size_t rampsize = (3 * 256 * sizeof(*display->gamma));
|
||||||
|
|
||||||
|
display->gamma = SDL_malloc(rampsize * 2);
|
||||||
|
if (!display->gamma) {
|
||||||
SDL_OutOfMemory();
|
SDL_OutOfMemory();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (_this && _this->GetDisplayGammaRamp) {
|
if (_this && _this->GetDisplayGammaRamp) {
|
||||||
/* Get the real hardware gamma */
|
/* Get the real hardware gamma */
|
||||||
_this->GetDisplayGammaRamp(_this, SDL_CurrentDisplay.gamma);
|
_this->GetDisplayGammaRamp(_this, display, display->gamma);
|
||||||
} else {
|
} else {
|
||||||
/* Assume an identity gamma */
|
/* Assume an identity gamma */
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 256; ++i) {
|
for (i = 0; i < 256; ++i) {
|
||||||
SDL_CurrentDisplay.gamma[0 * 256 + i] = (i << 8) | i;
|
display->gamma[0 * 256 + i] = (i << 8) | i;
|
||||||
SDL_CurrentDisplay.gamma[1 * 256 + i] = (i << 8) | i;
|
display->gamma[1 * 256 + i] = (i << 8) | i;
|
||||||
SDL_CurrentDisplay.gamma[2 * 256 + i] = (i << 8) | i;
|
display->gamma[2 * 256 + i] = (i << 8) | i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SDL_CurrentDisplay.saved_gamma = SDL_CurrentDisplay.gamma + (3 * 256);
|
display->saved_gamma = display->gamma + (3 * 256);
|
||||||
SDL_memcpy(SDL_CurrentDisplay.saved_gamma, SDL_CurrentDisplay.gamma,
|
SDL_memcpy(display->saved_gamma, display->gamma, rampsize);
|
||||||
rampsize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Just copy from our internal table */
|
/* Just copy from our internal table */
|
||||||
if (red) {
|
if (red) {
|
||||||
SDL_memcpy(red, &SDL_CurrentDisplay.gamma[0 * 256],
|
SDL_memcpy(red, &display->gamma[0 * 256], 256 * sizeof(*red));
|
||||||
256 * sizeof(*red));
|
|
||||||
}
|
}
|
||||||
if (green) {
|
if (green) {
|
||||||
SDL_memcpy(green, &SDL_CurrentDisplay.gamma[1 * 256],
|
SDL_memcpy(green, &display->gamma[1 * 256], 256 * sizeof(*green));
|
||||||
256 * sizeof(*green));
|
|
||||||
}
|
}
|
||||||
if (blue) {
|
if (blue) {
|
||||||
SDL_memcpy(blue, &SDL_CurrentDisplay.gamma[2 * 256],
|
SDL_memcpy(blue, &display->gamma[2 * 256], 256 * sizeof(*blue));
|
||||||
256 * sizeof(*blue));
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SDL_GetGammaRamp(Uint16 * red, Uint16 * green, Uint16 * blue)
|
||||||
|
{
|
||||||
|
SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
||||||
|
if (!_this) {
|
||||||
|
SDL_UninitializedVideo();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return SDL_GetGammaRampForDisplay(&SDL_CurrentDisplay, red, green, blue);
|
||||||
|
}
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
|
@ -139,6 +139,8 @@ struct SDL_Window
|
||||||
int display;
|
int display;
|
||||||
SDL_Renderer *renderer;
|
SDL_Renderer *renderer;
|
||||||
|
|
||||||
|
SDL_DisplayMode fullscreen_mode;
|
||||||
|
|
||||||
void *userdata;
|
void *userdata;
|
||||||
void *driverdata;
|
void *driverdata;
|
||||||
};
|
};
|
||||||
|
@ -158,7 +160,6 @@ struct SDL_VideoDisplay
|
||||||
SDL_DisplayMode *display_modes;
|
SDL_DisplayMode *display_modes;
|
||||||
SDL_DisplayMode desktop_mode;
|
SDL_DisplayMode desktop_mode;
|
||||||
SDL_DisplayMode current_mode;
|
SDL_DisplayMode current_mode;
|
||||||
SDL_DisplayMode fullscreen_mode;
|
|
||||||
SDL_Palette *palette;
|
SDL_Palette *palette;
|
||||||
|
|
||||||
Uint16 *gamma;
|
Uint16 *gamma;
|
||||||
|
@ -213,7 +214,7 @@ struct SDL_VideoDevice
|
||||||
* Get a list of the available display modes. e.g.
|
* Get a list of the available display modes. e.g.
|
||||||
* SDL_AddDisplayMode(_this->current_display, mode)
|
* SDL_AddDisplayMode(_this->current_display, mode)
|
||||||
*/
|
*/
|
||||||
void (*GetDisplayModes) (_THIS);
|
void (*GetDisplayModes) (_THIS, SDL_VideoDisplay * display);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Setting the display mode is independent of creating windows, so
|
* Setting the display mode is independent of creating windows, so
|
||||||
|
@ -221,19 +222,19 @@ struct SDL_VideoDevice
|
||||||
* their data updated accordingly, including the display surfaces
|
* their data updated accordingly, including the display surfaces
|
||||||
* associated with them.
|
* associated with them.
|
||||||
*/
|
*/
|
||||||
int (*SetDisplayMode) (_THIS, SDL_DisplayMode * mode);
|
int (*SetDisplayMode) (_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
|
||||||
|
|
||||||
/* Set the color entries of the display palette */
|
/* Set the color entries of the display palette */
|
||||||
int (*SetDisplayPalette) (_THIS, SDL_Palette * palette);
|
int (*SetDisplayPalette) (_THIS, SDL_VideoDisplay * display, SDL_Palette * palette);
|
||||||
|
|
||||||
/* Get the color entries of the display palette */
|
/* Get the color entries of the display palette */
|
||||||
int (*GetDisplayPalette) (_THIS, SDL_Palette * palette);
|
int (*GetDisplayPalette) (_THIS, SDL_VideoDisplay * display, SDL_Palette * palette);
|
||||||
|
|
||||||
/* Set the gamma ramp */
|
/* Set the gamma ramp */
|
||||||
int (*SetDisplayGammaRamp) (_THIS, Uint16 * ramp);
|
int (*SetDisplayGammaRamp) (_THIS, SDL_VideoDisplay * display, Uint16 * ramp);
|
||||||
|
|
||||||
/* Get the gamma ramp */
|
/* Get the gamma ramp */
|
||||||
int (*GetDisplayGammaRamp) (_THIS, Uint16 * ramp);
|
int (*GetDisplayGammaRamp) (_THIS, SDL_VideoDisplay * display, Uint16 * ramp);
|
||||||
|
|
||||||
/* * * */
|
/* * * */
|
||||||
/*
|
/*
|
||||||
|
@ -405,10 +406,19 @@ extern VideoBootStrap PND_bootstrap;
|
||||||
extern SDL_VideoDevice *SDL_GetVideoDevice();
|
extern SDL_VideoDevice *SDL_GetVideoDevice();
|
||||||
extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode);
|
extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode);
|
||||||
extern int SDL_AddVideoDisplay(const SDL_VideoDisplay * display);
|
extern int SDL_AddVideoDisplay(const SDL_VideoDisplay * display);
|
||||||
extern SDL_bool
|
extern SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode * mode);
|
||||||
SDL_AddDisplayMode(int displayIndex, const SDL_DisplayMode * mode);
|
extern int SDL_GetNumDisplayModesForDisplay(SDL_VideoDisplay * display);
|
||||||
extern void
|
extern int SDL_GetDisplayModeForDisplay(SDL_VideoDisplay * display, int index, SDL_DisplayMode * mode);
|
||||||
SDL_AddRenderDriver(int displayIndex, const SDL_RenderDriver * driver);
|
extern int SDL_GetDesktopDisplayModeForDisplay(SDL_VideoDisplay * display, SDL_DisplayMode * mode);
|
||||||
|
extern int SDL_GetCurrentDisplayModeForDisplay(SDL_VideoDisplay * display, SDL_DisplayMode * mode);
|
||||||
|
extern SDL_DisplayMode * SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * mode, SDL_DisplayMode * closest);
|
||||||
|
extern int SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * mode);
|
||||||
|
extern int SDL_SetDisplayPaletteForDisplay(SDL_VideoDisplay * display, const SDL_Color * colors, int firstcolor, int ncolors);
|
||||||
|
extern int SDL_GetDisplayPaletteForDisplay(SDL_VideoDisplay * display, SDL_Color * colors, int firstcolor, int ncolors);
|
||||||
|
extern void SDL_AddRenderDriver(SDL_VideoDisplay *display, const SDL_RenderDriver * driver);
|
||||||
|
|
||||||
|
extern int SDL_SetGammaRampForDisplay(SDL_VideoDisplay * display, const Uint16 * red, const Uint16 * green, const Uint16 * blue);
|
||||||
|
extern int SDL_GetGammaRampForDisplay(SDL_VideoDisplay * display, Uint16 * red, Uint16 * green, Uint16 * blue);
|
||||||
|
|
||||||
extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);
|
extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);
|
||||||
extern SDL_Window *SDL_GetWindowFromID(SDL_WindowID windowID);
|
extern SDL_Window *SDL_GetWindowFromID(SDL_WindowID windowID);
|
||||||
|
|
|
@ -256,16 +256,17 @@ SDL_VideoInit(const char *driver_name, Uint32 flags)
|
||||||
}
|
}
|
||||||
/* The software renderer is always available */
|
/* The software renderer is always available */
|
||||||
for (i = 0; i < _this->num_displays; ++i) {
|
for (i = 0; i < _this->num_displays; ++i) {
|
||||||
|
SDL_VideoDisplay *display = &_this->displays[i];
|
||||||
if (_this->GL_CreateContext) {
|
if (_this->GL_CreateContext) {
|
||||||
#if SDL_VIDEO_RENDER_OGL
|
#if SDL_VIDEO_RENDER_OGL
|
||||||
SDL_AddRenderDriver(i, &GL_RenderDriver);
|
SDL_AddRenderDriver(display, &GL_RenderDriver);
|
||||||
#endif
|
#endif
|
||||||
#if SDL_VIDEO_RENDER_OGL_ES
|
#if SDL_VIDEO_RENDER_OGL_ES
|
||||||
SDL_AddRenderDriver(i, &GL_ES_RenderDriver);
|
SDL_AddRenderDriver(display, &GL_ES_RenderDriver);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (_this->displays[i].num_render_drivers > 0) {
|
if (display->num_render_drivers > 0) {
|
||||||
SDL_AddRenderDriver(i, &SW_RenderDriver);
|
SDL_AddRenderDriver(display, &SW_RenderDriver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,9 +361,8 @@ SDL_GetCurrentVideoDisplay(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_bool
|
SDL_bool
|
||||||
SDL_AddDisplayMode(int displayIndex, const SDL_DisplayMode * mode)
|
SDL_AddDisplayMode(SDL_VideoDisplay * display, const SDL_DisplayMode * mode)
|
||||||
{
|
{
|
||||||
SDL_VideoDisplay *display = &_this->displays[displayIndex];
|
|
||||||
SDL_DisplayMode *modes;
|
SDL_DisplayMode *modes;
|
||||||
int i, nmodes;
|
int i, nmodes;
|
||||||
|
|
||||||
|
@ -397,30 +397,50 @@ SDL_AddDisplayMode(int displayIndex, const SDL_DisplayMode * mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SDL_GetNumDisplayModes()
|
SDL_GetNumDisplayModesForDisplay(SDL_VideoDisplay * display)
|
||||||
{
|
{
|
||||||
if (_this) {
|
|
||||||
SDL_VideoDisplay *display = &SDL_CurrentDisplay;
|
|
||||||
if (!display->num_display_modes && _this->GetDisplayModes) {
|
if (!display->num_display_modes && _this->GetDisplayModes) {
|
||||||
_this->GetDisplayModes(_this);
|
_this->GetDisplayModes(_this, display);
|
||||||
SDL_qsort(display->display_modes, display->num_display_modes,
|
SDL_qsort(display->display_modes, display->num_display_modes,
|
||||||
sizeof(SDL_DisplayMode), cmpmodes);
|
sizeof(SDL_DisplayMode), cmpmodes);
|
||||||
}
|
}
|
||||||
return display->num_display_modes;
|
return display->num_display_modes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SDL_GetNumDisplayModes()
|
||||||
|
{
|
||||||
|
if (_this) {
|
||||||
|
return SDL_GetNumDisplayModesForDisplay(&SDL_CurrentDisplay);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SDL_GetDisplayModeForDisplay(SDL_VideoDisplay * display, int index, SDL_DisplayMode * mode)
|
||||||
|
{
|
||||||
|
if (index < 0 || index >= SDL_GetNumDisplayModesForDisplay(display)) {
|
||||||
|
SDL_SetError("index must be in the range of 0 - %d",
|
||||||
|
SDL_GetNumDisplayModesForDisplay(display) - 1);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (mode) {
|
||||||
|
*mode = display->display_modes[index];
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SDL_GetDisplayMode(int index, SDL_DisplayMode * mode)
|
SDL_GetDisplayMode(int index, SDL_DisplayMode * mode)
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= SDL_GetNumDisplayModes()) {
|
return SDL_GetDisplayModeForDisplay(&SDL_CurrentDisplay, index, mode);
|
||||||
SDL_SetError("index must be in the range of 0 - %d",
|
|
||||||
SDL_GetNumDisplayModes() - 1);
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SDL_GetDesktopDisplayModeForDisplay(SDL_VideoDisplay * display, SDL_DisplayMode * mode)
|
||||||
|
{
|
||||||
if (mode) {
|
if (mode) {
|
||||||
*mode = SDL_CurrentDisplay.display_modes[index];
|
*mode = display->desktop_mode;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -432,8 +452,14 @@ SDL_GetDesktopDisplayMode(SDL_DisplayMode * mode)
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
return SDL_GetDesktopDisplayModeForDisplay(&SDL_CurrentDisplay, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SDL_GetCurrentDisplayModeForDisplay(SDL_VideoDisplay * display, SDL_DisplayMode * mode)
|
||||||
|
{
|
||||||
if (mode) {
|
if (mode) {
|
||||||
*mode = SDL_CurrentDisplay.desktop_mode;
|
*mode = display->current_mode;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -445,14 +471,12 @@ SDL_GetCurrentDisplayMode(SDL_DisplayMode * mode)
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (mode) {
|
return SDL_GetCurrentDisplayModeForDisplay(&SDL_CurrentDisplay, mode);
|
||||||
*mode = SDL_CurrentDisplay.current_mode;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_DisplayMode *
|
SDL_DisplayMode *
|
||||||
SDL_GetClosestDisplayMode(const SDL_DisplayMode * mode,
|
SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay * display,
|
||||||
|
const SDL_DisplayMode * mode,
|
||||||
SDL_DisplayMode * closest)
|
SDL_DisplayMode * closest)
|
||||||
{
|
{
|
||||||
Uint32 target_format;
|
Uint32 target_format;
|
||||||
|
@ -460,26 +484,28 @@ SDL_GetClosestDisplayMode(const SDL_DisplayMode * mode,
|
||||||
int i;
|
int i;
|
||||||
SDL_DisplayMode *current, *match;
|
SDL_DisplayMode *current, *match;
|
||||||
|
|
||||||
if (!_this || !mode || !closest) {
|
if (!mode || !closest) {
|
||||||
|
SDL_SetError("Missing desired mode or closest mode parameter");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Default to the desktop format */
|
/* Default to the desktop format */
|
||||||
if (mode->format) {
|
if (mode->format) {
|
||||||
target_format = mode->format;
|
target_format = mode->format;
|
||||||
} else {
|
} else {
|
||||||
target_format = SDL_CurrentDisplay.desktop_mode.format;
|
target_format = display->desktop_mode.format;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Default to the desktop refresh rate */
|
/* Default to the desktop refresh rate */
|
||||||
if (mode->refresh_rate) {
|
if (mode->refresh_rate) {
|
||||||
target_refresh_rate = mode->refresh_rate;
|
target_refresh_rate = mode->refresh_rate;
|
||||||
} else {
|
} else {
|
||||||
target_refresh_rate = SDL_CurrentDisplay.desktop_mode.refresh_rate;
|
target_refresh_rate = display->desktop_mode.refresh_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
match = NULL;
|
match = NULL;
|
||||||
for (i = 0; i < SDL_GetNumDisplayModes(); ++i) {
|
for (i = 0; i < SDL_GetNumDisplayModesForDisplay(display); ++i) {
|
||||||
current = &SDL_CurrentDisplay.display_modes[i];
|
current = &display->display_modes[i];
|
||||||
|
|
||||||
if (current->w && (current->w < mode->w)) {
|
if (current->w && (current->w < mode->w)) {
|
||||||
/* Out of sorted modes large enough here */
|
/* Out of sorted modes large enough here */
|
||||||
|
@ -555,19 +581,24 @@ SDL_GetClosestDisplayMode(const SDL_DisplayMode * mode,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
SDL_DisplayMode *
|
||||||
SDL_SetDisplayMode(const SDL_DisplayMode * mode)
|
SDL_GetClosestDisplayMode(const SDL_DisplayMode * mode,
|
||||||
|
SDL_DisplayMode * closest)
|
||||||
|
{
|
||||||
|
if (!_this) {
|
||||||
|
SDL_UninitializedVideo();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return SDL_GetClosestDisplayModeForDisplay(&SDL_CurrentDisplay, mode, closest);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * mode)
|
||||||
{
|
{
|
||||||
SDL_VideoDisplay *display;
|
|
||||||
SDL_DisplayMode display_mode;
|
SDL_DisplayMode display_mode;
|
||||||
SDL_DisplayMode current_mode;
|
SDL_DisplayMode current_mode;
|
||||||
int i, ncolors;
|
int i, ncolors;
|
||||||
|
|
||||||
if (!_this) {
|
|
||||||
SDL_UninitializedVideo();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
display = &SDL_CurrentDisplay;
|
|
||||||
if (!mode) {
|
if (!mode) {
|
||||||
mode = &display->desktop_mode;
|
mode = &display->desktop_mode;
|
||||||
}
|
}
|
||||||
|
@ -586,19 +617,22 @@ SDL_SetDisplayMode(const SDL_DisplayMode * mode)
|
||||||
if (!display_mode.refresh_rate) {
|
if (!display_mode.refresh_rate) {
|
||||||
display_mode.refresh_rate = display->current_mode.refresh_rate;
|
display_mode.refresh_rate = display->current_mode.refresh_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a good video mode, the closest one possible */
|
/* Get a good video mode, the closest one possible */
|
||||||
if (!SDL_GetClosestDisplayMode(&display_mode, &display_mode)) {
|
if (!SDL_GetClosestDisplayModeForDisplay(display, &display_mode, &display_mode)) {
|
||||||
SDL_SetError("No video mode large enough for %dx%d",
|
SDL_SetError("No video mode large enough for %dx%d",
|
||||||
display_mode.w, display_mode.h);
|
display_mode.w, display_mode.h);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See if there's anything left to do */
|
/* See if there's anything left to do */
|
||||||
SDL_GetCurrentDisplayMode(¤t_mode);
|
SDL_GetCurrentDisplayModeForDisplay(display, ¤t_mode);
|
||||||
if (SDL_memcmp(&display_mode, ¤t_mode, sizeof(display_mode)) == 0) {
|
if (SDL_memcmp(&display_mode, ¤t_mode, sizeof(display_mode)) == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Actually change the display mode */
|
/* Actually change the display mode */
|
||||||
if (_this->SetDisplayMode(_this, &display_mode) < 0) {
|
if (_this->SetDisplayMode(_this, display, &display_mode) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
display->current_mode = display_mode;
|
display->current_mode = display_mode;
|
||||||
|
@ -624,84 +658,74 @@ SDL_SetDisplayMode(const SDL_DisplayMode * mode)
|
||||||
SDL_BITSPERPIXEL(display_mode.format));
|
SDL_BITSPERPIXEL(display_mode.format));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Move any fullscreen windows into position */
|
|
||||||
for (i = 0; i < display->num_windows; ++i) {
|
|
||||||
SDL_Window *window = &display->windows[i];
|
|
||||||
if (FULLSCREEN_VISIBLE(window)) {
|
|
||||||
SDL_SetWindowPosition(window->id, window->x, window->y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SDL_SetFullscreenDisplayMode(const SDL_DisplayMode * mode)
|
SDL_SetDisplayMode(const SDL_DisplayMode * mode)
|
||||||
{
|
{
|
||||||
SDL_VideoDisplay *display;
|
|
||||||
SDL_DisplayMode fullscreen_mode;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (!_this) {
|
if (!_this) {
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
display = &SDL_CurrentDisplay;
|
return SDL_SetDisplayModeForDisplay(&SDL_CurrentDisplay, mode);
|
||||||
if (!mode) {
|
|
||||||
mode = &display->desktop_mode;
|
|
||||||
}
|
}
|
||||||
if (!SDL_GetClosestDisplayMode(mode, &fullscreen_mode)) {
|
|
||||||
|
int
|
||||||
|
SDL_SetWindowDisplayMode(SDL_WindowID windowID, const SDL_DisplayMode * mode)
|
||||||
|
{
|
||||||
|
SDL_Window *window = SDL_GetWindowFromID(windowID);
|
||||||
|
|
||||||
|
if (!window) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode) {
|
||||||
|
window->fullscreen_mode = *mode;
|
||||||
|
} else {
|
||||||
|
SDL_zero(window->fullscreen_mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SDL_GetWindowDisplayMode(SDL_WindowID windowID, SDL_DisplayMode * mode)
|
||||||
|
{
|
||||||
|
SDL_Window *window = SDL_GetWindowFromID(windowID);
|
||||||
|
SDL_DisplayMode fullscreen_mode;
|
||||||
|
|
||||||
|
if (!window) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
fullscreen_mode = window->fullscreen_mode;
|
||||||
|
if (!fullscreen_mode.w) {
|
||||||
|
fullscreen_mode.w = window->w;
|
||||||
|
}
|
||||||
|
if (!fullscreen_mode.h) {
|
||||||
|
fullscreen_mode.h = window->h;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SDL_GetClosestDisplayModeForDisplay(SDL_GetDisplayFromWindow(window),
|
||||||
|
&fullscreen_mode,
|
||||||
|
&fullscreen_mode)) {
|
||||||
SDL_SetError("Couldn't find display mode match");
|
SDL_SetError("Couldn't find display mode match");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDL_memcmp
|
|
||||||
(&fullscreen_mode, &display->fullscreen_mode,
|
|
||||||
sizeof(fullscreen_mode)) == 0) {
|
|
||||||
/* Nothing to do... */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
display->fullscreen_mode = fullscreen_mode;
|
|
||||||
|
|
||||||
/* Actually set the mode if we have a fullscreen window visible */
|
|
||||||
for (i = 0; i < display->num_windows; ++i) {
|
|
||||||
SDL_Window *window = &display->windows[i];
|
|
||||||
if (FULLSCREEN_VISIBLE(window)) {
|
|
||||||
if (SDL_SetDisplayMode(&display->fullscreen_mode) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (window->flags & SDL_WINDOW_FULLSCREEN) {
|
|
||||||
SDL_OnWindowResized(window);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
SDL_GetFullscreenDisplayMode(SDL_DisplayMode * mode)
|
|
||||||
{
|
|
||||||
if (!_this) {
|
|
||||||
SDL_UninitializedVideo();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (mode) {
|
if (mode) {
|
||||||
*mode = SDL_CurrentDisplay.fullscreen_mode;
|
*mode = fullscreen_mode;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SDL_SetDisplayPalette(const SDL_Color * colors, int firstcolor, int ncolors)
|
SDL_SetDisplayPaletteForDisplay(SDL_VideoDisplay * display, const SDL_Color * colors, int firstcolor, int ncolors)
|
||||||
{
|
{
|
||||||
SDL_Palette *palette;
|
SDL_Palette *palette;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
||||||
if (!_this) {
|
palette = display->palette;
|
||||||
SDL_UninitializedVideo();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
palette = SDL_CurrentDisplay.palette;
|
|
||||||
if (!palette) {
|
if (!palette) {
|
||||||
SDL_SetError("Display mode does not have a palette");
|
SDL_SetError("Display mode does not have a palette");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -709,13 +733,42 @@ SDL_SetDisplayPalette(const SDL_Color * colors, int firstcolor, int ncolors)
|
||||||
status = SDL_SetPaletteColors(palette, colors, firstcolor, ncolors);
|
status = SDL_SetPaletteColors(palette, colors, firstcolor, ncolors);
|
||||||
|
|
||||||
if (_this->SetDisplayPalette) {
|
if (_this->SetDisplayPalette) {
|
||||||
if (_this->SetDisplayPalette(_this, palette) < 0) {
|
if (_this->SetDisplayPalette(_this, display, palette) < 0) {
|
||||||
status = -1;
|
status = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SDL_SetDisplayPalette(const SDL_Color * colors, int firstcolor, int ncolors)
|
||||||
|
{
|
||||||
|
if (!_this) {
|
||||||
|
SDL_UninitializedVideo();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return SDL_SetDisplayPaletteForDisplay(&SDL_CurrentDisplay, colors, firstcolor, ncolors);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SDL_GetDisplayPaletteForDisplay(SDL_VideoDisplay * display, SDL_Color * colors, int firstcolor, int ncolors)
|
||||||
|
{
|
||||||
|
SDL_Palette *palette;
|
||||||
|
|
||||||
|
palette = display->palette;
|
||||||
|
if (!palette || !palette->ncolors) {
|
||||||
|
SDL_SetError("Display mode does not have a palette");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (firstcolor < 0 || (firstcolor + ncolors) > palette->ncolors) {
|
||||||
|
SDL_SetError("Palette indices are out of range");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
SDL_memcpy(colors, &palette->colors[firstcolor],
|
||||||
|
ncolors * sizeof(*colors));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SDL_GetDisplayPalette(SDL_Color * colors, int firstcolor, int ncolors)
|
SDL_GetDisplayPalette(SDL_Color * colors, int firstcolor, int ncolors)
|
||||||
{
|
{
|
||||||
|
@ -725,18 +778,7 @@ SDL_GetDisplayPalette(SDL_Color * colors, int firstcolor, int ncolors)
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
palette = SDL_CurrentDisplay.palette;
|
return SDL_GetDisplayPaletteForDisplay(&SDL_CurrentDisplay, colors, firstcolor, ncolors);
|
||||||
if (!palette->ncolors) {
|
|
||||||
SDL_SetError("Display mode does not have a palette");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (firstcolor < 0 || (firstcolor + ncolors) > palette->ncolors) {
|
|
||||||
SDL_SetError("Palette indices are out of range");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
SDL_memcpy(colors, &palette->colors[firstcolor],
|
|
||||||
ncolors * sizeof(*colors));
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_WindowID
|
SDL_WindowID
|
||||||
|
@ -835,6 +877,7 @@ SDL_CreateWindowFrom(const void *data)
|
||||||
_this->CreateWindowFrom(_this, &window, data) < 0) {
|
_this->CreateWindowFrom(_this, &window, data) < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/* FIXME: Find out what display this window is actually on... */
|
||||||
display = &SDL_CurrentDisplay;
|
display = &SDL_CurrentDisplay;
|
||||||
num_windows = display->num_windows;
|
num_windows = display->num_windows;
|
||||||
windows =
|
windows =
|
||||||
|
@ -1248,6 +1291,7 @@ SDL_SetWindowFullscreen(SDL_WindowID windowID, int fullscreen)
|
||||||
|
|
||||||
if (FULLSCREEN_VISIBLE(window)) {
|
if (FULLSCREEN_VISIBLE(window)) {
|
||||||
SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
|
SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
|
||||||
|
SDL_DisplayMode fullscreen_mode;
|
||||||
|
|
||||||
/* Hide any other fullscreen windows */
|
/* Hide any other fullscreen windows */
|
||||||
int i;
|
int i;
|
||||||
|
@ -1258,7 +1302,9 @@ SDL_SetWindowFullscreen(SDL_WindowID windowID, int fullscreen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_SetDisplayMode(&display->fullscreen_mode);
|
if (SDL_GetWindowDisplayMode(windowID, &fullscreen_mode) == 0) {
|
||||||
|
SDL_SetDisplayModeForDisplay(display, &fullscreen_mode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
window->flags &= ~SDL_WINDOW_FULLSCREEN;
|
window->flags &= ~SDL_WINDOW_FULLSCREEN;
|
||||||
|
@ -1336,11 +1382,11 @@ SDL_OnWindowFocusGained(SDL_Window * window)
|
||||||
{
|
{
|
||||||
SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
|
SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
|
||||||
|
|
||||||
if (window->flags & SDL_WINDOW_FULLSCREEN) {
|
if (FULLSCREEN_VISIBLE(window)) {
|
||||||
SDL_SetDisplayMode(&display->fullscreen_mode);
|
SDL_SetDisplayMode(&window->fullscreen_mode);
|
||||||
}
|
}
|
||||||
if (display->gamma && _this->SetDisplayGammaRamp) {
|
if (display->gamma && _this->SetDisplayGammaRamp) {
|
||||||
_this->SetDisplayGammaRamp(_this, display->gamma);
|
_this->SetDisplayGammaRamp(_this, display, display->gamma);
|
||||||
}
|
}
|
||||||
if ((window->flags & (SDL_WINDOW_INPUT_GRABBED | SDL_WINDOW_FULLSCREEN))
|
if ((window->flags & (SDL_WINDOW_INPUT_GRABBED | SDL_WINDOW_FULLSCREEN))
|
||||||
&& _this->SetWindowGrab) {
|
&& _this->SetWindowGrab) {
|
||||||
|
@ -1353,12 +1399,12 @@ SDL_OnWindowFocusLost(SDL_Window * window)
|
||||||
{
|
{
|
||||||
SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
|
SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
|
||||||
|
|
||||||
if (window->flags & SDL_WINDOW_FULLSCREEN) {
|
if (FULLSCREEN_VISIBLE(window)) {
|
||||||
SDL_MinimizeWindow(window->id);
|
SDL_MinimizeWindow(window->id);
|
||||||
SDL_SetDisplayMode(NULL);
|
SDL_SetDisplayMode(NULL);
|
||||||
}
|
}
|
||||||
if (display->gamma && _this->SetDisplayGammaRamp) {
|
if (display->gamma && _this->SetDisplayGammaRamp) {
|
||||||
_this->SetDisplayGammaRamp(_this, display->saved_gamma);
|
_this->SetDisplayGammaRamp(_this, display, display->saved_gamma);
|
||||||
}
|
}
|
||||||
if ((window->flags & (SDL_WINDOW_INPUT_GRABBED | SDL_WINDOW_FULLSCREEN))
|
if ((window->flags & (SDL_WINDOW_INPUT_GRABBED | SDL_WINDOW_FULLSCREEN))
|
||||||
&& _this->SetWindowGrab) {
|
&& _this->SetWindowGrab) {
|
||||||
|
@ -1430,16 +1476,10 @@ SDL_DestroyWindow(SDL_WindowID windowID)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SDL_AddRenderDriver(int displayIndex, const SDL_RenderDriver * driver)
|
SDL_AddRenderDriver(SDL_VideoDisplay * display, const SDL_RenderDriver * driver)
|
||||||
{
|
{
|
||||||
SDL_VideoDisplay *display;
|
|
||||||
SDL_RenderDriver *render_drivers;
|
SDL_RenderDriver *render_drivers;
|
||||||
|
|
||||||
if (displayIndex >= _this->num_displays) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
display = &_this->displays[displayIndex];
|
|
||||||
|
|
||||||
render_drivers =
|
render_drivers =
|
||||||
SDL_realloc(display->render_drivers,
|
SDL_realloc(display->render_drivers,
|
||||||
(display->num_render_drivers +
|
(display->num_render_drivers +
|
||||||
|
|
|
@ -35,8 +35,8 @@ typedef struct
|
||||||
} SDL_DisplayModeData;
|
} SDL_DisplayModeData;
|
||||||
|
|
||||||
extern void Cocoa_InitModes(_THIS);
|
extern void Cocoa_InitModes(_THIS);
|
||||||
extern void Cocoa_GetDisplayModes(_THIS);
|
extern void Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display);
|
||||||
extern int Cocoa_SetDisplayMode(_THIS, SDL_DisplayMode * mode);
|
extern int Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
|
||||||
extern void Cocoa_QuitModes(_THIS);
|
extern void Cocoa_QuitModes(_THIS);
|
||||||
|
|
||||||
#endif /* _SDL_cocoamodes_h */
|
#endif /* _SDL_cocoamodes_h */
|
||||||
|
|
|
@ -190,18 +190,18 @@ Cocoa_InitModes(_THIS)
|
||||||
static void
|
static void
|
||||||
AddDisplayMode(const void *moderef, void *context)
|
AddDisplayMode(const void *moderef, void *context)
|
||||||
{
|
{
|
||||||
SDL_VideoDevice *_this = (SDL_VideoDevice *) context;
|
SDL_VideoDisplay *display = (SDL_VideoDisplay *) context;
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
|
|
||||||
if (GetDisplayMode(moderef, &mode)) {
|
if (GetDisplayMode(moderef, &mode)) {
|
||||||
SDL_AddDisplayMode(_this->current_display, &mode);
|
SDL_AddDisplayMode(display, &mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Cocoa_GetDisplayModes(_THIS)
|
Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
|
||||||
CFArrayRef modes;
|
CFArrayRef modes;
|
||||||
CFRange range;
|
CFRange range;
|
||||||
|
|
||||||
|
@ -211,13 +211,13 @@ Cocoa_GetDisplayModes(_THIS)
|
||||||
}
|
}
|
||||||
range.location = 0;
|
range.location = 0;
|
||||||
range.length = CFArrayGetCount(modes);
|
range.length = CFArrayGetCount(modes);
|
||||||
CFArrayApplyFunction(modes, range, AddDisplayMode, _this);
|
CFArrayApplyFunction(modes, range, AddDisplayMode, display);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
Cocoa_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
|
Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
|
||||||
SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata;
|
SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata;
|
||||||
CGDisplayFadeReservationToken fade_token = kCGDisplayFadeReservationInvalidToken;
|
CGDisplayFadeReservationToken fade_token = kCGDisplayFadeReservationInvalidToken;
|
||||||
CGError result;
|
CGError result;
|
||||||
|
@ -279,21 +279,17 @@ ERR_NO_CAPTURE:
|
||||||
void
|
void
|
||||||
Cocoa_QuitModes(_THIS)
|
Cocoa_QuitModes(_THIS)
|
||||||
{
|
{
|
||||||
int i, saved_display;
|
int i;
|
||||||
|
|
||||||
saved_display = _this->current_display;
|
|
||||||
for (i = 0; i < _this->num_displays; ++i) {
|
for (i = 0; i < _this->num_displays; ++i) {
|
||||||
SDL_VideoDisplay *display = &_this->displays[i];
|
SDL_VideoDisplay *display = &_this->displays[i];
|
||||||
|
|
||||||
if (display->current_mode.driverdata != display->desktop_mode.driverdata) {
|
if (display->current_mode.driverdata != display->desktop_mode.driverdata) {
|
||||||
_this->current_display = i;
|
Cocoa_SetDisplayMode(_this, display, &display->desktop_mode);
|
||||||
Cocoa_SetDisplayMode(_this, &display->desktop_mode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CGReleaseAllDisplays();
|
CGReleaseAllDisplays();
|
||||||
ShowMenuBar();
|
ShowMenuBar();
|
||||||
|
|
||||||
_this->current_display = saved_display;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
|
@ -197,7 +197,7 @@ cbLayers(DFBDisplayLayerID layer_id, DFBDisplayLayerDescription desc,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
CheckSetDisplayMode(_THIS, DFB_DisplayData * data, SDL_DisplayMode * mode)
|
CheckSetDisplayMode(_THIS, SDL_VideoDisplay * display, DFB_DisplayData * data, SDL_DisplayMode * mode)
|
||||||
{
|
{
|
||||||
SDL_DFB_DEVICEDATA(_this);
|
SDL_DFB_DEVICEDATA(_this);
|
||||||
DFBDisplayLayerConfig config;
|
DFBDisplayLayerConfig config;
|
||||||
|
@ -219,7 +219,7 @@ CheckSetDisplayMode(_THIS, DFB_DisplayData * data, SDL_DisplayMode * mode)
|
||||||
SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer,
|
SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer,
|
||||||
DLSCL_SHARED));
|
DLSCL_SHARED));
|
||||||
if (failed == 0)
|
if (failed == 0)
|
||||||
SDL_AddDisplayMode(_this->current_display, mode);
|
SDL_AddDisplayMode(display, mode);
|
||||||
else
|
else
|
||||||
SDL_DFB_DEBUG("Mode %d x %d not available: %x\n", mode->w,
|
SDL_DFB_DEBUG("Mode %d x %d not available: %x\n", mode->w,
|
||||||
mode->h, failed);
|
mode->h, failed);
|
||||||
|
@ -356,11 +356,10 @@ DirectFB_InitModes(_THIS)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DirectFB_GetDisplayModes(_THIS)
|
DirectFB_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
|
||||||
{
|
{
|
||||||
SDL_DFB_DEVICEDATA(_this);
|
SDL_DFB_DEVICEDATA(_this);
|
||||||
DFB_DisplayData *dispdata =
|
DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
|
||||||
(DFB_DisplayData *) SDL_CurrentDisplay.driverdata;
|
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
struct modes_callback_t data;
|
struct modes_callback_t data;
|
||||||
int i;
|
int i;
|
||||||
|
@ -376,25 +375,23 @@ DirectFB_GetDisplayModes(_THIS)
|
||||||
mode = data.modelist[i];
|
mode = data.modelist[i];
|
||||||
|
|
||||||
mode.format = SDL_PIXELFORMAT_ARGB8888;
|
mode.format = SDL_PIXELFORMAT_ARGB8888;
|
||||||
CheckSetDisplayMode(_this, dispdata, &mode);
|
CheckSetDisplayMode(_this, display, dispdata, &mode);
|
||||||
mode.format = SDL_PIXELFORMAT_RGB888;
|
mode.format = SDL_PIXELFORMAT_RGB888;
|
||||||
CheckSetDisplayMode(_this, dispdata, &mode);
|
CheckSetDisplayMode(_this, display, dispdata, &mode);
|
||||||
mode.format = SDL_PIXELFORMAT_RGB24;
|
mode.format = SDL_PIXELFORMAT_RGB24;
|
||||||
CheckSetDisplayMode(_this, dispdata, &mode);
|
CheckSetDisplayMode(_this, display, dispdata, &mode);
|
||||||
mode.format = SDL_PIXELFORMAT_RGB565;
|
mode.format = SDL_PIXELFORMAT_RGB565;
|
||||||
CheckSetDisplayMode(_this, dispdata, &mode);
|
CheckSetDisplayMode(_this, display, dispdata, &mode);
|
||||||
mode.format = SDL_PIXELFORMAT_INDEX8;
|
mode.format = SDL_PIXELFORMAT_INDEX8;
|
||||||
CheckSetDisplayMode(_this, dispdata, &mode);
|
CheckSetDisplayMode(_this, display, dispdata, &mode);
|
||||||
}
|
}
|
||||||
SDL_DFB_FREE(data.modelist);
|
|
||||||
return;
|
|
||||||
error:
|
|
||||||
SDL_DFB_FREE(data.modelist);
|
SDL_DFB_FREE(data.modelist);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
DirectFB_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
|
DirectFB_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* FIXME: video mode switch is currently broken for 1.2.0
|
* FIXME: video mode switch is currently broken for 1.2.0
|
||||||
|
@ -402,7 +399,7 @@ DirectFB_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SDL_DFB_DEVICEDATA(_this);
|
SDL_DFB_DEVICEDATA(_this);
|
||||||
DFB_DisplayData *data = (DFB_DisplayData *) SDL_CurrentDisplay.driverdata;
|
DFB_DisplayData *data = (DFB_DisplayData *) display->driverdata;
|
||||||
DFBDisplayLayerConfig config, rconfig;
|
DFBDisplayLayerConfig config, rconfig;
|
||||||
DFBDisplayLayerConfigFlags fail = 0;
|
DFBDisplayLayerConfigFlags fail = 0;
|
||||||
DFBResult ret;
|
DFBResult ret;
|
||||||
|
@ -459,7 +456,7 @@ DirectFB_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
|
||||||
data->pixelformat = rconfig.pixelformat;
|
data->pixelformat = rconfig.pixelformat;
|
||||||
data->cw = config.width;
|
data->cw = config.width;
|
||||||
data->ch = config.height;
|
data->ch = config.height;
|
||||||
SDL_CurrentDisplay.current_mode = *mode;
|
display->current_mode = *mode;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
error:
|
error:
|
||||||
|
@ -474,18 +471,16 @@ DirectFB_QuitModes(_THIS)
|
||||||
DFBResult ret;
|
DFBResult ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
SDL_SelectVideoDisplay(0);
|
for (i = 0; i < _this->num_displays; ++i) {
|
||||||
|
SDL_VideoDisplay *display = &_this->displays[i];
|
||||||
|
DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
|
||||||
|
|
||||||
SDL_GetDesktopDisplayMode(&tmode);
|
SDL_GetDesktopDisplayModeForDisplay(display, &tmode);
|
||||||
tmode.format = SDL_PIXELFORMAT_UNKNOWN;
|
tmode.format = SDL_PIXELFORMAT_UNKNOWN;
|
||||||
DirectFB_SetDisplayMode(_this, &tmode);
|
DirectFB_SetDisplayMode(_this, display, &tmode);
|
||||||
|
|
||||||
SDL_GetDesktopDisplayMode(&tmode);
|
SDL_GetDesktopDisplayModeForDisplay(display, &tmode);
|
||||||
DirectFB_SetDisplayMode(_this, &tmode);
|
DirectFB_SetDisplayMode(_this, display, &tmode);
|
||||||
|
|
||||||
for (i = 0; i < SDL_GetNumVideoDisplays(); i++) {
|
|
||||||
DFB_DisplayData *dispdata =
|
|
||||||
(DFB_DisplayData *) _this->displays[i].driverdata;
|
|
||||||
|
|
||||||
if (dispdata->layer) {
|
if (dispdata->layer) {
|
||||||
SDL_DFB_CHECK(dispdata->
|
SDL_DFB_CHECK(dispdata->
|
||||||
|
|
|
@ -48,8 +48,8 @@ struct _DFB_DisplayData
|
||||||
|
|
||||||
|
|
||||||
extern void DirectFB_InitModes(_THIS);
|
extern void DirectFB_InitModes(_THIS);
|
||||||
extern void DirectFB_GetDisplayModes(_THIS);
|
extern void DirectFB_GetDisplayModes(_THIS, SDL_VideoDisplay * display);
|
||||||
extern int DirectFB_SetDisplayMode(_THIS, SDL_DisplayMode * mode);
|
extern int DirectFB_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
|
||||||
extern void DirectFB_QuitModes(_THIS);
|
extern void DirectFB_QuitModes(_THIS);
|
||||||
|
|
||||||
#endif /* _SDL_directfb_modes_h */
|
#endif /* _SDL_directfb_modes_h */
|
||||||
|
|
|
@ -234,7 +234,7 @@ DirectFB_AddRenderDriver(_THIS)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < _this->num_displays; i++)
|
for (i = 0; i < _this->num_displays; i++)
|
||||||
SDL_AddRenderDriver(i, &DirectFB_RenderDriver);
|
SDL_AddRenderDriver(&_this->displays[i], &DirectFB_RenderDriver);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -264,6 +264,8 @@ DisplayPaletteChanged(void *userdata, SDL_Palette * palette)
|
||||||
SDL_DFB_CHECKERR(surfpal->SetEntries(surfpal, entries, ncolors, 0));
|
SDL_DFB_CHECKERR(surfpal->SetEntries(surfpal, entries, ncolors, 0));
|
||||||
return 0;
|
return 0;
|
||||||
error:
|
error:
|
||||||
|
#else
|
||||||
|
SDL_Unsupported();
|
||||||
#endif
|
#endif
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,11 +56,6 @@ static void DirectFB_VideoQuit(_THIS);
|
||||||
static int DirectFB_Available(void);
|
static int DirectFB_Available(void);
|
||||||
static SDL_VideoDevice *DirectFB_CreateDevice(int devindex);
|
static SDL_VideoDevice *DirectFB_CreateDevice(int devindex);
|
||||||
|
|
||||||
#if 0
|
|
||||||
static int DirectFB_SetDisplayGammaRamp(_THIS, Uint16 * ramp);
|
|
||||||
static int DirectFB_GetDisplayGammaRamp(_THIS, Uint16 * ramp);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
VideoBootStrap DirectFB_bootstrap = {
|
VideoBootStrap DirectFB_bootstrap = {
|
||||||
"directfb", "DirectFB",
|
"directfb", "DirectFB",
|
||||||
DirectFB_Available, DirectFB_CreateDevice
|
DirectFB_Available, DirectFB_CreateDevice
|
||||||
|
@ -103,13 +98,6 @@ DirectFB_CreateDevice(int devindex)
|
||||||
device->VideoQuit = DirectFB_VideoQuit;
|
device->VideoQuit = DirectFB_VideoQuit;
|
||||||
device->GetDisplayModes = DirectFB_GetDisplayModes;
|
device->GetDisplayModes = DirectFB_GetDisplayModes;
|
||||||
device->SetDisplayMode = DirectFB_SetDisplayMode;
|
device->SetDisplayMode = DirectFB_SetDisplayMode;
|
||||||
#if 0
|
|
||||||
device->SetDisplayGammaRamp = DirectFB_SetDisplayGammaRamp;
|
|
||||||
device->GetDisplayGammaRamp = DirectFB_GetDisplayGammaRamp;
|
|
||||||
#else
|
|
||||||
device->SetDisplayGammaRamp = NULL;
|
|
||||||
device->GetDisplayGammaRamp = NULL;
|
|
||||||
#endif
|
|
||||||
device->PumpEvents = DirectFB_PumpEventsWindow;
|
device->PumpEvents = DirectFB_PumpEventsWindow;
|
||||||
device->CreateWindow = DirectFB_CreateWindow;
|
device->CreateWindow = DirectFB_CreateWindow;
|
||||||
device->CreateWindowFrom = DirectFB_CreateWindowFrom;
|
device->CreateWindowFrom = DirectFB_CreateWindowFrom;
|
||||||
|
@ -300,17 +288,3 @@ DirectFB_VideoQuit(_THIS)
|
||||||
|
|
||||||
devdata->initialized = 0;
|
devdata->initialized = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static int
|
|
||||||
DirectFB_SetDisplayGammaRamp(_THIS, Uint16 * ramp)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
DirectFB_GetDisplayGammaRamp(_THIS, Uint16 * ramp)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -108,10 +108,6 @@ PND_create()
|
||||||
device->VideoQuit = PND_videoquit;
|
device->VideoQuit = PND_videoquit;
|
||||||
device->GetDisplayModes = PND_getdisplaymodes;
|
device->GetDisplayModes = PND_getdisplaymodes;
|
||||||
device->SetDisplayMode = PND_setdisplaymode;
|
device->SetDisplayMode = PND_setdisplaymode;
|
||||||
device->SetDisplayPalette = PND_setdisplaypalette;
|
|
||||||
device->GetDisplayPalette = PND_getdisplaypalette;
|
|
||||||
device->SetDisplayGammaRamp = PND_setdisplaygammaramp;
|
|
||||||
device->GetDisplayGammaRamp = PND_getdisplaygammaramp;
|
|
||||||
device->CreateWindow = PND_createwindow;
|
device->CreateWindow = PND_createwindow;
|
||||||
device->CreateWindowFrom = PND_createwindowfrom;
|
device->CreateWindowFrom = PND_createwindowfrom;
|
||||||
device->SetWindowTitle = PND_setwindowtitle;
|
device->SetWindowTitle = PND_setwindowtitle;
|
||||||
|
@ -191,54 +187,17 @@ PND_videoquit(_THIS)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PND_getdisplaymodes(_THIS)
|
PND_getdisplaymodes(_THIS, SDL_VideoDisplay * display)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PND_setdisplaymode(_THIS, SDL_DisplayMode * mode)
|
PND_setdisplaymode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
PND_setdisplaypalette(_THIS, SDL_Palette * palette)
|
|
||||||
{
|
|
||||||
SDL_DisplayData *didata =
|
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
|
||||||
|
|
||||||
/* Setting display palette operation has been failed */
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
PND_getdisplaypalette(_THIS, SDL_Palette * palette)
|
|
||||||
{
|
|
||||||
SDL_DisplayData *didata =
|
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
|
||||||
|
|
||||||
/* Getting display palette operation has been failed */
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
PND_setdisplaygammaramp(_THIS, Uint16 * ramp)
|
|
||||||
{
|
|
||||||
SDL_DisplayData *didata =
|
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
|
||||||
|
|
||||||
/* Setting display gamma ramp operation has been failed */
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
PND_getdisplaygammaramp(_THIS, Uint16 * ramp)
|
|
||||||
{
|
|
||||||
/* Getting display gamma ramp operation has been failed */
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
PND_createwindow(_THIS, SDL_Window * window)
|
PND_createwindow(_THIS, SDL_Window * window)
|
||||||
{
|
{
|
||||||
|
@ -458,7 +417,7 @@ PND_gl_createcontext(_THIS, SDL_Window * window)
|
||||||
SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
|
SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
|
||||||
SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
|
||||||
SDL_DisplayData *didata =
|
SDL_DisplayData *didata =
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
(SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
|
||||||
EGLBoolean status;
|
EGLBoolean status;
|
||||||
int32_t gfstatus;
|
int32_t gfstatus;
|
||||||
EGLint configs;
|
EGLint configs;
|
||||||
|
@ -857,7 +816,7 @@ PND_gl_swapwindow(_THIS, SDL_Window * window)
|
||||||
SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
|
SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
|
||||||
SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
|
||||||
SDL_DisplayData *didata =
|
SDL_DisplayData *didata =
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
(SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
|
||||||
|
|
||||||
|
|
||||||
if (phdata->egl_initialized != SDL_TRUE) {
|
if (phdata->egl_initialized != SDL_TRUE) {
|
||||||
|
|
|
@ -269,10 +269,6 @@ photon_create(int devindex)
|
||||||
device->VideoQuit = photon_videoquit;
|
device->VideoQuit = photon_videoquit;
|
||||||
device->GetDisplayModes = photon_getdisplaymodes;
|
device->GetDisplayModes = photon_getdisplaymodes;
|
||||||
device->SetDisplayMode = photon_setdisplaymode;
|
device->SetDisplayMode = photon_setdisplaymode;
|
||||||
device->SetDisplayPalette = photon_setdisplaypalette;
|
|
||||||
device->GetDisplayPalette = photon_getdisplaypalette;
|
|
||||||
device->SetDisplayGammaRamp = photon_setdisplaygammaramp;
|
|
||||||
device->GetDisplayGammaRamp = photon_getdisplaygammaramp;
|
|
||||||
device->CreateWindow = photon_createwindow;
|
device->CreateWindow = photon_createwindow;
|
||||||
device->CreateWindowFrom = photon_createwindowfrom;
|
device->CreateWindowFrom = photon_createwindowfrom;
|
||||||
device->SetWindowTitle = photon_setwindowtitle;
|
device->SetWindowTitle = photon_setwindowtitle;
|
||||||
|
@ -524,11 +520,10 @@ photon_videoquit(_THIS)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
photon_getdisplaymodes(_THIS)
|
photon_getdisplaymodes(_THIS, SDL_VideoDisplay * display)
|
||||||
{
|
{
|
||||||
SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
|
SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
|
||||||
SDL_DisplayData *didata =
|
SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
PgVideoModes_t modes;
|
PgVideoModes_t modes;
|
||||||
PgVideoModeInfo_t modeinfo;
|
PgVideoModeInfo_t modeinfo;
|
||||||
|
@ -569,7 +564,7 @@ photon_getdisplaymodes(_THIS)
|
||||||
mode.refresh_rate = modeinfo.refresh_rates[jt];
|
mode.refresh_rate = modeinfo.refresh_rates[jt];
|
||||||
mode.format = photon_image_to_sdl_pixelformat(modeinfo.type);
|
mode.format = photon_image_to_sdl_pixelformat(modeinfo.type);
|
||||||
mode.driverdata = NULL;
|
mode.driverdata = NULL;
|
||||||
SDL_AddDisplayMode(_this->current_display, &mode);
|
SDL_AddDisplayMode(display, &mode);
|
||||||
|
|
||||||
/* If mode is RGBA8888, add the same mode as RGBx888 */
|
/* If mode is RGBA8888, add the same mode as RGBx888 */
|
||||||
if (modeinfo.type == Pg_IMAGE_DIRECT_8888) {
|
if (modeinfo.type == Pg_IMAGE_DIRECT_8888) {
|
||||||
|
@ -578,7 +573,7 @@ photon_getdisplaymodes(_THIS)
|
||||||
mode.refresh_rate = modeinfo.refresh_rates[jt];
|
mode.refresh_rate = modeinfo.refresh_rates[jt];
|
||||||
mode.format = SDL_PIXELFORMAT_RGB888;
|
mode.format = SDL_PIXELFORMAT_RGB888;
|
||||||
mode.driverdata = NULL;
|
mode.driverdata = NULL;
|
||||||
SDL_AddDisplayMode(_this->current_display, &mode);
|
SDL_AddDisplayMode(display, &mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If mode is RGBA1555, add the same mode as RGBx555 */
|
/* If mode is RGBA1555, add the same mode as RGBx555 */
|
||||||
|
@ -588,7 +583,7 @@ photon_getdisplaymodes(_THIS)
|
||||||
mode.refresh_rate = modeinfo.refresh_rates[jt];
|
mode.refresh_rate = modeinfo.refresh_rates[jt];
|
||||||
mode.format = SDL_PIXELFORMAT_RGB555;
|
mode.format = SDL_PIXELFORMAT_RGB555;
|
||||||
mode.driverdata = NULL;
|
mode.driverdata = NULL;
|
||||||
SDL_AddDisplayMode(_this->current_display, &mode);
|
SDL_AddDisplayMode(display, &mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
jt++;
|
jt++;
|
||||||
|
@ -600,11 +595,10 @@ photon_getdisplaymodes(_THIS)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
photon_setdisplaymode(_THIS, SDL_DisplayMode * mode)
|
photon_setdisplaymode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
|
||||||
{
|
{
|
||||||
SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
|
SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
|
||||||
SDL_DisplayData *didata =
|
SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
|
||||||
PgVideoModes_t modes;
|
PgVideoModes_t modes;
|
||||||
PgVideoModeInfo_t modeinfo;
|
PgVideoModeInfo_t modeinfo;
|
||||||
PgDisplaySettings_t modesettings;
|
PgDisplaySettings_t modesettings;
|
||||||
|
@ -651,15 +645,15 @@ photon_setdisplaymode(_THIS, SDL_DisplayMode * mode)
|
||||||
tempmode.refresh_rate = 0x0000FFFF;
|
tempmode.refresh_rate = 0x0000FFFF;
|
||||||
|
|
||||||
/* Check if window width and height matches one of our modes */
|
/* Check if window width and height matches one of our modes */
|
||||||
for (it = 0; it < SDL_CurrentDisplay.num_display_modes; it++) {
|
for (it = 0; it < display->num_display_modes; it++) {
|
||||||
if ((SDL_CurrentDisplay.display_modes[it].w == mode->w) &&
|
if ((display->display_modes[it].w == mode->w) &&
|
||||||
(SDL_CurrentDisplay.display_modes[it].h == mode->h) &&
|
(display->display_modes[it].h == mode->h) &&
|
||||||
(SDL_CurrentDisplay.display_modes[it].format == mode->format))
|
(display->display_modes[it].format == mode->format))
|
||||||
{
|
{
|
||||||
/* Find the lowest refresh rate available */
|
/* Find the lowest refresh rate available */
|
||||||
if (tempmode.refresh_rate >
|
if (tempmode.refresh_rate >
|
||||||
SDL_CurrentDisplay.display_modes[it].refresh_rate) {
|
display->display_modes[it].refresh_rate) {
|
||||||
tempmode = SDL_CurrentDisplay.display_modes[it];
|
tempmode = display->display_modes[it];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -680,21 +674,21 @@ photon_setdisplaymode(_THIS, SDL_DisplayMode * mode)
|
||||||
tempmode.refresh_rate = 0x0000FFFF;
|
tempmode.refresh_rate = 0x0000FFFF;
|
||||||
|
|
||||||
/* Check if window width and height matches one of our modes */
|
/* Check if window width and height matches one of our modes */
|
||||||
for (it = 0; it < SDL_CurrentDisplay.num_display_modes; it++) {
|
for (it = 0; it < display->num_display_modes; it++) {
|
||||||
if ((SDL_CurrentDisplay.display_modes[it].w == mode->w) &&
|
if ((display->display_modes[it].w == mode->w) &&
|
||||||
(SDL_CurrentDisplay.display_modes[it].h == mode->h) &&
|
(display->display_modes[it].h == mode->h) &&
|
||||||
(SDL_CurrentDisplay.display_modes[it].format == mode->format))
|
(display->display_modes[it].format == mode->format))
|
||||||
{
|
{
|
||||||
/* Find the lowest refresh rate available */
|
/* Find the lowest refresh rate available */
|
||||||
if (tempmode.refresh_rate >
|
if (tempmode.refresh_rate >
|
||||||
SDL_CurrentDisplay.display_modes[it].refresh_rate) {
|
display->display_modes[it].refresh_rate) {
|
||||||
tempmode = SDL_CurrentDisplay.display_modes[it];
|
tempmode = display->display_modes[it];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if requested refresh rate found */
|
/* Check if requested refresh rate found */
|
||||||
if (refresh_rate ==
|
if (refresh_rate ==
|
||||||
SDL_CurrentDisplay.display_modes[it].refresh_rate) {
|
display->display_modes[it].refresh_rate) {
|
||||||
tempmode = SDL_CurrentDisplay.display_modes[it];
|
tempmode = display->display_modes[it];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -778,49 +772,12 @@ photon_setdisplaymode(_THIS, SDL_DisplayMode * mode)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
photon_setdisplaypalette(_THIS, SDL_Palette * palette)
|
|
||||||
{
|
|
||||||
SDL_DisplayData *didata =
|
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
|
||||||
|
|
||||||
/* Setting display palette operation has been failed */
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
photon_getdisplaypalette(_THIS, SDL_Palette * palette)
|
|
||||||
{
|
|
||||||
SDL_DisplayData *didata =
|
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
|
||||||
|
|
||||||
/* Getting display palette operation has been failed */
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
photon_setdisplaygammaramp(_THIS, Uint16 * ramp)
|
|
||||||
{
|
|
||||||
SDL_DisplayData *didata =
|
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
|
||||||
|
|
||||||
/* Setting display gamma ramp operation has been failed */
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
photon_getdisplaygammaramp(_THIS, Uint16 * ramp)
|
|
||||||
{
|
|
||||||
/* Getting display gamma ramp operation has been failed */
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
photon_createwindow(_THIS, SDL_Window * window)
|
photon_createwindow(_THIS, SDL_Window * window)
|
||||||
{
|
{
|
||||||
SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
|
SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
|
||||||
SDL_DisplayData *didata =
|
SDL_DisplayData *didata =
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
(SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
|
||||||
SDL_WindowData *wdata;
|
SDL_WindowData *wdata;
|
||||||
PhDim_t winsize;
|
PhDim_t winsize;
|
||||||
PhPoint_t winpos;
|
PhPoint_t winpos;
|
||||||
|
@ -1098,7 +1055,7 @@ photon_setwindowposition(_THIS, SDL_Window * window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
|
||||||
SDL_DisplayData *didata =
|
SDL_DisplayData *didata =
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
(SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
|
||||||
PhPoint_t winpos;
|
PhPoint_t winpos;
|
||||||
int32_t status;
|
int32_t status;
|
||||||
|
|
||||||
|
@ -1266,7 +1223,7 @@ photon_destroywindow(_THIS, SDL_Window * window)
|
||||||
{
|
{
|
||||||
SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
|
SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
|
||||||
SDL_DisplayData *didata =
|
SDL_DisplayData *didata =
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
(SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
|
||||||
SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
|
||||||
int32_t status;
|
int32_t status;
|
||||||
|
|
||||||
|
@ -1457,7 +1414,7 @@ photon_gl_createcontext(_THIS, SDL_Window * window)
|
||||||
SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
|
SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
|
||||||
SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
|
||||||
SDL_DisplayData *didata =
|
SDL_DisplayData *didata =
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
(SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
|
||||||
EGLBoolean status;
|
EGLBoolean status;
|
||||||
int32_t gfstatus;
|
int32_t gfstatus;
|
||||||
EGLint configs;
|
EGLint configs;
|
||||||
|
@ -1984,7 +1941,7 @@ photon_gl_swapwindow(_THIS, SDL_Window * window)
|
||||||
SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
|
SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
|
||||||
SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
|
||||||
SDL_DisplayData *didata =
|
SDL_DisplayData *didata =
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
(SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
|
||||||
PhRect_t dst_rect;
|
PhRect_t dst_rect;
|
||||||
PhRect_t src_rect;
|
PhRect_t src_rect;
|
||||||
int32_t status;
|
int32_t status;
|
||||||
|
@ -2093,7 +2050,7 @@ int photon_gl_recreatesurface(_THIS, SDL_Window * window, uint32_t width, uint32
|
||||||
SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
|
SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
|
||||||
SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
|
||||||
SDL_DisplayData *didata =
|
SDL_DisplayData *didata =
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
(SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
|
||||||
SDL_bool makecurrent=SDL_FALSE;
|
SDL_bool makecurrent=SDL_FALSE;
|
||||||
int32_t gfstatus;
|
int32_t gfstatus;
|
||||||
|
|
||||||
|
@ -2194,7 +2151,6 @@ photon_pumpevents(_THIS)
|
||||||
PhEvent_t *event = (PhEvent_t *) eventbuffer;
|
PhEvent_t *event = (PhEvent_t *) eventbuffer;
|
||||||
int32_t status;
|
int32_t status;
|
||||||
uint32_t finish = 0;
|
uint32_t finish = 0;
|
||||||
uint32_t it;
|
|
||||||
SDL_Window *window;
|
SDL_Window *window;
|
||||||
SDL_WindowData *wdata;
|
SDL_WindowData *wdata;
|
||||||
|
|
||||||
|
@ -2211,18 +2167,16 @@ photon_pumpevents(_THIS)
|
||||||
{
|
{
|
||||||
/* Find a window, to which this handle destinated */
|
/* Find a window, to which this handle destinated */
|
||||||
status = 0;
|
status = 0;
|
||||||
for (it = 0; it < SDL_CurrentDisplay.num_windows; it++) {
|
for (i = 0; i < SDL_GetNumVideoDisplays(); ++i) {
|
||||||
wdata =
|
SDL_VideoDisplay *display = SDL_GetVideoDisplay(i);
|
||||||
(SDL_WindowData *) SDL_CurrentDisplay.windows[it].
|
for (j = 0; j < display->num_windows; ++j) {
|
||||||
driverdata;
|
wdata = (SDL_WindowData *) display->windows[j].driverdata;
|
||||||
|
|
||||||
/* Find the proper window */
|
/* Find the proper window */
|
||||||
if (wdata->window != NULL) {
|
if (wdata->window != NULL) {
|
||||||
if (PtWidgetRid(wdata->window) ==
|
if (PtWidgetRid(wdata->window) ==
|
||||||
event->collector.rid) {
|
event->collector.rid) {
|
||||||
window =
|
window = (SDL_Window *) &display->windows[it];
|
||||||
(SDL_Window *) & SDL_CurrentDisplay.
|
|
||||||
windows[it];
|
|
||||||
status = 1;
|
status = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2230,6 +2184,7 @@ photon_pumpevents(_THIS)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (status == 0) {
|
if (status == 0) {
|
||||||
window = NULL;
|
window = NULL;
|
||||||
wdata = NULL;
|
wdata = NULL;
|
||||||
|
|
|
@ -53,6 +53,8 @@ photon_addinputdevices(_THIS)
|
||||||
uint32_t it;
|
uint32_t it;
|
||||||
|
|
||||||
for (it = 0; it < _this->num_displays; it++) {
|
for (it = 0; it < _this->num_displays; it++) {
|
||||||
|
SDL_VideoDisplay *display = &_this->displays[it];
|
||||||
|
|
||||||
/* Clear SDL mouse structure */
|
/* Clear SDL mouse structure */
|
||||||
SDL_memset(&photon_mouse, 0x00, sizeof(struct SDL_Mouse));
|
SDL_memset(&photon_mouse, 0x00, sizeof(struct SDL_Mouse));
|
||||||
|
|
||||||
|
@ -74,7 +76,7 @@ photon_addinputdevices(_THIS)
|
||||||
photon_mouse.FreeMouse = photon_freemouse;
|
photon_mouse.FreeMouse = photon_freemouse;
|
||||||
|
|
||||||
/* Get display data */
|
/* Get display data */
|
||||||
didata = (SDL_DisplayData *) _this->displays[it].driverdata;
|
didata = (SDL_DisplayData *) display->driverdata;
|
||||||
|
|
||||||
/* Store SDL_DisplayData pointer in the mouse driver internals */
|
/* Store SDL_DisplayData pointer in the mouse driver internals */
|
||||||
mdata->didata = didata;
|
mdata->didata = didata;
|
||||||
|
|
|
@ -276,7 +276,7 @@ photon_addrenderdriver(_THIS)
|
||||||
uint32_t it;
|
uint32_t it;
|
||||||
|
|
||||||
for (it = 0; it < _this->num_displays; it++) {
|
for (it = 0; it < _this->num_displays; it++) {
|
||||||
SDL_AddRenderDriver(it, &photon_renderdriver);
|
SDL_AddRenderDriver(&_this->displays[it], &photon_renderdriver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,8 @@ static PS3_DisplayModeData ps3fb_data[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
PS3_GetDisplayModes(_THIS) {
|
PS3_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
|
||||||
|
{
|
||||||
deprintf(1, "+PS3_GetDisplayModes()\n");
|
deprintf(1, "+PS3_GetDisplayModes()\n");
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
unsigned int nummodes;
|
unsigned int nummodes;
|
||||||
|
@ -98,13 +99,13 @@ PS3_GetDisplayModes(_THIS) {
|
||||||
|
|
||||||
/* Add DisplayMode to list */
|
/* Add DisplayMode to list */
|
||||||
deprintf(2, "Adding resolution %u x %u\n", ps3fb_modedb[n].w, ps3fb_modedb[n].h);
|
deprintf(2, "Adding resolution %u x %u\n", ps3fb_modedb[n].w, ps3fb_modedb[n].h);
|
||||||
SDL_AddDisplayMode(_this->current_display, &ps3fb_modedb[n]);
|
SDL_AddDisplayMode(display, &ps3fb_modedb[n]);
|
||||||
}
|
}
|
||||||
deprintf(1, "-PS3_GetDisplayModes()\n");
|
deprintf(1, "-PS3_GetDisplayModes()\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PS3_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
|
PS3_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
|
||||||
{
|
{
|
||||||
deprintf(1, "+PS3_SetDisplayMode()\n");
|
deprintf(1, "+PS3_SetDisplayMode()\n");
|
||||||
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
|
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
|
||||||
|
@ -123,13 +124,14 @@ PS3_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PS3_QuitModes(_THIS) {
|
PS3_QuitModes(_THIS)
|
||||||
|
{
|
||||||
deprintf(1, "+PS3_QuitModes()\n");
|
deprintf(1, "+PS3_QuitModes()\n");
|
||||||
|
|
||||||
/* There was no mem allocated for driverdata */
|
/* There was no mem allocated for driverdata */
|
||||||
int i, j;
|
int i, j;
|
||||||
for (i = _this->num_displays; i--;) {
|
for (i = 0; i < SDL_GetNumVideoDisplays(); ++i) {
|
||||||
SDL_VideoDisplay *display = &_this->displays[i];
|
SDL_VideoDisplay *display = SDL_GetVideoDisplay(i);
|
||||||
for (j = display->num_display_modes; j--;) {
|
for (j = display->num_display_modes; j--;) {
|
||||||
display->display_modes[j].driverdata = NULL;
|
display->display_modes[j].driverdata = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
#define _SDL_ps3modes_h
|
#define _SDL_ps3modes_h
|
||||||
|
|
||||||
extern void PS3_InitModes(_THIS);
|
extern void PS3_InitModes(_THIS);
|
||||||
extern void PS3_GetDisplayModes(_THIS);
|
extern void PS3_GetDisplayModes(_THIS, SDL_VideoDisplay * display);
|
||||||
extern int PS3_SetDisplayMode(_THIS, SDL_DisplayMode * mode);
|
extern int PS3_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
|
||||||
extern void PS3_QuitModes(_THIS);
|
extern void PS3_QuitModes(_THIS);
|
||||||
|
|
||||||
#endif /* SDL_ps3modes_h */
|
#endif /* SDL_ps3modes_h */
|
||||||
|
|
|
@ -60,6 +60,8 @@ gf_addinputdevices(_THIS)
|
||||||
uint32_t it;
|
uint32_t it;
|
||||||
|
|
||||||
for (it = 0; it < _this->num_displays; it++) {
|
for (it = 0; it < _this->num_displays; it++) {
|
||||||
|
SDL_VideoDisplay *display = &_this->displays[it];
|
||||||
|
|
||||||
/* Clear SDL mouse structure */
|
/* Clear SDL mouse structure */
|
||||||
SDL_memset(&gf_mouse, 0x00, sizeof(struct SDL_Mouse));
|
SDL_memset(&gf_mouse, 0x00, sizeof(struct SDL_Mouse));
|
||||||
|
|
||||||
|
@ -81,7 +83,7 @@ gf_addinputdevices(_THIS)
|
||||||
gf_mouse.FreeMouse = gf_freemouse;
|
gf_mouse.FreeMouse = gf_freemouse;
|
||||||
|
|
||||||
/* Get display data */
|
/* Get display data */
|
||||||
didata = (SDL_DisplayData *) _this->displays[it].driverdata;
|
didata = (SDL_DisplayData *) display->driverdata;
|
||||||
|
|
||||||
/* Store SDL_DisplayData pointer in the mouse driver internals */
|
/* Store SDL_DisplayData pointer in the mouse driver internals */
|
||||||
mdata->didata = didata;
|
mdata->didata = didata;
|
||||||
|
|
|
@ -261,7 +261,7 @@ gf_addrenderdriver(_THIS)
|
||||||
uint32_t it;
|
uint32_t it;
|
||||||
|
|
||||||
for (it = 0; it < _this->num_displays; it++) {
|
for (it = 0; it < _this->num_displays; it++) {
|
||||||
SDL_AddRenderDriver(it, &gf_renderdriver);
|
SDL_AddRenderDriver(&_this->displays[it], &gf_renderdriver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -522,13 +522,9 @@ qnxgf_videoinit(_THIS)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get all display modes for this display */
|
/* Get all display modes for this display */
|
||||||
_this->current_display = it;
|
qnxgf_getdisplaymodes(_this, display);
|
||||||
qnxgf_getdisplaymodes(_this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restore default display */
|
|
||||||
_this->current_display = 0;
|
|
||||||
|
|
||||||
/* Add GF renderer to SDL */
|
/* Add GF renderer to SDL */
|
||||||
gf_addrenderdriver(_this);
|
gf_addrenderdriver(_this);
|
||||||
|
|
||||||
|
@ -614,10 +610,9 @@ qnxgf_videoquit(_THIS)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
qnxgf_getdisplaymodes(_THIS)
|
qnxgf_getdisplaymodes(_THIS, SDL_VideoDisplay * display)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *didata =
|
SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
gf_modeinfo_t modeinfo;
|
gf_modeinfo_t modeinfo;
|
||||||
uint32_t it = 0;
|
uint32_t it = 0;
|
||||||
|
@ -653,7 +648,7 @@ qnxgf_getdisplaymodes(_THIS)
|
||||||
mode.format =
|
mode.format =
|
||||||
qnxgf_gf_to_sdl_pixelformat(modeinfo.primary_format);
|
qnxgf_gf_to_sdl_pixelformat(modeinfo.primary_format);
|
||||||
mode.driverdata = NULL;
|
mode.driverdata = NULL;
|
||||||
SDL_AddDisplayMode(_this->current_display, &mode);
|
SDL_AddDisplayMode(display, &mode);
|
||||||
|
|
||||||
/* If mode is RGBA8888, add the same mode as RGBx888 */
|
/* If mode is RGBA8888, add the same mode as RGBx888 */
|
||||||
if (modeinfo.primary_format == GF_FORMAT_BGRA8888) {
|
if (modeinfo.primary_format == GF_FORMAT_BGRA8888) {
|
||||||
|
@ -662,7 +657,7 @@ qnxgf_getdisplaymodes(_THIS)
|
||||||
mode.refresh_rate = generic_mode[jt].refresh_rate;
|
mode.refresh_rate = generic_mode[jt].refresh_rate;
|
||||||
mode.format = SDL_PIXELFORMAT_RGB888;
|
mode.format = SDL_PIXELFORMAT_RGB888;
|
||||||
mode.driverdata = NULL;
|
mode.driverdata = NULL;
|
||||||
SDL_AddDisplayMode(_this->current_display, &mode);
|
SDL_AddDisplayMode(display, &mode);
|
||||||
}
|
}
|
||||||
/* If mode is RGBA1555, add the same mode as RGBx555 */
|
/* If mode is RGBA1555, add the same mode as RGBx555 */
|
||||||
if (modeinfo.primary_format == GF_FORMAT_PACK_ARGB1555) {
|
if (modeinfo.primary_format == GF_FORMAT_PACK_ARGB1555) {
|
||||||
|
@ -671,7 +666,7 @@ qnxgf_getdisplaymodes(_THIS)
|
||||||
mode.refresh_rate = generic_mode[jt].refresh_rate;
|
mode.refresh_rate = generic_mode[jt].refresh_rate;
|
||||||
mode.format = SDL_PIXELFORMAT_RGB555;
|
mode.format = SDL_PIXELFORMAT_RGB555;
|
||||||
mode.driverdata = NULL;
|
mode.driverdata = NULL;
|
||||||
SDL_AddDisplayMode(_this->current_display, &mode);
|
SDL_AddDisplayMode(display, &mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
jt++;
|
jt++;
|
||||||
|
@ -689,7 +684,7 @@ qnxgf_getdisplaymodes(_THIS)
|
||||||
qnxgf_gf_to_sdl_pixelformat(modeinfo.
|
qnxgf_gf_to_sdl_pixelformat(modeinfo.
|
||||||
primary_format);
|
primary_format);
|
||||||
mode.driverdata = NULL;
|
mode.driverdata = NULL;
|
||||||
SDL_AddDisplayMode(_this->current_display, &mode);
|
SDL_AddDisplayMode(display, &mode);
|
||||||
|
|
||||||
/* If mode is RGBA8888, add the same mode as RGBx888 */
|
/* If mode is RGBA8888, add the same mode as RGBx888 */
|
||||||
if (modeinfo.primary_format == GF_FORMAT_BGRA8888) {
|
if (modeinfo.primary_format == GF_FORMAT_BGRA8888) {
|
||||||
|
@ -698,7 +693,7 @@ qnxgf_getdisplaymodes(_THIS)
|
||||||
mode.refresh_rate = modeinfo.refresh[jt];
|
mode.refresh_rate = modeinfo.refresh[jt];
|
||||||
mode.format = SDL_PIXELFORMAT_RGB888;
|
mode.format = SDL_PIXELFORMAT_RGB888;
|
||||||
mode.driverdata = NULL;
|
mode.driverdata = NULL;
|
||||||
SDL_AddDisplayMode(_this->current_display, &mode);
|
SDL_AddDisplayMode(display, &mode);
|
||||||
}
|
}
|
||||||
/* If mode is RGBA1555, add the same mode as RGBx555 */
|
/* If mode is RGBA1555, add the same mode as RGBx555 */
|
||||||
if (modeinfo.primary_format ==
|
if (modeinfo.primary_format ==
|
||||||
|
@ -708,7 +703,7 @@ qnxgf_getdisplaymodes(_THIS)
|
||||||
mode.refresh_rate = modeinfo.refresh[jt];
|
mode.refresh_rate = modeinfo.refresh[jt];
|
||||||
mode.format = SDL_PIXELFORMAT_RGB555;
|
mode.format = SDL_PIXELFORMAT_RGB555;
|
||||||
mode.driverdata = NULL;
|
mode.driverdata = NULL;
|
||||||
SDL_AddDisplayMode(_this->current_display, &mode);
|
SDL_AddDisplayMode(display, &mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
jt++;
|
jt++;
|
||||||
|
@ -731,10 +726,9 @@ qnxgf_getdisplaymodes(_THIS)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
qnxgf_setdisplaymode(_THIS, SDL_DisplayMode * mode)
|
qnxgf_setdisplaymode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *didata =
|
SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
|
||||||
uint32_t refresh_rate = 0;
|
uint32_t refresh_rate = 0;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
@ -760,15 +754,15 @@ qnxgf_setdisplaymode(_THIS, SDL_DisplayMode * mode)
|
||||||
tempmode.refresh_rate = 0x0000FFFF;
|
tempmode.refresh_rate = 0x0000FFFF;
|
||||||
|
|
||||||
/* Check if window width and height matches one of our modes */
|
/* Check if window width and height matches one of our modes */
|
||||||
for (it = 0; it < SDL_CurrentDisplay.num_display_modes; it++) {
|
for (it = 0; it < display->num_display_modes; it++) {
|
||||||
if ((SDL_CurrentDisplay.display_modes[it].w == mode->w) &&
|
if ((display->display_modes[it].w == mode->w) &&
|
||||||
(SDL_CurrentDisplay.display_modes[it].h == mode->h) &&
|
(display->display_modes[it].h == mode->h) &&
|
||||||
(SDL_CurrentDisplay.display_modes[it].format == mode->format))
|
(display->display_modes[it].format == mode->format))
|
||||||
{
|
{
|
||||||
/* Find the lowest refresh rate available */
|
/* Find the lowest refresh rate available */
|
||||||
if (tempmode.refresh_rate >
|
if (tempmode.refresh_rate >
|
||||||
SDL_CurrentDisplay.display_modes[it].refresh_rate) {
|
display->display_modes[it].refresh_rate) {
|
||||||
tempmode = SDL_CurrentDisplay.display_modes[it];
|
tempmode = display->display_modes[it];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -790,21 +784,21 @@ qnxgf_setdisplaymode(_THIS, SDL_DisplayMode * mode)
|
||||||
tempmode.refresh_rate = 0x0000FFFF;
|
tempmode.refresh_rate = 0x0000FFFF;
|
||||||
|
|
||||||
/* Check if window width and height matches one of our modes */
|
/* Check if window width and height matches one of our modes */
|
||||||
for (it = 0; it < SDL_CurrentDisplay.num_display_modes; it++) {
|
for (it = 0; it < display->num_display_modes; it++) {
|
||||||
if ((SDL_CurrentDisplay.display_modes[it].w == mode->w) &&
|
if ((display->display_modes[it].w == mode->w) &&
|
||||||
(SDL_CurrentDisplay.display_modes[it].h == mode->h) &&
|
(display->display_modes[it].h == mode->h) &&
|
||||||
(SDL_CurrentDisplay.display_modes[it].format == mode->format))
|
(display->display_modes[it].format == mode->format))
|
||||||
{
|
{
|
||||||
/* Find the lowest refresh rate available */
|
/* Find the lowest refresh rate available */
|
||||||
if (tempmode.refresh_rate >
|
if (tempmode.refresh_rate >
|
||||||
SDL_CurrentDisplay.display_modes[it].refresh_rate) {
|
display->display_modes[it].refresh_rate) {
|
||||||
tempmode = SDL_CurrentDisplay.display_modes[it];
|
tempmode = display->display_modes[it];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if requested refresh rate found */
|
/* Check if requested refresh rate found */
|
||||||
if (refresh_rate ==
|
if (refresh_rate ==
|
||||||
SDL_CurrentDisplay.display_modes[it].refresh_rate) {
|
display->display_modes[it].refresh_rate) {
|
||||||
tempmode = SDL_CurrentDisplay.display_modes[it];
|
tempmode = display->display_modes[it];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -928,36 +922,33 @@ qnxgf_setdisplaymode(_THIS, SDL_DisplayMode * mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
qnxgf_setdisplaypalette(_THIS, SDL_Palette * palette)
|
qnxgf_setdisplaypalette(_THIS, SDL_VideoDisplay * display, SDL_Palette * palette)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *didata =
|
SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
|
||||||
|
|
||||||
/* QNX GF doesn't have support for global palette changing, but we */
|
/* QNX GF doesn't have support for global palette changing, but we */
|
||||||
/* could store it for usage in future */
|
/* could store it for usage in future */
|
||||||
|
|
||||||
/* Setting display palette operation has been failed */
|
SDL_Unsupported();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
qnxgf_getdisplaypalette(_THIS, SDL_Palette * palette)
|
qnxgf_getdisplaypalette(_THIS, SDL_VideoDisplay * display, SDL_Palette * palette)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *didata =
|
SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
|
||||||
|
|
||||||
/* We can't provide current palette settings and looks like SDL */
|
/* We can't provide current palette settings and looks like SDL */
|
||||||
/* do not call this function also, in such case this function returns -1 */
|
/* do not call this function also, in such case this function returns -1 */
|
||||||
|
|
||||||
/* Getting display palette operation has been failed */
|
SDL_Unsupported();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
qnxgf_setdisplaygammaramp(_THIS, Uint16 * ramp)
|
qnxgf_setdisplaygammaramp(_THIS, SDL_VideoDisplay * display, Uint16 * ramp)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *didata =
|
SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
/* Setup gamma ramp, for each color channel */
|
/* Setup gamma ramp, for each color channel */
|
||||||
|
@ -974,12 +965,12 @@ qnxgf_setdisplaygammaramp(_THIS, Uint16 * ramp)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
qnxgf_getdisplaygammaramp(_THIS, Uint16 * ramp)
|
qnxgf_getdisplaygammaramp(_THIS, SDL_VideoDisplay * display, Uint16 * ramp)
|
||||||
{
|
{
|
||||||
/* TODO: We need to return previous gamma set */
|
/* TODO: We need to return previous gamma set */
|
||||||
/* Also we need some initial fake gamma to return */
|
/* Also we need some initial fake gamma to return */
|
||||||
|
|
||||||
/* Getting display gamma ramp operation has been failed */
|
SDL_Unsupported();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -987,8 +978,8 @@ int
|
||||||
qnxgf_createwindow(_THIS, SDL_Window * window)
|
qnxgf_createwindow(_THIS, SDL_Window * window)
|
||||||
{
|
{
|
||||||
SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata;
|
SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata;
|
||||||
SDL_DisplayData *didata =
|
SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
|
||||||
SDL_WindowData *wdata;
|
SDL_WindowData *wdata;
|
||||||
int32_t status;
|
int32_t status;
|
||||||
|
|
||||||
|
@ -1002,15 +993,15 @@ qnxgf_createwindow(_THIS, SDL_Window * window)
|
||||||
mode.refresh_rate = 0x0000FFFF;
|
mode.refresh_rate = 0x0000FFFF;
|
||||||
|
|
||||||
/* Check if window width and height matches one of our modes */
|
/* Check if window width and height matches one of our modes */
|
||||||
for (it = 0; it < SDL_CurrentDisplay.num_display_modes; it++) {
|
for (it = 0; it < display->num_display_modes; it++) {
|
||||||
if ((SDL_CurrentDisplay.display_modes[it].w == window->w) &&
|
if ((display->display_modes[it].w == window->w) &&
|
||||||
(SDL_CurrentDisplay.display_modes[it].h == window->h) &&
|
(display->display_modes[it].h == window->h) &&
|
||||||
(SDL_CurrentDisplay.display_modes[it].format ==
|
(display->display_modes[it].format ==
|
||||||
SDL_CurrentDisplay.desktop_mode.format)) {
|
display->desktop_mode.format)) {
|
||||||
/* Find the lowest refresh rate available */
|
/* Find the lowest refresh rate available */
|
||||||
if (mode.refresh_rate >
|
if (mode.refresh_rate >
|
||||||
SDL_CurrentDisplay.display_modes[it].refresh_rate) {
|
display->display_modes[it].refresh_rate) {
|
||||||
mode = SDL_CurrentDisplay.display_modes[it];
|
mode = display->display_modes[it];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1164,7 +1155,7 @@ qnxgf_destroywindow(_THIS, SDL_Window * window)
|
||||||
{
|
{
|
||||||
SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata;
|
SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata;
|
||||||
SDL_DisplayData *didata =
|
SDL_DisplayData *didata =
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
(SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
|
||||||
SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
|
||||||
|
|
||||||
if (wdata != NULL) {
|
if (wdata != NULL) {
|
||||||
|
@ -1318,7 +1309,7 @@ qnxgf_gl_createcontext(_THIS, SDL_Window * window)
|
||||||
SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata;
|
SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata;
|
||||||
SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
|
||||||
SDL_DisplayData *didata =
|
SDL_DisplayData *didata =
|
||||||
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
(SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
|
||||||
EGLBoolean status;
|
EGLBoolean status;
|
||||||
int32_t gfstatus;
|
int32_t gfstatus;
|
||||||
EGLint configs;
|
EGLint configs;
|
||||||
|
|
|
@ -25,12 +25,12 @@
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
WIN_SetDisplayGammaRamp(_THIS, Uint16 * ramp)
|
WIN_SetDisplayGammaRamp(_THIS, SDL_VideoDisplay * display, Uint16 * ramp)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
return -1;
|
return -1;
|
||||||
#else
|
#else
|
||||||
SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
BOOL succeeded = FALSE;
|
BOOL succeeded = FALSE;
|
||||||
|
|
||||||
|
@ -47,12 +47,12 @@ WIN_SetDisplayGammaRamp(_THIS, Uint16 * ramp)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
WIN_GetDisplayGammaRamp(_THIS, Uint16 * ramp)
|
WIN_GetDisplayGammaRamp(_THIS, SDL_VideoDisplay * display, Uint16 * ramp)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
return -1;
|
return -1;
|
||||||
#else
|
#else
|
||||||
SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
BOOL succeeded = FALSE;
|
BOOL succeeded = FALSE;
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
#ifndef _SDL_win32gamma_h
|
#ifndef _SDL_win32gamma_h
|
||||||
#define _SDL_win32gamma_h
|
#define _SDL_win32gamma_h
|
||||||
|
|
||||||
extern int WIN_SetDisplayGammaRamp(_THIS, Uint16 * ramp);
|
extern int WIN_SetDisplayGammaRamp(_THIS, SDL_VideoDisplay * display, Uint16 * ramp);
|
||||||
extern int WIN_GetDisplayGammaRamp(_THIS, Uint16 * ramp);
|
extern int WIN_GetDisplayGammaRamp(_THIS, SDL_VideoDisplay * display, Uint16 * ramp);
|
||||||
|
|
||||||
#endif /* _SDL_win32gamma_h */
|
#endif /* _SDL_win32gamma_h */
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,6 @@ WIN_GetDisplayMode(LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode)
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
SDL_memcpy(data->DeviceName, deviceName, sizeof(data->DeviceName));
|
|
||||||
data->DeviceMode = devmode;
|
data->DeviceMode = devmode;
|
||||||
data->DeviceMode.dmFields =
|
data->DeviceMode.dmFields =
|
||||||
(DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY |
|
(DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY |
|
||||||
|
@ -196,9 +195,9 @@ WIN_InitModes(_THIS)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WIN_GetDisplayModes(_THIS)
|
WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
|
||||||
DWORD i;
|
DWORD i;
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
|
|
||||||
|
@ -207,15 +206,16 @@ WIN_GetDisplayModes(_THIS)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (mode.format != SDL_PIXELFORMAT_UNKNOWN)
|
if (mode.format != SDL_PIXELFORMAT_UNKNOWN)
|
||||||
if (!SDL_AddDisplayMode(_this->current_display, &mode)) {
|
if (!SDL_AddDisplayMode(display, &mode)) {
|
||||||
SDL_free(mode.driverdata);
|
SDL_free(mode.driverdata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
WIN_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
|
WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
|
||||||
{
|
{
|
||||||
|
SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
|
||||||
SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata;
|
SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata;
|
||||||
LONG status;
|
LONG status;
|
||||||
|
|
||||||
|
@ -228,8 +228,8 @@ WIN_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
status =
|
status =
|
||||||
ChangeDisplaySettingsEx(data->DeviceName, &data->DeviceMode, NULL,
|
ChangeDisplaySettingsEx(displaydata->DeviceName, &data->DeviceMode,
|
||||||
CDS_FULLSCREEN, NULL);
|
NULL, CDS_FULLSCREEN, NULL);
|
||||||
if (status == DISP_CHANGE_SUCCESSFUL) {
|
if (status == DISP_CHANGE_SUCCESSFUL) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -31,13 +31,12 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
TCHAR DeviceName[32];
|
|
||||||
DEVMODE DeviceMode;
|
DEVMODE DeviceMode;
|
||||||
} SDL_DisplayModeData;
|
} SDL_DisplayModeData;
|
||||||
|
|
||||||
extern void WIN_InitModes(_THIS);
|
extern void WIN_InitModes(_THIS);
|
||||||
extern void WIN_GetDisplayModes(_THIS);
|
extern void WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display);
|
||||||
extern int WIN_SetDisplayMode(_THIS, SDL_DisplayMode * mode);
|
extern int WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
|
||||||
extern void WIN_QuitModes(_THIS);
|
extern void WIN_QuitModes(_THIS);
|
||||||
|
|
||||||
#endif /* _SDL_win32modes_h */
|
#endif /* _SDL_win32modes_h */
|
||||||
|
|
|
@ -124,7 +124,7 @@ X11_TrackColormap(Display * display, int scrNum, Colormap colormap,
|
||||||
cool. If not, then we just fail */
|
cool. If not, then we just fail */
|
||||||
|
|
||||||
int
|
int
|
||||||
X11_SetDisplayGammaRamp(_THIS, Uint16 * ramp)
|
X11_SetDisplayGammaRamp(_THIS, SDL_VideoDisplay * sdl_display, Uint16 * ramp)
|
||||||
{
|
{
|
||||||
Visual *visual;
|
Visual *visual;
|
||||||
Display *display;
|
Display *display;
|
||||||
|
@ -214,7 +214,7 @@ X11_SetDisplayGammaRamp(_THIS, Uint16 * ramp)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
X11_GetDisplayGammaRamp(_THIS, Uint16 * ramp)
|
X11_GetDisplayGammaRamp(_THIS, SDL_VideoDisplay * display, Uint16 * ramp)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ extern void X11_TrackColormap(Display * display, int scrNum,
|
||||||
Colormap colormap,
|
Colormap colormap,
|
||||||
Visual * visual, XColor * ramp);
|
Visual * visual, XColor * ramp);
|
||||||
|
|
||||||
extern int X11_SetDisplayGammaRamp(_THIS, Uint16 * ramp);
|
extern int X11_SetDisplayGammaRamp(_THIS, SDL_VideoDisplay * display, Uint16 * ramp);
|
||||||
extern int X11_GetDisplayGammaRamp(_THIS, Uint16 * ramp);
|
extern int X11_GetDisplayGammaRamp(_THIS, SDL_VideoDisplay * display, Uint16 * ramp);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -311,10 +311,10 @@ restore_mode(Display * display, SDL_DisplayData * data)
|
||||||
#endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */
|
#endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */
|
||||||
|
|
||||||
void
|
void
|
||||||
X11_GetDisplayModes(_THIS)
|
X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display)
|
||||||
{
|
{
|
||||||
Display *display = ((SDL_VideoData *) _this->driverdata)->display;
|
Display *display = ((SDL_VideoData *) _this->driverdata)->display;
|
||||||
SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
SDL_DisplayData *data = (SDL_DisplayData *) sdl_display->driverdata;
|
||||||
#if SDL_VIDEO_DRIVER_X11_XINERAMA
|
#if SDL_VIDEO_DRIVER_X11_XINERAMA
|
||||||
int xinerama_major, xinerama_minor;
|
int xinerama_major, xinerama_minor;
|
||||||
int screens;
|
int screens;
|
||||||
|
@ -341,7 +341,7 @@ X11_GetDisplayModes(_THIS)
|
||||||
* we have to use the same format for all windows and all display modes.
|
* we have to use the same format for all windows and all display modes.
|
||||||
* (or support recreating the window with a new visual behind the scenes)
|
* (or support recreating the window with a new visual behind the scenes)
|
||||||
*/
|
*/
|
||||||
mode.format = SDL_CurrentDisplay.current_mode.format;
|
mode.format = sdl_display->current_mode.format;
|
||||||
mode.driverdata = NULL;
|
mode.driverdata = NULL;
|
||||||
|
|
||||||
data->use_xinerama = 0;
|
data->use_xinerama = 0;
|
||||||
|
@ -382,14 +382,14 @@ X11_GetDisplayModes(_THIS)
|
||||||
mode.w = screen_w;
|
mode.w = screen_w;
|
||||||
mode.h = screen_h;
|
mode.h = screen_h;
|
||||||
mode.refresh_rate = 0;
|
mode.refresh_rate = 0;
|
||||||
SDL_AddDisplayMode(_this->current_display, &mode);
|
SDL_AddDisplayMode(sdl_display, &mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add the head xinerama mode */
|
/* Add the head xinerama mode */
|
||||||
mode.w = data->xinerama_info.width;
|
mode.w = data->xinerama_info.width;
|
||||||
mode.h = data->xinerama_info.height;
|
mode.h = data->xinerama_info.height;
|
||||||
mode.refresh_rate = 0;
|
mode.refresh_rate = 0;
|
||||||
SDL_AddDisplayMode(_this->current_display, &mode);
|
SDL_AddDisplayMode(sdl_display, &mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */
|
#endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */
|
||||||
|
@ -426,7 +426,7 @@ X11_GetDisplayModes(_THIS)
|
||||||
"XRANDR: mode = %4d[%d], w = %4d, h = %4d, rate = %4d\n",
|
"XRANDR: mode = %4d[%d], w = %4d, h = %4d, rate = %4d\n",
|
||||||
i, j, mode.w, mode.h, mode.refresh_rate);
|
i, j, mode.w, mode.h, mode.refresh_rate);
|
||||||
#endif
|
#endif
|
||||||
SDL_AddDisplayMode(_this->current_display, &mode);
|
SDL_AddDisplayMode(sdl_display, &mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -462,7 +462,7 @@ X11_GetDisplayModes(_THIS)
|
||||||
mode.w = modes[i]->hdisplay;
|
mode.w = modes[i]->hdisplay;
|
||||||
mode.h = modes[i]->vdisplay;
|
mode.h = modes[i]->vdisplay;
|
||||||
mode.refresh_rate = calculate_rate(modes[i]);
|
mode.refresh_rate = calculate_rate(modes[i]);
|
||||||
SDL_AddDisplayMode(_this->current_display, &mode);
|
SDL_AddDisplayMode(sdl_display, &mode);
|
||||||
}
|
}
|
||||||
XFree(modes);
|
XFree(modes);
|
||||||
|
|
||||||
|
@ -475,7 +475,7 @@ X11_GetDisplayModes(_THIS)
|
||||||
mode.w = screen_w;
|
mode.w = screen_w;
|
||||||
mode.h = screen_h;
|
mode.h = screen_h;
|
||||||
mode.refresh_rate = 0;
|
mode.refresh_rate = 0;
|
||||||
SDL_AddDisplayMode(_this->current_display, &mode);
|
SDL_AddDisplayMode(sdl_display, &mode);
|
||||||
}
|
}
|
||||||
#ifdef X11MODES_DEBUG
|
#ifdef X11MODES_DEBUG
|
||||||
if (data->use_xinerama) {
|
if (data->use_xinerama) {
|
||||||
|
@ -672,10 +672,10 @@ set_best_resolution(Display * display, SDL_DisplayData * data, int w, int h,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
X11_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
|
X11_SetDisplayMode(_THIS, SDL_VideoDisplay * sdl_display, SDL_DisplayMode * mode)
|
||||||
{
|
{
|
||||||
Display *display = ((SDL_VideoData *) _this->driverdata)->display;
|
Display *display = ((SDL_VideoData *) _this->driverdata)->display;
|
||||||
SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
|
SDL_DisplayData *data = (SDL_DisplayData *) sdl_display->driverdata;
|
||||||
|
|
||||||
set_best_resolution(display, data, mode->w, mode->h, mode->refresh_rate);
|
set_best_resolution(display, data, mode->w, mode->h, mode->refresh_rate);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -55,8 +55,8 @@ typedef struct
|
||||||
} SDL_DisplayData;
|
} SDL_DisplayData;
|
||||||
|
|
||||||
extern void X11_InitModes(_THIS);
|
extern void X11_InitModes(_THIS);
|
||||||
extern void X11_GetDisplayModes(_THIS);
|
extern void X11_GetDisplayModes(_THIS, SDL_VideoDisplay * display);
|
||||||
extern int X11_SetDisplayMode(_THIS, SDL_DisplayMode * mode);
|
extern int X11_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
|
||||||
extern void X11_QuitModes(_THIS);
|
extern void X11_QuitModes(_THIS);
|
||||||
|
|
||||||
#endif /* _SDL_x11modes_h */
|
#endif /* _SDL_x11modes_h */
|
||||||
|
|
|
@ -76,7 +76,7 @@ CommonCreateState(char **argv, Uint32 flags)
|
||||||
state->argv = argv;
|
state->argv = argv;
|
||||||
state->flags = flags;
|
state->flags = flags;
|
||||||
state->window_title = argv[0];
|
state->window_title = argv[0];
|
||||||
state->window_flags = SDL_WINDOW_SHOWN;
|
state->window_flags = 0;
|
||||||
state->window_x = SDL_WINDOWPOS_UNDEFINED;
|
state->window_x = SDL_WINDOWPOS_UNDEFINED;
|
||||||
state->window_y = SDL_WINDOWPOS_UNDEFINED;
|
state->window_y = SDL_WINDOWPOS_UNDEFINED;
|
||||||
state->window_w = DEFAULT_WINDOW_WIDTH;
|
state->window_w = DEFAULT_WINDOW_WIDTH;
|
||||||
|
@ -737,6 +737,7 @@ CommonInit(CommonState * state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_zero(fullscreen_mode);
|
||||||
switch (state->depth) {
|
switch (state->depth) {
|
||||||
case 8:
|
case 8:
|
||||||
fullscreen_mode.format = SDL_PIXELFORMAT_INDEX8;
|
fullscreen_mode.format = SDL_PIXELFORMAT_INDEX8;
|
||||||
|
@ -754,14 +755,7 @@ CommonInit(CommonState * state)
|
||||||
fullscreen_mode.format = SDL_PIXELFORMAT_RGB888;
|
fullscreen_mode.format = SDL_PIXELFORMAT_RGB888;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fullscreen_mode.w = state->window_w;
|
|
||||||
fullscreen_mode.h = state->window_h;
|
|
||||||
fullscreen_mode.refresh_rate = state->refresh_rate;
|
fullscreen_mode.refresh_rate = state->refresh_rate;
|
||||||
if (SDL_SetFullscreenDisplayMode(&fullscreen_mode)<0) {
|
|
||||||
fprintf(stderr, "Can't switch to fullscreen display mode: %s\n",
|
|
||||||
SDL_GetError());
|
|
||||||
return SDL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
state->windows =
|
state->windows =
|
||||||
(SDL_WindowID *) SDL_malloc(state->num_windows *
|
(SDL_WindowID *) SDL_malloc(state->num_windows *
|
||||||
|
@ -789,6 +783,13 @@ CommonInit(CommonState * state)
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SDL_SetWindowDisplayMode(state->windows[i], &fullscreen_mode) < 0) {
|
||||||
|
fprintf(stderr, "Can't set up fullscreen display mode: %s\n",
|
||||||
|
SDL_GetError());
|
||||||
|
return SDL_FALSE;
|
||||||
|
}
|
||||||
|
SDL_ShowWindow(state->windows[i]);
|
||||||
|
|
||||||
if (!state->skip_renderer
|
if (!state->skip_renderer
|
||||||
&& (state->renderdriver
|
&& (state->renderdriver
|
||||||
|| !(state->window_flags & SDL_WINDOW_OPENGL))) {
|
|| !(state->window_flags & SDL_WINDOW_OPENGL))) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue