summaryrefslogtreecommitdiff
path: root/extra/abiword/flicker.patch
blob: aca283982b1b602f77b4bfc9714b4b5d909924dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
From 46388f407c893123d9b3824a7570b050fc3b049b Mon Sep 17 00:00:00 2001
From: James Cameron <quozl@laptop.org>
Date: Thu, 17 Aug 2017 15:05:39 +1000
Subject: [PATCH] Fix flickering
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- in GR_Caret::s_blink_timeout, avoid repeated calls by stopping the
  timer, it will be restarted when needed,

- in GR_Caret::s_enable, avoid extra unnecessary _blink calls when blink
  is enabled, as they serve no purpose,

- in XAP_UnixFrameImpl::_fe::expose, use the Cairo clip rectangle
  instead of the expose event area, thanks to Hubert Figuière in
  865c1dda7e13deff04573ffc42028b71fee07f9c,

- in XAP_UnixFrameImpl::_fe::expose, do not return FALSE, as other
  handlers will need to handle the draw event,

- in GR_UnixCairoGraphics::flush, fix excessive draw events;
  gtk_widget_queue_draw only marks the widget as needing redrawing,
  which causes a draw event for each call to flush, therefore every
  caret blink, so use gdk_flush instead,

Fixes AbiSource #13791.
Fixes Debian #851052.
Fixes Fedora #1287835.
Fixes Ubuntu LP: #1574278.
Fixes Sugar Labs #4915.

Signed-off-by: James Cameron <quozl@laptop.org>
---
 src/af/gr/gtk/gr_UnixCairoGraphics.cpp |  4 +---
 src/af/gr/xp/gr_Caret.cpp              | 13 ++++---------
 src/af/xap/gtk/xap_UnixFrameImpl.cpp   | 27 ++++++++++++++++++---------
 src/af/xap/gtk/xap_UnixFrameImpl.h     |  2 +-
 4 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/src/af/gr/gtk/gr_UnixCairoGraphics.cpp b/src/af/gr/gtk/gr_UnixCairoGraphics.cpp
index 509bd37..7c3c06f 100644
--- a/src/af/gr/gtk/gr_UnixCairoGraphics.cpp
+++ b/src/af/gr/gtk/gr_UnixCairoGraphics.cpp
@@ -577,9 +577,7 @@ void GR_UnixCairoGraphics::_endPaint()
 
 void GR_UnixCairoGraphics::flush(void)
 {
-	if (m_Widget) {
-		gtk_widget_queue_draw(m_Widget);
-	}
+	gdk_flush();
 }
 
 bool GR_UnixCairoGraphics::queryProperties(GR_Graphics::Properties gp) const
diff --git a/src/af/gr/xp/gr_Caret.cpp b/src/af/gr/xp/gr_Caret.cpp
index 5d5d116..a8aa451 100644
--- a/src/af/gr/xp/gr_Caret.cpp
+++ b/src/af/gr/xp/gr_Caret.cpp
@@ -155,22 +155,17 @@ void GR_Caret::s_enable(UT_Worker * _w)
 {
 	GR_Caret * c = static_cast<GR_Caret *>(_w->getInstanceData());
 
+	c->m_enabler->stop();
 	c->m_worker->stop();
-	c->_blink(true);
-	if (!c->m_bCursorIsOn)
-		c->_blink(true); // blink again
-	else
-	{
-		c->_blink(true); // ?? - MARCM
-		c->_blink(true);
-	}
 	c->m_worker->start();
-	c->m_enabler->stop();
+	c->_blink(true);
 }
 
 void GR_Caret::s_blink_timeout(UT_Worker * _w)
 {
 	GR_Caret * c = static_cast<GR_Caret *>(_w->getInstanceData());
+
+	c->m_blinkTimeout->stop();
 	if (c->isEnabled())
 		c->disable();
 }
-- 
2.11.0