'delta_x' and 'delta_y'

First post here - so apologies if it’s in the wrong place (previously it would’ve gone to the gtk-devel mailing list).

I’ve been building Gtk (version 2) for many years although it’s quite a long time since I last needed to build it (> 6 months). FWIW I use my own MSVC build projects rather than the official build (I’m just flagging that up in case this turns out to be a problem at my end). Anyway… I encountered a compilation problem this morning when building the latest gtk-2-24 code.

To cut a long story short… ‘gdk/gdkevents.h’ contains a struct (called _GdKEventScroll) which used to look like this:-

struct _GdkEventScroll
{
  GdkEventType type;
  GdkWindow *window;
  gint8 send_event;
  guint32 time;
  gdouble x;
  gdouble y;
  guint state;
  GdkScrollDirection direction;
  GdkDevice *device;
  gdouble x_root, y_root;
  gdouble delta_x;
  gdouble delta_y;
};

but at some point it looks like ‘delta_x’ and ‘delta_y’ got removed. However, they still seem to be getting referenced in ‘gdk/win32/gdkevents-win32.c’ - here, at line 2787:-

event->scroll.delta_y = (gdouble) GET_WHEEL_DELTA_WPARAM (msg->wParam) / 120.0;

and a few lines further down at line 2793:-

event->scroll.delta_x = (gdouble) GET_WHEEL_DELTA_WPARAM (msg->wParam) / 120.0;

In both cases, MSVC tells me that ‘delta_x’ and ‘delta_y’ aren’t members of the struct. Apart from that though, gtk-2-24 is still building okay.

I don’t mind doing some further checking at my end but I just wondered if other Windows devs have encountered this (and if so, how is it managing to build for them??)

The GdkEventScroll in GTK 2 hasn’t been changed since 2000. The delta_x and delta_y were added in GTK 3, as part of the smooth scrolling implementation; they were never backported to GTK 2.

Are you sure you’re not confusing GTK 3 with GTK 2?

Thanks Emmanuele - unless something’s gone wrong at my end ‘gdk/win32/gdkevents-win32.c’ does contain those references to ‘delta_x’ and ‘delta_y’. I’m looking at the ‘gtk-2-24’ branch and it seems like they got added on 14th Mar 2019 (in commit #6ae3082). In fact it’s the most recent commit for that particular file.

Incidentally… is there a way I can receive an email notification when someone responds to one of my posts here?

1 Like

Ah, yes. That’s clearly a mistake in a cherry picked commit from the gtk-3-24 branch.

It’s in your profile preferences:

Fixed the issue in the gtk-2-24 branch; testing is appreciated.

2 Likes

The 2.24 branch is building fine again this morning - many thanks Emmanuele.

Great. I’ve added a CI pipeline in msys2 just to be on the safe side from now on.