6 ms·
Isn’t is possible to get something like mouse position from almost any stdlib of most languages?
by dgfitz 2y ago
Isn’t is possible to get something like mouse position from almost any stdlib of most languages?
- seba_dos1 2y agoNo, not really. Modern APIs usually don't even let you access that kind of information without additional privileges. Some older toolkits have functions that are supposed to do this, but it doesn't work everywhere.
- dgfitz 2y agoCan’t you get the cursor position from the windows c++ stdlib? Or like pyautogui? Or the Java stdlib?
- adzm 2y agoWindows' pointer position is available to even the most limited GUI application; it is not protected information. For win32 at least, I am not familiar enough to say that about the newer app packages which are much more locked down, but I would be surprised.
- anyfoo 2y agoHopefully only if the given app has focus.
- funcDropShadow 2y agoWhy? I want to have some applications that can always see the mouse cursor like, xeyes. Because that allows me to implement a better customized desktop environment.
- anyfoo 2y agoThen give that piece of code extra-special permissions. As I’ve said in another comment, the days where you downloaded your software from the sunsite or tsx11.ai.mit.edu FTP servers and could be confident that it and all its dependencies were trustworthy are unfortunately gone for a very long time.
- kaba0 2y agoThey queried that info based on a specific implementation of a framework. If that framework is implemented under Wayland, then through the Wayland APIs it will only get rudimentary info on mouse position (e.g. only when it’s in focus and the mouse is over it).
- seba_dos1 2y agoApp doesn't have to be in focus. It receives pointer events over its own surfaces (plus in some additional cases like drags and grabs). It doesn't receive any information about pointer position otherwise, nor its global coordinates (at least not without extra protocols).
- dgfitz 2y agoIs it possible that one could write essentially a transparent app, which is always in focus and just passes click events through the transparent layer?
- seba_dos1 2y agoYou can write a transparent app, but its the compositor that decides whether it's in focus and your app will either pass both hovers and clicks to the window behind (not staying in focus for long and not getting any pointer events even when it still is), or it will consume them all.
- jcelerier 2y agoIt works fine on Windows and macOS's desktop APIs in 2024. This is a basic "desktop app" expected feature - if you aren't able to implement fully something like AutoHotkey or AppleScript macros, you aren't really a proper desktop platform.
- consteval 2y agoYou can implement all those things, just differently now. Relatedly, now random apps can't record the whole screen. This is a good thing, now they get explicit user permission and go through xdg. I don't know how anyone could be opposed to this - it's objectively more empowering for you, the user.
- funcDropShadow 2y agoYou think enforcing the one true rights model to everyone is more empowering? We have obviously different definitions.
- consteval 2y agoYes, it's empowering because your "rights model" is one where you don't have rights. You don't know what applications are using what data, and you also can't stop it. Is that empowering? I think no. But if you wanna argue Chrome should be able to read all your keyboard inputs whenever it wants be my guest. I can't fathom why people want that type of setup.
- orangeboats 2y agostdlib? Nope, a definite nope! I won't expect stdlib.h to provide me a magical get_cursor_pos() function in any way. GUI toolkits? (This includes the Win32 GUI.) Maybe. It's not a universal thing though -- for example, you may receive mouse position _only_ when the cursor is in your window.
- dgfitz 2y ago"stdlib" was shorthand for "the standard library of a given language" and it came across poorly. I did a quick google before I asked you that question, and it looks like wayland is one of the few exceptions to completely exposing current cursor position. Most "stdlibs" do expose it.
- orangeboats 2y agoPlease refrain from using the term "stdlib", it has a specific meaning and I have trouble understanding what do you mean by it. Are you referring to the native GUI toolkit of a platform (e.g. Winforms, Cocoa) or something else?
- dgfitz 2y agoI will not refrain, you're the only one confused by it. Just google it. You are incorrect and you're not pumped about it, I get it. The horse is fully beat to death. If you want to discuss further, my responses will probably just be lmgtfy links.
- orangeboats 2y agohttps://en.wikipedia.org/wiki/Standard_library https://en.wikipedia.org/wiki/Standard_library > In computer programming, a standard library is the library made available across implementations of a programming language. You should show me that, among the mainstream programming languages, their standard library will provide get_cursor_pos().
- 2y ago