mirror of https://github.com/encounter/SDL.git
solve FIXMEs in SDL_video.c
This commit is contained in:
parent
e5c599f8c6
commit
ac3349faaf
|
@ -694,29 +694,32 @@ SDL_GetDisplayName(int displayIndex)
|
||||||
int
|
int
|
||||||
SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect)
|
SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect)
|
||||||
{
|
{
|
||||||
|
SDL_VideoDisplay *display;
|
||||||
|
|
||||||
CHECK_DISPLAY_INDEX(displayIndex, -1);
|
CHECK_DISPLAY_INDEX(displayIndex, -1);
|
||||||
|
|
||||||
if (rect) {
|
if (!rect)
|
||||||
SDL_VideoDisplay *display = &_this->displays[displayIndex];
|
return SDL_InvalidParamError("rect");
|
||||||
|
|
||||||
if (_this->GetDisplayBounds) {
|
display = &_this->displays[displayIndex];
|
||||||
if (_this->GetDisplayBounds(_this, display, rect) == 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Assume that the displays are left to right */
|
if (_this->GetDisplayBounds) {
|
||||||
if (displayIndex == 0) {
|
if (_this->GetDisplayBounds(_this, display, rect) == 0) {
|
||||||
rect->x = 0;
|
return 0;
|
||||||
rect->y = 0;
|
|
||||||
} else {
|
|
||||||
SDL_GetDisplayBounds(displayIndex-1, rect);
|
|
||||||
rect->x += rect->w;
|
|
||||||
}
|
}
|
||||||
rect->w = display->current_mode.w;
|
|
||||||
rect->h = display->current_mode.h;
|
|
||||||
}
|
}
|
||||||
return 0; /* !!! FIXME: should this be an error if (rect==NULL) ? */
|
|
||||||
|
/* Assume that the displays are left to right */
|
||||||
|
if (displayIndex == 0) {
|
||||||
|
rect->x = 0;
|
||||||
|
rect->y = 0;
|
||||||
|
} else {
|
||||||
|
SDL_GetDisplayBounds(displayIndex-1, rect);
|
||||||
|
rect->x += rect->w;
|
||||||
|
}
|
||||||
|
rect->w = display->current_mode.w;
|
||||||
|
rect->h = display->current_mode.h;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -729,25 +732,27 @@ ParseDisplayUsableBoundsHint(SDL_Rect *rect)
|
||||||
int
|
int
|
||||||
SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect)
|
SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect)
|
||||||
{
|
{
|
||||||
|
SDL_VideoDisplay *display;
|
||||||
|
|
||||||
CHECK_DISPLAY_INDEX(displayIndex, -1);
|
CHECK_DISPLAY_INDEX(displayIndex, -1);
|
||||||
|
|
||||||
if (rect) {
|
if (!rect)
|
||||||
SDL_VideoDisplay *display = &_this->displays[displayIndex];
|
return SDL_InvalidParamError("rect");
|
||||||
|
|
||||||
if ((displayIndex == 0) && ParseDisplayUsableBoundsHint(rect)) {
|
display = &_this->displays[displayIndex];
|
||||||
|
|
||||||
|
if ((displayIndex == 0) && ParseDisplayUsableBoundsHint(rect)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_this->GetDisplayUsableBounds) {
|
||||||
|
if (_this->GetDisplayUsableBounds(_this, display, rect) == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_this->GetDisplayUsableBounds) {
|
|
||||||
if (_this->GetDisplayUsableBounds(_this, display, rect) == 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Oh well, just give the entire display bounds. */
|
|
||||||
return SDL_GetDisplayBounds(displayIndex, rect);
|
|
||||||
}
|
}
|
||||||
return 0; /* !!! FIXME: should this be an error if (rect==NULL) ? */
|
|
||||||
|
/* Oh well, just give the entire display bounds. */
|
||||||
|
return SDL_GetDisplayBounds(displayIndex, rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in New Issue