aboutsummaryrefslogtreecommitdiffhomepage
path: root/gtk/ScintillaGTK.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'gtk/ScintillaGTK.cxx')
-rw-r--r--gtk/ScintillaGTK.cxx35
1 files changed, 27 insertions, 8 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx
index 617a232f5..a94cfcb13 100644
--- a/gtk/ScintillaGTK.cxx
+++ b/gtk/ScintillaGTK.cxx
@@ -256,7 +256,9 @@ private:
static void DragDataGet(GtkWidget *widget, GdkDragContext *context,
GtkSelectionData *selection_data, guint info, guint time);
static gint TimeOut(ScintillaGTK *sciThis);
- static gint IdleCallback(ScintillaGTK *sciThis);
+ static gboolean IdleCallback(ScintillaGTK *sciThis);
+ static gboolean StyleIdle(ScintillaGTK *sciThis);
+ virtual void QueueStyling(int upTo);
static void PopUpCB(ScintillaGTK *sciThis, guint action, GtkWidget *widget);
gint ExposeTextThis(GtkWidget *widget, GdkEventExpose *ose);
@@ -875,16 +877,17 @@ void ScintillaGTK::SetTicking(bool on) {
bool ScintillaGTK::SetIdle(bool on) {
if (on) {
// Start idler, if it's not running.
- if (idler.state == false) {
+ if (!idler.state) {
idler.state = true;
- idler.idlerID = reinterpret_cast<IdlerID>
- (gtk_idle_add((GtkFunction)IdleCallback, this));
+ idler.idlerID = reinterpret_cast<IdlerID>(
+ g_idle_add_full(G_PRIORITY_DEFAULT_IDLE,
+ reinterpret_cast<GSourceFunc>(IdleCallback), this, NULL));
}
} else {
// Stop idler, if it's running
- if (idler.state == true) {
+ if (idler.state) {
idler.state = false;
- gtk_idle_remove(GPOINTER_TO_UINT(idler.idlerID));
+ g_source_remove(GPOINTER_TO_UINT(idler.idlerID));
}
}
return true;
@@ -2311,8 +2314,8 @@ int ScintillaGTK::TimeOut(ScintillaGTK *sciThis) {
return 1;
}
-int ScintillaGTK::IdleCallback(ScintillaGTK *sciThis) {
- // Idler will be automatically stoped, if there is nothing
+gboolean ScintillaGTK::IdleCallback(ScintillaGTK *sciThis) {
+ // Idler will be automatically stopped, if there is nothing
// to do while idle.
bool ret = sciThis->Idle();
if (ret == false) {
@@ -2324,6 +2327,22 @@ int ScintillaGTK::IdleCallback(ScintillaGTK *sciThis) {
return ret;
}
+gboolean ScintillaGTK::StyleIdle(ScintillaGTK *sciThis) {
+ sciThis->IdleStyling();
+ // Idler will be automatically stopped
+ return FALSE;
+}
+
+void ScintillaGTK::QueueStyling(int upTo) {
+ Editor::QueueStyling(upTo);
+ if (!styleNeeded.active) {
+ // Only allow one style needed to be queued
+ styleNeeded.active = true;
+ g_idle_add_full(G_PRIORITY_HIGH_IDLE,
+ reinterpret_cast<GSourceFunc>(StyleIdle), this, NULL);
+ }
+}
+
void ScintillaGTK::PopUpCB(ScintillaGTK *sciThis, guint action, GtkWidget *) {
if (action) {
sciThis->Command(action);