src/video/windows/SDL_windowsmodes.c
changeset 10019 36f7e8084508
parent 9998 f67cf37e9cd4
child 10031 2b3baddd9afa
     1.1 --- a/src/video/windows/SDL_windowsmodes.c	Wed Apr 22 16:50:48 2015 -0400
     1.2 +++ b/src/video/windows/SDL_windowsmodes.c	Mon Jan 04 23:52:40 2016 -0500
     1.3 @@ -332,6 +332,43 @@
     1.4      return data->DiagDPI != 0.0f ? 0 : -1;
     1.5  }
     1.6  
     1.7 +int
     1.8 +WIN_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect)
     1.9 +{
    1.10 +    const SDL_DisplayModeData *data = (const SDL_DisplayModeData *) display->current_mode.driverdata;
    1.11 +    const DEVMODE *pDevMode = &data->DeviceMode;
    1.12 +    POINT pt = {
    1.13 +        /* !!! FIXME: no scale, right? */
    1.14 +        (LONG) (pDevMode->dmPosition.x + (pDevMode->dmPelsWidth / 2)),
    1.15 +        (LONG) (pDevMode->dmPosition.y + (pDevMode->dmPelsHeight / 2))
    1.16 +    };
    1.17 +    HMONITOR hmon = MonitorFromPoint(&pt, MONITOR_DEFAULTTONULL);
    1.18 +    MONITORINFO minfo;
    1.19 +    const RECT *work;
    1.20 +    BOOL rc = FALSE;
    1.21 +
    1.22 +    SDL_assert(hmon != NULL);
    1.23 +
    1.24 +    if (hmon != NULL) {
    1.25 +        SDL_zero(minfo);
    1.26 +        minfo.cbSize = sizeof (MONITORINFO);
    1.27 +        rc = GetMonitorInfo(hmon, &minfo);
    1.28 +        SDL_assert(rc);
    1.29 +    }
    1.30 +
    1.31 +    if (!rc) {
    1.32 +        return SDL_SetError("Couldn't find monitor data");
    1.33 +    }
    1.34 +
    1.35 +    work = &minfo->rcWork;
    1.36 +    rect->x = (int)SDL_ceil(work->left * data->ScaleX);
    1.37 +    rect->y = (int)SDL_ceil(work->top * data->ScaleY);
    1.38 +    rect->w = (int)SDL_ceil((work->right - work->left) * data->ScaleX);
    1.39 +    rect->h = (int)SDL_ceil((work->bottom - work->top) * data->ScaleY);
    1.40 +
    1.41 +    return 0;
    1.42 +}
    1.43 +
    1.44  void
    1.45  WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
    1.46  {