winboard on 2nd screen

Discussions about Winboard/Xboard. News about engines or programs to use with these GUIs (e.g. tournament managers or adapters) belong in this sub forum.

Moderator: Andres Valverde

winboard on 2nd screen

Postby Laurens Winkelhagen » 14 Mar 2009, 17:00

Dear all,

I'm using HGM's version of winboard and would like to set it up to start in my 2nd monitor. I've tried to just put it there and save the settings, but the board defaults to the first monitor when I restart it. Interestingly it retains its vertical location, but it resets the horizontal position and reverts to the first monitor.

Is there a configuration solution for this problem, or must I look at HGM in funny ways? ^^

Kind Regards, Laurens Winkelhagen
Laurens Winkelhagen
 
Posts: 25
Joined: 03 Feb 2009, 13:10

Re: winboard on 2nd screen

Postby H.G.Muller » 15 Mar 2009, 09:42

My knowledge of Windows API is not good enough to say anything sensible about this. I was not even aware that you could have two monitors. I know how it works in WinBoard: it uses a Windows API call to request the parameters of the current window (X,Y,W,H). It saves (X,Y) in the winboard.ini, (W and H follow from the selected -boardSize and -variant), and then uses an API call to restore them when you restart it.

What you describe sounds like there is yet another parameter, the monitor number, which would have to be requested from the system and saved in the winboard.ini in a similar way as the X and Y coordinates.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: winboard on 2nd screen

Postby Laurens Winkelhagen » 16 Mar 2009, 18:49

Hi HGM,

I did a bit of testing just now and apparently my 2nd monitor is treated as an extension of the first, so it's in the same X/Y coördinate ballpark. Let's say I have 2 monitor's with 800 pixels width, when I put the winboard board 100pixels inside the 2nd screen, then winboard will save this location as /x=900!

However, the problem occurs when I start winboard with this parameter: winboard decides that this is not an acceptable /x option and uses /x=0 (or some other default) instead. I went ahead and glimpsed at the code:

Code: Select all
EnsureOnScreen(int *x, int *y)
{
  int gap = GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYCAPTION);
  /* Be sure window at (x,y) is not off screen (or even mostly off screen) */
  if (*x > screenWidth - 32) *x = 0;
  if (*y > screenHeight - 32) *y = 0;
  if (*x < 10) *x = 10;
  if (*y < gap) *y = gap;
}


Here screenWidth is for me the problem: it's set by
Code: Select all
  screenWidth = GetSystemMetrics(SM_CXSCREEN);
elsewhere, but I would like it to be
Code: Select all
screenWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
(note that I'm not really a windows api C programmer but I found this at http://msdn.microsoft.com/en-us/library/ms724385(VS.85).aspx where microsoft defines this metric as: "The width of the virtual screen, in pixels. The virtual screen is the bounding rectangle of all display monitors. .(snip).")

I wonder if it would be possible for you to try this solution and implement it in your excellent Winboard version:-) I would have tried it myself and maybe made a patch, but I cannot really oversee if there is more impact and it has been about 5 years since I last programmed in C (for my old engine JanWillem).

Thanks in advance, Laurens.

P.s., if you want to send me a version to test (I suppose you cannot fully test it yourself, given your post), I would be happy help.
Laurens Winkelhagen
 
Posts: 25
Joined: 03 Feb 2009, 13:10


Return to Winboard and related Topics

Who is online

Users browsing this forum: No registered users and 17 guests