[Vala] Gdk event handler cast mystery



Hello; partial code:
--
private bool handle_events(Gdk.Event event) {
  if (event.type == Gdk.EventType.BUTTON_PRESS)
  {
    Gdk.EventButton eb = (Gdk.EventButton) event;
    //Now I can use "eb" for e.g. eb.state or eb.x
    ... etc.
--

When I try to compile, I get an error. It seems to be an error in the
c compilation:
--
error: conversion to non-scalar type requested
eb = (GdkEventButton) _tmp2_;
^
--

I took the idea from the GDK docs
(https://developer.gnome.org/gdk3/stable/gdk3-Event-Structures.html#GdkEvent)
where they speak of casting:
--
GdkEvent *event;
gdouble x;

x = ((GdkEventButton*)event)->x;
--

Any idea what I'm doing wrong in Vala?

\d


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]