1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-08 09:05:17 +00:00

Patch to SLEEP, _KEYHIT, INP(&H60), _SCREENEXISTS for WINDOWS

Change so that modifer keypresses will only register when the window has
focus in Windows.  This corrects the issue with SLEEP, KEYHIT, and
INP(&H60) registering SHIFT, CTRL, and ALT keypresses even when the
program is not in focus or is running as a background app.

Also changed _SCREENEXISTS (and a few other window user commands) so
that they require windows to have actually registered a windows handle
for the function to return -1, and not just for glut to have finished
initializing the screen itself.
This commit is contained in:
SteveMcNeill 2017-09-23 20:24:19 -04:00
parent cc6a5fb40a
commit e264458841
4 changed files with 63 additions and 35 deletions

View file

@ -29469,12 +29469,23 @@ void sub__maptriangle(int32 cull_options,float sx1,float sy1,float sx2,float sy2
if (key==GLUT_KEY_INSERT){vk=0x5200;}
#ifdef CORE_FREEGLUT
#ifdef QB64_WINDOWS
if (window_handle==GetActiveWindow()) {
if (key==112){vk=VK+QBVK_LSHIFT;}
if (key==113){vk=VK+QBVK_RSHIFT;}
if (key==114){vk=VK+QBVK_LCTRL;}
if (key==115){vk=VK+QBVK_RCTRL;}
if (key==116){vk=VK+QBVK_LALT;}
if (key==117){vk=VK+QBVK_RALT;}
}
#else
if (key==112){vk=VK+QBVK_LSHIFT;}
if (key==113){vk=VK+QBVK_RSHIFT;}
if (key==114){vk=VK+QBVK_LCTRL;}
if (key==115){vk=VK+QBVK_RCTRL;}
if (key==116){vk=VK+QBVK_LALT;}
if (key==117){vk=VK+QBVK_RALT;}
#endif
#endif
if (vk!=-1){

View file

@ -32,3 +32,5 @@ double func_sec (double num);
double func_csc (double num);
double func_cot (double num);
int32 func_screenicon ();
extern HWND window_handle;

View file

@ -1,20 +1,32 @@
int32 func_screenwidth () {
while (!window_exists){Sleep(100);}
#ifdef QB64_WINDOWS
while (!window_handle){Sleep(100);}
#endif
return glutGet(GLUT_SCREEN_WIDTH);
}
int32 func_screenheight () {
while (!window_exists){Sleep(100);}
#ifdef QB64_WINDOWS
while (!window_handle){Sleep(100);}
#endif
return glutGet(GLUT_SCREEN_HEIGHT);
}
void sub_screenicon () {
while (!window_exists){Sleep(100);}
#ifdef QB64_WINDOWS
while (!window_handle){Sleep(100);}
#endif
glutIconifyWindow();
return;
}
int32 func_windowexists () {
#ifdef QB64_WINDOWS
if (!window_handle){return 0;}
#endif
return -window_exists;
}
@ -24,11 +36,13 @@ int32 func__controlchr () {
int32 func_screenicon () {
while (!window_exists){Sleep(100);}
#ifdef QB64_WINDOWS
while (!window_handle){Sleep(100);}
#endif
extern int32 screen_hide;
if (screen_hide) {error(5); return 0;}
#ifdef QB64_WINDOWS
#include <windows.h>
extern HWND window_handle;
return -IsIconic(window_handle);
#else
/*

View file

@ -3,5 +3,6 @@
#include "Steve Stuff/convert_angle.cpp"
#include "Steve Stuff/extramath.cpp"
#include "Steve Stuff/screeninfo.cpp"
#include "Steve Stuff/stringcomp.cpp"
#include "Steve Stuff/screeninfo.cpp"