Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package wev for openSUSE:Factory checked in 
at 2025-12-15 12:05:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/wev (Old)
 and      /work/SRC/openSUSE:Factory/.wev.new.1939 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "wev"

Mon Dec 15 12:05:27 2025 rev:2 rq:1322865 version:1.1.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/wev/wev.changes  2021-01-26 14:51:40.323834822 
+0100
+++ /work/SRC/openSUSE:Factory/.wev.new.1939/wev.changes        2025-12-15 
12:07:07.213341883 +0100
@@ -1,0 +2,20 @@
+Sun Dec 14 20:42:40 UTC 2025 - Avindra Goolcharan <[email protected]>
+
+- Update package to 1.1.0:
+  * Fix logging of modifiers serial/group
+  * Makefile: drop dependency on header file
+  * Handle our interface version being greater than the compositor version
+  * Add support for wl_pointer.axis_value120
+  * Add support for wl_pointer.axis_relative_direction
+  * Print ids 10 characters wide
+  * Add support for the tablet protocol
+  * Map the keymap with MAP_PRIVATE
+  * Fix crasher if the tablet manager doesn't exist
+  * Switch to the stable tablet protocol
+  * Add support for the relativ dials in tablets
+  * Fix axis_discrete event log
+  * remember to close and unmap buffer after drawing
+  * escape control characters
+- ran spec-cleaner
+
+-------------------------------------------------------------------

Old:
----
  1.0.0.tar.gz

New:
----
  1.1.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ wev.spec ++++++
--- /var/tmp/diff_new_pack.Hb1P2e/_old  2025-12-15 12:07:07.917371477 +0100
+++ /var/tmp/diff_new_pack.Hb1P2e/_new  2025-12-15 12:07:07.917371477 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package wev
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2025 SUSE LLC and contributors
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,16 +17,16 @@
 
 
 Name:           wev
-Version:        1.0.0
+Version:        1.1.0
 Release:        0
 Summary:        Wayland event viewer
 License:        MIT
 URL:            https://git.sr.ht/~sircmpwn/wev
-Source0:        https://git.sr.ht/~sircmpwn/wev/archive/%version.tar.gz
-BuildRequires:  wayland-devel
+Source0:        https://git.sr.ht/~sircmpwn/wev/archive/%{version}.tar.gz
 BuildRequires:  libxkbcommon-devel
-BuildRequires:  wayland-protocols-devel
 BuildRequires:  scdoc
+BuildRequires:  wayland-devel
+BuildRequires:  wayland-protocols-devel
 
 %description
 This is a tool for debugging events on a Wayland window, analagous to
@@ -36,14 +36,14 @@
 %setup -q
 
 %build
-%make_build CFLAGS="%optflags"
+%make_build CFLAGS="%{optflags}"
 
 %install
-%make_install PREFIX="%_prefix"
+%make_install PREFIX="%{_prefix}"
 
 %files
 %license LICENSE
 %doc README.md
-%_bindir/wev
-%_mandir/man1/wev.*
+%{_bindir}/wev
+%{_mandir}/man1/wev.*
 

++++++ 1.0.0.tar.gz -> 1.1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wev-1.0.0/.gitignore new/wev-1.1.0/.gitignore
--- old/wev-1.0.0/.gitignore    2020-02-06 18:48:08.000000000 +0100
+++ new/wev-1.1.0/.gitignore    2025-05-22 04:53:09.000000000 +0200
@@ -1,4 +1,6 @@
 xdg-shell-protocol.c
 xdg-shell-protocol.h
+wayland-tablet-protocol.c
+wayland-tablet-protocol.h
 wev
 wev.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wev-1.0.0/Makefile new/wev-1.1.0/Makefile
--- old/wev-1.0.0/Makefile      2020-02-06 18:48:08.000000000 +0100
+++ new/wev-1.1.0/Makefile      2025-05-22 04:53:09.000000000 +0200
@@ -13,10 +13,18 @@
        $(WAYLAND_SCANNER) private-code \
                $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
 
-wev: wev.c shm.c xdg-shell-protocol.h xdg-shell-protocol.c
+wayland-tablet-protocol.h:
+       $(WAYLAND_SCANNER) client-header \
+               $(WAYLAND_PROTOCOLS)/stable/tablet/tablet-v2.xml $@
+
+wayland-tablet-protocol.c: wayland-tablet-protocol.h
+       $(WAYLAND_SCANNER) private-code \
+               $(WAYLAND_PROTOCOLS)/stable/tablet/tablet-v2.xml $@
+
+wev: wev.c shm.c xdg-shell-protocol.c wayland-tablet-protocol.c
        $(CC) $(CFLAGS) \
                -g -std=c11 -I. \
-               -o wev wev.c shm.c xdg-shell-protocol.c \
+               -o wev wev.c shm.c xdg-shell-protocol.c 
wayland-tablet-protocol.c \
                $(LIBS) -lrt
 
 wev.1: wev.1.scd
@@ -37,7 +45,7 @@
        install -m644 wev.1 $(DESTDIR)$(MANDIR)/man1/wev.1
 
 clean:
-       rm -f wev wev.1 xdg-shell-protocol.h xdg-shell-protocol.c
+       rm -f wev wev.1 xdg-shell-protocol.h xdg-shell-protocol.c 
wayland-tablet-protocol.h wayland-tablet-protocol.c
 
 .DEFAULT_GOAL=all
 .PHONY: all install clean
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wev-1.0.0/wev.c new/wev-1.1.0/wev.c
--- old/wev-1.0.0/wev.c 2020-02-06 18:48:08.000000000 +0100
+++ new/wev-1.1.0/wev.c 2025-05-22 04:53:09.000000000 +0200
@@ -15,6 +15,7 @@
 #include <xkbcommon/xkbcommon.h>
 #include "shm.h"
 #include "xdg-shell-protocol.h"
+#include "wayland-tablet-protocol.h"
 
 struct wev_filter {
        char *interface;
@@ -53,6 +54,8 @@
 
        struct wl_data_offer *selection;
        struct wl_data_offer *dnd;
+
+       struct zwp_tablet_manager_v2 *tablet_manager;
 };
 
 #define SPACER "                      "
@@ -89,7 +92,7 @@
        }
 
        int n = 0;
-       n += printf("[%02u:%16s] %s%s",
+       n += printf("[%10u:%16s] %s%s",
                        wl_proxy_get_id(proxy),
                        class, event, strcmp(fmt, "\n") != 0 ? ": " : "");
        va_list ap;
@@ -99,6 +102,26 @@
        return n;
 }
 
+static void escape_utf8(char *buf) {
+       if (strcmp(buf, "\a") == 0) {
+               strcpy(buf, "\\a");
+       } else if (strcmp(buf, "\b") == 0) {
+               strcpy(buf, "\\b");
+       } else if (strcmp(buf, "\e") == 0) {
+               strcpy(buf, "\\e");
+       } else if (strcmp(buf, "\f") == 0) {
+               strcpy(buf, "\\f");
+       } else if (strcmp(buf, "\n") == 0) {
+               strcpy(buf, "\\n");
+       } else if (strcmp(buf, "\r") == 0) {
+               strcpy(buf, "\\r");
+       } else if (strcmp(buf, "\t") == 0) {
+               strcpy(buf, "\\t");
+       } else if (strcmp(buf, "\v") == 0) {
+               strcpy(buf, "\\v");
+       }
+}
+
 static void wl_pointer_enter(void *data, struct wl_pointer *wl_pointer,
                uint32_t serial, struct wl_surface *surface,
                wl_fixed_t surface_x, wl_fixed_t surface_y) {
@@ -144,6 +167,12 @@
                return "back";
        case BTN_TASK:
                return "task";
+       case BTN_STYLUS:
+               return "stylus";
+       case BTN_STYLUS2:
+               return "stylus2";
+       case BTN_STYLUS3:
+               return "stylus3";
        default:
                return "unknown";
        }
@@ -227,11 +256,28 @@
 static void wl_pointer_axis_discrete(void *data, struct wl_pointer *wl_pointer,
                uint32_t axis, int32_t discrete) {
        struct wev_state *state = data;
-       proxy_log(state, (struct wl_proxy *)wl_pointer, "axis_stop",
+       proxy_log(state, (struct wl_proxy *)wl_pointer, "axis_discrete",
                        "axis: %d (%s), discrete: %d\n",
                        axis, pointer_axis_str(axis), discrete);
 }
 
+static void wl_pointer_axis_value120(void *data, struct wl_pointer *wl_pointer,
+               uint32_t axis, int32_t value120) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)wl_pointer, "axis_value120",
+                       "axis: %d (%s), value120: %d\n",
+                       axis, pointer_axis_str(axis), value120);
+}
+
+static void wl_pointer_axis_relative_direction(void *data,
+               struct wl_pointer *wl_pointer, uint32_t axis,
+               uint32_t direction) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)wl_pointer, 
"axis_relative_direction",
+                       "axis: %d (%s), direction: %d\n",
+                       axis, pointer_axis_str(axis), direction);
+}
+
 static const struct wl_pointer_listener wl_pointer_listener = {
        .enter = wl_pointer_enter,
        .leave = wl_pointer_leave,
@@ -242,6 +288,8 @@
        .axis_source = wl_pointer_axis_source,
        .axis_stop = wl_pointer_axis_stop,
        .axis_discrete = wl_pointer_axis_discrete,
+       .axis_value120 = wl_pointer_axis_value120,
+       .axis_relative_direction = wl_pointer_axis_relative_direction,
 };
 
 static const char *keymap_format_str(uint32_t format) {
@@ -261,7 +309,7 @@
        proxy_log(state, (struct wl_proxy *)wl_keyboard, "keymap",
                        "format: %d (%s), size: %d\n",
                        format, keymap_format_str(format), size);
-       char *map_shm = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
+       char *map_shm = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
        if (map_shm == MAP_FAILED) {
                close(fd);
                fprintf(stderr, "Unable to mmap keymap: %s", strerror(errno));
@@ -307,6 +355,7 @@
                        printf(SPACER "sym: %-12s (%d), ", buf, sym);
                        xkb_state_key_get_utf8(
                                        state->xkb_state, *key + 8, buf, 
sizeof(buf));
+                       escape_utf8(buf);
                        printf("utf8: '%s'\n", buf);
                }
        }
@@ -347,6 +396,7 @@
                printf(SPACER "sym: %-12s (%d), ", buf, sym);
 
                xkb_state_key_get_utf8(wev_state->xkb_state, keycode, buf, 
sizeof(buf));
+               escape_utf8(buf);
                printf("utf8: '%s'\n", buf);
        }
 }
@@ -368,7 +418,7 @@
                uint32_t mods_locked, uint32_t group) {
        struct wev_state *state = data;
        int n = proxy_log(state, (struct wl_proxy *)wl_keyboard, "modifiers",
-                       "serial: %d; group: %d\n", group);
+                       "serial: %d; group: %d\n", serial, group);
        if (n != 0) {
                printf(SPACER "depressed: %08X", mods_depressed);
                print_modifiers(state, mods_depressed);
@@ -531,6 +581,7 @@
        struct wl_buffer *buffer = wl_shm_pool_create_buffer(pool, 0,
                        state->width, state->height, stride, 
WL_SHM_FORMAT_XRGB8888);
        wl_shm_pool_destroy(pool);
+       close(fd);
 
        for (int y = 0; y < state->height; ++y) {
                for (int x = 0; x < state->width; ++x) {
@@ -541,6 +592,7 @@
                        }
                }
        }
+       munmap(data, size);
 
        wl_buffer_add_listener(buffer, &wl_buffer_listener, NULL);
 
@@ -776,6 +828,544 @@
        .selection = wl_data_device_selection,
 };
 
+static void tablet_name(void *data, struct zwp_tablet_v2 *tablet,
+               const char *name) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet, "name", "%s\n", name);
+}
+
+static void tablet_id(void *data, struct zwp_tablet_v2 *tablet,
+               uint32_t vid, uint32_t pid) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet, "id",
+                       "vid: 0x%04x pid: 0x%04x\n", vid, pid);
+}
+
+static void tablet_path(void *data, struct zwp_tablet_v2 *tablet,
+               const char *path) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet, "path", "%s\n", path);
+}
+
+static void tablet_done(void *data, struct zwp_tablet_v2 *tablet) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet, "done", "\n");
+}
+
+static void tablet_removed(void *data, struct zwp_tablet_v2 *tablet) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet, "removed", "\n");
+}
+
+static void tablet_bustype(void *data, struct zwp_tablet_v2 *tablet,
+               uint32_t bustype) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet, "bustype", "bustype: %d\n", 
bustype);
+}
+
+static const struct zwp_tablet_v2_listener tablet_listener = {
+       .name = tablet_name,
+       .id = tablet_id,
+       .path = tablet_path,
+       .done = tablet_done,
+       .removed = tablet_removed,
+       .bustype = tablet_bustype,
+};
+
+static void tablet_added(void *data, struct zwp_tablet_seat_v2 *seat,
+               struct zwp_tablet_v2 *id) {
+       struct wev_state *state = data;
+       zwp_tablet_v2_add_listener(id, &tablet_listener, state);
+       proxy_log(state, (struct wl_proxy *)seat, "tablet_added", "%u\n",
+                       wl_proxy_get_id((struct wl_proxy *)id));
+}
+
+static const char *tablet_tool_type_str(uint32_t type) {
+       switch (type) {
+       case ZWP_TABLET_TOOL_V2_TYPE_PEN:
+               return "pen";
+       case ZWP_TABLET_TOOL_V2_TYPE_ERASER:
+               return "eraser";
+       case ZWP_TABLET_TOOL_V2_TYPE_BRUSH:
+               return "brush";
+       case ZWP_TABLET_TOOL_V2_TYPE_PENCIL:
+               return "pencil";
+       case ZWP_TABLET_TOOL_V2_TYPE_AIRBRUSH:
+               return "airbrush";
+       case ZWP_TABLET_TOOL_V2_TYPE_FINGER:
+               return "finger";
+       case ZWP_TABLET_TOOL_V2_TYPE_MOUSE:
+               return "mouse";
+       case ZWP_TABLET_TOOL_V2_TYPE_LENS:
+               return "lens";
+       default:
+               return "unknown";
+       }
+}
+
+static void tablet_tool_type(void *data,
+               struct zwp_tablet_tool_v2 *tablet_tool, uint32_t type) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet_tool, "type",
+                       "type: %d (%s)\n", type, tablet_tool_type_str(type));
+}
+
+static void tablet_tool_hardware_serial(void *data,
+               struct zwp_tablet_tool_v2 *tablet_tool,
+               uint32_t hw_serial_hi, uint32_t hw_serial_lo) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet_tool,
+                       "hardware_serial", "hi, lo: 0x%08x 0x%08x\n",
+                       hw_serial_hi, hw_serial_lo);
+}
+
+static void tablet_tool_hardware_id_wacom(void *data,
+               struct zwp_tablet_tool_v2 *tablet_tool,
+               uint32_t hardware_id_hi, uint32_t hardware_id_lo) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet_tool,
+                       "hardware_id_wacom", "hi, lo: 0x%08x 0x%08x\n",
+                       hardware_id_hi, hardware_id_lo);
+}
+
+static const char *tablet_tool_capability_str(uint32_t capability) {
+       switch (capability) {
+       case ZWP_TABLET_TOOL_V2_CAPABILITY_TILT :
+               return "tilt";
+       case ZWP_TABLET_TOOL_V2_CAPABILITY_PRESSURE :
+               return "pressure";
+       case ZWP_TABLET_TOOL_V2_CAPABILITY_DISTANCE :
+               return "distance";
+       case ZWP_TABLET_TOOL_V2_CAPABILITY_ROTATION :
+               return "rotation";
+       case ZWP_TABLET_TOOL_V2_CAPABILITY_SLIDER :
+               return "slider";
+       case ZWP_TABLET_TOOL_V2_CAPABILITY_WHEEL :
+               return "wheel";
+       default:
+               return "unknown";
+       }
+}
+
+static void tablet_tool_capability(void *data,
+               struct zwp_tablet_tool_v2 *tablet_tool, uint32_t capability) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet_tool, "capability",
+                       "capability: %d (%s)\n", capability,
+                       tablet_tool_capability_str(capability));
+}
+
+static void tablet_tool_done(void *data,
+               struct zwp_tablet_tool_v2 *tablet_tool) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet_tool, "done", "\n");
+}
+
+static void tablet_tool_removed(void *data,
+               struct zwp_tablet_tool_v2 *tablet_tool) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet_tool, "removed", "\n");
+}
+
+static void tablet_tool_proximity_in(void *data,
+               struct zwp_tablet_tool_v2 *tablet_tool,
+               uint32_t serial, struct zwp_tablet_v2 *tablet,
+               struct wl_surface *surface) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet_tool, "proximity_in",
+                       "serial: %d; tablet: %u; surface: %d\n",
+                       serial, wl_proxy_get_id((struct wl_proxy *)tablet),
+                       wl_proxy_get_id((struct wl_proxy *)surface));
+}
+
+static void tablet_tool_proximity_out(void *data,
+               struct zwp_tablet_tool_v2 *tablet_tool) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet_tool,
+                       "proximity_out", "\n");
+}
+
+static void tablet_tool_down(void *data,
+               struct zwp_tablet_tool_v2 *tablet_tool,
+               uint32_t serial) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet_tool, "down",
+                       "serial: %d\n", serial);
+}
+
+static void tablet_tool_up(void *data,
+               struct zwp_tablet_tool_v2 *tablet_tool) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet_tool, "up", "\n");
+}
+
+static void tablet_tool_motion(void *data,
+               struct zwp_tablet_tool_v2 *tablet_tool,
+               wl_fixed_t x, wl_fixed_t y) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet_tool, "motion",
+                       "x, y: %f, %f\n",
+                       wl_fixed_to_double(x), wl_fixed_to_double(y));
+}
+
+static void tablet_tool_pressure(void *data,
+               struct zwp_tablet_tool_v2 *tablet_tool, uint32_t pressure) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet_tool, "pressure",
+                       "%d (%.3f)\n", pressure,
+                       (double)pressure/0xffff);
+}
+
+static void tablet_tool_distance(void *data,
+               struct zwp_tablet_tool_v2 *tablet_tool,
+               uint32_t distance) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet_tool, "distance",
+                       "%d (%.3f)\n", distance,
+                       (double)distance/0xffff);
+}
+
+static void tablet_tool_tilt(void *data,
+               struct zwp_tablet_tool_v2 *tablet_tool,
+               wl_fixed_t x, wl_fixed_t y) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet_tool, "tilt",
+                       "x, y: %f, %f\n",
+                       wl_fixed_to_double(x), wl_fixed_to_double(y));
+}
+
+static void tablet_tool_rotation(void *data,
+               struct zwp_tablet_tool_v2 *tablet_tool,
+               wl_fixed_t degrees) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet_tool, "rotation",
+                       "degrees: %f\n", wl_fixed_to_double(degrees));
+}
+
+static void tablet_tool_slider(void *data,
+               struct zwp_tablet_tool_v2 *tablet_tool,
+               int32_t position) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet_tool, "slider",
+                       "position: %d (%.3f)\n", position,
+                       (double)position/0xffff);
+}
+
+static void tablet_tool_wheel(void *data,
+               struct zwp_tablet_tool_v2 *tablet_tool,
+               wl_fixed_t degrees, int32_t clicks) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet_tool, "wheel",
+                       "wheel: %f, clicks: %d\n", degrees, clicks);
+}
+
+static void tablet_tool_button(void *data,
+               struct zwp_tablet_tool_v2 *tablet_tool,
+               uint32_t serial, uint32_t button, uint32_t state) {
+       struct wev_state *wev_state = data;
+       proxy_log(wev_state, (struct wl_proxy *)tablet_tool, "button",
+                       "serial: %d;  button: %d (%s), state: %d (%s)\n",
+                       serial, button, pointer_button_str(button),
+                       state, pointer_state_str(state));
+}
+
+static void tablet_tool_frame(void *data,
+               struct zwp_tablet_tool_v2 *tablet_tool, uint32_t time) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)tablet_tool, "frame",
+                       "time: %d\n", time);
+}
+
+static const struct zwp_tablet_tool_v2_listener tablet_tool_listener = {
+       .type = tablet_tool_type,
+       .hardware_serial = tablet_tool_hardware_serial,
+       .hardware_id_wacom = tablet_tool_hardware_id_wacom,
+       .capability = tablet_tool_capability,
+       .done = tablet_tool_done,
+       .removed = tablet_tool_removed,
+       .proximity_in = tablet_tool_proximity_in,
+       .proximity_out = tablet_tool_proximity_out,
+       .down = tablet_tool_down,
+       .up = tablet_tool_up,
+       .motion = tablet_tool_motion,
+       .pressure = tablet_tool_pressure,
+       .distance = tablet_tool_distance,
+       .tilt = tablet_tool_tilt,
+       .rotation = tablet_tool_rotation,
+       .slider = tablet_tool_slider,
+       .wheel = tablet_tool_wheel,
+       .button = tablet_tool_button,
+       .frame = tablet_tool_frame,
+};
+
+static const char *tablet_ring_axis_source_str(uint32_t axis_source) {
+       switch (axis_source) {
+       case ZWP_TABLET_PAD_RING_V2_SOURCE_FINGER:
+               return "finger";
+       default:
+               return "unknown";
+       }
+}
+
+static void tablet_ring_source(void *data,
+               struct zwp_tablet_pad_ring_v2 *ring, uint32_t source) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)ring, "source",
+                       "%d (%s)\n", source,
+                       tablet_ring_axis_source_str(source));
+}
+
+static void tablet_ring_angle(void *data,
+               struct zwp_tablet_pad_ring_v2 *ring, wl_fixed_t degrees) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)ring, "angle",
+                       "%f\n", wl_fixed_to_double(degrees));
+}
+
+static void tablet_ring_stop(void *data,
+               struct zwp_tablet_pad_ring_v2 *ring) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)ring, "stop", "\n");
+}
+
+static void tablet_ring_frame(void *data,
+               struct zwp_tablet_pad_ring_v2 *ring, uint32_t time) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)ring, "frame",
+                       "time: %d\n", time);
+}
+
+static const struct zwp_tablet_pad_ring_v2_listener tablet_ring_listener = {
+       .source = tablet_ring_source,
+       .angle = tablet_ring_angle,
+       .stop = tablet_ring_stop,
+       .frame = tablet_ring_frame,
+};
+
+static const char *tablet_strip_axis_source_str(uint32_t axis_source) {
+       switch (axis_source) {
+       case ZWP_TABLET_PAD_STRIP_V2_SOURCE_FINGER:
+               return "finger";
+       default:
+               return "unknown";
+       }
+}
+
+static void tablet_strip_source(void *data,
+               struct zwp_tablet_pad_strip_v2 *strip, uint32_t source) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)strip, "source",
+                       "%d (%s)\n", source,
+                       tablet_strip_axis_source_str(source));
+}
+
+static void tablet_strip_position(void *data,
+               struct zwp_tablet_pad_strip_v2 *strip, uint32_t position) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)strip, "position",
+                       "%f\n", wl_fixed_to_double(position));
+}
+
+static void tablet_strip_stop(void *data, struct zwp_tablet_pad_strip_v2 
*strip) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)strip, "stop", "\n");
+}
+
+static void tablet_strip_frame(void *data,
+               struct zwp_tablet_pad_strip_v2 *strip, uint32_t time) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)strip, "frame",
+                       "time: %d\n", time);
+}
+
+static const struct zwp_tablet_pad_strip_v2_listener tablet_strip_listener = {
+       .source = tablet_strip_source,
+       .position = tablet_strip_position,
+       .stop = tablet_strip_stop,
+       .frame = tablet_strip_frame,
+};
+
+static void tablet_dial_delta(void *data,
+               struct zwp_tablet_pad_dial_v2 *dial, int32_t value120) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)dial, "delta",
+                       "%d\n", value120);
+}
+
+static void tablet_dial_frame(void *data,
+               struct zwp_tablet_pad_dial_v2 *dial, uint32_t time) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)dial, "frame",
+                       "time: %d\n", time);
+}
+
+static const struct zwp_tablet_pad_dial_v2_listener tablet_dial_listener = {
+       .delta = tablet_dial_delta,
+       .frame = tablet_dial_frame,
+};
+
+static void tablet_pad_group_buttons(void *data,
+               struct zwp_tablet_pad_group_v2 *pad_group,
+               struct wl_array *buttons) {
+       struct wev_state *state = data;
+       uint32_t *b;
+
+       int n = proxy_log(state, (struct wl_proxy *)pad_group, "buttons",
+                       "buttons: ");
+       if (n != 0) {
+               wl_array_for_each(b, buttons) {
+                       printf("%d ", *b);
+               }
+               printf("\n");
+       }
+}
+
+static void tablet_pad_group_ring(void *data,
+               struct zwp_tablet_pad_group_v2 *pad_group,
+               struct zwp_tablet_pad_ring_v2 *ring) {
+       struct wev_state *state = data;
+       zwp_tablet_pad_ring_v2_add_listener(ring, &tablet_ring_listener, state);
+}
+
+static void tablet_pad_group_strip(void *data,
+               struct zwp_tablet_pad_group_v2 *pad_group,
+               struct zwp_tablet_pad_strip_v2 *strip) {
+       struct wev_state *state = data;
+       zwp_tablet_pad_strip_v2_add_listener(strip, &tablet_strip_listener, 
state);
+}
+
+static void tablet_pad_group_modes(void *data,
+               struct zwp_tablet_pad_group_v2 *pad_group,
+               uint32_t modes) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)pad_group, "modes",
+                       "%d\n", modes);
+}
+
+static void tablet_pad_group_done(void *data,
+               struct zwp_tablet_pad_group_v2 *pad_group) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)pad_group, "done", "\n");
+}
+
+static void tablet_pad_group_mode_switch(void *data,
+               struct zwp_tablet_pad_group_v2 *pad_group,
+               uint32_t time, uint32_t serial, uint32_t mode) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)pad_group, "mode_switch",
+                       "time: %d; serial: %d; mode: %d\n",
+                       time, serial, mode);
+}
+
+static void tablet_pad_group_dial(void *data,
+               struct zwp_tablet_pad_group_v2 *pad_group,
+               struct zwp_tablet_pad_dial_v2 *dial) {
+       struct wev_state *state = data;
+       zwp_tablet_pad_dial_v2_add_listener(dial, &tablet_dial_listener, state);
+}
+
+static const struct zwp_tablet_pad_group_v2_listener tablet_pad_group_listener 
= {
+       .buttons = tablet_pad_group_buttons,
+       .ring = tablet_pad_group_ring,
+       .strip = tablet_pad_group_strip,
+       .modes = tablet_pad_group_modes,
+       .done = tablet_pad_group_done,
+       .mode_switch = tablet_pad_group_mode_switch,
+       .dial = tablet_pad_group_dial,
+};
+
+static void tablet_tool_added(void *data, struct zwp_tablet_seat_v2 *seat,
+               struct zwp_tablet_tool_v2 *id) {
+       struct wev_state *state = data;
+       zwp_tablet_tool_v2_add_listener(id, &tablet_tool_listener, state);
+       proxy_log(state, (struct wl_proxy *)seat, "tool_added", "%u\n",
+                       wl_proxy_get_id((struct wl_proxy *)id));
+}
+
+static void tablet_pad_group(void *data, struct zwp_tablet_pad_v2 *pad,
+               struct zwp_tablet_pad_group_v2 *pad_group) {
+       struct wev_state *state = data;
+       zwp_tablet_pad_group_v2_add_listener (pad_group,
+                       &tablet_pad_group_listener, state);
+       proxy_log(state, (struct wl_proxy *)pad, "group", "%u\n",
+                       wl_proxy_get_id((struct wl_proxy *)pad_group));
+}
+
+static void tablet_pad_path(void *data, struct zwp_tablet_pad_v2 *pad,
+               const char *path) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)pad, "path", "%s\n", path);
+}
+
+static void tablet_pad_buttons(void *data, struct zwp_tablet_pad_v2 *pad,
+               uint32_t buttons) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)pad, "buttons",
+                       "%d\n", buttons);
+}
+
+static void tablet_pad_done(void *data, struct zwp_tablet_pad_v2 *pad) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)pad, "done", "\n");
+}
+
+static void tablet_pad_button(void *data, struct zwp_tablet_pad_v2 *pad,
+               uint32_t time, uint32_t button, uint32_t state) {
+       struct wev_state *wev_state = data;
+       proxy_log(wev_state, (struct wl_proxy *)pad, "button",
+                       "time: %d; button: %d, state: %d (%s)\n",
+                       time, button, state, pointer_state_str(state));
+}
+
+static void tablet_pad_enter(void *data, struct zwp_tablet_pad_v2 *pad,
+               uint32_t serial, struct zwp_tablet_v2 *tablet,
+               struct wl_surface *surface) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)pad, "enter",
+                       "serial: %d; tablet: %u; surface: %d\n", serial,
+                       wl_proxy_get_id((struct wl_proxy *)tablet),
+                       wl_proxy_get_id((struct wl_proxy *)surface));
+}
+
+static void tablet_pad_leave(void *data, struct zwp_tablet_pad_v2 *pad,
+               uint32_t serial, struct wl_surface *surface) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)pad, "leave",
+                       "serial: %d; surface: %d\n", serial,
+                       wl_proxy_get_id((struct wl_proxy *)surface));
+}
+
+static void tablet_pad_removed(void *data, struct zwp_tablet_pad_v2 *pad) {
+       struct wev_state *state = data;
+       proxy_log(state, (struct wl_proxy *)pad, "removed", "\n");
+}
+
+static const struct zwp_tablet_pad_v2_listener tablet_pad_listener = {
+       .group = tablet_pad_group,
+       .path = tablet_pad_path,
+       .buttons = tablet_pad_buttons,
+       .done = tablet_pad_done,
+       .button = tablet_pad_button,
+       .enter = tablet_pad_enter,
+       .leave = tablet_pad_leave,
+       .removed = tablet_pad_removed,
+};
+
+static void tablet_pad_added(void *data,
+               struct zwp_tablet_seat_v2 *seat,
+               struct zwp_tablet_pad_v2 *id) {
+       struct wev_state *state = data;
+       zwp_tablet_pad_v2_add_listener(id, &tablet_pad_listener, state);
+       proxy_log(state, (struct wl_proxy *)seat, "pad_added", "%u\n",
+                       wl_proxy_get_id((struct wl_proxy *)id));
+}
+
+static const struct zwp_tablet_seat_v2_listener tablet_seat_listener = {
+       .tablet_added = tablet_added,
+       .tool_added = tablet_tool_added,
+       .pad_added = tablet_pad_added,
+};
+
 static void registry_global(void *data, struct wl_registry *wl_registry,
                uint32_t name, const char *interface, uint32_t version) {
        struct wev_state *state = data;
@@ -785,17 +1375,21 @@
                void **ptr;
        } handles[] = {
                { &wl_compositor_interface, 4, (void **)&state->compositor },
-               { &wl_seat_interface, 6, (void **)&state->seat },
+               { &wl_seat_interface, 9, (void **)&state->seat },
                { &wl_shm_interface, 1, (void **)&state->shm },
                { &xdg_wm_base_interface, 2, (void **)&state->wm_base },
                { &wl_data_device_manager_interface, 3,
                        (void **)&state->data_device_manager },
+               { &zwp_tablet_manager_v2_interface, 2, (void 
**)&state->tablet_manager },
        };
 
        for (size_t i = 0; i < sizeof(handles) / sizeof(handles[0]); ++i) {
                if (strcmp(interface, handles[i].interface->name) == 0) {
+                       if (handles[i].version < version) {
+                               version = handles[i].version;
+                       }
                        *handles[i].ptr = wl_registry_bind(wl_registry,
-                                       name, handles[i].interface, 
handles[i].version);
+                                       name, handles[i].interface, version);
                }
        }
 
@@ -916,6 +1510,12 @@
                                state.seat);
        wl_data_device_add_listener(data_device, &wl_data_device_listener, 
&state);
 
+       if (state.tablet_manager) {
+               struct zwp_tablet_seat_v2 *tablet_seat =
+                       
zwp_tablet_manager_v2_get_tablet_seat(state.tablet_manager, state.seat);
+               zwp_tablet_seat_v2_add_listener(tablet_seat, 
&tablet_seat_listener, &state);
+       }
+
        wl_surface_commit(state.surface);
        wl_display_roundtrip(state.display);
 

Reply via email to