Setting Fullscreen window to a secondary screen

Setting Fullscreen window to a secondary screen

Postby jobenmoe » 15 Sep 2017, 20:55

Hello,

I am trying to get supertuxkart to run full screen on a second monitor that is not set as main. Could someone be kind enough to guide me on how I could change screen setting in the code?

Best,
Jason
jobenmoe
 
Posts: 11
Joined: 22 Aug 2017, 21:26

Re: Setting Fullscreen window to a secondary screen

Postby Auria » 16 Sep 2017, 00:09

Hi,

first of all, which OS are you using?
Image
User avatar
Auria
STK Moderator
 
Posts: 2976
Joined: 07 Dec 2009, 03:52

Re: Setting Fullscreen window to a secondary screen

Postby deve » 16 Sep 2017, 00:30

If on linux, in CIrrDeviceLinux.cpp:

{l Code}: {l Select All Code}
            RROutput primary_id = XRRGetOutputPrimary(display, DefaultRootWindow(display));
      
            for (int i = 0; i < res->noutput; i++)
            {
               XRROutputInfo* output_tmp = XRRGetOutputInfo(display, res, res->outputs[i]);
               if (!output_tmp || !output_tmp->crtc || output_tmp->connection == RR_Disconnected)
               {
                  XRRFreeOutputInfo(output_tmp);
                  continue;
               }
      
               XRRCrtcInfo* crtc_tmp = XRRGetCrtcInfo(display, res, output_tmp->crtc);
               if (!crtc_tmp)
               {
                  XRRFreeOutputInfo(output_tmp);
                  continue;
               }
               
               if (res->outputs[i] == primary_id ||
                  output_id == BadRROutput || crtc_tmp->x < crtc->x ||
                  (crtc_tmp->x == crtc->x && crtc_tmp->y < crtc->y))
               {
                  XRRFreeCrtcInfo(crtc);
                  XRRFreeOutputInfo(output);      
                  
                  output = output_tmp;
                  crtc = crtc_tmp;               
                  output_id = res->outputs[i];
               }
               else
               {
                  XRRFreeCrtcInfo(crtc_tmp);
                  XRRFreeOutputInfo(output_tmp);         
               }
               
               if (res->outputs[i] == primary_id)
                  break;
            }


It uses primary display if available. If not available, it uses the most top left display.

So probably
{l Code}: {l Select All Code}
if (res->outputs[i] == primary_id)

should be changed to
{l Code}: {l Select All Code}
if (res->outputs[i] != primary_id)

in both places, assuming that you have two monitors connected. I didn't test it though.
deve
 
Posts: 268
Joined: 23 Jan 2014, 13:45

Who is online

Users browsing this forum: No registered users and 1 guest