Faculty of Information Technology
Software Engineering Group

Ticket #186: libview_fix_1_of_1_rev_ddbaa22b9352_Issue__186__Win32__use_inline_C_in___setForegroundWindow__.patch

File libview_fix_1_of_1_rev_ddbaa22b9352_Issue__186__Win32__use_inline_C_in___setForegroundWindow__.patch, 1.3 KB (added by Jan Vrany, 5 years ago)
  • WinWorkstation.st

    # HG changeset patch
    # User Jan Vrany <jan.vrany@fit.cvut.cz>
    # Date 1512724233 0
    #      Fri Dec 08 09:10:33 2017 +0000
    # Branch jv
    # Node ID ddbaa22b935264d423ad8df8b9a42db97232515d
    # Parent  6d994e1ee4fc114b395f545f9e10a745e82774ef
    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
    
    diff -r 6d994e1ee4fc -r ddbaa22b9352 WinWorkstation.st
    a b  
    1877618776     a different process is currently active - in this case the title bar/icon is flashed.
    1877718777     this also raises the priority of the sending thread slightly"
    1877818778
    18779     <apicall: bool "SetForegroundWindow" (handle) module: "user32.dll" >
     18779%{  /* NOCONTEXT */
     18780    if (__isExternalAddress(aWindowId)) {
     18781        HWND win = _HWNDVal(aWindowId);
     18782
     18783        if (win) {
     18784            SetForegroundWindow(win);           
     18785        }
     18786        RETURN ( self );
     18787    }
     18788%}
    1878018789!
    1878118790
    1878218791setIconName:aString in:aWindowId