I don't know if it's intentional but it is surprising :) The plugin handles the button release event instead of the clicked signal g_signal_connect(mwp->button, "button-release-event", G_CALLBACK(mailwatch_button_release_cb), mwp); this results in launching the associated command even if after a press I move the cursor away from the plugin, which is unlike how buttons usually behave. Reproducible: Always Steps to Reproduce: 1. 2. 3.
It's intentional, as we have different actions on different buttons (left button launches the configured program, middle button forces an update) and "clicked" signal does not reveal the button clicked.
then maybe check if the widget still has focus in the handler before doing anything? I haven't used it, maybe with GTK_WIDGET_HAS_FOCUS(). other plugins have properties in one button and action on left but they still behave traditionally
GTK_WIDGET_HAS_FOCUS() won't work, as the panel doesn't accept focus (and so the button never gets it). But checking if the event coordinates lie inside the widget's allocation would probably work. Brian?
Created attachment 396 Adds a check for cursor position in button-release-event For reference, here's what I meant.
Y'know, I also wish the button would show itself being pressed in and released when you middle click as well. I wonder if there's a way to do that. But I digress. Pasi, it looks fine to me. If it works, go ahead and commit it.
Ok, nevermind, I did it myself. Fixed.