MCPcopy Create free account
hub / github.com/bumptop/BumpTop / OnTimer

Method OnTimer

trunk/win/Source/BT_WindowsOS.cpp:2438–2691  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2436}
2437
2438void WindowsSystem::OnTimer(WPARAM wParam)
2439{
2440 if (wParam == checkForToggleDesktopTimerCallback)
2441 {
2442 // Problem: when we're in Show Desktop mode, the normal shellview-style Desktop gets keyboard focus
2443 // (even though it's obscured by the BumpTop desktop window)
2444 // Solution: if we detect that we're in the Show Desktop mode, and if the topmost window that Bumptop is attached to
2445 // (its grandfather) is the foreground window, there are two possibilities: either Bumptop
2446 // has keyboard focus, or the shellview-style desktop has keyboard focus. Unfortunately, I
2447 // couldn't find a way to find out which one; I tried AttachThreadInput and GetActiveWindow,
2448 // AttachThreadInput and GetFocus, as well as GetGUIThreadInfo. So, what I do is just give
2449 // BumpTop focus whenever its grandfather is the foreground window
2450
2451 if (winOS->GetWindowState() == WorkArea && winOS->IsInShowDesktopMode() && winOS->IsGrandfatherForegroundWindow())
2452 {
2453 winOS->SetFocusOnWindow();
2454 statsManager->getStats().bt.window.activatedFromShowDesktop++;
2455 }
2456
2457 // Problem: sometimes BumpTop fails in attaching itself to the desktop
2458 // Solution: check if BumpTop had failed, and if there is something to attach to,
2459 // and if so, try to reattach again
2460
2461 if (!GLOBAL(exitBumpTopFlag) && winOS->GetWindowState() == WorkArea && !winOS->isAttachedToDesktopWindow() && NULL != FindWindowEx(FindWindow(L"Progman", NULL), NULL, L"SHELLDLL_DefView", NULL))
2462 {
2463 winOS->attachToDesktopWindow();
2464 }
2465
2466 // Problem: when you have only one window in Windows XP and hit Alt-Tab, BumpTop disappears
2467 // this is because the FolderView sibling for some reason is moved up in the z-order
2468 // Solution: detect this situation and move BumpTop up in the z-order
2469 if (!GLOBAL(exitBumpTopFlag) && winOS->GetWindowState() == WorkArea && winOS->isAttachedToDesktopWindow() && !winOS->isTopMostDesktopWindowChild())
2470 {
2471 winOS->makeTopWindow();
2472 }
2473 }
2474 else if (wParam == windowTimerCallback)
2475 {
2476 // check if the work area has changed
2477 if (!scnManager->isShellExtension && windowState == WorkArea)
2478 {
2479 ResizeWindow();
2480 }
2481
2482 // also check if the background has changed
2483 if (GLOBAL(settings).useWindowsBackgroundImage)
2484 {
2485 // We are comparing file sizes instead of paths since the path does not change
2486 static qint64 prevWallpaperFileSize = QFileInfo(GetWallPaperPath()).size();
2487 qint64 newWallpaperFileSize = QFileInfo(GetWallPaperPath()).size();
2488
2489 static WallPaperStyle prevWallpaperStyle = UNABLETOREAD;
2490 WallPaperStyle newWallpaperStyle = GetWallPaperStyle();
2491
2492 static ColorVal prevBackgroundColor = ColorVal(0,0,0,0);
2493 ColorVal newBackgroundColor = GetWindowsBackgroundColor();
2494
2495 bool somethingChanged = false;

Callers 1

onTimerMethod · 0.80

Calls 15

FindWindowFunction · 0.85
QFileInfoClass · 0.85
ColorValClass · 0.85
assertClass · 0.85
randFunction · 0.85
FadeAndDeleteActorFunction · 0.85
GLTextureObjectClass · 0.85
GetWindowStateMethod · 0.80
IsInShowDesktopModeMethod · 0.80
SetFocusOnWindowMethod · 0.80

Tested by

no test coverage detected