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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
# HG changeset patch
# User Neil Hodgson <nyamatongwe@gmail.com>
# Date 1501291429 -36000
# Node ID 383b9c10d569932a0db878bc9f8b9f8acb21d4e3
# Parent 69fddf8f8a15101fdd7e670bcdc664f5e910ff99
Bug [#1876]. Fix scrollbar and corner drawing and flickering of text.
diff -r 69fddf8f8a15 -r 383b9c10d569 doc/ScintillaHistory.html
--- a/doc/ScintillaHistory.html Sat Jul 29 11:12:24 2017 +1000
+++ b/doc/ScintillaHistory.html Sat Jul 29 11:23:49 2017 +1000
@@ -580,6 +580,10 @@
<a href="http://sourceforge.net/p/scintilla/bugs/1949/">Bug #1949</a>.
</li>
<li>
+ On GTK+ fix drawing problems including incorrect scrollbar redrawing and flickering of text.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1876">Bug #1876</a>.
+ </li>
+ <li>
On Cocoa, fix doCommandBySelector but avoid double effect of 'delete'
key.
<a href="http://sourceforge.net/p/scintilla/bugs/1958">Bug #1958</a>.
diff -r 69fddf8f8a15 -r 383b9c10d569 gtk/ScintillaGTK.cxx
--- a/gtk/ScintillaGTK.cxx Sat Jul 29 11:12:24 2017 +1000
+++ b/gtk/ScintillaGTK.cxx Sat Jul 29 11:23:49 2017 +1000
@@ -297,7 +297,9 @@
gdk_window_set_cursor(PWindow(scrollbarh), cursor);
UnRefCursor(cursor);
- gtk_selection_add_targets(widget, GDK_SELECTION_PRIMARY,
+ g_signal_connect(PWidget(wSelection), "selection_get", G_CALLBACK(PrimarySelection), (gpointer) this);
+ g_signal_connect(PWidget(wSelection), "selection_clear_event", G_CALLBACK(PrimaryClear), (gpointer) this);
+ gtk_selection_add_targets(PWidget(wSelection), GDK_SELECTION_PRIMARY,
clipboardCopyTargets, nClipboardCopyTargets);
}
@@ -308,7 +310,7 @@
void ScintillaGTK::UnRealizeThis(GtkWidget *widget) {
try {
- gtk_selection_clear_targets(widget, GDK_SELECTION_PRIMARY);
+ gtk_selection_clear_targets(PWidget(wSelection), GDK_SELECTION_PRIMARY);
if (IS_WIDGET_MAPPED(widget)) {
gtk_widget_unmap(widget);
@@ -542,6 +544,8 @@
}
#endif
+ wSelection = gtk_invisible_new();
+
gtk_widget_set_can_focus(PWidget(wMain), TRUE);
gtk_widget_set_sensitive(PWidget(wMain), TRUE);
gtk_widget_set_events(PWidget(wMain),
@@ -664,6 +668,8 @@
accessible = 0;
}
+ wSelection.Destroy();
+
ScintillaBase::Finalise();
}
@@ -1336,16 +1342,16 @@
bool ScintillaGTK::OwnPrimarySelection() {
return ((gdk_selection_owner_get(GDK_SELECTION_PRIMARY)
- == PWindow(wMain)) &&
- (PWindow(wMain) != NULL));
+ == PWindow(wSelection)) &&
+ (PWindow(wSelection) != NULL));
}
void ScintillaGTK::ClaimSelection() {
// X Windows has a 'primary selection' as well as the clipboard.
// Whenever the user selects some text, we become the primary selection
- if (!sel.Empty() && IS_WIDGET_REALIZED(GTK_WIDGET(PWidget(wMain)))) {
+ if (!sel.Empty() && IS_WIDGET_REALIZED(GTK_WIDGET(PWidget(wSelection)))) {
primarySelection = true;
- gtk_selection_owner_set(GTK_WIDGET(PWidget(wMain)),
+ gtk_selection_owner_set(GTK_WIDGET(PWidget(wSelection)),
GDK_SELECTION_PRIMARY, GDK_CURRENT_TIME);
primary.Clear();
} else if (OwnPrimarySelection()) {
@@ -1554,6 +1560,27 @@
}
}
+void ScintillaGTK::PrimarySelection(GtkWidget *, GtkSelectionData *selection_data, guint info, guint, ScintillaGTK *sciThis) {
+ try {
+ if (SelectionOfGSD(selection_data) == GDK_SELECTION_PRIMARY) {
+ if (sciThis->primary.Empty()) {
+ sciThis->CopySelectionRange(&sciThis->primary);
+ }
+ sciThis->GetSelection(selection_data, info, &sciThis->primary);
+ }
+ } catch (...) {
+ sciThis->errorStatus = SC_STATUS_FAILURE;
+ }
+}
+
+gboolean ScintillaGTK::PrimaryClear(GtkWidget *widget, GdkEventSelection *event, ScintillaGTK *sciThis) {
+ sciThis->UnclaimSelection(event);
+ if (GTK_WIDGET_CLASS(sciThis->parentClass)->selection_clear_event) {
+ return GTK_WIDGET_CLASS(sciThis->parentClass)->selection_clear_event(widget, event);
+ }
+ return TRUE;
+}
+
void ScintillaGTK::Resize(int width, int height) {
//Platform::DebugPrintf("Resize %d %d\n", width, height);
//printf("Resize %d %d\n", width, height);
diff -r 69fddf8f8a15 -r 383b9c10d569 gtk/ScintillaGTK.h
--- a/gtk/ScintillaGTK.h Sat Jul 29 11:12:24 2017 +1000
+++ b/gtk/ScintillaGTK.h Sat Jul 29 11:23:49 2017 +1000
@@ -23,6 +23,7 @@
Window scrollbarh;
GtkAdjustment *adjustmentv;
GtkAdjustment *adjustmenth;
+ Window wSelection;
int verticalScrollBarWidth;
int horizontalScrollBarHeight;
@@ -139,6 +140,8 @@
static void ClipboardClearSelection(GtkClipboard* clip, void *data);
void UnclaimSelection(GdkEventSelection *selection_event);
+ static void PrimarySelection(GtkWidget *widget, GtkSelectionData *selection_data, guint info, guint time_stamp, ScintillaGTK *sciThis);
+ static gboolean PrimaryClear(GtkWidget *widget, GdkEventSelection *event, ScintillaGTK *sciThis);
void Resize(int width, int height);
// Callback functions
|