diff options
author | Neil Hodgson <nyamatongwe@gmail.com> | 2023-03-02 16:46:14 +1100 |
---|---|---|
committer | Neil Hodgson <nyamatongwe@gmail.com> | 2023-03-02 16:46:14 +1100 |
commit | c61df8742a4865ac9c67f8ed017248b82fe5574e (patch) | |
tree | d6872e88601bb6dcdcc0e7b93de125fd33312ca7 /cocoa/ScintillaCocoa.mm | |
parent | e18633f14c36732d007e8c5bb742cc7d3e69d22d (diff) | |
download | scintilla-mirror-c61df8742a4865ac9c67f8ed017248b82fe5574e.tar.gz |
Cache client size when view moved or sized. That allows access to it from
secondary threads which otherwise shows warnings.
Earlier approach of caching client rectangle failed to handle scrolling.
Diffstat (limited to 'cocoa/ScintillaCocoa.mm')
-rw-r--r-- | cocoa/ScintillaCocoa.mm | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index 4f4fa1b71..223c9dac0 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -732,15 +732,22 @@ Scintilla::Internal::Point ScintillaCocoa::GetVisibleOriginInMain() const { //-------------------------------------------------------------------------------------------------- /** + * Return the size of the client area which has been cached. + */ +Scintilla::Internal::Point ScintillaCocoa::ClientSize() const { + return sizeClient; +} + +//-------------------------------------------------------------------------------------------------- + +/** * Instead of returning the size of the inner view we have to return the visible part of it * in order to make scrolling working properly. * 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 NSRectToPRectangle(scrollView.contentView.bounds); } //-------------------------------------------------------------------------------------------------- @@ -2033,6 +2040,10 @@ bool ScintillaCocoa::SetScrollingSize() { void ScintillaCocoa::Resize() { SetScrollingSize(); + + const PRectangle rcClient = GetClientRectangle(); + sizeClient = Point(rcClient.Width(), rcClient.Height()); + ChangeSize(); } |