Ticket #4702: 6e6707714e348ba5e9397f5ab82b041644e95cb1.patch

File 6e6707714e348ba5e9397f5ab82b041644e95cb1.patch, 5.1 KB (added by waddlesplash, 4 years ago)
  • src/apps/workspaces/Workspaces.cpp

    From 479f26ae2feff0b616a2896664273432bdb571f7 Mon Sep 17 00:00:00 2001
    From: Augustin Cavalier <waddlesplash@gmail.com>
    Date: Sat, 17 Jan 2015 02:25:27 -0500
    Subject: [PATCH] Workspaces: fix #4702.
    
    This reverts commit 79f3690f4ae05b86f7405de517bda0b46aa9ea40.
    
    This was a hack to prevent flickering, and was the root cause of #4702.
    It doesn't appear to be needed anymore -- I couldn't get the
    Workspaces replicant to flicker -- and leaving it in breaks tracker_layout.
    ---
     src/apps/workspaces/Workspaces.cpp | 97 ++------------------------------------
     1 file changed, 5 insertions(+), 92 deletions(-)
    
    diff --git a/src/apps/workspaces/Workspaces.cpp b/src/apps/workspaces/Workspaces.cpp
    index 13493a5..0e262bf 100644
    a b class WorkspacesView : public BView { 
    101101        static  WorkspacesView* Instantiate(BMessage* archive);
    102102        virtual status_t Archive(BMessage* archive, bool deep = true) const;
    103103
    104         virtual void AttachedToWindow();
    105         virtual void DetachedFromWindow();
    106         virtual void FrameMoved(BPoint newPosition);
    107         virtual void FrameResized(float newWidth, float newHeight);
    108104        virtual void MessageReceived(BMessage* message);
    109105        virtual void MouseMoved(BPoint where, uint32 transit,
    110106            const BMessage* dragMessage);
    class WorkspacesView : public BView { 
    112108
    113109    private:
    114110        void _AboutRequested();
    115 
    116         void _UpdateParentClipping();
    117         void _ExcludeFromParentClipping();
    118         void _CleanupParentClipping();
    119 
    120         BView*  fParentWhichDrawsOnChildren;
    121         BRect   fCurrentFrame;
    122111};
    123112
    124113class WorkspacesWindow : public BWindow {
    WorkspacesSettings::SetWindowFrame(BRect frame) 
    338327
    339328WorkspacesView::WorkspacesView(BRect frame, bool showDragger=true)
    340329    :
    341     BView(frame, kDeskbarItemName, B_FOLLOW_ALL,
    342         kWorkspacesViewFlag | B_FRAME_EVENTS),
    343     fParentWhichDrawsOnChildren(NULL),
    344     fCurrentFrame(frame)
     330    BView(frame, kDeskbarItemName, B_FOLLOW_ALL, kWorkspacesViewFlag)
    345331{
    346332    if (showDragger) {
    347333        frame.OffsetTo(B_ORIGIN);
    WorkspacesView::WorkspacesView(BRect frame, bool showDragger=true) 
    356342
    357343WorkspacesView::WorkspacesView(BMessage* archive)
    358344    :
    359     BView(archive),
    360     fParentWhichDrawsOnChildren(NULL),
    361     fCurrentFrame(Frame())
     345    BView(archive)
    362346{
    363     // Just in case we are instantiated from an older archive...
    364     SetFlags(Flags() | B_FRAME_EVENTS);
    365347    // Make sure the auto-raise feature didn't leave any artifacts - this is
    366348    // not a good idea to keep enabled for a replicant.
    367349    if (EventMask() != 0)
    WorkspacesView::_AboutRequested() 
    429411
    430412
    431413void
    432 WorkspacesView::AttachedToWindow()
    433 {
    434     BView* parent = Parent();
    435     if (parent != NULL && (parent->Flags() & B_DRAW_ON_CHILDREN) != 0) {
    436         fParentWhichDrawsOnChildren = parent;
    437         _ExcludeFromParentClipping();
    438     }
    439 }
    440 
    441 
    442 void
    443 WorkspacesView::DetachedFromWindow()
    444 {
    445     if (fParentWhichDrawsOnChildren != NULL)
    446         _CleanupParentClipping();
    447 }
    448 
    449 
    450 void
    451 WorkspacesView::FrameMoved(BPoint newPosition)
    452 {
    453     _UpdateParentClipping();
    454 }
    455 
    456 
    457 void
    458 WorkspacesView::FrameResized(float newWidth, float newHeight)
    459 {
    460     _UpdateParentClipping();
    461 }
    462 
    463 
    464 void
    465 WorkspacesView::_UpdateParentClipping()
    466 {
    467     if (fParentWhichDrawsOnChildren != NULL) {
    468         _CleanupParentClipping();
    469         _ExcludeFromParentClipping();
    470         fParentWhichDrawsOnChildren->Invalidate(fCurrentFrame);
    471         fCurrentFrame = Frame();
    472     }
    473 }
    474 
    475 
    476 void
    477 WorkspacesView::_ExcludeFromParentClipping()
    478 {
    479     // Prevent the parent view to draw over us. Do so in a way that allows
    480     // restoring the parent to the previous state.
    481     fParentWhichDrawsOnChildren->PushState();
    482 
    483     BRegion clipping(fParentWhichDrawsOnChildren->Bounds());
    484     clipping.Exclude(Frame());
    485     fParentWhichDrawsOnChildren->ConstrainClippingRegion(&clipping);
    486 }
    487 
    488 
    489 void
    490 WorkspacesView::_CleanupParentClipping()
    491 {
    492     // Restore the previous parent state. NOTE: This relies on views
    493     // being detached in exactly the opposite order as them being
    494     // attached. Otherwise we would mess up states if a sibbling view did
    495     // the same thing we did in AttachedToWindow()...
    496     fParentWhichDrawsOnChildren->PopState();
    497 }
    498 
    499 
    500 void
    501414WorkspacesView::MessageReceived(BMessage* message)
    502415{
    503416    switch (message->what) {
    WorkspacesView::MouseDown(BPoint where) 
    652565
    653566WorkspacesWindow::WorkspacesWindow(WorkspacesSettings *settings)
    654567    :
    655     BWindow(settings->WindowFrame(), B_TRANSLATE_SYSTEM_NAME("Workspaces"), 
     568    BWindow(settings->WindowFrame(), B_TRANSLATE_SYSTEM_NAME("Workspaces"),
    656569        B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
    657570        B_AVOID_FRONT | B_WILL_ACCEPT_FIRST_CLICK, B_ALL_WORKSPACES),
    658571    fSettings(settings),
    WorkspacesWindow::MessageReceived(BMessage *message) 
    796709            else
    797710                SetLook(B_MODAL_WINDOW_LOOK);
    798711
    799             // No matter what the setting for title, 
     712            // No matter what the setting for title,
    800713            // we must force the border on
    801714            fSettings->SetHasBorder(true);
    802715            fSettings->SetHasTitle(enable);
    WorkspacesApp::ArgvReceived(int32 argc, char **argv) 
    970883BView* instantiate_deskbar_item()
    971884{
    972885    // Calculate the correct size of the Deskbar replicant first
    973    
     886
    974887    BScreen screen;
    975888    float screenWidth = screen.Frame().Width();
    976889    float screenHeight = screen.Frame().Height();