| 1827 | |
| 1828 | |
| 1829 | void DialogPrep() |
| 1830 | // Having it as a function vs. macro should reduce code size due to expansion of macros inside. |
| 1831 | { |
| 1832 | // Make the thread immediately interruptible but don't change g->ThreadIsCritical, |
| 1833 | // since DIALOG_END will refer to it when resetting g->AllowThreadToBeInterrupted. |
| 1834 | g->AllowThreadToBeInterrupted = true; |
| 1835 | if (g_KeybdHook) // Workaround added in v1.1.22.01. |
| 1836 | { |
| 1837 | // If a Control or Shift key is physically down, the dialog somehow recognizes this |
| 1838 | // and acts as though the key is logically down even if it really isn't. Logically |
| 1839 | // releasing the key before or after the dialog is shown appears to work around the |
| 1840 | // issue. If one L/R modifier is logically down and the opposite side is physically |
| 1841 | // down, the workaround isn't wanted/needed, because the dialog *should* act like |
| 1842 | // the key is down, and it does so until the key is released. |
| 1843 | // UPDATE: I'm not able to reproduce this problem on Windows 10, but it's done there |
| 1844 | // too just in case. |
| 1845 | mod_type mods_logical = ConvertModifiersLR(g_modifiersLR_logical); |
| 1846 | modLR_type mods_not_to_release = ConvertModifiers(mods_logical & (MOD_CONTROL | MOD_SHIFT)) |
| 1847 | | MOD_LALT | MOD_RALT | MOD_LWIN | MOD_RWIN; // v1.1.23.05: No need to release these keys. |
| 1848 | modLR_type mods_to_release = g_modifiersLR_physical & ~mods_not_to_release; |
| 1849 | if (mods_to_release) |
| 1850 | { |
| 1851 | if (mods_logical == MOD_WIN) // Fixed in v1.1.23.05 to exclude combinations like MOD_WIN|MOD_CONTROL, which don't need this. |
| 1852 | { |
| 1853 | // Even though the Win key isn't being released, sending a Shift or Control key-up |
| 1854 | // triggers the Start menu. To prevent that, we send the mask key. This has been |
| 1855 | // confirmed to apply to #Control, #Shift and the left/right variants. |
| 1856 | KeyEventMenuMask(KEYDOWNANDUP, KEY_IGNORE_ALL_EXCEPT_MODIFIER); |
| 1857 | // Releasing the Win key now does not prevent it from being "masked" again later: |
| 1858 | //mods_to_release |= (g_modifiersLR_logical & (MOD_LWIN | MOD_RWIN)); |
| 1859 | } |
| 1860 | SetModifierLRState(0, mods_to_release, NULL, false, false); |
| 1861 | } |
| 1862 | } |
| 1863 | if (HIWORD(GetQueueStatus(QS_ALLEVENTS))) // See DIALOG_PREP for explanation. |
| 1864 | MsgSleep(-1); |
| 1865 | } |
nothing calls this directly
no test coverage detected