GNU bug report logs - #79032
30.1; Stylus (Wacom Pen) Support under Wayland

Previous Next

Package: emacs;

Reported by: Justus-dev <at> Piater.name

Date: Wed, 16 Jul 2025 15:50:02 UTC

Severity: normal

Found in version 30.1

To reply to this bug, email your comments to 79032 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#79032; Package emacs. (Wed, 16 Jul 2025 15:50:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Justus-dev <at> Piater.name:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 16 Jul 2025 15:50:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Justus-dev <at> Piater.name
To: bug-gnu-emacs <at> gnu.org
Subject: 30.1; Stylus (Wacom Pen) Support under Wayland
Date: Wed, 16 Jul 2025 17:48:58 +0200
In a text-mode buffer I'd generally expect the stylus to behave like the
mouse-1 button (press-drag-release highlights a text region), but it
does not. In the following, "cursor" refers to Emacs' text cursor, and
"pointer" refers to the graphical pointer controlled by the mouse and
the stylus.

1. Start emacs -Q in a Wayland session. In the *scratch* buffer:

2. Use the mouse to move the pointer over a text character (without
   pressing a button).

3. Tap a different character with the stylus (pen-down).

   Expected effect: The cursor is placed at the pen-down location.

   Actual effect: The cursor is placed at the location where the pointer
   was before pen-down, and the region of text between cursor and
   pointer (now at the pen-down location) is highlighted.

4. Drag the stylus.

   Expected effect: Pointer and cursor follow the stylus, and the region
   between pen-down and cursor is highlighted.

   Actual effect: Pointer follows stylus, but cursor and highlighted
   region remain unchanged.

5. Lift the stylus (pen-up).

   Expected and actual effect: The cursor is located at the pen-up
   location, and the region between pen-down and pen-up is highlighted.

6. Iterate Steps 3-5. The above description always holds. In particular,
   at Step 3, "the location where the pointer was before pen-down" is

   if the mouse was moved since the preceding pen-up (as in Step 2):
     the pointer location where the mouse left it before pen-down,

   otherwise:
     the preceding pen-up location.

   Both are, of course, unexpected behavior.

After Steps 1-5, C-h l gives me the following:

 <help-echo> <down-mouse-1> ;; mouse-drag-region
 <mouse-movement>	    ;; anonymous-command
 ... [repeats many times]
 <mouse-movement>	    ;; anonymous-command
 <drag-mouse-1>		    ;; mouse-set-region
 C-h l			    ;; view-lossage

This behavior makes it impossible to use the stylus for drawing inside
Emacs, e.g. using artist-mode or el-easydraw
(https://github.com/misohena/el-easydraw/issues/40).

This behavior appears to be specific to Wayland, perhaps even to my
compositor (swaywm). In particular, X (by default) appears to treat the
stylus like the mouse:

- xev (running under Xwayland) reports stylus interactions as mouse
  events, but wev reports stylus interactions as "zwp_tablet_tool_v2"
  events.

- If I run Emacs under Xwayland (GDK_BACKEND=X11 emacs -Q), the stylus
  behaves identically to the mouse.

Thus, for starters, it would be interesting if other Wayland users,
using the same or different compositors, observe the same behavior.


In GNU Emacs 30.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.49,
cairo version 1.18.4)
System Description: Arch Linux

Configured using:
 'configure --with-pgtk --sysconfdir=/etc --prefix=/usr
 --libexecdir=/usr/lib --localstatedir=/var --disable-build-details
 --with-cairo --with-harfbuzz --with-libsystemd --with-modules
 --with-native-compilation=aot --with-tree-sitter 'CFLAGS=-march=x86-64
 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3
 -Wformat -Werror=format-security -fstack-clash-protection
 -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g
 -ffile-prefix-map=/build/emacs/src=/usr/src/debug/emacs -flto=auto'
 'LDFLAGS=-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro
 -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto'
 'CXXFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions
 -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer
 -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g
 -ffile-prefix-map=/build/emacs/src=/usr/src/debug/emacs -flto=auto''

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

Important settings:
  value of $LC_COLLATE: de_AT.UTF-8
  value of $LC_MONETARY: de_AT.UTF-8
  value of $LC_TIME: de_AT.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Help

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  isearch-fold-quotes-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date subr-x mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
help-mode cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/pgtk-win pgtk-win term/common-win touch-screen pgtk-dnd 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 nadvice seq simple cl-generic
indonesian philippine 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 abbrev obarray oclosure cl-preloaded button loaddefs
theme-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 gtk pgtk
lcms2 multi-tty move-toolbar make-network-process native-compile emacs)

Memory information:
((conses 16 53221 8904) (symbols 48 5611 0) (strings 32 14333 3337)
 (string-bytes 1 471846) (vectors 16 9250)
 (vector-slots 8 128560 7593) (floats 8 26 35) (intervals 56 286 4)
 (buffers 992 12))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79032; Package emacs. (Wed, 16 Jul 2025 16:41:02 GMT) Full text and rfc822 format available.

Message #8 received at 79032 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Justus-dev <at> Piater.name, Po Lu <luangruo <at> yahoo.com>
Cc: 79032 <at> debbugs.gnu.org
Subject: Re: bug#79032: 30.1; Stylus (Wacom Pen) Support under Wayland
Date: Wed, 16 Jul 2025 19:40:04 +0300
> Date: Wed, 16 Jul 2025 17:48:58 +0200
> From: Justus-dev--- via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> In a text-mode buffer I'd generally expect the stylus to behave like the
> mouse-1 button (press-drag-release highlights a text region), but it
> does not. In the following, "cursor" refers to Emacs' text cursor, and
> "pointer" refers to the graphical pointer controlled by the mouse and
> the stylus.
> 
> 1. Start emacs -Q in a Wayland session. In the *scratch* buffer:
> 
> 2. Use the mouse to move the pointer over a text character (without
>    pressing a button).
> 
> 3. Tap a different character with the stylus (pen-down).
> 
>    Expected effect: The cursor is placed at the pen-down location.
> 
>    Actual effect: The cursor is placed at the location where the pointer
>    was before pen-down, and the region of text between cursor and
>    pointer (now at the pen-down location) is highlighted.
> 
> 4. Drag the stylus.
> 
>    Expected effect: Pointer and cursor follow the stylus, and the region
>    between pen-down and cursor is highlighted.
> 
>    Actual effect: Pointer follows stylus, but cursor and highlighted
>    region remain unchanged.
> 
> 5. Lift the stylus (pen-up).
> 
>    Expected and actual effect: The cursor is located at the pen-up
>    location, and the region between pen-down and pen-up is highlighted.
> 
> 6. Iterate Steps 3-5. The above description always holds. In particular,
>    at Step 3, "the location where the pointer was before pen-down" is
> 
>    if the mouse was moved since the preceding pen-up (as in Step 2):
>      the pointer location where the mouse left it before pen-down,
> 
>    otherwise:
>      the preceding pen-up location.
> 
>    Both are, of course, unexpected behavior.
> 
> After Steps 1-5, C-h l gives me the following:
> 
>  <help-echo> <down-mouse-1> ;; mouse-drag-region
>  <mouse-movement>	    ;; anonymous-command
>  ... [repeats many times]
>  <mouse-movement>	    ;; anonymous-command
>  <drag-mouse-1>		    ;; mouse-set-region
>  C-h l			    ;; view-lossage

Thanks.

This seems to imply that the stylus doesn't produce mouse-up events in
this case?  Because otherwise, you should have seen <mouse-1> events
as well.

Po Lu, any ideas?   Is this a known issue with Wayland?

> This behavior makes it impossible to use the stylus for drawing inside
> Emacs, e.g. using artist-mode or el-easydraw
> (https://github.com/misohena/el-easydraw/issues/40).
> 
> This behavior appears to be specific to Wayland, perhaps even to my
> compositor (swaywm). In particular, X (by default) appears to treat the
> stylus like the mouse:
> 
> - xev (running under Xwayland) reports stylus interactions as mouse
>   events, but wev reports stylus interactions as "zwp_tablet_tool_v2"
>   events.
> 
> - If I run Emacs under Xwayland (GDK_BACKEND=X11 emacs -Q), the stylus
>   behaves identically to the mouse.
> 
> Thus, for starters, it would be interesting if other Wayland users,
> using the same or different compositors, observe the same behavior.
> 
> 
> In GNU Emacs 30.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.49,
> cairo version 1.18.4)
> System Description: Arch Linux
> 
> Configured using:
>  'configure --with-pgtk --sysconfdir=/etc --prefix=/usr
>  --libexecdir=/usr/lib --localstatedir=/var --disable-build-details
>  --with-cairo --with-harfbuzz --with-libsystemd --with-modules
>  --with-native-compilation=aot --with-tree-sitter 'CFLAGS=-march=x86-64
>  -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3
>  -Wformat -Werror=format-security -fstack-clash-protection
>  -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g
>  -ffile-prefix-map=/build/emacs/src=/usr/src/debug/emacs -flto=auto'
>  'LDFLAGS=-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro
>  -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto'
>  'CXXFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions
>  -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security
>  -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer
>  -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g
>  -ffile-prefix-map=/build/emacs/src=/usr/src/debug/emacs -flto=auto''
> 
> Configured features:
> ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
> LCMS2 LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
> PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
> TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB
> 
> Important settings:
>   value of $LC_COLLATE: de_AT.UTF-8
>   value of $LC_MONETARY: de_AT.UTF-8
>   value of $LC_TIME: de_AT.UTF-8
>   value of $LANG: en_US.UTF-8
>   locale-coding-system: utf-8-unix
> 
> Major mode: Help
> 
> Minor modes in effect:
>   tooltip-mode: t
>   global-eldoc-mode: t
>   show-paren-mode: t
>   electric-indent-mode: t
>   mouse-wheel-mode: t
>   tool-bar-mode: t
>   menu-bar-mode: t
>   file-name-shadow-mode: t
>   isearch-fold-quotes-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   blink-cursor-mode: t
>   minibuffer-regexp-mode: t
>   buffer-read-only: t
>   line-number-mode: t
>   indent-tabs-mode: t
>   transient-mark-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
> 
> Load-path shadows:
> None found.
> 
> Features:
> (shadow sort mail-extr emacsbug message mailcap yank-media puny dired
> dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
> epg-config gnus-util text-property-search time-date subr-x mm-decode
> mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
> sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
> help-mode cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren
> electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
> term/pgtk-win pgtk-win term/common-win touch-screen pgtk-dnd 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 nadvice seq simple cl-generic
> indonesian philippine 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 abbrev obarray oclosure cl-preloaded button loaddefs
> theme-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 gtk pgtk
> lcms2 multi-tty move-toolbar make-network-process native-compile emacs)
> 
> Memory information:
> ((conses 16 53221 8904) (symbols 48 5611 0) (strings 32 14333 3337)
>  (string-bytes 1 471846) (vectors 16 9250)
>  (vector-slots 8 128560 7593) (floats 8 26 35) (intervals 56 286 4)
>  (buffers 992 12))
> 
> 
> 
> 




This bug report was last modified 1 day ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.