tryphotino / photino.NET

https://tryphotino.io
Apache License 2.0
935 stars 76 forks source link

[Fedora 40] gdk_display_get_primary_monitor() returned NULL #205

Open LauraWebdev opened 3 months ago

LauraWebdev commented 3 months ago

After updating my project from Photino.NET 2.6 to 3, it continues to give me the same error message box "gdk_display_get_primary_monitor() returned NULL" on Linux (Fedora).

image

I can click on close and it seems like the window does start, however WebMessages are apparently not sent to the window. They do appear within the debug log but don't register on the page itself.

It is worth noting that Fedora 40 apparently does not ship with webkit2gtk-4.0 anymore (they have switched to 4.1), so I had to install it via my package manager.

System information image

CalvinPVIII commented 2 months ago

I'm getting the same error on arch as well. I needed to install the wbekit2gtk package to get the app to launch at all, and after installing that package it launches but that message pops up first. I haven't noticed any other issues outside of the initial popup.

MikeYeager commented 2 months ago

This occurs when centering the window. We have confirmed that this does not happen on Ubuntu 22.04. It does happen on WSL running Ubuntu 22.04. In fact, several windows functions don't work in WSL. There does not seem to be much we can do about that. In any case, we did add that pop up dialog when the Center() call fails to aid in troubleshooting. If you get this popup, the Center() call won't work anyway. Removing the Center() call will get rid of the pop up. Not a great solution, I understand, but all we can do is stop activating the popup in this scenario. We cannot make the centering of the window work. What we know from the GTK docs is this, "The primary monitor, or NULL if no primary monitor is configured by the user." I'm not sure how one configures a primary monitor in Fedora (or WSL) or if it's even possible. We are open to ideas.

philippjbauer commented 1 month ago

Not all Linux distributions allow to check for the primary monitor that is configured in the operating system. This leads to an error and we display a message, instead of failing silently. We can try to figure out a way to get the width and height of the first monitor instead of the configured primary monitor and use that information for centering. If we cannot find this information we may fail silently in the future (with console logging).

philippjbauer commented 1 month ago

I've made a change that should help with this. @MikeYeager could you check out the latest debug commits and try to run that on WSL?

https://github.com/tryphotino/photino.Native/blob/73d762d3d4b0d59365193b4d0a4ce95f977e5e72/Photino.Native/Photino.Linux.cpp#L315

LauraWebdev commented 1 month ago

@philippjbauer @MikeYeager I just noticed that this issue of course also drippled down to the examples repo, so none of the examples can actually be run as of now.

MikeYeager commented 1 month ago

@LauraWebdev We are currently working on updating all of the samples. Unfortunately, when we updated the samples that use frameworks like Angular, React and Vue, those samples all broke. We are fixing them and will post new samples soo, followed by new project templates.