You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing a program that reads the current focused window title. For that, I'm trying to read the WM_NAME property of my focused window. By using the xprop command, I can see the atom type of the WM_NAME is UTF8_STRING, and by using the command xlsatoms | grep UTF8_STRING, I can see it's id is 408. Therefore, I tried writing this code:
UTF8_STRING_ATOM,
^^^^^^^^^^^^^^^^ the trait `From<u32>` is not implemented for `GetPropertyType`
The Problem
The struct GetPropertyType internally holds a u8 instead of a u32, and therefore, when calling connection.get_property, the atom type can only be up to 255.
This does not conform to the X11 specification, which states that the type argument is of type ATOM, which is a 32 bit value.
Proposed Solution
Change the internal value of GetPropertyType to be a u32, and implement the trait From<u32>.
Workarounds
Instead of using the correct type in the function get_property, using the breadx::protocol::xproto::AtomEnum::ANY type works. Example:
I just realized the GetPropertyType is not defined in this crate. It's defined in the x11rb crate. However, the GetPropertyType struct doesn't seem to be used anywhere in the x11rb crate.
In x11rb, the get_property function is defined here, and the GetPropertyRequest struct is defined here. In both instances, the type can be supplied with a u32.
Maybe the solution then would be to not use the GetPropertyType struct at all, and replace all instances of impl Into<GetPropertyType> (such as in here) with impl Into<Atom>?
My Specific case
I'm writing a program that reads the current focused window title. For that, I'm trying to read the
WM_NAME
property of my focused window. By using thexprop
command, I can see the atom type of theWM_NAME
isUTF8_STRING
, and by using the commandxlsatoms | grep UTF8_STRING
, I can see it'sid
is408
. Therefore, I tried writing this code:However, I'm getting this compiler error:
The Problem
The struct GetPropertyType internally holds a
u8
instead of au32
, and therefore, when calling connection.get_property, the atom type can only be up to 255.This does not conform to the X11 specification, which states that the
type
argument is of typeATOM
, which is a 32 bit value.Proposed Solution
Change the internal value of
GetPropertyType
to be a u32, and implement the traitFrom<u32>
.Workarounds
Instead of using the correct type in the function
get_property
, using thebreadx::protocol::xproto::AtomEnum::ANY
type works. Example:The text was updated successfully, but these errors were encountered: