x11-cr icon indicating copy to clipboard operation
x11-cr copied to clipboard

window_property: expose raw prop

Open phil294 opened this issue 1 year ago • 0 comments

Currently, display.window_property(...) always ever returns the property value as a String, but there seem to be cases where this is not right. For example, I'm working with _NET_ACTIVE_WINDOW https://specifications.freedesktop.org/wm-spec/latest/ar01s03.html#idm45374033238240 similar to this answer https://stackoverflow.com/a/73834445/3779853 and here the returned value is a Window, so a UInt64.

This I tried to just convert the returned String into a UInt64 but this is unreliable, probably because the 0-byte position is not predictable, if I understood this right. So unless I'm mistaken, the raw data needs to be exposed by this function too.

This is what I did in my PR. I changed the prop return value to prop_string. Then I could change the return value prop from String to Char* to better align with the overall naming convention of the file. So overall it's a breaking change. Tell me if you want me to change it.

Also, I have removed the X.free prop_return and I'm not quite sure about the implications of this :S

What I'm trying to say is, I guess, I don't really know what I am doing

phil294 avatar Jul 20 '23 06:07 phil294