Free Process Information / Window Manipulation library

Works in Windows, Mac, Linux, and FreeBSD. With tweaks it could easily work on other BSD’s, I would just need to do all the stuff that depends on libutil to use sysctl directly instead. That would also allow for the removal of some mac code that could use sysctl as well in place of the darwin-specific crapola.

Anyway, once I’ve done that, I was wondering if some of these features could be implemented into SDL, and since I’m asking the community this and not the actual SDL developers, the reason I made a topic here is because I wanted to know if there was any demand for these things; it would help the SDL developers know whether it’s worth pursuing.

One thing in particular that my library does that SDL already does (but SDL does it to a more limited extent), is set a modal parent for a given window. I’d like a version of SDL_SetWindowModalFor() that takes actual window ID’s. In Windows, this would be an unsigned long long safely c-casted from an HWND. On linux and mac a window id (for X11 and Core Graphics, idk about Wayland) is an unsigned long, so it could just be a typedef of an unsigned long long that people would have to cast their platform specific window types to before using it. The cool thing about my implementation is that it can be used with a global window id, meaning it can belong to even an external app, even on macOS because on Mac I’m not using NSWindow * for the window id but rather a CGWindowID.

The library is written in c++ but can easily be adapted to be only using c code by the SDL developers if they care enough to do that.

This is the library, also ignore the filemanip and widgets folders those are irrelevent in this topic:

You can get a Mac CGWindowID from an NSWindow and vise versa via the helper functions wid_from_window and window_from_wid but an NSWindow * is only valid for the current app. So you would need either the parent and/or child window to belong to the current app, but it wont work if neither one of them belong to the current app for setting a parent or child window. You’d use wid_set_pwid() to set a parent window cross-platform.

My library can do a ton of other things like execute programs async and read their output, get process ID’s, parent process ID’s, window ID’s, and executable paths/names in a wide variety of ways. But that was just one feature of personal interest I wanted to talk about, since it took the most effort to implement, at least on mac. See the for the function list.