aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil Hodgson <nyamatongwe@gmail.com>2023-02-28 16:42:55 +1100
committerNeil Hodgson <nyamatongwe@gmail.com>2023-02-28 16:42:55 +1100
commita55079bdcea7f3bbaae726166890841eb1ad1c2f (patch)
tree92f1fb8e05e87bfec6cfafbb1a7c12c932b60308
parent0af575240f85b65e2a80eac8baddc38cd45eaf31 (diff)
downloadscintilla-mirror-a55079bdcea7f3bbaae726166890841eb1ad1c2f.tar.gz
Cache client rectangle when view resized. That makes it safer to access from
secondary threads.
-rwxr-xr-xgtk/ScintillaGTK.cxx8
-rwxr-xr-xgtk/ScintillaGTK.h3
2 files changed, 10 insertions, 1 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx
index fb852e637..ab415e743 100755
--- a/gtk/ScintillaGTK.cxx
+++ b/gtk/ScintillaGTK.cxx
@@ -402,6 +402,7 @@ void ScintillaGTK::MapThis() {
wMain.SetCursor(Window::Cursor::arrow);
scrollbarv.SetCursor(Window::Cursor::arrow);
scrollbarh.SetCursor(Window::Cursor::arrow);
+ SetClientRectangle();
ChangeSize();
gdk_window_show(PWindow(wMain));
} catch (...) {
@@ -1061,8 +1062,12 @@ void ScintillaGTK::FullPaint() {
wText.InvalidateAll();
}
+void ScintillaGTK::SetClientRectangle() {
+ rectangleClient = wMain.GetClientPosition();
+}
+
PRectangle ScintillaGTK::GetClientRectangle() const {
- PRectangle rc = wMain.GetClientPosition();
+ PRectangle rc = rectangleClient;
if (verticalScrollBarVisible)
rc.right -= verticalScrollBarWidth;
if (horizontalScrollBarVisible && !Wrapping())
@@ -1788,6 +1793,7 @@ void ScintillaGTK::Resize(int width, int height) {
gtk_widget_hide(GTK_WIDGET(PWidget(scrollbarv)));
verticalScrollBarWidth = 0;
}
+ SetClientRectangle();
if (IS_WIDGET_MAPPED(PWidget(wMain))) {
ChangeSize();
} else {
diff --git a/gtk/ScintillaGTK.h b/gtk/ScintillaGTK.h
index a1ce05969..7c9b165cb 100755
--- a/gtk/ScintillaGTK.h
+++ b/gtk/ScintillaGTK.h
@@ -33,6 +33,8 @@ class ScintillaGTK : public ScintillaBase {
int verticalScrollBarWidth;
int horizontalScrollBarHeight;
+ PRectangle rectangleClient;
+
SelectionText primary;
SelectionPosition posPrimary;
@@ -128,6 +130,7 @@ private:
bool HaveMouseCapture() override;
bool PaintContains(PRectangle rc) override;
void FullPaint();
+ void SetClientRectangle();
PRectangle GetClientRectangle() const override;
void ScrollText(Sci::Line linesToMove) override;
void SetVerticalScrollPos() override;