Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6748287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:32:50+00:00 2026-05-26T12:32:50+00:00

Using SDL 1.3 I want to create fake fullscreen SDL_Window under linux. It is

  • 0

Using SDL 1.3 I want to create fake fullscreen SDL_Window under linux. It is easy if i have only one display.
I just got current display mode and created a window.

SDL_GetDesktopDisplayMode(0, &mode);

SDL_Window *win = SDL_CreateWindow("my window",
    0,0,mode.w, mode.h,
    SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS );

But when i have two displays, things get complicated. The window spreads across multiple monitors. SDL sees only one, double sized virtual display.

I tested it with this code

int num = SDL_GetNumVideoDisplays();
for( int i=0; i < num; i++ )
{
    SDL_Rect displayRect;
    SDL_GetDisplayBounds( i, &displayRect );
    std::cout
        << "display " << i << ": x,y,w,h("
        << displayRect.x << ", "
        << displayRect.y << ", "
        << displayRect.w << ", "
        << displayRect.h << ")"
        << std::endl;
}

output:

display 0: x,y,w,h(0, 0, 2960, 1050)

But i have two displays (1680×1050 and 1280×1024).

How to force the window to stay on only one (assume main) display?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:32:51+00:00Added an answer on May 26, 2026 at 12:32 pm

    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 🙁

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create an editor in C++ using SDL & OpenGL and have
I'm using SDL with FASM, and have code that's minimally like the following: format
I'm using the SDL library to try to create a rendering context in a
I'm just using the opengl SDL template with Xcode, and everything runs fine. I
I have been trying to implement Win32's MessageBox using GTK. The app uses SDL/OpenGL,
I'm trying to create a transparent sprite with SDL. I'm using SDL_SetColorKey on a
I have this function in Haskell (I am using the Haskell-SDL library): pixel ::
I'm using SDL for a project of mine, and I want a shorter way
I want to make sure I am using OpenGL for 2d rendering, but SDL
I am using SDL for an OpenGL application, running on Linux. My problem is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.