diff options
| -rwxr-xr-x | gtk/ScintillaGTK.cxx | 14 | ||||
| -rwxr-xr-x | gtk/ScintillaGTK.h | 2 | 
2 files changed, 5 insertions, 11 deletions
| diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index 03213c500..5e4abd13c 100755 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -172,6 +172,7 @@ ScintillaGTK::ScintillaGTK(_ScintillaObject *sci_) :  	atomSought(nullptr),  	im_context(nullptr),  	lastNonCommonScript(PANGO_SCRIPT_INVALID_CODE), +	lastWheelMouseTime(0),  	lastWheelMouseDirection(0),  	wheelMouseIntensity(0),  	smoothScrollY(0), @@ -201,8 +202,6 @@ ScintillaGTK::ScintillaGTK(_ScintillaObject *sci_) :  #else  	linesPerScroll = 4;  #endif -	lastWheelMouseTime.tv_sec = 0; -	lastWheelMouseTime.tv_usec = 0;  	Init();  } @@ -1893,13 +1892,8 @@ gint ScintillaGTK::ScrollEvent(GtkWidget *widget, GdkEventScroll *event) {  			cLineScroll = 4;  		sciThis->wheelMouseIntensity = cLineScroll;  #else -		int timeDelta = 1000000; -		GTimeVal curTime; -		g_get_current_time(&curTime); -		if (curTime.tv_sec == sciThis->lastWheelMouseTime.tv_sec) -			timeDelta = curTime.tv_usec - sciThis->lastWheelMouseTime.tv_usec; -		else if (curTime.tv_sec == sciThis->lastWheelMouseTime.tv_sec + 1) -			timeDelta = 1000000 + (curTime.tv_usec - sciThis->lastWheelMouseTime.tv_usec); +		const gint64 curTime = g_get_monotonic_time(); +		const gint64 timeDelta = curTime - sciThis->lastWheelMouseTime;  		if ((event->direction == sciThis->lastWheelMouseDirection) && (timeDelta < 250000)) {  			if (sciThis->wheelMouseIntensity < 12)  				sciThis->wheelMouseIntensity++; @@ -1910,11 +1904,11 @@ gint ScintillaGTK::ScrollEvent(GtkWidget *widget, GdkEventScroll *event) {  				cLineScroll = 4;  			sciThis->wheelMouseIntensity = cLineScroll;  		} +		sciThis->lastWheelMouseTime = curTime;  #endif  		if (event->direction == GDK_SCROLL_UP || event->direction == GDK_SCROLL_LEFT) {  			cLineScroll *= -1;  		} -		g_get_current_time(&sciThis->lastWheelMouseTime);  		sciThis->lastWheelMouseDirection = event->direction;  		// Note:  Unpatched versions of win32gtk don't set the 'state' value so diff --git a/gtk/ScintillaGTK.h b/gtk/ScintillaGTK.h index 357efee8a..516115acc 100755 --- a/gtk/ScintillaGTK.h +++ b/gtk/ScintillaGTK.h @@ -53,7 +53,7 @@ class ScintillaGTK : public ScintillaBase {  	// Wheel mouse support  	unsigned int linesPerScroll; -	GTimeVal lastWheelMouseTime; +	gint64 lastWheelMouseTime;  	gint lastWheelMouseDirection;  	gint wheelMouseIntensity;  	gdouble smoothScrollY; | 
