macOS: GdkScreen::monitors-changed is not emitted
The monitors-changed
signal on GdkScreen is not emitted on macOS in GTK3.
Example code:
#include <glib.h>
#include <gtk/gtk.h>
void on_monitors_changed (GdkScreen *screen, gpointer userdata)
{
g_debug ("Monitors changed");
g_object_set ((GtkLabel*) userdata, "label", "Monitors changed!", NULL);
}
int main(int argc, char **argv) {
gtk_init (&argc, &argv);
GtkWidget *win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
GtkWidget *label = gtk_label_new ("Change the monitor configuration");
gtk_container_add (GTK_CONTAINER (win), label);
gtk_widget_show_all (win);
g_signal_connect (gdk_screen_get_default(),
"monitors-changed",
G_CALLBACK (on_monitors_changed),
(gpointer) label);
gtk_main ();
return 0;
}
When you run this code, then change your monitor configuration (plug in/unplug an external monitor, etc.) you would expect the label to change to "Monitors changed", but it does not.
macOS 10.14.5, gtk+3 3.24.9 from Homebrew