aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/ScintillaHistory.html7
-rw-r--r--gtk/ScintillaGTK.cxx35
-rw-r--r--gtk/ScintillaGTK.h2
-rw-r--r--scripts/HeaderOrder.txt1
4 files changed, 44 insertions, 1 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 4f45fcb95..f36226cd2 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -501,12 +501,13 @@
<td>jedailey</td>
<td>oirfeodent</td>
<td>A-R-C-A</td>
- </tr>
</tr><tr>
<td>Roberto Rossi</td>
<td>Kenny Liu</td>
<td>Iain Clarke</td>
<td>desto</td>
+ </tr><tr>
+ <td>John Flatness</td>
</tr>
</table>
<p>
@@ -562,6 +563,10 @@
Fix display of autocompletion lists and calltips on GTK+ 3.22 on Wayland.
Newer APIs used on GTK+ 3.22 as older APIs were deprecated.
</li>
+ <li>
+ Make trackpad scrolling work on Wayland.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1901/">Bug #1901</a>.
+ </li>
</ul>
<h3>
<a href="http://www.scintilla.org/scite372.zip">Release 3.7.2</a>
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx
index 753a52c3b..993aa8fbd 100644
--- a/gtk/ScintillaGTK.cxx
+++ b/gtk/ScintillaGTK.cxx
@@ -7,6 +7,7 @@
#include <string.h>
#include <stdio.h>
#include <time.h>
+#include <math.h>
#include <assert.h>
#include <ctype.h>
@@ -22,6 +23,9 @@
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
+#if defined(GDK_WINDOWING_WAYLAND)
+#include <gdk/gdkwayland.h>
+#endif
#if defined(__WIN32__) || defined(_MSC_VER)
#include <windows.h>
@@ -165,6 +169,8 @@ ScintillaGTK::ScintillaGTK(_ScintillaObject *sci_) :
im_context(NULL), lastNonCommonScript(PANGO_SCRIPT_INVALID_CODE),
lastWheelMouseDirection(0),
wheelMouseIntensity(0),
+ smoothScrollY(0),
+ smoothScrollX(0),
rgnUpdate(0),
repaintFullWindow(false),
styleIdleID(0),
@@ -545,11 +551,21 @@ void ScintillaGTK::Initialise() {
parentClass = reinterpret_cast<GtkWidgetClass *>(
g_type_class_ref(gtk_container_get_type()));
+ gint maskSmooth = 0;
+#if defined(GDK_WINDOWING_WAYLAND)
+ GdkDisplay *pdisplay = gdk_display_get_default();
+ if (GDK_IS_WAYLAND_DISPLAY(pdisplay)) {
+ // On Wayland, touch pads only produce smooth scroll events
+ maskSmooth = GDK_SMOOTH_SCROLL_MASK;
+ }
+#endif
+
gtk_widget_set_can_focus(PWidget(wMain), TRUE);
gtk_widget_set_sensitive(PWidget(wMain), TRUE);
gtk_widget_set_events(PWidget(wMain),
GDK_EXPOSURE_MASK
| GDK_SCROLL_MASK
+ | maskSmooth
| GDK_STRUCTURE_MASK
| GDK_KEY_PRESS_MASK
| GDK_KEY_RELEASE_MASK
@@ -1784,6 +1800,25 @@ gint ScintillaGTK::ScrollEvent(GtkWidget *widget, GdkEventScroll *event) {
if (widget == NULL || event == NULL)
return FALSE;
+#if defined(GDK_WINDOWING_WAYLAND)
+ if (event->direction == GDK_SCROLL_SMOOTH) {
+ const int smoothScrollFactor = 4;
+ sciThis->smoothScrollY += event->delta_y * smoothScrollFactor;
+ sciThis->smoothScrollX += event->delta_x * smoothScrollFactor;;
+ if (ABS(sciThis->smoothScrollY) >= 1.0) {
+ const int scrollLines = trunc(sciThis->smoothScrollY);
+ sciThis->ScrollTo(sciThis->topLine + scrollLines);
+ sciThis->smoothScrollY -= scrollLines;
+ }
+ if (ABS(sciThis->smoothScrollX) >= 1.0) {
+ const int scrollPixels = trunc(sciThis->smoothScrollX);
+ sciThis->HorizontalScrollTo(sciThis->xOffset + scrollPixels);
+ sciThis->smoothScrollX -= scrollPixels;
+ }
+ return TRUE;
+ }
+#endif
+
// Compute amount and direction to scroll (even tho on win32 there is
// intensity of scrolling info in the native message, gtk doesn't
// support this so we simulate similarly adaptive scrolling)
diff --git a/gtk/ScintillaGTK.h b/gtk/ScintillaGTK.h
index 35778c520..6f69661f2 100644
--- a/gtk/ScintillaGTK.h
+++ b/gtk/ScintillaGTK.h
@@ -57,6 +57,8 @@ class ScintillaGTK : public ScintillaBase {
GTimeVal lastWheelMouseTime;
gint lastWheelMouseDirection;
gint wheelMouseIntensity;
+ gdouble smoothScrollY;
+ gdouble smoothScrollX;
#if GTK_CHECK_VERSION(3,0,0)
cairo_rectangle_list_t *rgnUpdate;
diff --git a/scripts/HeaderOrder.txt b/scripts/HeaderOrder.txt
index 98efd3074..43afd5c43 100644
--- a/scripts/HeaderOrder.txt
+++ b/scripts/HeaderOrder.txt
@@ -45,6 +45,7 @@
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
+#include <gdk/gdkwayland.h>
#include <gtk/gtk-a11y.h>
// Windows headers