wrapper for gtk_dialog_run() that brings the dialog to the front see issues at: https://github.com/btzy/nativefiledialog-extended/issues/31 https://github.com/mlabbe/nativefiledialog/pull/92 https://github.com/guillaumechereau/noc/pull/11
| 368 | // https://github.com/mlabbe/nativefiledialog/pull/92 |
| 369 | // https://github.com/guillaumechereau/noc/pull/11 |
| 370 | gint RunDialogWithFocus(GtkDialog* dialog) { |
| 371 | #if defined(GDK_WINDOWING_X11) |
| 372 | gtk_widget_show_all(GTK_WIDGET(dialog)); // show the dialog so that it gets a display |
| 373 | if (GDK_IS_X11_DISPLAY(gtk_widget_get_display(GTK_WIDGET(dialog)))) { |
| 374 | GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(dialog)); |
| 375 | gdk_window_set_events( |
| 376 | window, |
| 377 | static_cast<GdkEventMask>(gdk_window_get_events(window) | GDK_PROPERTY_CHANGE_MASK)); |
| 378 | gtk_window_present_with_time(GTK_WINDOW(dialog), gdk_x11_get_server_time(window)); |
| 379 | } |
| 380 | #endif |
| 381 | return gtk_dialog_run(dialog); |
| 382 | } |
| 383 | |
| 384 | } // namespace |
| 385 |
no outgoing calls
no test coverage detected