Sdl Fake Fullscreen Mode on Dual Monitor Setup Under Linux

SDL fake fullscreen mode on dual monitor setup under linux

src/video/x11/SDL_x11modes.c checks some interesting #defines:

SDL_VIDEO_DRIVER_X11_XINERAMA
SDL_VIDEO_DRIVER_X11_XRANDR
SDL_VIDEO_DRIVER_X11_XVIDMODE

You might check include/SDL_config.h to see which path(s) your copy is following. Rebuilding with X11MODES_DEBUG defined may also be productive.

EDIT: Tried test/testvidinfo.c on my system with X11MODES_DEBUG and got this:

Built-in video drivers: x11, dummy
Video driver: x11
Number of displays: 1
Display 0: 2646x1024 at 0,0
Current mode: 2646x1024@0Hz, 32 bits-per-pixel
Red Mask = 0x00ff0000
Green Mask = 0x0000ff00
Blue Mask = 0x000000ff
X11 detected Xinerama:
xinerama 0: 1366x768+0+0
xinerama 1: 1280x1024+1366+0
XRANDR: XRRQueryVersion: V1.3
XRANDR: mode = 0[0], w = 1366, h = 768, rate = 60
XRANDR: mode = 1[0], w = 1360, h = 768, rate = 60
XRANDR: mode = 2[0], w = 1024, h = 768, rate = 60
XRANDR: mode = 3[0], w = 800, h = 600, rate = 60
XRANDR: mode = 3[1], w = 800, h = 600, rate = 56
XRANDR: mode = 4[0], w = 640, h = 480, rate = 60
Xinerama is enabled
XRandR is enabled
Fullscreen video modes:
Mode 0: 2646x1024@0Hz, 32 bits-per-pixel
Red Mask = 0x00ff0000
Green Mask = 0x0000ff00
Blue Mask = 0x000000ff
Mode 1: 1366x768@60Hz, 32 bits-per-pixel
Red Mask = 0x00ff0000
Green Mask = 0x0000ff00
Blue Mask = 0x000000ff
Mode 2: 1366x768@0Hz, 32 bits-per-pixel
Red Mask = 0x00ff0000
Green Mask = 0x0000ff00
Blue Mask = 0x000000ff
Mode 3: 1360x768@60Hz, 32 bits-per-pixel
Red Mask = 0x00ff0000
Green Mask = 0x0000ff00
Blue Mask = 0x000000ff
Mode 4: 1024x768@60Hz, 32 bits-per-pixel
Red Mask = 0x00ff0000
Green Mask = 0x0000ff00
Blue Mask = 0x000000ff
Mode 5: 800x600@60Hz, 32 bits-per-pixel
Red Mask = 0x00ff0000
Green Mask = 0x0000ff00
Blue Mask = 0x000000ff
Mode 6: 800x600@56Hz, 32 bits-per-pixel
Red Mask = 0x00ff0000
Green Mask = 0x0000ff00
Blue Mask = 0x000000ff
Mode 7: 640x480@60Hz, 32 bits-per-pixel
Red Mask = 0x00ff0000
Green Mask = 0x0000ff00
Blue Mask = 0x000000ff
Current resolution: 2646x1024

You can see SDL has queried Xinerama and gotten both of my monitors but doesn't seem to communicate that back to the client in a useful manner.

Sadly it looks like you need to post to the mailing list or file a bug :(

sdl: unlock mouse in fullscreen mode and make it useable on another monitor

I don't see any way of doing it.

You could fake it by using SDL_SetVideoMode().
Set it to the exact size of the desktop and use the SDL_NOFRAME flag.
Desktop size can be acquired with

const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo();    //get desktop size
desktopWidth = videoInfo->current_w;
desktopHeight = videoInfo->current_h;

and this hack can work on any resolution.

Setting QWidget fullscreen on multi monitor setup

Cause of the problem is the window manager. If i started the X server without any window manager, it was possible to call

QWidget::setGeometry(...) 

and the window sized itself across all connected displays.

So i mistakenly assumed that Qt is the problem.

Move fullscreen window to secondary monitor with Win32/SDL

Raymond Chen wrote a useful article on how to switch an application between windowed and full screen. The important part for you would be this section of the code:

GetMonitorInfo(MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY), &mi))

This gets the monitor information for a specific monitor, but uses the value returned from MonitorFromWindow to pick the monitor on which the window currently resides. There are several other methods of picking a monitor, such as providing an X,Y coordinate, or enumerating them (using EnumDisplayMonitors(...)).

GetMonitorInfo(...) passes a MONITORINFO back out, which contains the relative position and size of the display, which you can use to position your full-screen window.

The full API is detailed on MSDN.



Related Topics



Leave a reply



Submit