From 7fb1db97f68b0c54e2eba6510e79589c8da0b835 Mon Sep 17 00:00:00 2001 From: SMcNeill Date: Sat, 8 Aug 2015 12:50:45 -0400 Subject: [PATCH] Added function _SCREENICON to tell us if the window has been minimized to the taskbar (Iconified) --- .../c/parts/user_mods/include/steve_mods.h | 3 ++- .../user_mods/src/Steve Stuff/screeninfo.cpp | 23 +++++++++++++++++++ .../extensions/Steve Stuff-ID_Includes.bas | 9 ++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/internal/c/parts/user_mods/include/steve_mods.h b/internal/c/parts/user_mods/include/steve_mods.h index e4416cc4d..646ab078d 100644 --- a/internal/c/parts/user_mods/include/steve_mods.h +++ b/internal/c/parts/user_mods/include/steve_mods.h @@ -30,4 +30,5 @@ double func_csch (double num); double func_coth (double num); double func_sec (double num); double func_csc (double num); -double func_cot (double num); \ No newline at end of file +double func_cot (double num); +int32 func_screenicon (); \ 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 7a856751f..2226418e1 100644 --- a/internal/c/parts/user_mods/src/Steve Stuff/screeninfo.cpp +++ b/internal/c/parts/user_mods/src/Steve Stuff/screeninfo.cpp @@ -21,3 +21,26 @@ int32 func_windowexists () { int32 func__controlchr () { return -no_control_characters2; } + +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 + #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. +} \ No newline at end of file diff --git a/source/subs_functions/extensions/Steve Stuff-ID_Includes.bas b/source/subs_functions/extensions/Steve Stuff-ID_Includes.bas index 8f4f90975..0bf09f68f 100644 --- a/source/subs_functions/extensions/Steve Stuff-ID_Includes.bas +++ b/source/subs_functions/extensions/Steve Stuff-ID_Includes.bas @@ -319,3 +319,12 @@ id.ret = FLOATTYPE - ISPOINTER id.Dependency = DEPENDENCY_USER_MODS regid +clearid +id.n = "_SCREENICON" +id.subfunc = 1 +id.callname = "func_screenicon" +id.args = 0 +id.ret = LONGTYPE - ISPOINTER +id.Dependency = DEPENDENCY_USER_MODS +regid +