Closed SDLBugzilla closed 3 weeks ago
(Just so the bug report is all in the same place, this was the attachment image from Bugzilla...)
Okay, so, this still happens with the latest Dear Imgui, if you use the newer imgui/examples/example_sdl3_opengl3
and drag the Hello World window out of the main window and try to drag it off the screen (or even just write a test app that calls SDL_SetWindowPosition() to move to a negative X coordinate). And, yes, it's the lack of the override_redirect flag that prevents this.
BUT: turning on that flag can only be done at window creation time, so we can't do it for borderless windows unless we're willing to recreate them during a SDL_SetWindowBordered() call.
But also: this works because override_redirect=True basically removes Window Manager control from the window. This means it won't respect keyboard focus, z-ordering, it won't show up in the task bar, etc.
If you want to see why this is a bad idea, run that Dear Imgui example with the environment variable SDL_X11_FORCE_OVERRIDE_REDIRECT=1
. Just be prepared to reboot your machine or ssh in to kill the process, since it will basically hang the desktop.
I've only tried this on Gnome (with...Metacity? Is that the current Gnome window manager?), but I can see that you can drag windows outside the desktop from a standard title bar but not programmatically position them. I would argue this is a window manager bug and should be addressed by them.
We should close this one.
BUT: turning on that flag can only be done at window creation time, so we can't do it for borderless windows unless we're willing to recreate them during a SDL_SetWindowBordered() call.
Wait, that's not true; XChangeWindowAttributes() can change this flag on an existing window.
I'm guessing it would cause problems to just change this flag right before moving the window and then change it back, especially over and over while dragging the window, so I still think we should close this.
I'm guessing it would cause problems to just change this flag right before moving the window and then change it back, especially over and over while dragging the window, so I still think we should close this.
Agreed. Positioning the window is just a request, and if the window manager policy is not to programmatically move windows outside the desktop area, that's fine.
Okay, closing. I would definitely recommend someone take this up with the Metacity (or whatever is the current thing) developers, though, since it seems like an incorrect thing to be doing at the window manager level.
This bug report was migrated from our old Bugzilla tracker.
These attachments are available in the static archive:
Reported in version: 2.0.13 Reported for operating system, platform: Linux, x86_64
Comments on the original bug report:
On 2020-08-31 12:09:01 +0000, Rokas Kupstys wrote: