Hi,
I maintain tuxmath and tuxtype. The games have a fullscreen mode and
a 640x480 windowed mode. I recently switched to a dual-monitor
(linux, using Nvidia TwinView) and noticed that the fullscreen mode
spreads across both monitors (as expected, because the combined
monitors appear as one big screen). I’d like to have a fullscreen SDL
game display in just one monitor, ideally leaving the other monitor
usable for other apps, but OK if it just goes black or shows “no input
signal”. I’ve figured out how to get my computer behave as desired,
but I’d like to fix tuxmath and tuxtype so they handle this situation
more intelligently. Is there any way to detect if “fullscreen” is in
fact spread across both monitors?
As a sort of workaround hack, I’ve tried simply testing if the screen
is more than twice as wide as it is tall, and then just passing half
the total width to SDL_SetVideoMode() to see if I could force SDL to
just use one monitor:
// Determine the current resolution: this will be used as the //
fullscreen resolution, if the user wants
fullscreen. DEBUGMSG(debug_setup, “Current resolution: w %d, h
%d.\n”,videoInfo->current_w,videoInfo->current_h); fs_res_x =
videoInfo->current_w; fs_res_y = videoInfo->current_h;
if (Opts_GetGlobalOpt(FULLSCREEN)) { ? ?//HACK - assume dual
monitors if x > 2y, try to force game to display fullscreen ? ?//on
only one: ? ?if (fs_res_x > 2 * fs_res_y) fs_res_x /= 2;
? ?screen = SDL_SetVideoMode(fs_res_x, fs_res_y, PIXEL_BITS,
SDL_FULLSCREEN | surfaceMode); ? ?if (screen == NULL)
{ fprintf(stderr, “\nWarning: I could not open the display in
fullscreen mode.\n” “The Simple DirectMedia error that occured
was:\n” “%s\n\n”, SDL_GetError()); Opts_SetGlobalOpt(FULLSCREEN,
0); ? ?} }
if (!Opts_GetGlobalOpt(FULLSCREEN)) { ? ?screen =
SDL_SetVideoMode(640, 480, PIXEL_BITS, surfaceMode); }
This worked as desired on my machine, but I’m not at all confident
that it is a proper practice or that it will work for other
dual-monitor scenarios.
What’s the best way to check for this programatically?–
David Bruce
For all your software needs, visit The Apt Store:
deb http://ftp.us.debian.org/debian stable main