After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 697558 - Wayland backend doesn't use _gdk_default_filters
Wayland backend doesn't use _gdk_default_filters
Status: RESOLVED WONTFIX
Product: gtk+
Classification: Platform
Component: Backend: Wayland
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2013-04-08 13:28 UTC by Bastien Nocera
Modified: 2013-07-30 15:15 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Bastien Nocera 2013-04-08 13:28:55 UTC
Filters added through gdk_window_add_filter() are never called.
Comment 1 Matthias Clasen 2013-04-09 02:32:04 UTC
Turns out this is slightly tricky to do.

GdkFilterFunc is defined like this:

typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
                                          GdkEvent *event,
                                          gpointer  data);

and GdkXEvent is defined as

typedef void GdkXEvent;   /* Can be cast to window system specific
                           * even type, XEvent on X11, MSG on Win32.
                           */

But Wayland doesn't have any struct types for events; instead, the client registers handlers for the various events, like

         void (*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);

We could certainly define structs ourselves, like

typedef struct GdkWEventEnter {
                      gint type;
                      void *data;
                      struct wl_pointer *wl_pointer;
                      uint32_t serial;
                      struct wl_surface *surface;
                      wl_fixed_t surface_x;
                      wl_fixed_t surface_y;
}

and then

union GdkWEvent {
  GdkWEventEnter enter;
  GdkWEventLeave leave;
  ...
}
Comment 2 Matthias Clasen 2013-04-09 03:02:30 UTC
On the other hand, the common use for filter function is to deal with root window properties and client messages - both things that don't exist under Wayland.
Comment 3 Bastien Nocera 2013-04-09 05:38:43 UTC
I use it to catch motion events on every window in my app without having to deal with specific widgets eating the events without me seeing them.
Comment 4 Kristian Høgsberg 2013-04-09 18:08:27 UTC
The win32 backend just passes NULL for the native event struct.
Comment 5 Matthias Clasen 2013-04-10 13:03:58 UTC
passing NULL misses the point entirely...
Comment 6 Rob Bradford 2013-07-03 17:02:10 UTC
(In reply to comment #3)
> I use it to catch motion events on every window in my app without having to
> deal with specific widgets eating the events without me seeing them.

To do this you'd need to write some wayland specific code in totem to do this: basically you'd need to create a proxy for the seat (by looking for the global) and then setup a listener on that proxy.

This would be quite a bit of work I admit - but i'm not sure how we could use the existing mechanism to help you solve this problem with wayland.
Comment 7 Rob Bradford 2013-07-30 15:15:06 UTC
Bastien, I don't think we should go with the approach of adding these structures. It really feels like it goes against the Wayland architecture.

I'm happy to help you with setting up the pointer listener using libwayland-client to catch these events.