fabioarnold/MiniPixel

Issues Minimizing Window on Linux

shadeops opened this issue ยท 3 comments

Howdy,

I noticed some issues when trying to minimize MiniPixel on Linux. (MiniPixel is so awesome I hadn't tried to minimize it before now. ๐Ÿ˜„ )

Here is a .gif of what happens when the window's minimize button is clicked.

MiniPixel

The window loses focus but the immediately seems to un-minimize itself. Additionally if I go to another desktop, I can see it show up in the task bar which generally only happens if an application is trying to get attention.

I have zero SDL experience, but my guess is that the SdlWindow.draw() call is sees that the window is hidden and tells the window manager to show it:

MiniPixel/src/main.zig

Lines 261 to 263 in f5f0195

if (c.SDL_GetWindowFlags(self.handle) & c.SDL_WINDOW_HIDDEN != 0) {
c.SDL_ShowWindow(self.handle);
}

I made a small change here, shadeops@9728a1a, which avoids the SdlWindow.draw() call entirely if minimized.

Note - This doesn't appear to be a problem with 0.2.1 on Windows.

OS: Kubuntu 20.04
Head: f5f0195

Oh, I never noticed because this issue doesn't show on Gnome:
Screencast from 12.01.2023 22:10:15.webm

It's a bit annoying that KDE conflates the hidden and minimized state of windows. But I guess you can work around that by checking both flags as you did.

IIRC, I added this window unhide mechanism to avoid initially showing a black flash because nothing had been drawn, yet.

I'll try to reproduce this on my Steam Deck. I think it does have KDE. ๐Ÿ˜„

Check out Mini Pixel running on the Steam Deck! ๐Ÿ˜„ (Had to install Zig and VS Code first)
A9510900-807A-4298-A19E-B26191166194_1_102_o

And yes I can reproduce your issue now! Do you mind opening a PR with your change, please?

Yas! That is so amazing. And now I want a Steam Deck!