Unable to set reasonable full screen resolution

Issue #1373 resolved
Walter Stanish
created an issue

I am using the following code under Linux (Gentoo, 4.14.15, x86_64) with love2d-0.10.2 (Super Toast).

-- determine available fullscreen modes
print('Querying available fullscreen modes...')
modes = love.window.getFullscreenModes()
-- sort from smallest to largest
table.sort(modes, function(a, b) return a.width*a.height < b.width*b.height end)
-- get largest
v = modes[#modes]
while v.width>2000 do
        print("   [v.width = " .. v.width .. "]")
        v = modes[(#modes-i)]
        print("   [v.width reduced. now = " .. v.width .. "]")
-- report
print(' - Reported maximum full screen resolution: ' .. v.width .. ' x ' .. v.height .. ' pixels')
screenModeFlags = {fullscreen=true,highdpi=true}

Then later in love.load() I run...

        -- set up graphics mode
        print('Attempting to switch to fullscreen resolution ' .. resolutionPixelsX .. 'x' .. resolutionPixelsY .. '...')
        love.window.setMode(resolutionPixelsX, resolutionPixelsY, screenModeFlags)
        resolutionPixelsX = love.graphics.getWidth()
        resolutionPixelsY = love.graphics.getHeight()
        print(' - Resolution obtained: ' .. resolutionPixelsX .. ' x ' .. resolutionPixelsY .. ' pixels')

... but the output I get is:

Querying available fullscreen modes...

   [v.width = 3840]
   [v.width reduced. now = 3200]
   [v.width = 3200]
   [v.width reduced. now = 2880]
   [v.width = 2880]
   [v.width reduced. now = 2560]
   [v.width = 2560]
   [v.width reduced. now = 2048]
   [v.width = 2048]
   [v.width reduced. now = 1920]
 - Reported maximum full screen resolution: 1920 x 1440 pixels
Loading fonts
Hiding mouse
Attempting to switch to fullscreen resolution 1920x1440...
 - Resolution obtained: 3840 x 2160 pixels

The problem is that, while I can obtain an explicit list of video modes switching to anything but the maximum resolution seems impossible. When I attempt to switch to those resolutions, I just get given the maximum resolution. This is not expected, documented or useful behavior. Therefore I guess it is a bug.

I remember this was the same under OSX with an older version (0.10.1 probably).

Comments (8)

  1. Alex Szpakowski

    love uses desktop-fullscreen by default. You need to use exclusive fullscreen if you want to change the user's display mode on their monitor:

    love.window.setMode(width, height, {fullscreen=true, fullscreentype="exclusive"})
    -- or if you want to toggle between desktop and fullscreen:
    love.window.setFullscreen(true, "exclusive")
  2. Walter Stanish reporter

    Thanks, that works for altering resolution however when exiting the system stays in that resolution which munges the desktop. There is no way I can see to get back to the original resolution and have it persist after the program completes.

  3. Walter Stanish reporter
    *  media-libs/libsdl
          Latest version available: 1.2.15-r9
          Latest version installed: 1.2.15-r9
          Size of files: 3,829 KiB
          Homepage:      http://www.libsdl.org/
          Description:   Simple Direct Media Layer
          License:       LGPL-2.1
    *  media-libs/libsdl2
          Latest version available: 2.0.4
          Latest version installed: 2.0.4
          Size of files: 4,040 KiB
          Homepage:      http://www.libsdl.org
          Description:   Simple Direct Media Layer
          License:       ZLIB

    I will try upgrading to libsdl2-2.0.7 which is marked unstable on Gentoo.

  4. Walter Stanish reporter

    OK. Installed that then recompiled and reinstalled love-0.10.2. Going to try now. If it fails I have to restart X to get this browser back up .. wish me luck...

  5. Log in to comment