> "button-press-event" occurs outside my window > application? Is there any way to connect an > extern mouse event with my gtk application?
So, other people may know more about this, but here's what I can find. You can g_signal_connect() the focus-out-event. https://developer.gnome.org/gtk3/stable/GtkWidget.html#GtkWidget-focus-out-event As the documentation says, this requires a gtk_widget_set_events (window, GDK_FOCUS_CHANGE_MASK); I don't know if you also need to set g_object_set (window, "can-focus", TRUE, NULL); Either way, in the function you g_signal_connect(), you can then check if the window that has focus is 'foreign' or not. If it is, it is not part of your application. This means you need to figure out the active window. This should be possible in two steps, perhaps you can leave out the first. (I didn't check to verify.) 1. screen = gdk_screen_get_default(); window = gdk_screen_get_active_window (screen); if, after this, window == NULL, you can do 2. manager = gdk_display_get_device_manager (gdk_display_get_default ()); device = gdk_device_manager_get_client_pointer (manager); window = gdk_device_get_window_at_position (device, NULL, NULL); After both steps, if window is NULL, it is a foreign application. If the window is _not_ NULL, you need to do an additional check. windowtype = gdk_window_get_window_type (window); type = event->type; if ((type == GDK_FOCUS_CHANGE) && (windowtype == GDK_WINDOW_FOREIGN)) then it's a foreign application. I have just roughly tested all this locally and it works for me. Best regards, Norbert _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list