diff options
| author | nyamatongwe <devnull@localhost> | 2010-05-26 07:50:58 +0000 | 
|---|---|---|
| committer | nyamatongwe <devnull@localhost> | 2010-05-26 07:50:58 +0000 | 
| commit | 08ba4aa4ff60d4aede42cc7dd160ff6b85eaab5e (patch) | |
| tree | 4e17351bd977fcb8d3330bcbeee9e74732b8548e /gtk/ScintillaGTK.cxx | |
| parent | 1ca6d19e45b14665ce347ba4153e796ce5e79b76 (diff) | |
| download | scintilla-mirror-08ba4aa4ff60d4aede42cc7dd160ff6b85eaab5e.tar.gz | |
Drawing optimizations adding a styling idle task redrawing less of the
selection margin and scrolling the window for caret movement when possible.
Diffstat (limited to 'gtk/ScintillaGTK.cxx')
| -rw-r--r-- | gtk/ScintillaGTK.cxx | 35 | 
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); | 
