I have a program that really needs to know when the user has released the mouse button after resizing the window. I asked to get button-release signals for the window, and I get them when the mouse is clicked INSIDE the window, but NOT when I resize the window and release the mouse button. Below is a short program that demonstrates this. Can anyone tell me what I need to do to get these events?
People have suggested "just use configure signals to do that", but the last configure signal occurs when the mouse stops moving. The user might hold down the mouse button long after that.
C code: '''
#include <stdlib.h>
#include <gtk/gtk.h>
GtkWidget *window;
GtkBuilder *builder;
int
main(int argc, char *argv[]) {
gtk_init(0, NULL); // init Gtk
builder = gtk_builder_new_from_file ("test.glade");
window = GTK_WIDGET(gtk_builder_get_object(builder, "window"));
g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
gtk_builder_connect_signals(builder, NULL);
gtk_widget_show(window);
gtk_main();
return 0;
}
gboolean
on_window_button_release_event(GtkWidget *w, GdkEvent *e, gpointer p)
{
printf("button release\n");
return FALSE;
}
'''
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.4 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkWindow" id="window">
<property name="can_focus">False</property>
<signal name="button-release-event" handler="on_window_button_release_event" swapped="no"/>
<child>
<object class="GtkFixed" id="fixed1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel">
<property name="width_request">100</property>
<property name="height_request">80</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Label</property>
</object>
<packing>
<property name="x">113</property>
<property name="y">93</property>
</packing>
</child>
</object>
</child>
<child type="titlebar">
<placeholder/>
</child>
</object>
</interface>
'''