tl;dr: How can I reliably test which modifier a user is pressing while clicking the mouse?
ImageView.imshow as a GUI to select points on an image. The functionalities already baked-in in
imshow (zoom, pan, annotate) are the main reason why I’m hijacking that structure. But I need to add some way for the user to pick (and un-pick) a point on the displayed image. To do that I’ve used the drawing example in
sigstart = map(c.mouse.buttonpress) do btn if btn.button == 1 if btn.modifiers == 1 #shift push!(add, btn.position) elseif btn.modifiers == 5 #shift+ctrl push!(remove, btn.position) end end end
remove are signals that add or remove the coordinate from the list of chosen coordinates.
My problem is that
Ctrl-Shift are not always 1 and 5 respectively (i.e. I sometimes get 16 and 17). I have no idea what governs this fickleness, but it means that I can’t use that as a mechanism to identify which modifiers the user pressed. I have tried to pry-out the way this is accomplished in
ImageView.imshow (e.g. the users can press
Ctrl with the scroll wheel to zoom), but without any success. Even trying to compare
GtkReactive.SHIFT didn’t work…
Anyone knows how to do this from within Julia (i.e. I’m not any wiser from reading the
Gtk manual about modifiers)?