Hello,
Rewriting the xffm application from gtk3 to gtk4.
Currently the xffm+ app serves the purpose of a file manager dialog to the lightweight panned window manager i3. As such, it should open by default in floating mode.
With gtk3 this is done easily with gtk_window_set_type_hint(window, GDK_WINDOW_TYPE_HINT_DIALOG);
But this function is no longer in gtk4. I suppose this is no longer an option as it is X11 specific and gtk4 is targeting a more general approach (just my guess).
Is there any easy replacement function call that will do the same?
In the meantime, if anyone needs a workaround, the following code works for me with X11. I have no idea if it will work with Wayland.
void showWindow(GtkWindow *mainWindow_){
GtkWidget *widget = GTK_WIDGET(mainWindow_);
gtk_widget_realize(widget);
GtkNative *native = gtk_widget_get_native(widget);
GdkSurface *surface = gtk_native_get_surface(native);
Window w = gdk_x11_surface_get_xid (surface);
GdkDisplay *displayGdk = gdk_display_get_default();
Atom atom = gdk_x11_get_xatom_by_name_for_display (displayGdk, "_NET_WM_WINDOW_TYPE_DIALOG");
Atom atom0 = gdk_x11_get_xatom_by_name_for_display (displayGdk, "_NET_WM_WINDOW_TYPE");
Display *display = gdk_x11_display_get_xdisplay(displayGdk);
XChangeProperty (display, w,
atom0, XA_ATOM,
32, PropModeReplace,
(guchar *)&atom, 1);
gtk_window_present (mainWindow_);
}