With set_event_compression, most recent motion event is held in waiting
Jason M'Sadoques via gtkmm-list <[email protected]> Sat, 21 May 2022 01:43:48 +0000
| Newsgroups | gmane.comp.gnome.gtkmm |
|---|---|
| Message-ID | <[email protected]> |
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --===============4286063032524101615== Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha256; boundary="------cba190b65e9861e9c9d212c05e9a97bd1067334c70451dbc6aa3606d719039d4"; charset=utf-8 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------cba190b65e9861e9c9d212c05e9a97bd1067334c70451dbc6aa3606d719039d4 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Message-ID: <[email protected]> Subject: With set_event_compression, most recent motion event is held in waiting From: Jason M'Sadoques <[email protected]> To: [email protected] Date: Fri, 20 May 2022 21:43:33 -0400 User-Agent: Evolution 3.44.1 MIME-Version: 1.0 I have a simple drawing area, and I have configured set_event_compression(false). I am printing out motion and button events, and I see while I move the mouse the motion events come out, but then when I stop and press the mouse button, I get one more motion event and then the button press event. Now I can do this because I'm using a trackball, so it is easy to press a button without incurring any further actual mouse motion. When I comment out the line to set_event_compression, I do not see this behavior. So instead when I press the mouse button, I just get a button press, and the coordinates of that button press match exactly to the last motion event. I wonder if someone can either confirm it is a bug, or I really hope that it is a problem I'm doing. I am using GTKMM 3.24.6. Here is a simple example which I compiled with: g++ -o drawtest $(pkg-config --cflags --libs gtkmm-3.0) drawtest.cpp #include <gtkmm.h> #include <iostream> class drawingArea : public Gtk::DrawingArea { public: drawingArea(GtkDrawingArea* cObject, const Glib::RefPtr<Gtk::Builder>& builder) : Gtk::DrawingArea(cObject), eventNum(0) { }; void on_realize(void) override; int eventNum; bool on_button_press_event(GdkEventButton* event); bool on_button_release_event(GdkEventButton* event); bool on_motion_notify_event(GdkEventMotion* event); }; void drawingArea::on_realize(void) { Gtk::DrawingArea::on_realize(); get_window()->set_event_compression(false); } bool drawingArea::on_button_press_event(GdkEventButton* event) { std::cout << eventNum++ << " button pressed " << event->x << ":" << event->y << std::endl; return true; } bool drawingArea::on_button_release_event(GdkEventButton* event) { std::cout << eventNum++ << " button released " << event->x << ":" << event->y << std::endl; return true; } bool drawingArea::on_motion_notify_event(GdkEventMotion* event) { std::cout << eventNum++ << " motion " << event->x << ":" << event->y << std::endl; return true; } int main (int argc, char **argv) { auto app =3D Gtk::Application::create(argc, argv, "org.drawarea"); Glib::RefPtr<Gtk::Builder> builder =3D Gtk::Builder::create(); builder->add_from_file("drawarea.glade"); Gtk::Window* mainWindow =3D nullptr; builder->get_widget("Window", mainWindow); drawingArea* drawArea =3D nullptr; builder->get_widget_derived("drawing", drawArea); drawArea->add_events(Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK); app->run(*mainWindow); delete mainWindow; } --------cba190b65e9861e9c9d212c05e9a97bd1067334c70451dbc6aa3606d719039d4 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: ProtonMail wsBzBAEBCAAnBQJiiEPRCZCRLah6OSFOThYhBE0p+kJR+uVpGr6LC5EtqHo5 IU5OAADpSwgAkSt4f0g3QIRJuXaJGM8F/VZQGit+WfJ9qOJ5vQZnxupnFEO/ u3NmuoletEra91oGifxy+Hfx5tKo3KcFrnrHpNoMTdAXs9a1srY0tQIvs8rV wGeP/hU1N4TtMs4xYdfuTK13QAIKyzRKQrbasJMDsl0G0ANG15boD6I92x0g FUpcjzQIYClzC7kb40CPwBrsydqJ58YqYjbsyJPK52/4NLF1lrLVn4NCUO5h 3dHb5/zososy6/q96yixSDsWVPIyeZjOhmXbNGTag6YK2GKCQ79SY7tcbkeQ ckoZmxZInCi5DMpkV/gYG5R/qUB2X7BJsTd5a5ROYyhpQQvBBLSTog== =jODR -----END PGP SIGNATURE----- --------cba190b65e9861e9c9d212c05e9a97bd1067334c70451dbc6aa3606d719039d4-- --===============4286063032524101615== 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 --===============4286063032524101615==--