frang75 / nappgui_src

SDK for building cross-platform desktop apps in ANSI-C
https://www.nappgui.com
MIT License
506 stars 50 forks source link

Bug: Maximized window and taskbar overlap #63

Open millken opened 1 year ago

millken commented 1 year ago

Normally, when the taskbar is on the left side, the maximized window should be aligned with the taskbar instead of covering the entire desktop.

env: Debian12 GTK3 image

chris-deep commented 1 year ago

The window is screen coordinate [0,0] e.g. top left window coord is at screen coord 0,0? I'll look into a fix...

Does the NApp window adapt when the taskbar is located at bottom of screen or any other location (taskbar top or right docked)? I have Ubuntu only that I can test on. Let me see if I can get Debian running in a VM. My host laptop is MacOS but I have Parallels for Windows/Ubuntu.

Seems doable... https://stackoverflow.com/questions/5768740/how-to-get-the-size-and-location-of-the-taskbar-with-pygtk

chris-deep commented 1 year ago

This looks closer:

https://stackoverflow.com/questions/12331486/finding-out-the-size-of-taskbar-in-linux-c-c-gtkmm-other

void done(GtkWidget widget, void payload) { GdkScreen *screen = gtk_widget_get_screen(widget);

screen_width = gdk_screen_get_width(screen);
screen_height = gdk_screen_get_height(screen);

gtk_window_get_position((GtkWindow *)widget, &window_left, &window_top);
gtk_window_get_size((GtkWindow *)widget, &window_width, &window_height);

gtk_widget_destroy(widget);
gtk_main_quit();

}

In this case, the sample code provided maximizes the app to test the location/dimensions of the app window. And, from that determines/deduces where the taskbar is located and its dimensions. I'll keep looking, maybe there's a GTK API that can let us interrogate directly the taskbar location/size without having to maximize our windows...

frang75 commented 1 year ago

The maximize function works correctly. Another thing is that the window is positioned or resized using arbitrary parameters. Please share the code.

Maximize

Maximize2

chris-deep commented 1 year ago

Nice! I looked at the NApp code a little today and read some on how window positioning works with GTK (my background is Win32, so I'm learning as I go on Linux stuff). I'll do some testing with different window managers and see if I can get the behavior from the OP's screenshot with Debian. Any advice on which window managers would be best to test?