Skip to content

Commit f6ca9f8

Browse files
committed
better change handling in ientry
matrixview was detecting change incorrectly under load
1 parent bb13bcf commit f6ca9f8

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## master
22

3+
- better change handling in ientry improves matrixview behaviour
4+
35
## 9.0.4 2025/03/20
46

57
- revise image repaint

src/ientry.c

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,22 +149,33 @@ ientry_get_property(GObject *object,
149149
}
150150
}
151151

152+
static void
153+
ientry_set_text(iEntry *ientry, const char *text)
154+
{
155+
GtkEntryBuffer *buffer = gtk_entry_get_buffer(GTK_ENTRY(ientry->entry));
156+
157+
g_signal_handlers_block_matched(G_OBJECT(buffer),
158+
G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, ientry);
159+
160+
if (text &&
161+
!g_str_equal(text, ientry->text)) {
162+
gtk_entry_buffer_set_text(buffer, text, -1);
163+
VIPS_SETSTR(ientry->text, text);
164+
}
165+
166+
g_signal_handlers_unblock_matched(G_OBJECT(buffer),
167+
G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, ientry);
168+
}
169+
152170
static void
153171
ientry_set_property(GObject *object,
154172
guint prop_id, const GValue *value, GParamSpec *pspec)
155173
{
156174
iEntry *ientry = (iEntry *) object;
157175

158-
const char *text;
159-
160176
switch (prop_id) {
161177
case PROP_TEXT:
162-
text = g_value_get_string(value);
163-
if (text &&
164-
!g_str_equal(text, ientry->text)) {
165-
VIPS_SETSTR(ientry->text, text);
166-
gtk_editable_set_text(GTK_EDITABLE(ientry->entry), text);
167-
}
178+
ientry_set_text(ientry, g_value_get_string(value));
168179
break;
169180

170181
case PROP_WIDTH_CHARS:

0 commit comments

Comments
 (0)