I am trying to build an App in linux Ubuntu with C and GTK3 and I get an Error about gdk_window_get_origin and I can not figure out what I am doing wrong.
The app runs and the Window is indeed the size of my Screen, but there is this warning which I cannot fix it:
(Stack:7229): Gdk-CRITICAL **: 11:09:22.221: gdk_window_get_origin: assertion 'GDK_IS_WINDOW (window)' failed Screen max: 1600W X 900H
Here is a sample code:
#include <gtk/gtk.h>
int main(int argc, char *argv[])
{
GtkWidget *window;
gint width, height;
gtk_init(&argc, &argv);
/// Creating the Window
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
/// Get window Size
GdkDisplay *dpy = gtk_widget_get_display( window );
GdkWindow *win = gtk_widget_get_window(window);
GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win);
/// Get window Geometry
GdkRectangle geometry;
gdk_monitor_get_geometry(monitor, &geometry);
width = geometry.width;
height = geometry.height;
g_print("Screen max: %dW X %dH\n", width, height);
// Setting the default size of the Window
gtk_window_set_default_size(GTK_WINDOW(window), width, height );
// Destroy the Window
g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
gtk_widget_show_all(window);
gtk_main();
}