From 9bb8d3a40ad2e74fe7d6aaf1c6b1c5cb8d604305 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 25 Aug 2019 10:40:53 +0200 Subject: [PATCH] Tracker InfoWindow: fix regressions - Misplaced popup window for showing truncated paths in full (#15301) - Crash when using Alt + E to edit the filename (#15302) - "Link To" information for symlinks does not fit in window (#15303) Change-Id: I72416ab4473e0b01c33817b9364eb9e9e59172e1 Reviewed-on: https://review.haiku-os.org/c/haiku/+/1747 Reviewed-by: waddlesplash --- src/kits/tracker/Jamfile | 1 + src/kits/tracker/infowindow/GeneralInfoView.cpp | 17 +++++++---------- src/kits/tracker/infowindow/InfoWindow.cpp | 3 ++- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/kits/tracker/Jamfile b/src/kits/tracker/Jamfile index 875c96b19e..632dc947d9 100644 --- a/src/kits/tracker/Jamfile +++ b/src/kits/tracker/Jamfile @@ -120,6 +120,7 @@ DoCatalogs libtracker.so : FindPanel.cpp FSClipboard.cpp FSUtils.cpp + GeneralInfoView.cpp InfoWindow.cpp LocalizedFolders.h Model.cpp diff --git a/src/kits/tracker/infowindow/GeneralInfoView.cpp b/src/kits/tracker/infowindow/GeneralInfoView.cpp index 6373cb380b..b071f56f81 100644 --- a/src/kits/tracker/infowindow/GeneralInfoView.cpp +++ b/src/kits/tracker/infowindow/GeneralInfoView.cpp @@ -188,7 +188,10 @@ GeneralInfoView::GeneralInfoView(Model* model) // Keep some free space for the stuff we print ourselves float lineHeight = CurrentFontHeight(); - GroupLayout()->SetInsets(kBorderMargin, lineHeight * 7, + int lineCount = 7; + if (model->IsSymLink()) + lineCount += 1; // Add space for "Link to" line + GroupLayout()->SetInsets(kBorderMargin, lineHeight * lineCount, B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING); // Add a preferred handler pop-up menu if this item @@ -553,9 +556,7 @@ GeneralInfoView::MouseMoved(BPoint where, uint32, const BMessage* dragMessage) if (font.StringWidth(fPathStr.String()) > maxWidth) { fTrackingState = no_track; - BRect rect(fPathRect); - rect.OffsetBy(Window()->Frame().left, - Window()->Frame().top); + BRect rect = ConvertToScreen(fPathRect); if (fPathWindow == NULL || BMessenger(fPathWindow).IsValid() == false) { @@ -572,9 +573,7 @@ GeneralInfoView::MouseMoved(BPoint where, uint32, const BMessage* dragMessage) if (font.StringWidth(fLinkToStr.String()) > maxWidth) { fTrackingState = no_track; - BRect rect(fLinkRect); - rect.OffsetBy(Window()->Frame().left, - Window()->Frame().top); + BRect rect = ConvertToScreen(fLinkRect); if (!fLinkWindow || BMessenger(fLinkWindow).IsValid() == false) { @@ -587,9 +586,7 @@ GeneralInfoView::MouseMoved(BPoint where, uint32, const BMessage* dragMessage) } else if (fDescRect.Contains(point) && font.StringWidth(fDescStr.String()) > maxWidth) { fTrackingState = no_track; - BRect rect(fDescRect); - rect.OffsetBy(Window()->Frame().left, - Window()->Frame().top); + BRect rect = ConvertToScreen(fDescRect); if (!fDescWindow || BMessenger(fDescWindow).IsValid() == false) { diff --git a/src/kits/tracker/infowindow/InfoWindow.cpp b/src/kits/tracker/infowindow/InfoWindow.cpp index a86b7f18f1..a36db15021 100644 --- a/src/kits/tracker/infowindow/InfoWindow.cpp +++ b/src/kits/tracker/infowindow/InfoWindow.cpp @@ -129,7 +129,8 @@ BInfoWindow::BInfoWindow(Model* model, int32 group_index, if (TargetModel()->InitCheck() != B_OK) return; - AddChild(new HeaderView(TargetModel())); + fHeaderView = new HeaderView(TargetModel()); + AddChild(fHeaderView); BTabView* tabView = new BTabView("tabs"); tabView->SetBorder(B_NO_BORDER); AddChild(tabView);