Question about GdkEventButton in gtkmm-4.0

Aaron Scheinberg via gtkmm-list <[email protected]> Thu, 6 Oct 2022 14:57:20 -0700
Newsgroups gmane.comp.gnome.gtkmm
Message-ID <CA+_8y7cZV7XHi-XW420rK-iTpfzZCUzd4PXS09DOhgr0hN6Uow@mail.gmail.com>
--===============5974252821874057189==
Content-Type: multipart/alternative; boundary="000000000000b485ed05ea64c727"

--000000000000b485ed05ea64c727
Content-Type: text/plain; charset="UTF-8"

Hello,

I hope this is the right place for this, sorry if not!

I'm trying to implement an example gtkmm 3.0 code in gtkmm 4.0 and ran into
a problem. The goal is to get the cursor's coordinates and what type of
click occurred when clicking on a button. In gtkmm 3.0, I could use
GdkEventButton, as in this example from the docs
<https://developer-old.gnome.org/gtkmm-tutorial/unstable/gtkmm-tutorial.html#sec-xeventsignals>
:

bool on_button_press(GdkEventButton* event);
Gtk::Button button("label");
button.signal_button_press_event().connect( sigc::ptr_fun(&on_button_press) );

But GdkEventButton seems to no longer exist or no longer be accessible in
gtkmm 4.0.

There is a reference to GdkEvent API changes in the migration documentation
<https://docs.gtk.org/gtk4/migrating-3to4.html>, but I still do not
understand how to migrate that example code. Is anyone more familiar or has
any sort of related example?
I've also posted this on stack overflow:
https://stackoverflow.com/questions/73979631/gdkeventbutton-when-migrating-from-gtkmm-3-0-to-gtkmm-4-0

Thanks for your help,
Aaron

--000000000000b485ed05ea64c727
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello,<div><br></div><div>I hope this is the right place f=
or this, sorry if not!</div><div><br></div><div>I&#39;m trying to implement=
 an example gtkmm 3.0 code in gtkmm 4.0 and ran into a problem.=C2=A0<span =
style=3D"color:rgb(35,38,41);font-family:-apple-system,&quot;system-ui&quot=
;,&quot;Segoe UI Adjusted&quot;,&quot;Segoe UI&quot;,&quot;Liberation Sans&=
quot;,sans-serif">The goal is to get the cursor&#39;s coordinates and what =
type of click occurred when clicking on a button.=C2=A0</span><span style=
=3D"color:rgb(35,38,41);font-family:-apple-system,&quot;system-ui&quot;,&qu=
ot;Segoe UI Adjusted&quot;,&quot;Segoe UI&quot;,&quot;Liberation Sans&quot;=
,sans-serif">In gtkmm 3.0, I could use</span><span style=3D"color:rgb(35,38=
,41);font-family:-apple-system,&quot;system-ui&quot;,&quot;Segoe UI Adjuste=
d&quot;,&quot;Segoe UI&quot;,&quot;Liberation Sans&quot;,sans-serif">=C2=A0=
</span><code style=3D"color:rgb(35,38,41);font-style:inherit;font-variant:i=
nherit;font-weight:inherit;margin:0px;border:0px;font-stretch:inherit;line-=
height:inherit;vertical-align:baseline;box-sizing:inherit;white-space:pre-w=
rap">GdkEventButton</code><span style=3D"color:rgb(35,38,41);font-family:-a=
pple-system,&quot;system-ui&quot;,&quot;Segoe UI Adjusted&quot;,&quot;Segoe=
 UI&quot;,&quot;Liberation Sans&quot;,sans-serif">, as in this example from=
 the</span><span style=3D"color:rgb(35,38,41);font-family:-apple-system,&qu=
ot;system-ui&quot;,&quot;Segoe UI Adjusted&quot;,&quot;Segoe UI&quot;,&quot=
;Liberation Sans&quot;,sans-serif">=C2=A0</span><a href=3D"https://develope=
r-old.gnome.org/gtkmm-tutorial/unstable/gtkmm-tutorial.html#sec-xeventsigna=
ls" rel=3D"nofollow noreferrer" style=3D"font-family:inherit;font-style:inh=
erit;font-variant:inherit;font-weight:inherit;margin:0px;padding:0px;border=
:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-s=
izing:inherit">docs</a><span style=3D"color:rgb(35,38,41);font-family:-appl=
e-system,&quot;system-ui&quot;,&quot;Segoe UI Adjusted&quot;,&quot;Segoe UI=
&quot;,&quot;Liberation Sans&quot;,sans-serif">:</span></div><div><span sty=
le=3D"color:rgb(35,38,41);font-family:-apple-system,&quot;system-ui&quot;,&=
quot;Segoe UI Adjusted&quot;,&quot;Segoe UI&quot;,&quot;Liberation Sans&quo=
t;,sans-serif"><br></span></div><div><pre style=3D"margin-top:0px;border:0p=
x;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch=
:inherit;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:6=
00px;overflow:auto"><code style=3D"margin:0px;padding:0px;border:0px;font-s=
tyle:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;=
line-height:inherit;vertical-align:baseline;box-sizing:inherit;background-c=
olor:transparent;white-space:inherit;border-radius:0px">bool on_button_pres=
s(GdkEventButton* event);
Gtk::Button button(&quot;label&quot;);
button.signal_button_press_event().connect( sigc::ptr_fun(&amp;on_button_pr=
ess) );
</code></pre><p style=3D"margin-top:0px;margin-right:0px;margin-left:0px;pa=
dding:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:i=
nherit;font-stretch:inherit;line-height:inherit;font-family:-apple-system,&=
quot;system-ui&quot;,&quot;Segoe UI Adjusted&quot;,&quot;Segoe UI&quot;,&qu=
ot;Liberation Sans&quot;,sans-serif;vertical-align:baseline;box-sizing:inhe=
rit;clear:both;color:rgb(35,38,41)">But=C2=A0<code style=3D"margin:0px;bord=
er:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-str=
etch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit=
;white-space:pre-wrap">GdkEventButton</code>=C2=A0seems to no longer exist =
or no longer be accessible in gtkmm 4.0.</p><p style=3D"margin-top:0px;marg=
in-right:0px;margin-left:0px;padding:0px;border:0px;font-variant-numeric:in=
herit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inhe=
rit;font-family:-apple-system,&quot;system-ui&quot;,&quot;Segoe UI Adjusted=
&quot;,&quot;Segoe UI&quot;,&quot;Liberation Sans&quot;,sans-serif;vertical=
-align:baseline;box-sizing:inherit;clear:both;color:rgb(35,38,41)">There is=
 a reference to GdkEvent API changes in the=C2=A0<a href=3D"https://docs.gt=
k.org/gtk4/migrating-3to4.html" rel=3D"nofollow noreferrer" style=3D"margin=
:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-we=
ight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;v=
ertical-align:baseline;box-sizing:inherit">migration documentation</a>, but=
 I still do not understand how to migrate that example code. Is anyone more=
 familiar or has any sort of related example?</p></div><div>I&#39;ve also p=
osted this on stack overflow:=C2=A0<a href=3D"https://stackoverflow.com/que=
stions/73979631/gdkeventbutton-when-migrating-from-gtkmm-3-0-to-gtkmm-4-0">=
https://stackoverflow.com/questions/73979631/gdkeventbutton-when-migrating-=
from-gtkmm-3-0-to-gtkmm-4-0</a></div><div><br></div><div>Thanks for your he=
lp,</div><div>Aaron</div></div>

--000000000000b485ed05ea64c727--

--===============5974252821874057189==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list

--===============5974252821874057189==--