GFX_FULLSCREEN not working properly

Windows specific questions.
UEZ
Posts: 162
Joined: May 05, 2017 19:59
Location: Germany

GFX_FULLSCREEN not working properly

Postby UEZ » Jan 11, 2018 10:28

GFX_FULLSCREEN is not working properly with multi monitors.

Code: Select all

#Include "fbgfx.bi"
#Include "windows.bi"


Using FB
Dim As RECT tDesktop
Dim As hwnd hHWND_Dt
hHWND_Dt = FindWindow("Progman","Program Manager")
GetWindowRect(hHWND_Dt, @tDesktop)

Dim as integer x, y, w, h
x = tDesktop.left
y = tDesktop.top
w = tDesktop.right + Abs(x)
h = tDesktop.bottom + Abs(y)
? x, y
? w, h

ScreenRes(w, h, 32, 1, GFX_FULLSCREEN)
ScreenControl(SET_WINDOW_POS, tDesktop.left, tDesktop.top)

Sleep


I have 3 monitors like this here (monitor 3 is the primary):
Image
Monitor 2 and 3 have a resolution of 1680x1050 pixels and monitor 3 @1600x900 -> 4960x1050 pixels.

I expect the result of the code above to have a black screen over all monitor but it's not working. The result is rather like this here:
Image

Output from code:
-1680 0
4960 1050

Further, it takes a very long time until the GUI is shown.

Any idea how to fix it?
Last edited by UEZ on Jan 11, 2018 12:10, edited 2 times in total.
MrSwiss
Posts: 2597
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: GFX_FULLSCREEN not working properly

Postby MrSwiss » Jan 11, 2018 11:47

This has a few dependencies, like high DPI scaling (by OS) ...
Since you seem to be on WIN, check the currently used scaling factor first.
If it isn't: 100% (above or below), ScreenRes() settings w, h are scaled!

Then, for full screen: ScreenControl(SET_WINDOW_POS, 0, 0) - left/top.
Also in code: use ScreenControl() before ScreenRes().
Please test this and report outcome/results ...
UEZ
Posts: 162
Joined: May 05, 2017 19:59
Location: Germany

Re: GFX_FULLSCREEN not working properly

Postby UEZ » Jan 11, 2018 12:27

MrSwiss wrote:This has a few dependencies, like high DPI scaling (by OS) ...
Since you seem to be on WIN, check the currently used scaling factor first.
If it isn't: 100% (above or below), ScreenRes() settings w, h are scaled!

Then, for full screen: ScreenControl(SET_WINDOW_POS, 0, 0) - left/top.
Also in code: use ScreenControl() before ScreenRes().
Please test this and report outcome/results ...


Scale and layout is at 100%.

The outcome is nearly the same: no full screen, whereas the left side of the GUI isn't at x:-1680, y:0.
dodicat
Posts: 4961
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: GFX_FULLSCREEN not working properly

Postby dodicat » Jan 11, 2018 14:28

From the help file, use this to check your supported full screen resolutions

Code: Select all

Dim As Integer mode, w, h

Print "Resolutions supported at 32 bits per pixel:"

mode = ScreenList(32)
While (mode <> 0)
    w = HiWord(mode)
    h = LoWord(mode)
    Print w & "x" & h
    mode = ScreenList()
Wend
sleep
 


Maybe you should just use movewindow.
This should always give a full screen, except in 64 bit FreeBASIC, where it fails.
(Note no_frame must be applied)

Code: Select all

#Include "fbgfx.bi"
#Include "windows.bi"


Using FB
Dim As RECT tDesktop
Dim As hwnd hHWND_Dt
hHWND_Dt = FindWindow("Progman","Program Manager")
GetWindowRect(hHWND_Dt, @tDesktop)

Dim as integer x, y, w, h
x = tDesktop.left
y = tDesktop.top
w = tDesktop.right + Abs(x)
h = tDesktop.bottom + Abs(y)
? x, y
? w, h


ScreenRes(w, h, 32, 1,  GFX_NO_FRAME)

Dim As long I
Screencontrol(GET_WINDOW_HANDLE ,I)
Dim As Any Ptr Win = Cast(Any Ptr,I)
'ScreenControl(SET_WINDOW_POS, tDesktop.left, tDesktop.top)
movewindow(win,0,0,w,h,1)
locate 10
? x, y
? w, h

Sleep

Win 10 here.
UEZ
Posts: 162
Joined: May 05, 2017 19:59
Location: Germany

Re: GFX_FULLSCREEN not working properly

Postby UEZ » Jan 11, 2018 15:04

dodicat wrote:From the help file, use this to check your supported full screen resolutions

Code: Select all

Dim As Integer mode, w, h

Print "Resolutions supported at 32 bits per pixel:"

mode = ScreenList(32)
While (mode <> 0)
    w = HiWord(mode)
    h = LoWord(mode)
    Print w & "x" & h
    mode = ScreenList()
Wend
sleep
 


Maybe you should just use movewindow.
This should always give a full screen, except in 64 bit FreeBASIC, where it fails.
(Note no_frame must be applied)

Code: Select all

#Include "fbgfx.bi"
#Include "windows.bi"


Using FB
Dim As RECT tDesktop
Dim As hwnd hHWND_Dt
hHWND_Dt = FindWindow("Progman","Program Manager")
GetWindowRect(hHWND_Dt, @tDesktop)

Dim as integer x, y, w, h
x = tDesktop.left
y = tDesktop.top
w = tDesktop.right + Abs(x)
h = tDesktop.bottom + Abs(y)
? x, y
? w, h


ScreenRes(w, h, 32, 1,  GFX_NO_FRAME)

Dim As long I
Screencontrol(GET_WINDOW_HANDLE ,I)
Dim As Any Ptr Win = Cast(Any Ptr,I)
'ScreenControl(SET_WINDOW_POS, tDesktop.left, tDesktop.top)
movewindow(win,0,0,w,h,1)
locate 10
? x, y
? w, h

Sleep

Win 10 here.


Almost dodicat.

Code: Select all

movewindow(win,x,y,w,h,1)

will do it properly.

Thanks.
dodicat
Posts: 4961
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: GFX_FULLSCREEN not working properly

Postby dodicat » Jan 11, 2018 15:21

x and y are zero.
But for generality x,y is better, I agree.
Pity about 64 bit.
I did mention the bug in the passing
https://www.freebasic.net/forum/viewtopic.php?f=2&t=26047&p=238327&hilit=%2Amovewindow%2A#p238327
When FreeBASIC is up and running again I shall use a bug report.

Note Win 10 crashes if you apply FULL SCREEN to a non 32 bit screen.
Another bug I would say.
UEZ
Posts: 162
Joined: May 05, 2017 19:59
Location: Germany

Re: GFX_FULLSCREEN not working properly

Postby UEZ » Jan 11, 2018 15:24

dodicat wrote:x and y are zero.
But for generality x,y is better, I agree.
Pity about 64 bit.
I did mention the bug in the passing
https://www.freebasic.net/forum/viewtopic.php?f=2&t=26047&p=238327&hilit=%2Amovewindow%2A#p238327
When FreeBASIC is up and running again I shall use a bug report.

Note Win 10 crashes if you apply FULL SCREEN to a non 32 bit screen.
Another bug I would say.


In my case x = -1680 and y = 0.

Furthermore when I use GFX_FULLSCREEN it will take up to 20 seconds until the GUI has been created and shown.

Thanks again. :-)


Another question not directly related to this. When I start "Infinite Image Zoom Flight" from monitor 1 then the GUI will also created on monitor 1 but desktop width / height will be used from primary monitor 3. As monitor 1 has a smaller resolution the GUI is larger.

I expect that the GUI will always created on primary monitor and not where it was started from.

Return to “Windows”

Who is online

Users browsing this forum: No registered users and 1 guest