Ticket #4702: 6e6707714e348ba5e9397f5ab82b041644e95cb1.patch
File 6e6707714e348ba5e9397f5ab82b041644e95cb1.patch, 5.1 KB (added by , 9 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 { 101 101 static WorkspacesView* Instantiate(BMessage* archive); 102 102 virtual status_t Archive(BMessage* archive, bool deep = true) const; 103 103 104 virtual void AttachedToWindow();105 virtual void DetachedFromWindow();106 virtual void FrameMoved(BPoint newPosition);107 virtual void FrameResized(float newWidth, float newHeight);108 104 virtual void MessageReceived(BMessage* message); 109 105 virtual void MouseMoved(BPoint where, uint32 transit, 110 106 const BMessage* dragMessage); … … class WorkspacesView : public BView { 112 108 113 109 private: 114 110 void _AboutRequested(); 115 116 void _UpdateParentClipping();117 void _ExcludeFromParentClipping();118 void _CleanupParentClipping();119 120 BView* fParentWhichDrawsOnChildren;121 BRect fCurrentFrame;122 111 }; 123 112 124 113 class WorkspacesWindow : public BWindow { … … WorkspacesSettings::SetWindowFrame(BRect frame) 338 327 339 328 WorkspacesView::WorkspacesView(BRect frame, bool showDragger=true) 340 329 : 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) 345 331 { 346 332 if (showDragger) { 347 333 frame.OffsetTo(B_ORIGIN); … … WorkspacesView::WorkspacesView(BRect frame, bool showDragger=true) 356 342 357 343 WorkspacesView::WorkspacesView(BMessage* archive) 358 344 : 359 BView(archive), 360 fParentWhichDrawsOnChildren(NULL), 361 fCurrentFrame(Frame()) 345 BView(archive) 362 346 { 363 // Just in case we are instantiated from an older archive...364 SetFlags(Flags() | B_FRAME_EVENTS);365 347 // Make sure the auto-raise feature didn't leave any artifacts - this is 366 348 // not a good idea to keep enabled for a replicant. 367 349 if (EventMask() != 0) … … WorkspacesView::_AboutRequested() 429 411 430 412 431 413 void 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 void443 WorkspacesView::DetachedFromWindow()444 {445 if (fParentWhichDrawsOnChildren != NULL)446 _CleanupParentClipping();447 }448 449 450 void451 WorkspacesView::FrameMoved(BPoint newPosition)452 {453 _UpdateParentClipping();454 }455 456 457 void458 WorkspacesView::FrameResized(float newWidth, float newHeight)459 {460 _UpdateParentClipping();461 }462 463 464 void465 WorkspacesView::_UpdateParentClipping()466 {467 if (fParentWhichDrawsOnChildren != NULL) {468 _CleanupParentClipping();469 _ExcludeFromParentClipping();470 fParentWhichDrawsOnChildren->Invalidate(fCurrentFrame);471 fCurrentFrame = Frame();472 }473 }474 475 476 void477 WorkspacesView::_ExcludeFromParentClipping()478 {479 // Prevent the parent view to draw over us. Do so in a way that allows480 // 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 void490 WorkspacesView::_CleanupParentClipping()491 {492 // Restore the previous parent state. NOTE: This relies on views493 // being detached in exactly the opposite order as them being494 // attached. Otherwise we would mess up states if a sibbling view did495 // the same thing we did in AttachedToWindow()...496 fParentWhichDrawsOnChildren->PopState();497 }498 499 500 void501 414 WorkspacesView::MessageReceived(BMessage* message) 502 415 { 503 416 switch (message->what) { … … WorkspacesView::MouseDown(BPoint where) 652 565 653 566 WorkspacesWindow::WorkspacesWindow(WorkspacesSettings *settings) 654 567 : 655 BWindow(settings->WindowFrame(), B_TRANSLATE_SYSTEM_NAME("Workspaces"), 568 BWindow(settings->WindowFrame(), B_TRANSLATE_SYSTEM_NAME("Workspaces"), 656 569 B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, 657 570 B_AVOID_FRONT | B_WILL_ACCEPT_FIRST_CLICK, B_ALL_WORKSPACES), 658 571 fSettings(settings), … … WorkspacesWindow::MessageReceived(BMessage *message) 796 709 else 797 710 SetLook(B_MODAL_WINDOW_LOOK); 798 711 799 // No matter what the setting for title, 712 // No matter what the setting for title, 800 713 // we must force the border on 801 714 fSettings->SetHasBorder(true); 802 715 fSettings->SetHasTitle(enable); … … WorkspacesApp::ArgvReceived(int32 argc, char **argv) 970 883 BView* instantiate_deskbar_item() 971 884 { 972 885 // Calculate the correct size of the Deskbar replicant first 973 886 974 887 BScreen screen; 975 888 float screenWidth = screen.Frame().Width(); 976 889 float screenHeight = screen.Frame().Height();