bool FixPopupMenuHWnd(HWND hWnd, int& x, int& y) { bool bProcessed = false; // Seems like that is required(?) for Far's EMenu only // and can harm other applications: gh#112, gh#357 if (ghConEmuWndDC && (hWnd != hInTrackPopupMenu) && (gFarMode.cbSize == sizeof(gFarMode)) && gFarMode.bFarHookMode) { // We have to ensure that hWnd is on top (has focus) because menu expects that GuiSetForeground(hWnd); // Far Manager related (EMenu especially) if (gFarMode.bPopupMenuPos) { gFarMode.bPopupMenuPos = FALSE; // one time POINT pt; GetCursorPos(&pt); x = pt.x; y = pt.y; } bProcessed = true; } return bProcessed; }
BOOL WINAPI OnSetForegroundWindow(HWND hWnd) { //typedef BOOL (WINAPI* OnSetForegroundWindow_t)(HWND hWnd); ORIGINAL_EX(SetForegroundWindow); BOOL lbRc = FALSE; if (ghConEmuWndDC) { if (hWnd == ghConEmuWndDC) hWnd = ghConEmuWnd; lbRc = GuiSetForeground(hWnd); } // ConEmu наверное уже все сделал, но на всякий случай, дернем и здесь if (F(SetForegroundWindow) != NULL) { lbRc = F(SetForegroundWindow)(hWnd); //if (gbShowOnSetForeground && lbRc) //{ // if (IsWindow(hWnd) && !IsWindowVisible(hWnd)) // ShowWindow(hWnd, SW_SHOW); //} } return lbRc; }
// !!! UNDOCUMENTED !!! // Old note: Required for bring create dialog on top (Z-order) during shell operations // Does this mention "Run as" (pre-UAC) // or Explorer's choose application (start using) - can't remember. // New note: It's required for proper function of ChooseColor functions INT_PTR WINAPI OnDialogBoxIndirectParamAorW(HINSTANCE hInstance, LPCDLGTEMPLATE hDialogTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam, DWORD Flags) { //typedef INT_PTR (WINAPI* OnDialogBoxIndirectParamAorW_t)(HINSTANCE hInstance, LPCDLGTEMPLATE hDialogTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam, DWORD Flags); ORIGINALFASTEX(DialogBoxIndirectParamAorW,NULL); INT_PTR iRc = 0; if (ghConEmuWndDC) { // Необходимо "поднять" наверх консольное окно, иначе Shell-овский диалог окажется ПОД ConEmu GuiSetForeground(hWndParent ? hWndParent : ghConWnd); // bugreport from Andrey Budko: conemu + emenu/{Run Sandboxed} замораживает фар PatchDialogParentWnd(hWndParent); } if (F(DialogBoxIndirectParamAorW)) iRc = F(DialogBoxIndirectParamAorW)(hInstance, hDialogTemplate, hWndParent, lpDialogFunc, dwInitParam, Flags); return iRc; }