unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
@ 2021-12-20 20:42 Andrey Listopadov
  2021-12-21  1:27 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 23+ messages in thread
From: Andrey Listopadov @ 2021-12-20 20:42 UTC (permalink / raw)
  To: 52685

After PGTK was merged I've compiled Emacs with the required switch.  The
first thing I've noticed was that --with-xinput2 has no effect when
--with-pgtk switch is supplied, so I've removed it.  I'm not sure if
this is intentional or not.  The main issue now is that horizontal
scrolling with a touchpad no longer works for me. All horizontal events
are registered as mwheel-down events.

In GNU Emacs 29.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version
3.24.30, cairo version 1.17.4)
 of 2021-12-20 built on toolbox
Repository revision: eaa44ca40e8da9ba86e6e03b76b41fd6843661d6
Repository branch: master
Windowing system distributor 'System Description: Fedora Linux 35
(Workstation Edition)

Configured using:
 'configure --with-native-compilation --with-pgtk
 --prefix=/home/alist/.local'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PGTK PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS XIM
GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  isayt-mode: t
  smartparens-strict-mode: t
  smartparens-mode: t
  hl-todo-mode: t
  global-auto-revert-mode: t
  gcmh-mode: t
  which-key-mode: t
  recentf-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  editorconfig-mode: t
  csv-field-index-mode: t
  shell-dirtrack-mode: t
  pixel-scroll-precision-mode: t
  corfu-global-mode: t
  corfu-mode: t
  marginalia-mode: t
  vertico-mode: t
  minions-mode: t
  delete-selection-mode: t
  savehist-mode: t
  common-lisp-modes-mode: t
  override-global-mode: t
  straight-use-package-mode: t
  straight-package-neutering-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t

Load-path shadows:
/home/alist/.config/emacs/straight/build-29.0.50/transient/transient
hides /home/alist/.local/share/emacs/29.0.50/lisp/transient
/home/alist/.config/emacs/straight/build-29.0.50/xref/xref hides
/home/alist/.local/share/emacs/29.0.50/lisp/progmodes/xref
/home/alist/.config/emacs/straight/build-29.0.50/project/project hides
/home/alist/.local/share/emacs/29.0.50/lisp/progmodes/project
/home/alist/.config/emacs/straight/build-29.0.50/map/map hides
/home/alist/.local/share/emacs/29.0.50/lisp/emacs-lisp/map
/home/alist/.config/emacs/straight/build-29.0.50/let-alist/let-alist
hides /home/alist/.local/share/emacs/29.0.50/lisp/emacs-lisp/let-alist
/home/alist/.local/share/emacs/29.0.50/lisp/emacs-lisp/eieio-compat
hides /home/alist/.local/share/emacs/29.0.50/lisp/obsolete/eieio-compat

Features:
(shadow mail-extr emacsbug message yank-media rmc rfc822 mml mml-sec epa
epg rfc6068 epg-config mm-decode mm-bodies mm-encode mailabbrev
gmm-utils mailheader sendmail mule-util isayt disp-table flyspell ispell
smartparens-config smartparens-text smartparens-html smartparens-elixir
smartparens-clojure smartparens dumb-jump popup s hl-todo autorevert
filenotify init aoc ht aoc-autoloads ht-autoloads jdecomp-autoloads
esh-mode esh-cmd esh-ext esh-opt esh-proc esh-io esh-arg esh-module
esh-groups esh-util isayt-autoloads gcmh gcmh-autoloads which-key
which-key-autoloads dumb-jump-autoloads popup-autoloads recentf
tree-widget separedit-autoloads edit-indirect-autoloads server
project-autoloads xref-autoloads magit-todos-autoloads pcre2el-autoloads
hl-todo-autoloads f-autoloads s-autoloads async-autoloads
magit-autoloads magit-section-autoloads git-commit-autoloads
with-editor-autoloads transient-autoloads undo-tree diff
undo-tree-autoloads smartparens-autoloads flycheck-package package-lint
finder package url-handlers flycheck-package-autoloads
package-lint-autoloads let-alist pcase flymake-proc flymake editorconfig
editorconfig-autoloads vterm-autoloads doc-view jka-compr image-mode
exif dired dired-loaddefs elixir-mode elixir-format elixir-smie
elixir-mode-autoloads erlang tempo erlang-autoloads csv-mode sort
csv-mode-autoloads json-mode-autoloads json-snatcher-autoloads css-mode
smie sgml-mode facemenu eww xdg url-queue shr pixel-fill kinsoku svg xml
dom browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util url-parse auth-source eieio
eieio-core eieio-loaddefs password-cache url-vars mailcap puny mm-url
gnus nnheader gnus-util time-date mail-utils color lua-mode-autoloads
yaml-mode yaml-mode-autoloads racket-mode-autoloads sly-autoloads
clj-refactor-autoloads hydra-autoloads lv-autoloads
inflections-autoloads multiple-cursors-autoloads paredit-autoloads
yasnippet-autoloads flycheck-clj-kondo flycheck json map find-func dash
flycheck-clj-kondo-autoloads flycheck-autoloads let-alist-autoloads
dash-autoloads cider-autoloads sesman vc vc-dispatcher sesman-autoloads
spinner-autoloads queue-autoloads pkg-info-autoloads epl-autoloads
finder-inf parseedn-autoloads map-autoloads parseclj-autoloads
inferior-clojure derived clojure-mode lisp-mnt mail-parse rfc2231
rfc2047 rfc2045 mm-util ietf-drums mail-prsvr align thingatpt imenu
inf-lisp shell pcomplete clojure-mode-autoloads fennel-mode-autoloads
geiser-guile info-look geiser geiser-repl compile text-property-search
geiser-image geiser-company geiser-doc geiser-menu geiser-edit etags
fileloop generator xref project geiser-completion geiser-autodoc advice
geiser-eval geiser-connection tq geiser-syntax scheme geiser-log comint
ansi-color geiser-popup view geiser-guile-autoloads geiser-impl help-fns
radix-tree geiser-custom geiser-base geiser-autoloads
markdown-mode-autoloads ox-hugo-autoloads pixel-scroll ring formfeed
cape cape-autoloads corfu corfu-autoloads consult-autoloads marginalia
marginalia-autoloads vertico vertico-autoloads minions minions-autoloads
display-line-numbers modus-vivendi-theme modus-themes
modus-themes-autoloads delsel savehist comp comp-cstr warnings rx novice
cus-edit pp cus-load wid-edit font defaults edmacro kmacro
common-lisp-modes-mode functions local-config use-package
use-package-ensure use-package-delight use-package-diminish
use-package-bind-key bind-key easy-mmode use-package-core
use-package-autoloads bind-key-autoloads early-init straight-autoloads
info cl-seq cl-extra help-mode seq byte-opt straight subr-x cl-macs gv
cl-loaddefs cl-lib bytecomp byte-compile cconv iso-transl tooltip eldoc
paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode
mwheel term/pgtk-win pgtk-win term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice
button loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit pgtk lcms2 multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 439300 347003)
 (symbols 48 49273 658)
 (strings 32 120328 161276)
 (string-bytes 1 4376451)
 (vectors 16 46029)
 (vector-slots 8 783458 512099)
 (floats 8 340 1112)
 (intervals 56 409 120)
 (buffers 992 12))


-- 
Andrey Listopadov





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
  2021-12-20 20:42 bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk Andrey Listopadov
@ 2021-12-21  1:27 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-21  7:22   ` Andrey Listopadov
  2021-12-21 13:28   ` Yuuki Harano
  0 siblings, 2 replies; 23+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-12-21  1:27 UTC (permalink / raw)
  To: Andrey Listopadov; +Cc: Yuuki Harano, 52685

Andrey Listopadov <andreyorst@gmail.com> writes:

> After PGTK was merged I've compiled Emacs with the required switch.  The
> first thing I've noticed was that --with-xinput2 has no effect when
> --with-pgtk switch is supplied, so I've removed it.  I'm not sure if
> this is intentional or not.  The main issue now is that horizontal
> scrolling with a touchpad no longer works for me. All horizontal events
> are registered as mwheel-down events.

To answer your first question: since the PGTK build doesn't use X, the
--with-xinput2 option has no effect.

As for the second problem, I don't see the problem here, but I'm copying
in Yuuki as he might have some ideas.

Thanks.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
  2021-12-21  1:27 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-12-21  7:22   ` Andrey Listopadov
  2021-12-21  7:27     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-21 13:28   ` Yuuki Harano
  1 sibling, 1 reply; 23+ messages in thread
From: Andrey Listopadov @ 2021-12-21  7:22 UTC (permalink / raw)
  To: Po Lu; +Cc: Yuuki Harano, 52685

[-- Attachment #1: Type: text/plain, Size: 1105 bytes --]

вт, 21 дек. 2021 г., 04:28 Po Lu <luangruo@yahoo.com>:

> Andrey Listopadov <andreyorst@gmail.com> writes:
>
> > After PGTK was merged I've compiled Emacs with the required switch.  The
> > first thing I've noticed was that --with-xinput2 has no effect when
> > --with-pgtk switch is supplied, so I've removed it.  I'm not sure if
> > this is intentional or not.  The main issue now is that horizontal
> > scrolling with a touchpad no longer works for me. All horizontal events
> > are registered as mwheel-down events.
>
> To answer your first question: since the PGTK build doesn't use X, the
> --with-xinput2 option has no effect.
>
> As for the second problem, I don't see the problem here, but I'm copying
> in Yuuki as he might have some ideas.
>
> Thanks.
>

Makes sense, thanks.

>
By "I don't see the problem here" do you mean horizontal scrolling works
for you on PGTK build?

I've tested this on my second laptop, which has different manufacturer, and
it doesn't work there either.  For the record, I'm using Fedora 34 and 35.


-- 
Andrey Listopadov

>

[-- Attachment #2: Type: text/html, Size: 2152 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
  2021-12-21  7:22   ` Andrey Listopadov
@ 2021-12-21  7:27     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 23+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-12-21  7:27 UTC (permalink / raw)
  To: Andrey Listopadov; +Cc: Yuuki Harano, 52685

Andrey Listopadov <andreyorst@gmail.com> writes:

> By "I don't see the problem here" do you mean horizontal scrolling
> works for you on PGTK build?

Yes.

> I've tested this on my second laptop, which has different
> manufacturer, and it doesn't work there either.  For the record, I'm
> using Fedora 34 and 35.

Same here, I'm using Fedora 35.

Thanks.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
  2021-12-21  1:27 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-21  7:22   ` Andrey Listopadov
@ 2021-12-21 13:28   ` Yuuki Harano
  2021-12-21 13:54     ` Andrey Listopadov
  1 sibling, 1 reply; 23+ messages in thread
From: Yuuki Harano @ 2021-12-21 13:28 UTC (permalink / raw)
  To: andreyorst; +Cc: luangruo, 52685


> The main issue now is that horizontal
> scrolling with a touchpad no longer works for me. All horizontal events
> are registered as mwheel-down events.

Are all of left and right scroll events registered as mwheel-down?

Does the issue reproduce even if `emacs -Q`?

-- 
Yuuki Harano





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
  2021-12-21 13:28   ` Yuuki Harano
@ 2021-12-21 13:54     ` Andrey Listopadov
  2021-12-22  1:00       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 23+ messages in thread
From: Andrey Listopadov @ 2021-12-21 13:54 UTC (permalink / raw)
  To: Yuuki Harano; +Cc: luangruo, 52685

[-- Attachment #1: Type: text/plain, Size: 997 bytes --]

вт, 21 дек. 2021 г., 16:28 Yuuki Harano <masm+emacs@masm11.me>:

>
> > The main issue now is that horizontal
> > scrolling with a touchpad no longer works for me. All horizontal events
> > are registered as mwheel-down events.
>
> Are all of left and right scroll events registered as mwheel-down?
>
> Does the issue reproduce even if `emacs -Q`?
>
> --
> Yuuki Harano



I've figured out that this was caused by me enabling
`pixel-scroll-precision-mode'. If the mode is enabled, all horizontal
events are treated as wheel-down in PGTK build. Additionally to that, it
seems that all events that are not exactly wheel-up are treated as down
events, e.g. C-<wheel-up> is also seen as C-<wheel-down> (in `emacs -Q'
with `pixel-scroll-precision-mode' enabled)

When `pixel-scroll-precision-mode' is disabled everything works fine.
When compiled without `--with-pgtk' but with `--with-xinput2'
`pixel-scroll-precision-mode' works as expected.


--
Andrey Listopadov

[-- Attachment #2: Type: text/html, Size: 1602 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
  2021-12-21 13:54     ` Andrey Listopadov
@ 2021-12-22  1:00       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-22  1:09         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 23+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-12-22  1:00 UTC (permalink / raw)
  To: Andrey Listopadov; +Cc: Yuuki Harano, 52685

Andrey Listopadov <andreyorst@gmail.com> writes:

> When `pixel-scroll-precision-mode' is disabled everything works fine.
> When compiled without `--with-pgtk' but with `--with-xinput2'
> `pixel-scroll-precision-mode' works as expected.

Thanks, I will look into this now.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
  2021-12-22  1:00       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-12-22  1:09         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-22  5:55           ` Andrey Listopadov
  0 siblings, 1 reply; 23+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-12-22  1:09 UTC (permalink / raw)
  To: Andrey Listopadov; +Cc: Yuuki Harano, 52685

Po Lu <luangruo@yahoo.com> writes:

> Andrey Listopadov <andreyorst@gmail.com> writes:
>
>> When `pixel-scroll-precision-mode' is disabled everything works fine.
>> When compiled without `--with-pgtk' but with `--with-xinput2'
>> `pixel-scroll-precision-mode' works as expected.
>
> Thanks, I will look into this now.

Please try the following patch to see if it resolves your problem.
Thanks.

diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index bd61c65edd..bea2650584 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -6133,78 +6133,64 @@ scroll_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data)
     }
   else if (gdk_event_get_scroll_deltas (event, &delta_x, &delta_y))
     {
-      dpyinfo->scroll.acc_x += delta_x;
-      dpyinfo->scroll.acc_y += delta_y;
-      if (dpyinfo->scroll.acc_y >= dpyinfo->scroll.y_per_line
-	  || !mwheel_coalesce_scroll_events)
+      if (!mwheel_coalesce_scroll_events)
 	{
-	  int nlines = dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
-	  inev.ie.kind = WHEEL_EVENT;
-	  inev.ie.modifiers |= down_modifier;
-	  inev.ie.arg = list3 (make_fixnum (nlines),
-			       make_float (-dpyinfo->scroll.acc_x * 100),
-			       make_float (-dpyinfo->scroll.acc_y * 100));
-	  if (!mwheel_coalesce_scroll_events)
-	    {
-	      dpyinfo->scroll.acc_y = 0;
-	      dpyinfo->scroll.acc_x = 0;
-	    }
-	  else
+	  inev.ie.kind = ((fabs (delta_x) > fabs (delta_y))
+			  ? HORIZ_WHEEL_EVENT
+			  : WHEEL_EVENT);
+	  inev.ie.modifiers = (inev.ie.kind == HORIZ_WHEEL_EVENT
+			       ? (delta_x >= 0 ? down_modifier : up_modifier)
+			       : (delta_y >= 0 ? down_modifier : up_modifier));
+	  inev.ie.arg = list3 (Qnil, make_float (delta_x),
+			       make_float (delta_y));
+	}
+      else
+	{
+	  dpyinfo->scroll.acc_x += delta_x;
+	  dpyinfo->scroll.acc_y += delta_y;
+	  if (dpyinfo->scroll.acc_y >= dpyinfo->scroll.y_per_line)
 	    {
+	      int nlines = dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
+	      inev.ie.kind = WHEEL_EVENT;
+	      inev.ie.modifiers |= down_modifier;
+	      inev.ie.arg = list3 (make_fixnum (nlines),
+				   make_float (-dpyinfo->scroll.acc_x * 100),
+				   make_float (-dpyinfo->scroll.acc_y * 100));
 	      dpyinfo->scroll.acc_y -= dpyinfo->scroll.y_per_line * nlines;
 	    }
-	}
-      else if (dpyinfo->scroll.acc_y <= -dpyinfo->scroll.y_per_line
-	       || !mwheel_coalesce_scroll_events)
-	{
-	  int nlines = -dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
-	  inev.ie.kind = WHEEL_EVENT;
-	  inev.ie.modifiers |= up_modifier;
-	  inev.ie.arg = list3 (make_fixnum (nlines),
-			       make_float (-dpyinfo->scroll.acc_x * 100),
-			       make_float (-dpyinfo->scroll.acc_y * 100));
-
-	  if (!mwheel_coalesce_scroll_events)
+	  else if (dpyinfo->scroll.acc_y <= -dpyinfo->scroll.y_per_line)
 	    {
-	      dpyinfo->scroll.acc_y = 0;
-	      dpyinfo->scroll.acc_x = 0;
+	      int nlines = -dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
+	      inev.ie.kind = WHEEL_EVENT;
+	      inev.ie.modifiers |= up_modifier;
+	      inev.ie.arg = list3 (make_fixnum (nlines),
+				   make_float (-dpyinfo->scroll.acc_x * 100),
+				   make_float (-dpyinfo->scroll.acc_y * 100));
+
+	      dpyinfo->scroll.acc_y -= -dpyinfo->scroll.y_per_line * nlines;
 	    }
-	  else
-	    dpyinfo->scroll.acc_y -= -dpyinfo->scroll.y_per_line * nlines;
-	}
-      else if (dpyinfo->scroll.acc_x >= dpyinfo->scroll.x_per_char
-	       || !mwheel_coalesce_scroll_events)
-	{
-	  int nchars = dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
-	  inev.ie.kind = HORIZ_WHEEL_EVENT;
-	  inev.ie.modifiers |= up_modifier;
-	  inev.ie.arg = list3 (make_fixnum (nchars),
-			       make_float (-dpyinfo->scroll.acc_x * 100),
-			       make_float (-dpyinfo->scroll.acc_y * 100));
-
-	  if (mwheel_coalesce_scroll_events)
-	    dpyinfo->scroll.acc_x -= dpyinfo->scroll.x_per_char * nchars;
-	  else
+	  else if (dpyinfo->scroll.acc_x >= dpyinfo->scroll.x_per_char
+		   || !mwheel_coalesce_scroll_events)
 	    {
-	      dpyinfo->scroll.acc_x = 0;
-	      dpyinfo->scroll.acc_y = 0;
+	      int nchars = dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
+	      inev.ie.kind = HORIZ_WHEEL_EVENT;
+	      inev.ie.modifiers |= up_modifier;
+	      inev.ie.arg = list3 (make_fixnum (nchars),
+				   make_float (-dpyinfo->scroll.acc_x * 100),
+				   make_float (-dpyinfo->scroll.acc_y * 100));
+
+	      dpyinfo->scroll.acc_x -= dpyinfo->scroll.x_per_char * nchars;
 	    }
-	}
-      else if (dpyinfo->scroll.acc_x <= -dpyinfo->scroll.x_per_char)
-	{
-	  int nchars = -dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
-	  inev.ie.kind = HORIZ_WHEEL_EVENT;
-	  inev.ie.modifiers |= down_modifier;
-	  inev.ie.arg = list3 (make_fixnum (nchars),
-			       make_float (-dpyinfo->scroll.acc_x * 100),
-			       make_float (-dpyinfo->scroll.acc_y * 100));
-
-	  if (mwheel_coalesce_scroll_events)
-	    dpyinfo->scroll.acc_x -= -dpyinfo->scroll.x_per_char * nchars;
-	  else
+	  else if (dpyinfo->scroll.acc_x <= -dpyinfo->scroll.x_per_char)
 	    {
-	      dpyinfo->scroll.acc_x = 0;
-	      dpyinfo->scroll.acc_y = 0;
+	      int nchars = -dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
+	      inev.ie.kind = HORIZ_WHEEL_EVENT;
+	      inev.ie.modifiers |= down_modifier;
+	      inev.ie.arg = list3 (make_fixnum (nchars),
+				   make_float (-dpyinfo->scroll.acc_x * 100),
+				   make_float (-dpyinfo->scroll.acc_y * 100));
+
+	      dpyinfo->scroll.acc_x -= -dpyinfo->scroll.x_per_char * nchars;
 	    }
 	}
     }





^ permalink raw reply related	[flat|nested] 23+ messages in thread

* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
  2021-12-22  1:09         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-12-22  5:55           ` Andrey Listopadov
  2021-12-22  6:11             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 23+ messages in thread
From: Andrey Listopadov @ 2021-12-22  5:55 UTC (permalink / raw)
  To: Po Lu; +Cc: Yuuki Harano, 52685

On Wed, Dec 22, 2021 at 4:09 AM Po Lu <luangruo@yahoo.com> wrote:
>
> Po Lu <luangruo@yahoo.com> writes:
>
> > Andrey Listopadov <andreyorst@gmail.com> writes:
> >
> >> When `pixel-scroll-precision-mode' is disabled everything works fine.
> >> When compiled without `--with-pgtk' but with `--with-xinput2'
> >> `pixel-scroll-precision-mode' works as expected.
> >
> > Thanks, I will look into this now.
>
> Please try the following patch to see if it resolves your problem.
> Thanks.
>
> diff --git a/src/pgtkterm.c b/src/pgtkterm.c
> index bd61c65edd..bea2650584 100644
> --- a/src/pgtkterm.c
> +++ b/src/pgtkterm.c
> @@ -6133,78 +6133,64 @@ scroll_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data)
>      }
>    else if (gdk_event_get_scroll_deltas (event, &delta_x, &delta_y))
>      {
> -      dpyinfo->scroll.acc_x += delta_x;
> -      dpyinfo->scroll.acc_y += delta_y;
> -      if (dpyinfo->scroll.acc_y >= dpyinfo->scroll.y_per_line
> -         || !mwheel_coalesce_scroll_events)
> +      if (!mwheel_coalesce_scroll_events)
>         {
> -         int nlines = dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
> -         inev.ie.kind = WHEEL_EVENT;
> -         inev.ie.modifiers |= down_modifier;
> -         inev.ie.arg = list3 (make_fixnum (nlines),
> -                              make_float (-dpyinfo->scroll.acc_x * 100),
> -                              make_float (-dpyinfo->scroll.acc_y * 100));
> -         if (!mwheel_coalesce_scroll_events)
> -           {
> -             dpyinfo->scroll.acc_y = 0;
> -             dpyinfo->scroll.acc_x = 0;
> -           }
> -         else
> +         inev.ie.kind = ((fabs (delta_x) > fabs (delta_y))
> +                         ? HORIZ_WHEEL_EVENT
> +                         : WHEEL_EVENT);
> +         inev.ie.modifiers = (inev.ie.kind == HORIZ_WHEEL_EVENT
> +                              ? (delta_x >= 0 ? down_modifier : up_modifier)
> +                              : (delta_y >= 0 ? down_modifier : up_modifier));
> +         inev.ie.arg = list3 (Qnil, make_float (delta_x),
> +                              make_float (delta_y));
> +       }
> +      else
> +       {
> +         dpyinfo->scroll.acc_x += delta_x;
> +         dpyinfo->scroll.acc_y += delta_y;
> +         if (dpyinfo->scroll.acc_y >= dpyinfo->scroll.y_per_line)
>             {
> +             int nlines = dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
> +             inev.ie.kind = WHEEL_EVENT;
> +             inev.ie.modifiers |= down_modifier;
> +             inev.ie.arg = list3 (make_fixnum (nlines),
> +                                  make_float (-dpyinfo->scroll.acc_x * 100),
> +                                  make_float (-dpyinfo->scroll.acc_y * 100));
>               dpyinfo->scroll.acc_y -= dpyinfo->scroll.y_per_line * nlines;
>             }
> -       }
> -      else if (dpyinfo->scroll.acc_y <= -dpyinfo->scroll.y_per_line
> -              || !mwheel_coalesce_scroll_events)
> -       {
> -         int nlines = -dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
> -         inev.ie.kind = WHEEL_EVENT;
> -         inev.ie.modifiers |= up_modifier;
> -         inev.ie.arg = list3 (make_fixnum (nlines),
> -                              make_float (-dpyinfo->scroll.acc_x * 100),
> -                              make_float (-dpyinfo->scroll.acc_y * 100));
> -
> -         if (!mwheel_coalesce_scroll_events)
> +         else if (dpyinfo->scroll.acc_y <= -dpyinfo->scroll.y_per_line)
>             {
> -             dpyinfo->scroll.acc_y = 0;
> -             dpyinfo->scroll.acc_x = 0;
> +             int nlines = -dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
> +             inev.ie.kind = WHEEL_EVENT;
> +             inev.ie.modifiers |= up_modifier;
> +             inev.ie.arg = list3 (make_fixnum (nlines),
> +                                  make_float (-dpyinfo->scroll.acc_x * 100),
> +                                  make_float (-dpyinfo->scroll.acc_y * 100));
> +
> +             dpyinfo->scroll.acc_y -= -dpyinfo->scroll.y_per_line * nlines;
>             }
> -         else
> -           dpyinfo->scroll.acc_y -= -dpyinfo->scroll.y_per_line * nlines;
> -       }
> -      else if (dpyinfo->scroll.acc_x >= dpyinfo->scroll.x_per_char
> -              || !mwheel_coalesce_scroll_events)
> -       {
> -         int nchars = dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
> -         inev.ie.kind = HORIZ_WHEEL_EVENT;
> -         inev.ie.modifiers |= up_modifier;
> -         inev.ie.arg = list3 (make_fixnum (nchars),
> -                              make_float (-dpyinfo->scroll.acc_x * 100),
> -                              make_float (-dpyinfo->scroll.acc_y * 100));
> -
> -         if (mwheel_coalesce_scroll_events)
> -           dpyinfo->scroll.acc_x -= dpyinfo->scroll.x_per_char * nchars;
> -         else
> +         else if (dpyinfo->scroll.acc_x >= dpyinfo->scroll.x_per_char
> +                  || !mwheel_coalesce_scroll_events)
>             {
> -             dpyinfo->scroll.acc_x = 0;
> -             dpyinfo->scroll.acc_y = 0;
> +             int nchars = dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
> +             inev.ie.kind = HORIZ_WHEEL_EVENT;
> +             inev.ie.modifiers |= up_modifier;
> +             inev.ie.arg = list3 (make_fixnum (nchars),
> +                                  make_float (-dpyinfo->scroll.acc_x * 100),
> +                                  make_float (-dpyinfo->scroll.acc_y * 100));
> +
> +             dpyinfo->scroll.acc_x -= dpyinfo->scroll.x_per_char * nchars;
>             }
> -       }
> -      else if (dpyinfo->scroll.acc_x <= -dpyinfo->scroll.x_per_char)
> -       {
> -         int nchars = -dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
> -         inev.ie.kind = HORIZ_WHEEL_EVENT;
> -         inev.ie.modifiers |= down_modifier;
> -         inev.ie.arg = list3 (make_fixnum (nchars),
> -                              make_float (-dpyinfo->scroll.acc_x * 100),
> -                              make_float (-dpyinfo->scroll.acc_y * 100));
> -
> -         if (mwheel_coalesce_scroll_events)
> -           dpyinfo->scroll.acc_x -= -dpyinfo->scroll.x_per_char * nchars;
> -         else
> +         else if (dpyinfo->scroll.acc_x <= -dpyinfo->scroll.x_per_char)
>             {
> -             dpyinfo->scroll.acc_x = 0;
> -             dpyinfo->scroll.acc_y = 0;
> +             int nchars = -dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
> +             inev.ie.kind = HORIZ_WHEEL_EVENT;
> +             inev.ie.modifiers |= down_modifier;
> +             inev.ie.arg = list3 (make_fixnum (nchars),
> +                                  make_float (-dpyinfo->scroll.acc_x * 100),
> +                                  make_float (-dpyinfo->scroll.acc_y * 100));
> +
> +             dpyinfo->scroll.acc_x -= -dpyinfo->scroll.x_per_char * nchars;
>             }
>         }
>      }

The patch doesn't apply.

-- 
Andrey Listopadov





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
  2021-12-22  5:55           ` Andrey Listopadov
@ 2021-12-22  6:11             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-22  8:14               ` Andrey Listopadov
  0 siblings, 1 reply; 23+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-12-22  6:11 UTC (permalink / raw)
  To: Andrey Listopadov; +Cc: Yuuki Harano, 52685

Andrey Listopadov <andreyorst@gmail.com> writes:

> On Wed, Dec 22, 2021 at 4:09 AM Po Lu <luangruo@yahoo.com> wrote:
>>
>> Po Lu <luangruo@yahoo.com> writes:
>>
>> > Andrey Listopadov <andreyorst@gmail.com> writes:
>> >
>> >> When `pixel-scroll-precision-mode' is disabled everything works fine.
>> >> When compiled without `--with-pgtk' but with `--with-xinput2'
>> >> `pixel-scroll-precision-mode' works as expected.
>> >
>> > Thanks, I will look into this now.
>>
>> Please try the following patch to see if it resolves your problem.
>> Thanks.
>>
>> diff --git a/src/pgtkterm.c b/src/pgtkterm.c
>> index bd61c65edd..bea2650584 100644
>> --- a/src/pgtkterm.c
>> +++ b/src/pgtkterm.c
>> @@ -6133,78 +6133,64 @@ scroll_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data)
>>      }
>>    else if (gdk_event_get_scroll_deltas (event, &delta_x, &delta_y))
>>      {
>> -      dpyinfo->scroll.acc_x += delta_x;
>> -      dpyinfo->scroll.acc_y += delta_y;
>> -      if (dpyinfo->scroll.acc_y >= dpyinfo->scroll.y_per_line
>> -         || !mwheel_coalesce_scroll_events)
>> +      if (!mwheel_coalesce_scroll_events)
>>         {
>> -         int nlines = dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
>> -         inev.ie.kind = WHEEL_EVENT;
>> -         inev.ie.modifiers |= down_modifier;
>> -         inev.ie.arg = list3 (make_fixnum (nlines),
>> -                              make_float (-dpyinfo->scroll.acc_x * 100),
>> -                              make_float (-dpyinfo->scroll.acc_y * 100));
>> -         if (!mwheel_coalesce_scroll_events)
>> -           {
>> -             dpyinfo->scroll.acc_y = 0;
>> -             dpyinfo->scroll.acc_x = 0;
>> -           }
>> -         else
>> +         inev.ie.kind = ((fabs (delta_x) > fabs (delta_y))
>> +                         ? HORIZ_WHEEL_EVENT
>> +                         : WHEEL_EVENT);
>> +         inev.ie.modifiers = (inev.ie.kind == HORIZ_WHEEL_EVENT
>> +                              ? (delta_x >= 0 ? down_modifier : up_modifier)
>> +                              : (delta_y >= 0 ? down_modifier : up_modifier));
>> +         inev.ie.arg = list3 (Qnil, make_float (delta_x),
>> +                              make_float (delta_y));
>> +       }
>> +      else
>> +       {
>> +         dpyinfo->scroll.acc_x += delta_x;
>> +         dpyinfo->scroll.acc_y += delta_y;
>> +         if (dpyinfo->scroll.acc_y >= dpyinfo->scroll.y_per_line)
>>             {
>> +             int nlines = dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
>> +             inev.ie.kind = WHEEL_EVENT;
>> +             inev.ie.modifiers |= down_modifier;
>> +             inev.ie.arg = list3 (make_fixnum (nlines),
>> +                                  make_float (-dpyinfo->scroll.acc_x * 100),
>> +                                  make_float (-dpyinfo->scroll.acc_y * 100));
>>               dpyinfo->scroll.acc_y -= dpyinfo->scroll.y_per_line * nlines;
>>             }
>> -       }
>> -      else if (dpyinfo->scroll.acc_y <= -dpyinfo->scroll.y_per_line
>> -              || !mwheel_coalesce_scroll_events)
>> -       {
>> -         int nlines = -dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
>> -         inev.ie.kind = WHEEL_EVENT;
>> -         inev.ie.modifiers |= up_modifier;
>> -         inev.ie.arg = list3 (make_fixnum (nlines),
>> -                              make_float (-dpyinfo->scroll.acc_x * 100),
>> -                              make_float (-dpyinfo->scroll.acc_y * 100));
>> -
>> -         if (!mwheel_coalesce_scroll_events)
>> +         else if (dpyinfo->scroll.acc_y <= -dpyinfo->scroll.y_per_line)
>>             {
>> -             dpyinfo->scroll.acc_y = 0;
>> -             dpyinfo->scroll.acc_x = 0;
>> +             int nlines = -dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
>> +             inev.ie.kind = WHEEL_EVENT;
>> +             inev.ie.modifiers |= up_modifier;
>> +             inev.ie.arg = list3 (make_fixnum (nlines),
>> +                                  make_float (-dpyinfo->scroll.acc_x * 100),
>> +                                  make_float (-dpyinfo->scroll.acc_y * 100));
>> +
>> +             dpyinfo->scroll.acc_y -= -dpyinfo->scroll.y_per_line * nlines;
>>             }
>> -         else
>> -           dpyinfo->scroll.acc_y -= -dpyinfo->scroll.y_per_line * nlines;
>> -       }
>> -      else if (dpyinfo->scroll.acc_x >= dpyinfo->scroll.x_per_char
>> -              || !mwheel_coalesce_scroll_events)
>> -       {
>> -         int nchars = dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
>> -         inev.ie.kind = HORIZ_WHEEL_EVENT;
>> -         inev.ie.modifiers |= up_modifier;
>> -         inev.ie.arg = list3 (make_fixnum (nchars),
>> -                              make_float (-dpyinfo->scroll.acc_x * 100),
>> -                              make_float (-dpyinfo->scroll.acc_y * 100));
>> -
>> -         if (mwheel_coalesce_scroll_events)
>> -           dpyinfo->scroll.acc_x -= dpyinfo->scroll.x_per_char * nchars;
>> -         else
>> +         else if (dpyinfo->scroll.acc_x >= dpyinfo->scroll.x_per_char
>> +                  || !mwheel_coalesce_scroll_events)
>>             {
>> -             dpyinfo->scroll.acc_x = 0;
>> -             dpyinfo->scroll.acc_y = 0;
>> +             int nchars = dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
>> +             inev.ie.kind = HORIZ_WHEEL_EVENT;
>> +             inev.ie.modifiers |= up_modifier;
>> +             inev.ie.arg = list3 (make_fixnum (nchars),
>> +                                  make_float (-dpyinfo->scroll.acc_x * 100),
>> +                                  make_float (-dpyinfo->scroll.acc_y * 100));
>> +
>> +             dpyinfo->scroll.acc_x -= dpyinfo->scroll.x_per_char * nchars;
>>             }
>> -       }
>> -      else if (dpyinfo->scroll.acc_x <= -dpyinfo->scroll.x_per_char)
>> -       {
>> -         int nchars = -dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
>> -         inev.ie.kind = HORIZ_WHEEL_EVENT;
>> -         inev.ie.modifiers |= down_modifier;
>> -         inev.ie.arg = list3 (make_fixnum (nchars),
>> -                              make_float (-dpyinfo->scroll.acc_x * 100),
>> -                              make_float (-dpyinfo->scroll.acc_y * 100));
>> -
>> -         if (mwheel_coalesce_scroll_events)
>> -           dpyinfo->scroll.acc_x -= -dpyinfo->scroll.x_per_char * nchars;
>> -         else
>> +         else if (dpyinfo->scroll.acc_x <= -dpyinfo->scroll.x_per_char)
>>             {
>> -             dpyinfo->scroll.acc_x = 0;
>> -             dpyinfo->scroll.acc_y = 0;
>> +             int nchars = -dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
>> +             inev.ie.kind = HORIZ_WHEEL_EVENT;
>> +             inev.ie.modifiers |= down_modifier;
>> +             inev.ie.arg = list3 (make_fixnum (nchars),
>> +                                  make_float (-dpyinfo->scroll.acc_x * 100),
>> +                                  make_float (-dpyinfo->scroll.acc_y * 100));
>> +
>> +             dpyinfo->scroll.acc_x -= -dpyinfo->scroll.x_per_char * nchars;
>>             }
>>         }
>>      }

> The patch doesn't apply.

That's odd.  Could you try updating your checkout, or failing that,
applying it manually?

Thanks.






^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
  2021-12-22  6:11             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-12-22  8:14               ` Andrey Listopadov
  2021-12-22  9:29                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 23+ messages in thread
From: Andrey Listopadov @ 2021-12-22  8:14 UTC (permalink / raw)
  To: Po Lu; +Cc: Yuuki Harano, 52685

On Wed, Dec 22, 2021 at 9:11 AM Po Lu <luangruo@yahoo.com> wrote:
>
> Andrey Listopadov <andreyorst@gmail.com> writes:
>
> > On Wed, Dec 22, 2021 at 4:09 AM Po Lu <luangruo@yahoo.com> wrote:
> >>
> >> Po Lu <luangruo@yahoo.com> writes:
> >>
> >> > Andrey Listopadov <andreyorst@gmail.com> writes:
> >> >
> >> >> When `pixel-scroll-precision-mode' is disabled everything works fine.
> >> >> When compiled without `--with-pgtk' but with `--with-xinput2'
> >> >> `pixel-scroll-precision-mode' works as expected.
> >> >
> >> > Thanks, I will look into this now.
> >>
> >> Please try the following patch to see if it resolves your problem.
> >> Thanks.
> >>
> >> diff --git a/src/pgtkterm.c b/src/pgtkterm.c
> >> index bd61c65edd..bea2650584 100644
> >> --- a/src/pgtkterm.c
> >> +++ b/src/pgtkterm.c
> >> @@ -6133,78 +6133,64 @@ scroll_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data)
> >>      }
> >>    else if (gdk_event_get_scroll_deltas (event, &delta_x, &delta_y))
> >>      {
> >> -      dpyinfo->scroll.acc_x += delta_x;
> >> -      dpyinfo->scroll.acc_y += delta_y;
> >> -      if (dpyinfo->scroll.acc_y >= dpyinfo->scroll.y_per_line
> >> -         || !mwheel_coalesce_scroll_events)
> >> +      if (!mwheel_coalesce_scroll_events)
> >>         {
> >> -         int nlines = dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
> >> -         inev.ie.kind = WHEEL_EVENT;
> >> -         inev.ie.modifiers |= down_modifier;
> >> -         inev.ie.arg = list3 (make_fixnum (nlines),
> >> -                              make_float (-dpyinfo->scroll.acc_x * 100),
> >> -                              make_float (-dpyinfo->scroll.acc_y * 100));
> >> -         if (!mwheel_coalesce_scroll_events)
> >> -           {
> >> -             dpyinfo->scroll.acc_y = 0;
> >> -             dpyinfo->scroll.acc_x = 0;
> >> -           }
> >> -         else
> >> +         inev.ie.kind = ((fabs (delta_x) > fabs (delta_y))
> >> +                         ? HORIZ_WHEEL_EVENT
> >> +                         : WHEEL_EVENT);
> >> +         inev.ie.modifiers = (inev.ie.kind == HORIZ_WHEEL_EVENT
> >> +                              ? (delta_x >= 0 ? down_modifier : up_modifier)
> >> +                              : (delta_y >= 0 ? down_modifier : up_modifier));
> >> +         inev.ie.arg = list3 (Qnil, make_float (delta_x),
> >> +                              make_float (delta_y));
> >> +       }
> >> +      else
> >> +       {
> >> +         dpyinfo->scroll.acc_x += delta_x;
> >> +         dpyinfo->scroll.acc_y += delta_y;
> >> +         if (dpyinfo->scroll.acc_y >= dpyinfo->scroll.y_per_line)
> >>             {
> >> +             int nlines = dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
> >> +             inev.ie.kind = WHEEL_EVENT;
> >> +             inev.ie.modifiers |= down_modifier;
> >> +             inev.ie.arg = list3 (make_fixnum (nlines),
> >> +                                  make_float (-dpyinfo->scroll.acc_x * 100),
> >> +                                  make_float (-dpyinfo->scroll.acc_y * 100));
> >>               dpyinfo->scroll.acc_y -= dpyinfo->scroll.y_per_line * nlines;
> >>             }
> >> -       }
> >> -      else if (dpyinfo->scroll.acc_y <= -dpyinfo->scroll.y_per_line
> >> -              || !mwheel_coalesce_scroll_events)
> >> -       {
> >> -         int nlines = -dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
> >> -         inev.ie.kind = WHEEL_EVENT;
> >> -         inev.ie.modifiers |= up_modifier;
> >> -         inev.ie.arg = list3 (make_fixnum (nlines),
> >> -                              make_float (-dpyinfo->scroll.acc_x * 100),
> >> -                              make_float (-dpyinfo->scroll.acc_y * 100));
> >> -
> >> -         if (!mwheel_coalesce_scroll_events)
> >> +         else if (dpyinfo->scroll.acc_y <= -dpyinfo->scroll.y_per_line)
> >>             {
> >> -             dpyinfo->scroll.acc_y = 0;
> >> -             dpyinfo->scroll.acc_x = 0;
> >> +             int nlines = -dpyinfo->scroll.acc_y / dpyinfo->scroll.y_per_line;
> >> +             inev.ie.kind = WHEEL_EVENT;
> >> +             inev.ie.modifiers |= up_modifier;
> >> +             inev.ie.arg = list3 (make_fixnum (nlines),
> >> +                                  make_float (-dpyinfo->scroll.acc_x * 100),
> >> +                                  make_float (-dpyinfo->scroll.acc_y * 100));
> >> +
> >> +             dpyinfo->scroll.acc_y -= -dpyinfo->scroll.y_per_line * nlines;
> >>             }
> >> -         else
> >> -           dpyinfo->scroll.acc_y -= -dpyinfo->scroll.y_per_line * nlines;
> >> -       }
> >> -      else if (dpyinfo->scroll.acc_x >= dpyinfo->scroll.x_per_char
> >> -              || !mwheel_coalesce_scroll_events)
> >> -       {
> >> -         int nchars = dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
> >> -         inev.ie.kind = HORIZ_WHEEL_EVENT;
> >> -         inev.ie.modifiers |= up_modifier;
> >> -         inev.ie.arg = list3 (make_fixnum (nchars),
> >> -                              make_float (-dpyinfo->scroll.acc_x * 100),
> >> -                              make_float (-dpyinfo->scroll.acc_y * 100));
> >> -
> >> -         if (mwheel_coalesce_scroll_events)
> >> -           dpyinfo->scroll.acc_x -= dpyinfo->scroll.x_per_char * nchars;
> >> -         else
> >> +         else if (dpyinfo->scroll.acc_x >= dpyinfo->scroll.x_per_char
> >> +                  || !mwheel_coalesce_scroll_events)
> >>             {
> >> -             dpyinfo->scroll.acc_x = 0;
> >> -             dpyinfo->scroll.acc_y = 0;
> >> +             int nchars = dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
> >> +             inev.ie.kind = HORIZ_WHEEL_EVENT;
> >> +             inev.ie.modifiers |= up_modifier;
> >> +             inev.ie.arg = list3 (make_fixnum (nchars),
> >> +                                  make_float (-dpyinfo->scroll.acc_x * 100),
> >> +                                  make_float (-dpyinfo->scroll.acc_y * 100));
> >> +
> >> +             dpyinfo->scroll.acc_x -= dpyinfo->scroll.x_per_char * nchars;
> >>             }
> >> -       }
> >> -      else if (dpyinfo->scroll.acc_x <= -dpyinfo->scroll.x_per_char)
> >> -       {
> >> -         int nchars = -dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
> >> -         inev.ie.kind = HORIZ_WHEEL_EVENT;
> >> -         inev.ie.modifiers |= down_modifier;
> >> -         inev.ie.arg = list3 (make_fixnum (nchars),
> >> -                              make_float (-dpyinfo->scroll.acc_x * 100),
> >> -                              make_float (-dpyinfo->scroll.acc_y * 100));
> >> -
> >> -         if (mwheel_coalesce_scroll_events)
> >> -           dpyinfo->scroll.acc_x -= -dpyinfo->scroll.x_per_char * nchars;
> >> -         else
> >> +         else if (dpyinfo->scroll.acc_x <= -dpyinfo->scroll.x_per_char)
> >>             {
> >> -             dpyinfo->scroll.acc_x = 0;
> >> -             dpyinfo->scroll.acc_y = 0;
> >> +             int nchars = -dpyinfo->scroll.acc_x / dpyinfo->scroll.x_per_char;
> >> +             inev.ie.kind = HORIZ_WHEEL_EVENT;
> >> +             inev.ie.modifiers |= down_modifier;
> >> +             inev.ie.arg = list3 (make_fixnum (nchars),
> >> +                                  make_float (-dpyinfo->scroll.acc_x * 100),
> >> +                                  make_float (-dpyinfo->scroll.acc_y * 100));
> >> +
> >> +             dpyinfo->scroll.acc_x -= -dpyinfo->scroll.x_per_char * nchars;
> >>             }
> >>         }
> >>      }
>
> > The patch doesn't apply.
>
> That's odd.  Could you try updating your checkout, or failing that,
> applying it manually?
>
> Thanks.
>

Sorry, seems the mail got corrupted the first time I tried.

I've applied the patch, and now horizontal scrolling works correctly.
However, pressing Ctrl while scrolling doesn't register as `C-' event.
With `pixel-scroll-precision-mode` off, if I press C-h k and scroll in
any direction with the Ctrl key held down I get this:

There were several key-sequences:
  C-<wheel-up> at that spot runs the command mouse-wheel-text-scale
  C-<wheel-down> at that spot runs the command mouse-wheel-text-scale

(Since C-<wheel-left> and C-<wheel-right> aren't mapped to anything
they're not in the list)

With `pixel-scroll-precision-mode` on I get:

There were several key-sequences:
  <wheel-up> at that spot runs the command pixel-scroll-precision
  <wheel-down> at that spot runs the command pixel-scroll-precision
  <wheel-right> at that spot runs the command mwheel-scroll
  <wheel-left> at that spot runs the command mwheel-scroll
  <touch-end> runs the command pixel-scroll-start-momentum

So the scrolling works, but the Ctrl key is ignored now.  The same
happens with other modifier keys.

-- 
Andrey Listopadov





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
  2021-12-22  8:14               ` Andrey Listopadov
@ 2021-12-22  9:29                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-22 13:24                   ` Andrey Listopadov
  0 siblings, 1 reply; 23+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-12-22  9:29 UTC (permalink / raw)
  To: Andrey Listopadov; +Cc: Yuuki Harano, 52685

Andrey Listopadov <andreyorst@gmail.com> writes:

>   <wheel-up> at that spot runs the command pixel-scroll-precision
>   <wheel-down> at that spot runs the command pixel-scroll-precision
>   <wheel-right> at that spot runs the command mwheel-scroll
>   <wheel-left> at that spot runs the command mwheel-scroll
>   <touch-end> runs the command pixel-scroll-start-momentum

> So the scrolling works, but the Ctrl key is ignored now.  The same
> happens with other modifier keys.

Thanks, this issue should be fixed on master now.  Please test.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
  2021-12-22  9:29                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-12-22 13:24                   ` Andrey Listopadov
  2021-12-22 13:26                     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-22 13:33                     ` Andrey Listopadov
  0 siblings, 2 replies; 23+ messages in thread
From: Andrey Listopadov @ 2021-12-22 13:24 UTC (permalink / raw)
  To: Po Lu; +Cc: Yuuki Harano, 52685

[-- Attachment #1: Type: text/plain, Size: 174 bytes --]

>
> Thanks, this issue should be fixed on master now.  Please test.
>

Can confirm that the scrolling works as expected on current master.  Thanks!

-- 
Andrey Listopadov

>

[-- Attachment #2: Type: text/html, Size: 624 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
  2021-12-22 13:24                   ` Andrey Listopadov
@ 2021-12-22 13:26                     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-22 13:33                     ` Andrey Listopadov
  1 sibling, 0 replies; 23+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-12-22 13:26 UTC (permalink / raw)
  To: Andrey Listopadov; +Cc: Yuuki Harano, 52685-done

Andrey Listopadov <andreyorst@gmail.com> writes:

>  Thanks, this issue should be fixed on master now.  Please test.
>
> Can confirm that the scrolling works as expected on current master.
> Thanks!

Thanks for testing.  I'm closing this bug report.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
  2021-12-22 13:24                   ` Andrey Listopadov
  2021-12-22 13:26                     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-12-22 13:33                     ` Andrey Listopadov
  2021-12-22 13:36                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 23+ messages in thread
From: Andrey Listopadov @ 2021-12-22 13:33 UTC (permalink / raw)
  To: Po Lu; +Cc: Yuuki Harano, 52685

[-- Attachment #1: Type: text/plain, Size: 339 bytes --]

Sorry again, should have tested it a bit better before replying. On current
master the scroll is not only inversed, it is also super slow and works
only in the active window. Previously inactive windows were scrollable on
per line basis (e.g. not by pixels), now it is required to focus a window
for scrolling.  Am I missing some setting?

[-- Attachment #2: Type: text/html, Size: 363 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
  2021-12-22 13:33                     ` Andrey Listopadov
@ 2021-12-22 13:36                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-22 13:48                         ` Andrey Listopadov
  0 siblings, 1 reply; 23+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-12-22 13:36 UTC (permalink / raw)
  To: Andrey Listopadov; +Cc: Yuuki Harano, 52685

Andrey Listopadov <andreyorst@gmail.com> writes:

> Sorry again, should have tested it a bit better before replying. On
> current master the scroll is not only inversed, it is also super slow
> and works only in the active window.  Previously inactive windows were
> scrollable on per line basis (e.g. not by pixels), now it is required
> to focus a window for scrolling.  Am I missing some setting?

No you're not, this is my fault.  Please try now with latest master.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
  2021-12-22 13:36                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-12-22 13:48                         ` Andrey Listopadov
  2022-01-10 18:40                           ` Andrey Listopadov
  0 siblings, 1 reply; 23+ messages in thread
From: Andrey Listopadov @ 2021-12-22 13:48 UTC (permalink / raw)
  To: Po Lu; +Cc: Yuuki Harano, 52685

[-- Attachment #1: Type: text/plain, Size: 351 bytes --]

> No you're not, this is my fault.  Please try now with latest master.
>

Thanks!

Seems to work, with pixel scrolling mode enabled.  But when the mode is
disabled, the horizontal scrolling is inversed.  In other words, the
vertical direction is correct in both cases, horizontal is correct only
when pixel scrolling is on.


-- 
Andrey Listopadov

>

[-- Attachment #2: Type: text/html, Size: 938 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
  2021-12-22 13:48                         ` Andrey Listopadov
@ 2022-01-10 18:40                           ` Andrey Listopadov
  2022-01-11  0:54                             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 23+ messages in thread
From: Andrey Listopadov @ 2022-01-10 18:40 UTC (permalink / raw)
  To: Po Lu; +Cc: Yuuki Harano, 52685

after a recent update, horizontal scrolling is now reversed both when
pixel scrolling is enabled and disabled.  I've recompiled without the
`--with-pgtk' switch and horizontal scrolling is not reversed anymore.
Seems that some value needs to be negated on the pgtk side





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
  2022-01-10 18:40                           ` Andrey Listopadov
@ 2022-01-11  0:54                             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-01-11  4:16                               ` Andrey Listopadov
  0 siblings, 1 reply; 23+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-01-11  0:54 UTC (permalink / raw)
  To: Andrey Listopadov; +Cc: Yuuki Harano, 52685

Andrey Listopadov <andreyorst@gmail.com> writes:

> after a recent update, horizontal scrolling is now reversed both when
> pixel scrolling is enabled and disabled.  I've recompiled without the
> `--with-pgtk' switch and horizontal scrolling is not reversed anymore.
> Seems that some value needs to be negated on the pgtk side

Could you explain what "reversed" means in this context?  Which events
are sent when you scroll with your fingers moving leftwards?  And
rightwards?

Perhaps you just need to set mouse-wheel-tilt-scroll to t.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
  2022-01-11  0:54                             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-01-11  4:16                               ` Andrey Listopadov
  2022-01-11  4:22                                 ` Andrey Listopadov
  0 siblings, 1 reply; 23+ messages in thread
From: Andrey Listopadov @ 2022-01-11  4:16 UTC (permalink / raw)
  To: Po Lu; +Cc: Yuuki Harano, 52685

>Could you explain what "reversed" means in this context?  Which events
>are sent when you scroll with your fingers moving leftwards?  And
>rightwards?
>
>Perhaps you just need to set mouse-wheel-tilt-scroll to t.

I have this setting enabled. I also have mouse-wheel-flip-direction set to t.

The problem is, that the same touchpad movement scrolls text in different directions when Emacs is compiled with and without pgtk support with the same init file.

When compiled without pgtk, its behavior configured in my init file matches all system apps, and when compiled with the pgtk support it is inversed.

Both pgtk and non-pgtk builds send rhe same events, but scroll in different directions.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
  2022-01-11  4:16                               ` Andrey Listopadov
@ 2022-01-11  4:22                                 ` Andrey Listopadov
  2022-01-11  4:39                                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 23+ messages in thread
From: Andrey Listopadov @ 2022-01-11  4:22 UTC (permalink / raw)
  To: Po Lu; +Cc: Yuuki Harano, 52685

>I also have mouse-wheel-flip-direction set to t.
Oh, I just realized, that perhaps I don't need this setting on the pgtk build, as it probably respects the operating system settings for natural scrolling? Non-pgtk build probably didnt, and this is why I needed the setting in the first place?





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
  2022-01-11  4:22                                 ` Andrey Listopadov
@ 2022-01-11  4:39                                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-01-11  5:39                                     ` Andrey Listopadov
  0 siblings, 1 reply; 23+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-01-11  4:39 UTC (permalink / raw)
  To: Andrey Listopadov; +Cc: Yuuki Harano, 52685

Andrey Listopadov <andreyorst@gmail.com> writes:

>>I also have mouse-wheel-flip-direction set to t.
> Oh, I just realized, that perhaps I don't need this setting on the
> pgtk build, as it probably respects the operating system settings for
> natural scrolling? Non-pgtk build probably didnt, and this is why I
> needed the setting in the first place?

That could be the case, yes.
I will look into this a little further.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk
  2022-01-11  4:39                                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-01-11  5:39                                     ` Andrey Listopadov
  0 siblings, 0 replies; 23+ messages in thread
From: Andrey Listopadov @ 2022-01-11  5:39 UTC (permalink / raw)
  To: Po Lu; +Cc: Yuuki Harano, 52685

I've tried building Emacs without pgtk support, and it turns out that
it also respects the system settings for natural scrolling.  So the
horizontal scrolling is indeed inversed on the pgtk build.





^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2022-01-11  5:39 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-20 20:42 bug#52685: 29.0.50; Horizontal scrolling doesn't work when compiled with pgtk Andrey Listopadov
2021-12-21  1:27 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-21  7:22   ` Andrey Listopadov
2021-12-21  7:27     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-21 13:28   ` Yuuki Harano
2021-12-21 13:54     ` Andrey Listopadov
2021-12-22  1:00       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-22  1:09         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-22  5:55           ` Andrey Listopadov
2021-12-22  6:11             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-22  8:14               ` Andrey Listopadov
2021-12-22  9:29                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-22 13:24                   ` Andrey Listopadov
2021-12-22 13:26                     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-22 13:33                     ` Andrey Listopadov
2021-12-22 13:36                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-22 13:48                         ` Andrey Listopadov
2022-01-10 18:40                           ` Andrey Listopadov
2022-01-11  0:54                             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-11  4:16                               ` Andrey Listopadov
2022-01-11  4:22                                 ` Andrey Listopadov
2022-01-11  4:39                                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-11  5:39                                     ` Andrey Listopadov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).