From 0af575240f85b65e2a80eac8baddc38cd45eaf31 Mon Sep 17 00:00:00 2001 From: Neil Hodgson Date: Mon, 27 Feb 2023 17:54:43 +1100 Subject: Cache client rectangle when view moved or sized. That allows access to it from secondary threads which otherwise shows warnings. --- cocoa/ScintillaCocoa.h | 2 ++ cocoa/ScintillaCocoa.mm | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'cocoa') diff --git a/cocoa/ScintillaCocoa.h b/cocoa/ScintillaCocoa.h index 4c1f10a97..402eeff20 100644 --- a/cocoa/ScintillaCocoa.h +++ b/cocoa/ScintillaCocoa.h @@ -103,6 +103,8 @@ private: bool isFirstResponder; bool isActive; + PRectangle rectangleClient; + bool enteredSetScrollingSize; bool GetPasteboardData(NSPasteboard *board, SelectionText *selectedText); diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index 4f4fa1b71..66962e148 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -737,10 +737,7 @@ Scintilla::Internal::Point ScintillaCocoa::GetVisibleOriginInMain() const { * The returned value is in document coordinates. */ PRectangle ScintillaCocoa::GetClientRectangle() const { - NSScrollView *scrollView = ScrollContainer(); - NSSize size = scrollView.contentView.bounds.size; - Point origin = GetVisibleOriginInMain(); - return PRectangle(origin.x, origin.y, origin.x+size.width, origin.y + size.height); + return rectangleClient; } //-------------------------------------------------------------------------------------------------- @@ -2033,6 +2030,10 @@ bool ScintillaCocoa::SetScrollingSize() { void ScintillaCocoa::Resize() { SetScrollingSize(); + + NSScrollView *scrollView = ScrollContainer(); + rectangleClient = NSRectToPRectangle(scrollView.contentView.bounds); + ChangeSize(); } -- cgit v1.2.3