From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dov Grobgeld Newsgroups: gmane.emacs.devel Subject: Re: Stylus drawing input? Date: Mon, 23 Jan 2023 23:15:58 +0200 Message-ID: References: <87pmbhpjkc.fsf@web.de> <87cz7eq5uh.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35250"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: tomas@tuxteam.de Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jan 23 22:17:00 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pK4BX-0008vg-GU for ged-emacs-devel@m.gmane-mx.org; Mon, 23 Jan 2023 22:16:59 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pK4Aq-00060J-Uz; Mon, 23 Jan 2023 16:16:17 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pK4Ap-0005zS-8h for emacs-devel@gnu.org; Mon, 23 Jan 2023 16:16:15 -0500 Original-Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pK4An-00005L-GJ for emacs-devel@gnu.org; Mon, 23 Jan 2023 16:16:14 -0500 Original-Received: by mail-lj1-x232.google.com with SMTP id c3so14607984ljh.1 for ; Mon, 23 Jan 2023 13:16:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ANCU12CzlhBbE9j+P3osRYhAf31Vytz8z967+xkcW1w=; b=hISY9OpS7HsaYjoT+4XczdSnNxiEnnx0MJcNnWqu5ZR43gfGqvE71kJSKpWt0AvDTe MZNz/S9JsUepF5yywKJ6pyaJSZdzjgAHd42QW8S+B3tkwAckehzcP2xica75FkxK45Ij JQC+g/i3UxXP72zrgLapMqpFnsk+eceY9EqYmcqb9UgLgLHyDiFJPNAoMk+w6QjsSKwB eAKYRhdfW6cK5vFUAAKdWIJrowp0HGdnEZFQXBnaH+XBOK1Q4fl0GPnCaoAkv/jrtyIq yEnZZm6aZjMyknb1PfZTZ5ybw1/YeE5EiAUiriF8aHcfnZvOs2D65ZwJddlkdmUoTYfF lwGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ANCU12CzlhBbE9j+P3osRYhAf31Vytz8z967+xkcW1w=; b=7uSNykJ0xbI/GQmpagxGBe3L/jLOVz/bhAPAu1JgA1tknuPI6WpnLs+jwZQIVDo35l Z0OP4XoFuxrgGpBGwD8xRvlQn+4Q3yIOTnOwI6RduOzQNn/aFAyM0ab3/cwHzIF46Iil Aq9OkNIzGLvvvUyaHy/1DtdYmez6PzwKPU/Y8r83Tq+IJe/hBnkbJCuv8YVU6h4ShwZ6 58XudGyUp37iyFoKS3pabqg5dn/g/5Zy21gVyikHmVsbQYSO14YVtFGubs3Sq/5v/AbN 0o0pZDyIUElqiZnfOis7In3bEgDnPD0++Ge/y2ZCxxiXNXxuhonD1YA4ilR/Y97nJ6T3 JkJA== X-Gm-Message-State: AFqh2kqiGfKm9zrO3AdjvbvTSQ1bWUr+VQ1jV04M4GE9SsSX5t8O3FBt bhGUICMNMFdGgLWYVnJH8sCV3XCgWQ/ZTIS+x0o= X-Google-Smtp-Source: AMrXdXvYpSmEhk/oWa/u8cxpG0u5yXuSDa9q71yXtastflTI8o5I19tR+BbcKJPodp3ap+u62I8lPBNy2ApWnRJwCJo= X-Received: by 2002:a2e:8893:0:b0:282:cf65:3c93 with SMTP id k19-20020a2e8893000000b00282cf653c93mr2293124lji.456.1674508571079; Mon, 23 Jan 2023 13:16:11 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::232; envelope-from=dov.grobgeld@gmail.com; helo=mail-lj1-x232.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:302625 Archived-At: 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 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