SDL icon indicating copy to clipboard operation
SDL copied to clipboard

SDL_ShowOpenFileDialog slower with larger window

Open sava41 opened this issue 1 year ago • 3 comments

I noticed in my main application that the file dialog was opening slower when testing on my 4k laptop screen vs plugged into a 1080p external monitor. I made a simple test app using https://github.com/Ravbug/sdl3-sample that opens the file dialog on a key up event. from the video recording you can see that the small sdl window app opens the dialog in about 1.5 seconds while the big window takes 2.5 seconds.

https://github.com/libsdl-org/SDL/assets/50882455/4c6ba590-62c4-450e-ac1c-187bfc0503b7

https://github.com/libsdl-org/SDL/assets/50882455/ac33138a-ab42-4ce8-b7e1-f7f4027c7d99

Any ideas what might be causing this?

System: windows Compiler: msvc 2019

sava41 avatar Jun 17 '24 00:06 sava41

Can you try with testdialog? I've tried with that on my device, and it consistently takes about 1 second to open, regardless of whether the window is maximized or 50x50.

You'll need to open test/testdialog.c and change the SDL_CreateWindowAndRenderer line (86) to have the arguments ("testdialog", 640, 480, SDL_WINDOW_RESIZABLE, &w, &r), then run from the build directory:

cmake -DSDL_TESTS=ON ..
make
.\test\testdialog.exe

Semphriss avatar Jun 20 '24 22:06 Semphriss

After some quick testing, it does appear like the testdialog example opens consistently regardless of window size. I noticed testdialog uses a while loop while my application and the ravbug example uses the newer SDL_AppIterate. Could this be somehow related to the file dialog delay? I'll do some more research on my end.

sava41 avatar Jun 24 '24 03:06 sava41

Maybe rendering the bigger window puts more strain on your computer which slows down the opening of the file dialog? Note that the testdialog limits the frame rate using SDL_Delay(100) so that might be something you want to try in your application if you're not doing that already.

Kaktus514 avatar Jun 24 '24 13:06 Kaktus514

After more testing on several different systems, I believe this is a windows issue or issue with my laptop. Other computers open the file dialog consistently.

sava41 avatar Jul 02 '24 21:07 sava41