unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Po Lu <Luangruo@yahoo.com>
To: emacs-devel@gnu.org, Dov Grobgeld <dov.grobgeld@gmail.com>,
	tomas@tuxteam.de
Subject: Re: Stylus drawing input?
Date: Tue, 24 Jan 2023 07:48:45 +0800	[thread overview]
Message-ID: <0C19A13B-EEFF-486B-BED3-36A4AEF629D8@yahoo.com> (raw)
In-Reply-To: <CA++fsGEhZrF8s5wf7ddxckpgufqiW1n0PLZoFmsU5_aeOar_Xw@mail.gmail.com>

Emacs 29 already has native support for version 2 of the the X Input extension and its various input devices.

See the node Touchscreen Events in the Emacs Lisp reference manual.  This is not yet supported on the PGTK build.

On January 24, 2023 5:15:58 AM GMT+08:00, Dov Grobgeld <dov.grobgeld@gmail.com> wrote:
>On X11, to read stylus input, we need to use XInput extension.
>
>Gdk, used in gtk, has a good abstraction to it that allows doing code
>like the following to distinguish between mouse and stylus input in
>its motion notify callback, and in this case extract the pressure.
>
>  int on_motion_notify_event(GdkEventMotion *event)
>  {
>    // The pressure value is:
>    //   found=false for mouse motion
>    //   0 for proximity stylus motion
>    //   >0 for the pen touching the pad
>    double pressure=-1;
>    int found = gdk_event_get_axis((GdkEvent*)event,
>GDK_AXIS_PRESSURE, &pressure);
>    GdkDeviceTool *tool = gdk_event_get_device_tool((GdkEvent*)event);
>
>    // For mouse the tool isn't defined, so we set a default -1
>    GdkDeviceToolType tool_type = (GdkDeviceToolType)(-1);
>    if (tool)
>      // true for stylus only
>      tool_type = gdk_device_tool_get_tool_type (tool);
>
>    printf("motion_notify: tool_type=%d,
>x=%.3f},y=%.3f},found_stylus=%d,pressure=%.3f\n",
>          (int)tool_type,
>          event->x, event->y, found, pressure);
>    return TRUE;
>  }
>
>To support styluses (i.e. to distinguish them from mouse events) we
>need something similar in emacs.
>
>Regards,
>
>
>On Mon, Jan 16, 2023 at 10:27 AM <tomas@tuxteam.de> wrote:
>>
>> On Mon, Jan 16, 2023 at 08:45:55AM +0100, Dr. Arne Babenhauserheide wrote:
>> > PS: Here is a website with a description that does not rely on unfree
>> >     platforms: https://misohena.jp/blog/2021-09-21-emacs-easy-draw.html
>> >
>> > The clearest description is a gif, though:
>> > https://misohena.jp/blog/wp-content/uploads/2021-09-21-edraw-example.gif
>>
>> Thanks for the non-github link!
>>
>> Cheers
>> --
>> t
>



  reply	other threads:[~2023-01-23 23:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-12  6:39 Stylus drawing input? Dov Grobgeld
2023-01-14  6:06 ` Richard Stallman
2023-01-14  8:17   ` Dr. Arne Babenhauserheide
2023-01-14  9:38     ` Peter
2023-01-14  9:57     ` Eli Zaretskii
2023-01-14 10:49       ` Dr. Arne Babenhauserheide
2023-01-15  5:13     ` Richard Stallman
2023-01-16  7:41       ` Dr. Arne Babenhauserheide
2023-01-16  7:45       ` Dr. Arne Babenhauserheide
2023-01-16  8:26         ` tomas
2023-01-23 21:15           ` Dov Grobgeld
2023-01-23 23:48             ` Po Lu [this message]
2023-01-24  8:03               ` Dov Grobgeld
2023-01-24 10:50                 ` Po Lu
2023-01-24 12:27                 ` Eli Zaretskii
2023-01-24 15:55                   ` Dov Grobgeld
2023-01-24 17:00                     ` Eli Zaretskii
2023-01-14  9:50   ` Po Lu
2023-01-15  5:13     ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0C19A13B-EEFF-486B-BED3-36A4AEF629D8@yahoo.com \
    --to=luangruo@yahoo.com \
    --cc=dov.grobgeld@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=tomas@tuxteam.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).