From f328f4023d8be8be9504d96b26ab9595d0a659a7 Mon Sep 17 00:00:00 2001 From: Savanni D'Gerinel Date: Sun, 12 Mar 2023 09:19:16 -0400 Subject: [PATCH] Set up a controller to detect mouse clicks --- hex-grid/src/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hex-grid/src/main.rs b/hex-grid/src/main.rs index 2fa1683..b61e113 100644 --- a/hex-grid/src/main.rs +++ b/hex-grid/src/main.rs @@ -257,7 +257,13 @@ impl ObjectImpl for HexGridWindowPrivate { } }); } + let click_controller = gtk::GestureClick::new(); + click_controller.connect_released(|_, press, x, y| { + println!("key pressed: {} {} {}", press, x, y); + }); + self.drawing_area.add_controller(&motion_controller); + self.drawing_area.add_controller(&click_controller); } }