diff --git a/large-sw.nix b/large-sw.nix index 3818a20..706fb55 100644 --- a/large-sw.nix +++ b/large-sw.nix @@ -13,6 +13,12 @@ # calibre goldendict + (xournalpp.overrideDerivation (_: { + patches = [ + ./xournalpp-cursor-blink.patch + ]; + })) + vscode ccls diff --git a/xournalpp-cursor-blink.patch b/xournalpp-cursor-blink.patch new file mode 100644 index 0000000..462c8e2 --- /dev/null +++ b/xournalpp-cursor-blink.patch @@ -0,0 +1,69 @@ +commit 92e4041efb6165505a8729968648392d7b5ff459 +Author: Gabriel Ebner +Date: Sun Aug 16 19:47:52 2020 +0200 + + Allow the user to disable cursor blinking. + + This uses the same setting which is also used by the built-in text entry + widget. + +diff --git a/src/gui/TextEditor.cpp b/src/gui/TextEditor.cpp +index 0750ad0e..807786cf 100644 +--- a/src/gui/TextEditor.cpp ++++ b/src/gui/TextEditor.cpp +@@ -37,6 +37,7 @@ TextEditor::TextEditor(XojPageView* gui, GtkWidget* widget, Text* text, bool own + gtk_text_buffer_place_cursor(this->buffer, &first); + + GtkSettings* settings = gtk_widget_get_settings(this->widget); ++ g_object_get(settings, "gtk-cursor-blink", &this->cursorBlink, nullptr); + g_object_get(settings, "gtk-cursor-blink-time", &this->cursorBlinkTime, nullptr); + g_object_get(settings, "gtk-cursor-blink-timeout", &this->cursorBlinkTimeout, nullptr); + +@@ -48,7 +49,12 @@ TextEditor::TextEditor(XojPageView* gui, GtkWidget* widget, Text* text, bool own + g_signal_connect(this->imContext, "retrieve-surrounding", G_CALLBACK(iMRetrieveSurroundingCallback), this); + g_signal_connect(this->imContext, "delete-surrounding", G_CALLBACK(imDeleteSurroundingCallback), this); + +- blinkCallback(this); ++ if (this->cursorBlink) { ++ blinkCallback(this); ++ } else { ++ this->cursorVisible = true; ++ } ++ + } + + TextEditor::~TextEditor() +@@ -654,12 +660,15 @@ void TextEditor::moveCursor(GtkMovementStep step, int count, bool extendSelectio + gtk_widget_error_bell(this->widget); + } + +- this->cursorVisible = false; +- if (this->blinkTimeout) +- { +- g_source_remove(this->blinkTimeout); +- } +- blinkCallback(this); ++ if (this->cursorBlink) { ++ this->cursorVisible = false; ++ if (this->blinkTimeout) { ++ g_source_remove(this->blinkTimeout); ++ } ++ blinkCallback(this); ++ } else { ++ repaintCursor(); ++ } + } + + void TextEditor::findPos(GtkTextIter* iter, double xPos, double yPos) +diff --git a/src/gui/TextEditor.h b/src/gui/TextEditor.h +index fdeb8b0f..008807b1 100644 +--- a/src/gui/TextEditor.h ++++ b/src/gui/TextEditor.h +@@ -108,6 +108,7 @@ private: + double markPosX = 0; + double markPosY = 0; + ++ bool cursorBlink = true; + int cursorBlinkTime = 0; + int cursorBlinkTimeout = 0; + int blinkTimeout = 0; // handler id