Issue #186: Win32: use inline C in `#setForegroundWindow:`
...rather than FFI. It's much faster and uses lot less stack.
The latter is also important since `#setForegroundWindow:` is called
when opening debugger. In case a debugger is opened due to
a recursion interrupt, stack space is very limited so better save
every byte.
https://swing.fit.cvut.cz/projects/stx-jv/ticket/186
--- a/WinWorkstation.st Tue Nov 21 15:29:42 2017 +0000
+++ b/WinWorkstation.st Fri Dec 08 09:10:33 2017 +0000
@@ -18776,7 +18776,16 @@
a different process is currently active - in this case the title bar/icon is flashed.
this also raises the priority of the sending thread slightly"
- <apicall: bool "SetForegroundWindow" (handle) module: "user32.dll" >
+%{ /* NOCONTEXT */
+ if (__isExternalAddress(aWindowId)) {
+ HWND win = _HWNDVal(aWindowId);
+
+ if (win) {
+ SetForegroundWindow(win);
+ }
+ RETURN ( self );
+ }
+%}
!
setIconName:aString in:aWindowId