diff --git a/internal/c/libqb.cpp b/internal/c/libqb.cpp index 21245b15f..a6de5ee9d 100644 --- a/internal/c/libqb.cpp +++ b/internal/c/libqb.cpp @@ -44,7 +44,7 @@ #ifdef QB64_ANDROID - #include //required for system() + #include //required for system() struct android_app* android_state; JavaVM* android_vm; JNIEnv* android_env; @@ -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 - 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;} + #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){ diff --git a/internal/c/parts/user_mods/include/steve_mods.h b/internal/c/parts/user_mods/include/steve_mods.h index 646ab078d..fd31498ce 100644 --- a/internal/c/parts/user_mods/include/steve_mods.h +++ b/internal/c/parts/user_mods/include/steve_mods.h @@ -31,4 +31,6 @@ double func_coth (double num); double func_sec (double num); double func_csc (double num); double func_cot (double num); -int32 func_screenicon (); \ No newline at end of file +int32 func_screenicon (); + +extern HWND window_handle; \ No newline at end of file diff --git a/internal/c/parts/user_mods/src/Steve Stuff/screeninfo.cpp b/internal/c/parts/user_mods/src/Steve Stuff/screeninfo.cpp index 01837ae27..04334eab5 100644 --- a/internal/c/parts/user_mods/src/Steve Stuff/screeninfo.cpp +++ b/internal/c/parts/user_mods/src/Steve Stuff/screeninfo.cpp @@ -1,20 +1,32 @@ int32 func_screenwidth () { while (!window_exists){Sleep(100);} - return glutGet(GLUT_SCREEN_WIDTH); + #ifdef QB64_WINDOWS + while (!window_handle){Sleep(100);} + #endif + return glutGet(GLUT_SCREEN_WIDTH); } int32 func_screenheight () { while (!window_exists){Sleep(100);} - return glutGet(GLUT_SCREEN_HEIGHT); + #ifdef QB64_WINDOWS + while (!window_handle){Sleep(100);} + #endif + return glutGet(GLUT_SCREEN_HEIGHT); } void sub_screenicon () { while (!window_exists){Sleep(100);} - glutIconifyWindow(); + #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; } @@ -23,27 +35,29 @@ int32 func__controlchr () { } int32 func_screenicon () { - while (!window_exists){Sleep(100);} - extern int32 screen_hide; - if (screen_hide) {error(5); return 0;} -#ifdef QB64_WINDOWS -#include - extern HWND window_handle; - return -IsIconic(window_handle); -#else - /* - Linux code not compiling for now - #include - #include - extern Display *X11_display; - extern Window X11_window; - extern int32 screen_hide; - XWindowAttributes attribs; - while (!(X11_display && X11_window)); - XGetWindowAttributes(X11_display, X11_window, &attribs); - if (attribs.map_state == IsUnmapped) return -1; - return 0; - #endif */ - return 0; //if we get here and haven't exited already, we failed somewhere along the way. - #endif + 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 + return -IsIconic(window_handle); + #else + /* + Linux code not compiling for now + #include + #include + extern Display *X11_display; + extern Window X11_window; + extern int32 screen_hide; + XWindowAttributes attribs; + while (!(X11_display && X11_window)); + XGetWindowAttributes(X11_display, X11_window, &attribs); + if (attribs.map_state == IsUnmapped) return -1; + return 0; + #endif */ + return 0; //if we get here and haven't exited already, we failed somewhere along the way. + #endif } diff --git a/internal/c/parts/user_mods/src/steve_mods.cpp b/internal/c/parts/user_mods/src/steve_mods.cpp index aa8b13c37..c5e666d92 100644 --- a/internal/c/parts/user_mods/src/steve_mods.cpp +++ b/internal/c/parts/user_mods/src/steve_mods.cpp @@ -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" +