How to get the last parameter ( gint monitor ) for gtk-window-fullscreen-on-monitor Function

No, that’s what gtk_window_fullscreen() does.

Or more precisely: What you can expect it to do, as the request is handled by the window manager.

When you use gtk_window_fullscreen_on_monitor(), the last parameter specifies the monitor index you want the window moved to. 0 does not have any special meaning, it means “the monitor with index 0”.

According to its implementation the function gtk_window_fullscreen_on_monitor() takes 3 parameters.

From what I understand it goes to fullscreen on the monitor on which the window currently is positioned.
This means that I can use Zero as the last argument like in the following demo:

#include <gtk/gtk.h>

int main ( void )
    GtkWidget *window;

    /// ***
    gtk_init ( NULL, NULL );

    /// *** Create a Window
    window = gtk_window_new( GTK_WINDOW_TOPLEVEL );

    /// *** Set the Window to FullScreen
    GdkScreen   *screen;
    GdkDisplay  *display;

    display  = gdk_display_get_default ();
    screen   = gdk_display_get_default_screen ( display );

    gtk_window_fullscreen_on_monitor ( GTK_WINDOW( window ), screen, 0 );

    gtk_widget_show_all( window );
    gtk_main ();

This works fine, but how do I programmatically have to deal with the last argument (gint monitor) so that GTK does the work for me instead of using myself 0 (zero) as its last argument?

And how do I detect that programmatically?
I mean, if the application is on another monitor how do I pass the right parameter?

Or you mean that no matter which monitor uses, the result will always be 0 (ZERO)?

Most of functions which I think they worked are now marked as deprecated.

The API is mostly an X11-ism, and mostly for desktop components that can negotiate with the window manager/compositor their geometry and location; as it is, the API does not make sense on other platforms or windowing systems—ultimately, for applications, only the window manager can decide which monitor to use, or what kind of geometry the window can have.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.