static VOID CALLBACK TrayIconAutoHideTimer(HWND hwnd, UINT, UINT_PTR idEvent, DWORD) { KillTimer(hwnd, idEvent); HWND hwndClui = pcli->hwndContactList; HWND ActiveWindow = GetActiveWindow(); if (ActiveWindow == hwndClui) return; if (CLUI_CheckOwnedByClui(ActiveWindow)) return; CListMod_HideWindow(); SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1); }
int cliShowHide(WPARAM wParam,LPARAM lParam) { BOOL bShow = FALSE; int iVisibleState = GetWindowVisibleState(pcli->hwndContactList,0,0); int method; method=ModernGetSettingByte(NULL, "ModernData", "HideBehind", SETTING_HIDEBEHIND_DEFAULT);; //(0-none, 1-leftedge, 2-rightedge); if (method) { if (ModernGetSettingByte(NULL, "ModernData", "BehindEdge", SETTING_BEHINDEDGE_DEFAULT)==0 && lParam!=1) { //hide CLUI_HideBehindEdge(); } else { CLUI_ShowFromBehindEdge(); } bShow=TRUE; iVisibleState=GWVS_HIDDEN; } if (!method && ModernGetSettingByte(NULL, "ModernData", "BehindEdge", SETTING_BEHINDEDGE_DEFAULT)>0) { g_CluiData.bBehindEdgeSettings=ModernGetSettingByte(NULL, "ModernData", "BehindEdge", SETTING_BEHINDEDGE_DEFAULT); CLUI_ShowFromBehindEdge(); g_CluiData.bBehindEdgeSettings=0; g_CluiData.nBehindEdgeState=0; ModernDeleteSetting(NULL, "ModernData", "BehindEdge"); } //bShow is FALSE when we enter the switch if no hide behind edge. switch (iVisibleState) { case GWVS_PARTIALLY_COVERED: bShow = TRUE; break; case GWVS_COVERED: //Fall through (and we're already falling) bShow = TRUE; break; case GWVS_HIDDEN: bShow = TRUE; break; case GWVS_VISIBLE: //This is not needed, but goes for readability. bShow = FALSE; break; case -1: //We can't get here, both pcli->hwndContactList and iStepX and iStepY are right. return 0; } if( (bShow == TRUE || lParam == 1) ) { Sync( CLUIFrames_ActivateSubContainers, TRUE ); CLUI_ShowWindowMod(pcli->hwndContactList, SW_RESTORE); if (!ModernGetSettingByte(NULL,"CList","OnDesktop",SETTING_ONDESKTOP_DEFAULT)) { Sync(CLUIFrames_OnShowHide, pcli->hwndContactList,1); //TO BE PROXIED SetWindowPos(pcli->hwndContactList, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE |SWP_NOACTIVATE); g_bCalledFromShowHide=1; if (!ModernGetSettingByte(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT)) SetWindowPos(pcli->hwndContactList, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); g_bCalledFromShowHide=0; } else { SetWindowPos(pcli->hwndContactList, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); Sync(CLUIFrames_OnShowHide, pcli->hwndContactList,1); SetForegroundWindow(pcli->hwndContactList); } ModernWriteSettingByte(NULL,"CList","State",SETTING_STATE_NORMAL); RECT rcWindow; GetWindowRect(pcli->hwndContactList,&rcWindow); if (Utils_AssertInsideScreen(&rcWindow) == 1) { MoveWindow(pcli->hwndContactList, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, TRUE); } //if (DBGetContactSettingByte(NULL,"CList","OnDesktop",SETTING_ONDESKTOP_DEFAULT)) // SetWindowPos(pcli->hwndContactList, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } else { //It needs to be hidden if (GetWindowLong(pcli->hwndContactList, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) { CListMod_HideWindow(pcli->hwndContactList, SW_HIDE); ModernWriteSettingByte(NULL,"CList","State",SETTING_STATE_HIDDEN); } else { if (ModernGetSettingByte(NULL,"CList","Min2Tray",SETTING_MIN2TRAY_DEFAULT)) { CLUI_ShowWindowMod(pcli->hwndContactList, SW_HIDE); ModernWriteSettingByte(NULL,"CList","State",SETTING_STATE_HIDDEN); } else { CLUI_ShowWindowMod(pcli->hwndContactList, SW_MINIMIZE); ModernWriteSettingByte(NULL,"CList","State",SETTING_STATE_MINIMIZED); } } if (MySetProcessWorkingSetSize != NULL) MySetProcessWorkingSetSize(GetCurrentProcess(),-1,-1); } return 0; }