From 0e5e37f98b1856a58b6c7d0856f7cfc754721fca Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 22 May 2016 23:14:33 -0400 Subject: [PATCH] Fixed multilne entry changed events on GTK+. --- README.md | 1 + unix/multilineentry.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 68ff8f4b..81a9b4a1 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ This README is being written.
* Added `uiUserBugCannotSetParentOnToplevel()`, which should be used by implementations of toplevel controls in their `SetParent()` implementations. This will also be the beginning of consolidating common user bug messages into a single place, though this will be one of the only few exported user bug functions. * uiSpinbox and uiSlider now merely swap their min and max if min ≥ max. They will no longer panic and do nothing, respectively. * Matrix scaling will no longer leave the matrix in an invalid state on OS X and GTK+. + * `uiMultilineEntrySetText()` and `uiMutlilineEntryAppend()` on GTK+ no longer fire `OnChanged()` events. ## Runtime Requirements diff --git a/unix/multilineentry.c b/unix/multilineentry.c index 92f0e27e..09ffd460 100644 --- a/unix/multilineentry.c +++ b/unix/multilineentry.c @@ -44,8 +44,10 @@ char *uiMultilineEntryText(uiMultilineEntry *e) void uiMultilineEntrySetText(uiMultilineEntry *e, const char *text) { - // TODO does this send a changed signal? + // we need to inhibit sending of ::changed because this WILL send a ::changed otherwise + g_signal_handler_block(e->textbuf, e->onChangedSignal); gtk_text_buffer_set_text(e->textbuf, text, -1); + g_signal_handler_unblock(e->textbuf, e->onChangedSignal); } // TODO scroll to end? @@ -54,8 +56,10 @@ void uiMultilineEntryAppend(uiMultilineEntry *e, const char *text) GtkTextIter end; gtk_text_buffer_get_end_iter(e->textbuf, &end); - // TODO does this send a changed signal? + // we need to inhibit sending of ::changed because this WILL send a ::changed otherwise + g_signal_handler_block(e->textbuf, e->onChangedSignal); gtk_text_buffer_insert(e->textbuf, &end, text, -1); + g_signal_handler_unblock(e->textbuf, e->onChangedSignal); } void uiMultilineEntryOnChanged(uiMultilineEntry *e, void (*f)(uiMultilineEntry *e, void *data), void *data)