GLBasic forum

Main forum => Bug Reports => Topic started by: spacefractal on 2018-Dec-23

Title: Alt Tab dosent work in fullscreen (AUTOPAUSE not works correctly Windows 10).
Post by: spacefractal on 2018-Dec-23
as topic said, Alt Tab dosent work in fullscreen, and even jobcenter can been shown at all! This bug needs to been fixed before the steam release really. Im not sure what it happens, since im even used AUTOPAUSE True, that also dosent work correctly on Windows.

Etc there also no way to set a borderless windowered mode at all, which could have fix it.
Title: Re: Alt Tab dosent work in fullscreen.
Post by: Qedo on 2018-Dec-24
while waiting debug try this workaround.

Code (glbasic) Select

f_fullscreen=TRUE
Nf_fullscreen=TRUE
CGLB_ON_RESUME=GETTIMERALL()

REPEAT
IF Nf_fullscreen<>f_fullscreen
f_fullscreen=Nf_fullscreen
SETSCREEN 640, 480, f_fullscreen
CGLB_ON_RESUME=GETTIMERALL()
ENDIF
.......



........
UNTIL FALSE

SUB GLB_ON_PAUSE:
IF Nf_fullscreen=f_fullscreen
CGLB_ON_RESUME=GETTIMERALL()-CGLB_ON_RESUME
IF CGLB_ON_RESUME>1000
Nf_fullscreen=NOT Nf_fullscreen
ENDIF
ENDIF
CGLB_ON_RESUME=GETTIMERALL()

ENDSUB
SUB GLB_ON_RESUME:
IF Nf_fullscreen=f_fullscreen
CGLB_ON_RESUME=GETTIMERALL()-CGLB_ON_RESUME
IF CGLB_ON_RESUME>1000
Nf_fullscreen=NOT Nf_fullscreen
ENDIF
ENDIF
CGLB_ON_RESUME=GETTIMERALL()
ENDSUB
Title: Re: Alt Tab dosent work in fullscreen.
Post by: spacefractal on 2018-Dec-25
the only issue is SUB GLB_ON_PAUSE and SUB GLB_ON_RESUME seens not been called on Windows 10, even with AUTOPAUSE True. Otherwise im would have done something extractly like this workaround by switch between fullscreen and windowred mode. Me and Gernot should look why its dont call them as its should. This was a hell to support this on iOS as well Android correctly.
Title: Re: Alt Tab dosent work in fullscreen.
Post by: Qedo on 2018-Dec-25
tried on win10 and it seems to work
Title: Re: Alt Tab dosent work in fullscreen.
Post by: spacefractal on 2018-Dec-25
not here or at my friend. When im alt-tab from a full window, the windows is still stays in fullscreen and got inactivated. A friend of my did even forced to restart windows, because ctrl,alt,delete diddent work. Howover im do have implemented that workaround its send to windowered mode on Tab, Ctrl+ALT and Alt-Enter in that game.

GLB_ON_PAUSE and GLB_ON_RESUME is newer called on a alt/tab here. but if they did, then this workaround would have works fine.

Property a GLB_WIN32_MSG subrutine can been checked the windows is activated or not. This sub does calls its seen.
Title: Re: Alt Tab dosent work in fullscreen.
Post by: spacefractal on 2018-Dec-25
This is actuelly not a bug, but its is the code: its dosent work in the debugger mode.
Title: Re: Alt Tab dosent work in fullscreen.
Post by: spacefractal on 2018-Dec-25
but its still dosent works as intendend. Im get a black screen when doing workaround like this and resume dosent works when you just reactivate the window, but require to been minimized and maximized again. So its still quite fuzzy here.
Title: Re: Alt Tab dosent work in fullscreen.
Post by: spacefractal on 2018-Dec-25
To get that workaround to work, you do a little more work to do:

in the glb_pc.cpp in the function LRESULT CALLBACK __WndProc and in the WM_ACTIVATE case:
Code (glbasic) Select

case WM_ACTIVATE:
{
switch(wParam & 0xffff)
{
case WA_ACTIVE: case WA_CLICKACTIVE:
if(!__DG_DEBUG)
{
glb_do_pause(false);
if(!__g_paused && __g_allowPause)
::SetWindowText(__hWnd, __g_Caption().c_str());
}
else
{ CALLBYNAME(DGStr("GLB_ON_RESUME"));

}
break;
case WA_INACTIVE:
if(!__DG_DEBUG)
{
glb_do_pause(true);
if(__g_paused && __g_allowPause)
::SetWindowText(__hWnd, (__g_Caption() + CGStr(" <pause>")).c_str());
}
else
{ CALLBYNAME(DGStr("GLB_ON_PAUSE"));
}
break;
}
}
return 0L;


Now the above issue workaround can been done and works, even with AUTOPAUSE FALSE as well. Those subs is required to been called when the windows is in fullscreen, or the user cant switch betweens apps.
Title: Re: Alt Tab dosent work in fullscreen.
Post by: Qedo on 2018-Dec-25
Great !!!
Title: Re: Alt Tab dosent work in fullscreen: Very easy source code fix!
Post by: spacefractal on 2019-Feb-09
im have still got issues, but im do found a very simple fix in the c++ code, all its actuelly was need to do is MINIMIZE the window, when its in FULLSCREEN,  then its escape its correctly!

Code (glbasic) Select

case WM_ACTIVATE:
{
switch(wParam & 0xffff)
{
case WA_ACTIVE: case WA_CLICKACTIVE:
if(!__DG_DEBUG)
{
glb_do_pause(false);
if(!__g_paused && __g_allowPause)
::SetWindowText(__hWnd, __g_Caption().c_str());
}
break;
case WA_INACTIVE:
if (__DG_FULLSCREEN==1)
{
::ShowWindow(__hWnd,SW_MINIMIZE);
}
if(!__DG_DEBUG)
{
glb_do_pause(true);
if(__g_paused && __g_allowPause)
::SetWindowText(__hWnd, (__g_Caption() + CGStr(" <pause>")).c_str());
}
break;
}
}
return 0L;


Actuelly pretty simple fix! Windows 10 simply dosent minimize from fullscreen as its should? So im just let it minimze if its fullscreen. You dont need to maximize, which works as intended.
Title: Re: Alt Tab dosent work in fullscreen (AUTOPAUSE not works correctly Windows 10).
Post by: Hemlos on 2019-Feb-10
I noticed this too, and thought about this solution:
Code (glbasic) Select
IF (KEY(alt+tab) detected)
SETSCREEN 1920,1080, FALSE
Render a button too, (SETSCREEN 1920,1080, TRUE), so its waiting for the user to reactivate the fullscreen mode when they tab back to program.
ENDIF

Title: Re: Alt Tab dosent work in fullscreen (AUTOPAUSE not works correctly Windows 10).
Post by: Hemlos on 2019-Feb-11
i tried alt-tab detection....its hit or miss.

There are many games that use ALT+ENTER to toggle fullscreen mode.

This is what i'm going to use as a solution for ALT-TAB not working from fullscreen mode:

Code (glbasic) Select
// ALT+ENTER -- toggle fullscreen mode
STATIC tempscrmode
IF (KEY(184)) AND (KEY(28)) AND (tempscrmode = FALSE)
SETSCREEN 1900,1000,FALSE
tempscrmode = TRUE
ELSEIF (KEY(184)) AND (KEY(28)) AND (tempscrmode = TRUE)
SETSCREEN 1920,1080,TRUE
tempscrmode = FALSE
ENDIF
Title: Re: Alt Tab dosent work in fullscreen (AUTOPAUSE not works correctly Windows 10).
Post by: spacefractal on 2019-Feb-12
just use the source code modification, then its works as intended (and dont try to detect alt-tab etc, which might conflict so). Windows 10 simply just do not minimize the window as its should. Then you dosent need to detect the alt-tab anymore.

Etc the main issue is in the glbasic source code when WA_INACTIVE is called:
LRESULT CALLBACK __WndProc_(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)

The new code checks, if the windows is fullscreen, then manually minimize it. Done with success with 3 of my games, with 2 is remaining.
Title: Re: Alt Tab dosent work in fullscreen (AUTOPAUSE not works correctly Windows 10).
Post by: Hemlos on 2019-Feb-12
Its not only win10, Its the same for windows 7, full screen is not maximized, its fullscreen.

Many fullscreen games use ALT+ENTER to induce window mode because their games dont minimize on ALT TAB, its not a window.

How do you implement your sourcecode?
Title: Re: Alt Tab dosent work in fullscreen (AUTOPAUSE not works correctly Windows 10).
Post by: spacefractal on 2019-Feb-12
im put the source code under compiler/platform/source from the downloaded one (can been download from the main site). then you can build the source code by using _build.bat from each platform.

Hopefully Gernot adds this to the glbasic 16 soon. Im only just added 2 lines or code or such in glb_pc.cpp.

Here im do manual minimize it (which worked best in this case), if its fullscreen when the windows inactivate status is called.

This seens to also make sure the Windows dosent got stuck in the game, which was happens (im was needed to reset it).
Title: Re: Alt Tab dosent work in fullscreen (AUTOPAUSE not works correctly Windows 10).
Post by: Kitty Hello on 2019-Feb-28
OK, added to the next update.