Ticket #8188: NewEnhancedRaise.diff

File NewEnhancedRaise.diff, 1.7 KB (added by devine, 13 years ago)

A new version of Auto-raise enhancement for Workspaces following Axel's advice.

  • src/apps/workspaces/Workspaces.cpp

    diff --git a/src/apps/workspaces/Workspaces.cpp b/src/apps/workspaces/Workspaces.cpp
    index 043fd18..83190ad 100644
    a b WorkspacesView::MouseMoved(BPoint where, uint32 transit,  
    533533    // Auto-Raise
    534534
    535535    where = ConvertToScreen(where);
    536     BScreen screen(window);
    537     BRect frame = screen.Frame();
    538     if (where.x == frame.left || where.x == frame.right
    539         || where.y == frame.top || where.y == frame.bottom) {
    540         // cursor is on screen edge
    541         if (window->Frame().Contains(where))
    542             window->Activate();
    543     }
     536    BRect screenFrame = BScreen(window).Frame();
     537   
     538    if (where.x != screenFrame.left && where.x != screenFrame.right
     539        && where.y != screenFrame.top && where.y != screenFrame.bottom)
     540            return;
     541    else {
     542        BMessage settings;
     543        BRect windowFrame = window->Frame();
     544        float offset = kScreenBorderOffset / 2.0;
     545       
     546        if (window->GetDecoratorSettings(&settings) == B_OK){
     547            BRect tabFrame = settings.FindRect("tab frame"); // Frame of the decorator tab
     548            if (tabFrame.top <= screenFrame.top){ // Take into account tab height.
     549                windowFrame.InsetBy(-(offset), -(tabFrame.bottom + offset));
     550                if (screenFrame.Contains(windowFrame) && windowFrame.Contains(where))
     551                    window->Activate();
     552            } else { // Not at top, SAT decor turned on.
     553                windowFrame.InsetBy(-(offset), -(offset));
     554                if (screenFrame.Contains(windowFrame) && windowFrame.Contains(where))
     555                    window->Activate();
     556            }   
     557        } else { //Window at edge within offset, without SAT Decor enabled.
     558            windowFrame.InsetBy(-(offset), -(offset)); //We should still be lenient!
     559            if (screenFrame.Contains(windowFrame) && windowFrame.Contains(where))
     560                window->Activate();
     561        }
     562    }
    544563}
    545564
    546565