![]() |
SDL-gui-backend merged... | ![]() |
Ryan C. Gordon
Guest
![]() |
![]() |
The first piece of my SDL-gui-backend experiment has been merged into
the main SDL repository. I've been looking at what SDL needs to be useful as a backend for GUI toolkits. This isn't so much a question of "how do I build a UI with SDL," but more like, "what would something like GTK+ need to talk exclusively to SDL instead of X11?" As a first target, we added what Unreal Engine 4's Slate UI toolkit would need to never talk directly to X11 on Linux, since the added requirements were pretty modest. Here's the merge, modulo a few patches on top to get it to compile: https://hg.libsdl.org/SDL/rev/dc80dc0bd22e The documentation on the new functions are right at the top of the patch, if you scroll down a little. All of the new stuff works on Mac, Windows, and X11, probably isn't relevant to iOS/Android/etc, and still needs support for Wayland, Mir, and Haiku. This experiment will continue. I'm not sure what else, if anything else, will be added, yet. There's a delicate balance to SDL, and you don't want to go crazy adding things like this, especially when the primary use is games, but I'm interested in finding cases like Slate--can mostly use SDL, just needed X11 for a few special items--and seeing if we can make those cases more portable. --ryan. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||
|
![]() |
SDL-gui-backend merged... | ![]() |
Jonas Kulla
Guest
![]() |
![]() |
2014-06-26 3:57 GMT+02:00 Ryan C. Gordon:
Interesting stuff!
What are you planning to do about platforms where this is impossible by design (eg. Wayland)? Jonas |
||||||||||||||
|
![]() |
SDL-gui-backend merged... | ![]() |
Ryan C. Gordon
Guest
![]() |
![]() |
Why is that impossible by design? --ryan. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||||
|
![]() |
SDL-gui-backend merged... | ![]() |
![]() |
SDL-gui-backend merged... | ![]() |
Sam Lantinga
![]() |
![]() |
You just return the current mouse coordinates in global space when it's over one of your application windows.
On Wed, Jun 25, 2014 at 8:53 PM, Jonas Kulla wrote:
|
||||||||||||||||
|
![]() |
SDL-gui-backend merged... | ![]() |
Jonas Kulla
Guest
![]() |
![]() |
2014-06-26 6:01 GMT+02:00 Sam Lantinga:
How do you define "global space" without knowing your window's position on the screen? Â
|
||||||||||||||||||||
|
![]() |
SDL-gui-backend merged... | ![]() |
Sam Lantinga
![]() |
![]() |
You don't know your window position in Wayland?? :)
On Wed, Jun 25, 2014 at 9:29 PM, Jonas Kulla wrote:
|
||||||||||||||||||||||
|
![]() |
SDL-gui-backend merged... | ![]() |
Jonas Kulla
Guest
![]() |
![]() |
2014-06-26 6:33 GMT+02:00 Sam Lantinga:
That's what I just said two emails ago.. But hey, this time I actually have a reference [1] to point to! =P [1]Â http://wayland.freedesktop.org/docs/html/sect-Protocol-Surface.html Â
|
||||||||||||||||||||||||||
|
![]() |
SDL-gui-backend merged... | ![]() |
Ethan Lee
Guest
![]() |
![]() |
While not strictly related to GUI toolkits, this does bring up a question I have about the mouse state in SDL2.
Something that was recently brought up for both FNA and MonoGame was the accuracy of MouseState. Basically, we still have the problem of the mouse state only caring about the coordinates within the window, when XNA4 can actually provide coordinates both <0 and >ClientBounds. It _looks_ like something similar to SDL_GetGlobalMouseState would work, but with this call we would still need to get the mouse state relative to the window and subtract to get XNA4 behavior... and if SDL_GetGlobalMouseState is as inefficient as the docs note, this probably isn't something to use in addition to SDL_GetWindowPosition every time the client asks for MouseState. On the other hand, something like SDL_CaptureMouse would be pretty nice to get those negative coordinates (for example) right away, but the rest of this call's behavior would make things messy really quickly... TL;DR: Is there any use for something like SDL_GetGlobalMouseState except that it provides the coordinates that SDL_CaptureMouse would provide, or is this something that only weird projects like FNA would need? -Ethan
|
||||||||||||||
|
![]() |
SDL-gui-backend merged... | ![]() |
Ryan C. Gordon
Guest
![]() |
![]() |
It's not _inefficient_, but it _does_ talk to the display server, whereas SDL_GetMouseState() just returns whatever value SDL last saw for the mouse without any further work done. I think it's still safe to call every frame.
Slate had a similar concern, but we decided doing the subtraction worked fine, so we didn't add an SDL_ClientToScreen() API. SDL_GetWindowPosition() also does not talk to the display server, but returns the last known window position, which is updated as the appropriate events come from the OS. I would say just call SDL_GetWindowPosition() and do the subtraction, and we can revisit if this proves problematic. --ryan. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||||||
|
![]() |
SDL-gui-backend merged... | ![]() |
Ryan C. Gordon
Guest
![]() |
![]() |
That seems like a weird piece of security to enforce. Sort of feels like that would break lots of things. I'll follow up with the Wayland people about this. --ryan. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||||
|
![]() |
SDL-gui-backend merged... | ![]() |
Jonas Kulla
Guest
![]() |
![]() |
2014-06-26 9:48 GMT+02:00 Ryan C. Gordon:
To be clear, the surface positions not being exposed is less of a security thing, and more of a "please don't assume you're on a flat rectangular display". I think it was argued that the core design of Wayland should not prohibit different display scenarios where the concept of a Cartesian coordinate system makes no sense. But do talk to the Wayland people, I'm sure they'll have more accurate explanations for the hows and whys. |
||||||||||||||
|
![]() |
SDL-gui-backend merged... | ![]() |
Mason Wheeler
Guest
![]() |
![]() |
...seriously?
OK, someone totally needs to smack them all upside the head with a YAGNI-bat. (This is a highly specialized form of clue-bat.) Mason On Thursday, June 26, 2014 11:44 AM, Jonas Kulla wrote: To be clear, the surface positions not being exposed is less of a security thing, and moreof a "please don't assume you're on a flat rectangular display". I think it was argued that the core design of Wayland should not prohibit different display scenarios where the concept of a Cartesian coordinate system makes no sense. |
||||||||||
|
![]() |
SDL-gui-backend merged... | ![]() |
Joseph Carter
![]() |
![]() |
If you can still figure out what color the cursor is pointing at and
the like for a color picking tool, I'm happy. Otherwise, they should be whipped with wet spaghetti noodles. I'm all for "make few/no assumptions". Just don't break stuff in the process, YAGNI violated or not. Joseph On Thu, Jun 26, 2014 at 01:49:57PM -0700, Mason Wheeler wrote:
_______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||||
|
![]() |
SDL-gui-backend merged... | ![]() |
Jonas Kulla
Guest
![]() |
![]() |
2014-06-27 1:17 GMT+02:00 T. Joseph Carter:
You mean from anywhere on the screen (ie. not your own surface)? That's not possible because in Wayland you have no access to the main framebuffer. Every compositor will have it's own screenshooter utility that talks to it via a private protocol to not expose this to clients. This one makes the most sense, really. It makes it infinitely harder to steal someone's credit card information simply by stealthily taking screenshots and sending them back. Â
|
||||||||||||||
|
![]() |
SDL-gui-backend merged... | ![]() |
Daniel Gibson
Guest
![]() |
![]() |
Hi Mason,
would you mind using another email address for the mailing list? Your E-Mails are always filtered as SPAM by many mail providers, because Yahoo sucks, see http://www.ietf.org/mail-archive/web/ietf/current/msg87153.html for details. (@Michael: I put you in CC because I just found mails from you from another topic in my SPAM folder for the same reason) Thanks, Daniel _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||
|