xcb_get_property_reply returning trash
Uli Schlachter
psychon at znc.in
Fri Sep 20 05:02:17 UTC 2024
Good morning,
Am 20.09.24 um 01:37 schrieb Steven J Abner:
> If I remember
> correctly, only a bad window supplied will cause an error for reply().
> I'm implying that technically all windows are XdndAware since they reply
> and all values are in the range of version 0 to 0xFF.
I'm not quite sure what you are doing, but this sounds weird.
From [1]:
> If the specified property does not exist for the specified window,
> then the return type is None, the format and bytes-after are zero, and
> the value is empty.
So how exactly are you checking the reply that you get? Do you look at
the length of the reply (reply->value_len or
xcb_get_property_value_length(reply))? Do you check e.g. reply->type or
reply->format?
To (hopefully) be more clear, at [2] is an example on checking the
property reply for something that should be structured a bit (not just a
plain list of numbers). This code checks that the reply has the expected
length of five. It should also check that the reply has format == 32,
but, well... whatever. I did not find a better example quickly.
Assuming I were to drop the length check, I would read beyond the end of
the reply into essentially random bytes. It sounds a bit like you are
doing that..?
Another idea I had: Run "xtrace xprop XdndAware" against different
windows! Actually, "xprop XdndAware" should be enough for you so you can
compare the numbers you get from xprop with what your own code does.
Here is the output for a window supporting DnD (dunno why type "ATOM"
was thought to be a good idea, but that's why both "xtrace" and "xprop"
decode data=0x5 as "BITMAP":
000:<:0035: 24: Request(20): GetProperty delete=false(0x00)
window=0x00600157 property=0x18a("XdndAware") type=any(0x0)
long-offset=0x00000000 long-length=0x0001e848
000:>:0035:36: Reply to GetProperty: type=0x4("ATOM")
bytes-after=0x00000000 data=0x5("BITMAP");
XdndAware(ATOM) = BITMAP
And for my root window, I get:
000:<:0020: 24: Request(20): GetProperty delete=false(0x00)
window=0x000004a9 property=0x18a("XdndAware") type=any(0x0)
long-offset=0x00000000 long-length=0x0001e848
000:>:0020:32: Reply to GetProperty: type=None(0x0) bytes-after=0x00000000
XdndAware: not found.
I hope I guessed correctly and this information is actually helpful to
you. If not... uhm... perhaps a link to some code would help?
Good luck & cheers,
Uli
[1]:
https://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#requests:GetProperty
[2]:
https://github.com/awesomeWM/awesome/blob/d53eb1be67f594f62fb6134fe40928e8ca17304a/property.c#L327-L329
--
"Do you know that books smell like nutmeg or some spice from a foreign
land?"
-- Faber in Fahrenheit 451
More information about the Xcb
mailing list