Use paste to simplify ewmh_get_property

This commit is contained in:
Armin Friedl 2022-05-22 15:07:07 +02:00
parent 1729b8c2b1
commit 4d18bf5994
4 changed files with 193 additions and 309 deletions

View file

@ -12,6 +12,7 @@ homepage = "https://git.friedl.net/incubator/xcb-wm"
[dependencies] [dependencies]
xcb = "1" xcb = "1"
paste = "1"
[features] [features]
icccm = [] icccm = []

View file

@ -8,12 +8,10 @@ use crate::ewmh::proto::util::{strings_to_x_buffer, x_buffer_to_strings};
use crate::ewmh::traits::*; use crate::ewmh::traits::*;
use crate::ewmh::Connection; use crate::ewmh::Connection;
use paste::paste; // Needed for macros
// _NET_WM_NAME, UTF8_STRING // _NET_WM_NAME, UTF8_STRING
// {{{ // {{{
pub struct GetWmName(xcb::x::Window);
pub struct GetWmNameCookie(xcb::x::GetPropertyCookie);
pub struct GetWmNameCookieUnchecked(xcb::x::GetPropertyCookieUnchecked);
#[derive(Debug)] #[derive(Debug)]
pub struct GetWmNameReply { pub struct GetWmNameReply {
pub name: String, pub name: String,
@ -29,13 +27,11 @@ impl From<xcb::x::GetPropertyReply> for GetWmNameReply {
ewmh_get_property! { ewmh_get_property! {
request=GetWmName{ request=GetWmName{
window: client_window, window: client,
property: _NET_WM_NAME, property: _NET_WM_NAME,
xtype: UTF8_STRING xtype: UTF8_STRING
}, },
reply=GetWmNameReply, reply=GetWmNameReply
cookie=GetWmNameCookie,
cookie_unchecked=GetWmNameCookieUnchecked
} }
pub struct SetWmName { pub struct SetWmName {
@ -64,10 +60,6 @@ ewmh_set_property! {
// _NET_WM_VISIBLE_NAME, UTF8_STRING // _NET_WM_VISIBLE_NAME, UTF8_STRING
// {{{ // {{{
pub struct GetWmVisibleName(xcb::x::Window);
pub struct GetWmVisibleNameCookie(xcb::x::GetPropertyCookie);
pub struct GetWmVisibleNameCookieUnchecked(xcb::x::GetPropertyCookieUnchecked);
#[derive(Debug)] #[derive(Debug)]
pub struct GetWmVisibleNameReply { pub struct GetWmVisibleNameReply {
pub name: String, pub name: String,
@ -83,22 +75,16 @@ impl From<xcb::x::GetPropertyReply> for GetWmVisibleNameReply {
ewmh_get_property! { ewmh_get_property! {
request=GetWmVisibleName{ request=GetWmVisibleName{
window: root_window, window: client,
property: _NET_WM_VISIBLE_NAME, property: _NET_WM_VISIBLE_NAME,
xtype: UTF8_STRING xtype: UTF8_STRING
}, },
reply=GetWmVisibleNameReply, reply=GetWmVisibleNameReply
cookie=GetWmVisibleNameCookie,
cookie_unchecked=GetWmVisibleNameCookieUnchecked
} }
// }}} // }}}
// _NET_WM_ICON_NAME, UTF8_STRING // _NET_WM_ICON_NAME, UTF8_STRING
// {{{ // {{{
pub struct GetWmIconName;
pub struct GetWmIconNameCookie(xcb::x::GetPropertyCookie);
pub struct GetWmIconNameCookieUnchecked(xcb::x::GetPropertyCookieUnchecked);
#[derive(Debug)] #[derive(Debug)]
pub struct GetWmIconNameReply { pub struct GetWmIconNameReply {
pub name: String, pub name: String,
@ -114,22 +100,16 @@ impl From<xcb::x::GetPropertyReply> for GetWmIconNameReply {
ewmh_get_property! { ewmh_get_property! {
request=GetWmIconName{ request=GetWmIconName{
window: root_window, window: client,
property: _NET_WM_ICON_NAME, property: _NET_WM_ICON_NAME,
xtype: UTF8_STRING xtype: UTF8_STRING
}, },
reply=GetWmIconNameReply, reply=GetWmIconNameReply
cookie=GetWmIconNameCookie,
cookie_unchecked=GetWmIconNameCookieUnchecked
} }
// }}} // }}}
// _NET_WM_VISIBLE_ICON_NAME, UTF8_STRING // _NET_WM_VISIBLE_ICON_NAME, UTF8_STRING
// {{{ // {{{
pub struct GetWmVisibleIconName;
pub struct GetWmVisibleIconNameCookie(xcb::x::GetPropertyCookie);
pub struct GetWmVisibleIconNameCookieUnchecked(xcb::x::GetPropertyCookieUnchecked);
#[derive(Debug)] #[derive(Debug)]
pub struct GetWmVisibleIconNameReply { pub struct GetWmVisibleIconNameReply {
pub name: String, pub name: String,
@ -145,22 +125,16 @@ impl From<xcb::x::GetPropertyReply> for GetWmVisibleIconNameReply {
ewmh_get_property! { ewmh_get_property! {
request=GetWmVisibleIconName{ request=GetWmVisibleIconName{
window: root_window, window: client,
property: _NET_WM_VISIBLE_ICON_NAME, property: _NET_WM_VISIBLE_ICON_NAME,
xtype: UTF8_STRING xtype: UTF8_STRING
}, },
reply=GetWmVisibleIconNameReply, reply=GetWmVisibleIconNameReply
cookie=GetWmVisibleIconNameCookie,
cookie_unchecked=GetWmVisibleIconNameCookieUnchecked
} }
// }}} // }}}
// _NET_WM_DESKTOP, CARDINAL/32 // _NET_WM_DESKTOP, CARDINAL/32
// {{{ // {{{
pub struct GetWmDesktop;
pub struct GetWmDesktopCookie(xcb::x::GetPropertyCookie);
pub struct GetWmDesktopCookieUnchecked(xcb::x::GetPropertyCookieUnchecked);
#[derive(Debug)] #[derive(Debug)]
pub struct GetWmDesktopReply { pub struct GetWmDesktopReply {
pub desktop: u32, pub desktop: u32,
@ -176,13 +150,11 @@ impl From<xcb::x::GetPropertyReply> for GetWmDesktopReply {
ewmh_get_property! { ewmh_get_property! {
request=GetWmDesktop{ request=GetWmDesktop{
window: root_window, window: client,
property: _NET_WM_DESKTOP, property: _NET_WM_DESKTOP,
xtype: ATOM_CARDINAL xtype: ATOM_CARDINAL
}, },
reply=GetWmDesktopReply, reply=GetWmDesktopReply
cookie=GetWmDesktopCookie,
cookie_unchecked=GetWmDesktopCookieUnchecked
} }
pub struct SetWmDesktop { pub struct SetWmDesktop {
@ -230,11 +202,6 @@ ewmh_client_message! {
// _NET_WM_WINDOW_TYPE, ATOM[]/32 // _NET_WM_WINDOW_TYPE, ATOM[]/32
// {{{ // {{{
pub struct GetWmWindowType;
pub struct GetWmWindowTypeCookie(xcb::x::GetPropertyCookie);
pub struct GetWmWindowTypeCookieUnchecked(xcb::x::GetPropertyCookieUnchecked);
#[derive(Debug)] #[derive(Debug)]
pub struct GetWmWindowTypeReply { pub struct GetWmWindowTypeReply {
pub window_types: Vec<xcb::x::Atom>, pub window_types: Vec<xcb::x::Atom>,
@ -250,13 +217,11 @@ impl From<xcb::x::GetPropertyReply> for GetWmWindowTypeReply {
ewmh_get_property! { ewmh_get_property! {
request=GetWmWindowType{ request=GetWmWindowType{
window: root_window, window: client,
property: _NET_WM_WINDOW_TYPE, property: _NET_WM_WINDOW_TYPE,
xtype: ATOM_ATOM xtype: ATOM_ATOM
}, },
reply=GetWmWindowTypeReply, reply=GetWmWindowTypeReply
cookie=GetWmWindowTypeCookie,
cookie_unchecked=GetWmWindowTypeCookieUnchecked
} }
pub struct SetWmWindowType { pub struct SetWmWindowType {
@ -285,11 +250,6 @@ ewmh_set_property! {
// _NET_WM_STATE, ATOM[]/32 // _NET_WM_STATE, ATOM[]/32
// {{{ // {{{
pub struct GetWmState(xcb::x::Window);
pub struct GetWmStateCookie(xcb::x::GetPropertyCookie);
pub struct GetWmStateCookieUnchecked(xcb::x::GetPropertyCookieUnchecked);
#[derive(Debug)] #[derive(Debug)]
pub struct GetWmStateReply { pub struct GetWmStateReply {
pub states: Vec<xcb::x::Atom>, pub states: Vec<xcb::x::Atom>,
@ -305,13 +265,11 @@ impl From<xcb::x::GetPropertyReply> for GetWmStateReply {
ewmh_get_property! { ewmh_get_property! {
request=GetWmState{ request=GetWmState{
window: client_window, window: client,
property: _NET_WM_STATE, property: _NET_WM_STATE,
xtype: ATOM_ATOM xtype: ATOM_ATOM
}, },
reply=GetWmStateReply, reply=GetWmStateReply
cookie=GetWmStateCookie,
cookie_unchecked=GetWmStateCookieUnchecked
} }
pub struct SetWmState { pub struct SetWmState {

View file

@ -1,117 +1,3 @@
macro_rules! _get_property_base {
($reply:ident, $cookie:ident, $cookie_unchecked:ident) => {
impl EwmhCookie for $cookie {
type XcbCookie = xcb::x::GetPropertyCookie;
}
impl EwmhPropertyCookieChecked for $cookie {
type Reply = $reply;
fn inner(self) -> xcb::x::GetPropertyCookie {
self.0
}
}
impl EwmhPropertyCookieUnchecked for $cookie_unchecked {
type Reply = $reply;
fn inner(self) -> xcb::x::GetPropertyCookieUnchecked {
self.0
}
}
};
}
macro_rules! _get_property_request {
(root_window, $property:ident, UTF8_STRING) => {
fn xcb_request(&self, con: &Connection) -> xcb::x::GetProperty {
xcb::x::GetProperty {
delete: false,
window: con.con.get_setup().roots().next().unwrap().root(),
property: con.atoms.$property,
r#type: con.atoms.UTF8_STRING,
long_offset: 0,
long_length: u32::MAX,
}
}
};
(root_window, $property:ident, $xtype:ident) => {
fn xcb_request(&self, con: &Connection) -> xcb::x::GetProperty {
xcb::x::GetProperty {
delete: false,
window: con.con.get_setup().roots().next().unwrap().root(),
property: con.atoms.$property,
r#type: xcb::x::$xtype,
long_offset: 0,
long_length: u32::MAX,
}
}
};
(client_window, $property:ident, UTF8_STRING) => {
fn xcb_request(&self, con: &Connection) -> xcb::x::GetProperty {
xcb::x::GetProperty {
delete: false,
window: self.0,
property: con.atoms.$property,
r#type: con.atoms.UTF8_STRING,
long_offset: 0,
long_length: u32::MAX,
}
}
};
(client_window, $property:ident, $xtype:ident) => {
fn xcb_request(&self, con: &Connection) -> xcb::x::GetProperty {
xcb::x::GetProperty {
delete: false,
window: self.0,
property: con.atoms.$property,
r#type: xcb::x::$xtype,
long_offset: 0,
long_length: u32::MAX,
}
}
};
}
macro_rules! ewmh_get_property {
(request=$request:ident{
window: $window:ident,
property: $property:ident,
xtype: $xtype: ident
},
reply=$reply:ident,
cookie=$cookie:ident,
cookie_unchecked=$cookie_unchecked:ident) => {
impl<'a> EwmhRequest<'a> for $request {
type XcbRequest = xcb::x::GetProperty;
type EwmhCookie = $cookie;
_get_property_request! {$window, $property, $xtype}
fn convert_cookie(&'a self, xcb_cookie: xcb::x::GetPropertyCookie) -> Self::EwmhCookie {
$cookie(xcb_cookie)
}
}
impl EwmhPropertyRequestUnchecked for $request {
type EwmhCookie = $cookie_unchecked;
#[rustfmt::skip]
fn convert_cookie(&self,xcb_cookie: xcb::x::GetPropertyCookieUnchecked,) -> Self::EwmhCookie {
$cookie_unchecked(xcb_cookie)
}
_get_property_request! {$window, $property, $xtype}
}
_get_property_base! {$reply, $cookie, $cookie_unchecked}
};
}
macro_rules! _set_property_base { macro_rules! _set_property_base {
(root_window, $property:ident, UTF8_STRING) => { (root_window, $property:ident, UTF8_STRING) => {
fn xcb_request(&'a self, con: &Connection) -> xcb::x::ChangeProperty<'a, u8> { fn xcb_request(&'a self, con: &Connection) -> xcb::x::ChangeProperty<'a, u8> {
@ -292,3 +178,143 @@ macro_rules! ewmh_client_message {
} }
}; };
} }
macro_rules! _get_property_cookies {
(@private $request:ident, $reply:ident) => {
paste! {
impl EwmhCookie for [<$request Cookie>] {
type XcbCookie = xcb::x::GetPropertyCookie;
}
impl EwmhPropertyCookieChecked for [<$request Cookie>] {
type Reply = $reply;
fn inner(self) -> xcb::x::GetPropertyCookie {
self.0
}
}
impl EwmhPropertyCookieUnchecked for [<$request CookieUnchecked>] {
type Reply = $reply;
fn inner(self) -> xcb::x::GetPropertyCookieUnchecked {
self.0
}
}
}
};
}
macro_rules! _get_property_request {
(@private root, $property:ident, UTF8_STRING) => {
fn xcb_request(&self, con: &Connection) -> xcb::x::GetProperty {
xcb::x::GetProperty {
delete: false,
window: con.con.get_setup().roots().next().unwrap().root(),
property: con.atoms.$property,
r#type: con.atoms.UTF8_STRING,
long_offset: 0,
long_length: u32::MAX,
}
}
};
(@private root, $property:ident, $xtype:ident) => {
fn xcb_request(&self, con: &Connection) -> xcb::x::GetProperty {
xcb::x::GetProperty {
delete: false,
window: con.con.get_setup().roots().next().unwrap().root(),
property: con.atoms.$property,
r#type: xcb::x::$xtype,
long_offset: 0,
long_length: u32::MAX,
}
}
};
(@private client, $property:ident, UTF8_STRING) => {
fn xcb_request(&self, con: &Connection) -> xcb::x::GetProperty {
xcb::x::GetProperty {
delete: false,
window: self.0,
property: con.atoms.$property,
r#type: con.atoms.UTF8_STRING,
long_offset: 0,
long_length: u32::MAX,
}
}
};
(@private client, $property:ident, $xtype:ident) => {
fn xcb_request(&self, con: &Connection) -> xcb::x::GetProperty {
xcb::x::GetProperty {
delete: false,
window: self.0,
property: con.atoms.$property,
r#type: xcb::x::$xtype,
long_offset: 0,
long_length: u32::MAX,
}
}
};
}
macro_rules! _get_property_structs {
(@private $request:ident, root) => {
paste! {
pub struct $request;
pub struct [<$request Cookie>](xcb::x::GetPropertyCookie);
pub struct [<$request CookieUnchecked>](xcb::x::GetPropertyCookieUnchecked);
}
};
(@private $request:ident, client) => {
paste! {
pub struct $request(xcb::x::Window);
pub struct [<$request Cookie>](xcb::x::GetPropertyCookie);
pub struct [<$request CookieUnchecked>](xcb::x::GetPropertyCookieUnchecked);
impl $request {
fn new(window: xcb::x::Window) -> $request {
$request(window)
}
}
}
};
}
macro_rules! ewmh_get_property {
(request=$request:ident{
window: $window:ident,
property: $property:ident,
xtype: $xtype: ident
},
reply=$reply:ident) => {
paste!{
_get_property_structs! {@private $request, $window}
impl<'a> EwmhRequest<'a> for $request {
type XcbRequest = xcb::x::GetProperty;
type EwmhCookie = [<$request Cookie>];
_get_property_request! {@private $window, $property, $xtype}
fn convert_cookie(&'a self, xcb_cookie: xcb::x::GetPropertyCookie) -> Self::EwmhCookie {
[<$request Cookie>](xcb_cookie)
}
}
impl EwmhPropertyRequestUnchecked for $request {
paste!{type EwmhCookie = [<$request CookieUnchecked>];}
#[rustfmt::skip]
fn convert_cookie(&self, xcb_cookie: xcb::x::GetPropertyCookieUnchecked) -> Self::EwmhCookie {
[<$request CookieUnchecked>](xcb_cookie)
}
_get_property_request! {@private $window, $property, $xtype}
}
_get_property_cookies! {@private $request, $reply}
}
};
}

View file

@ -8,14 +8,10 @@ use crate::ewmh::proto::util::{strings_to_x_buffer, x_buffer_to_strings};
use crate::ewmh::traits::*; use crate::ewmh::traits::*;
use crate::ewmh::Connection; use crate::ewmh::Connection;
use paste::paste; // Needed for macros
// _NET_SUPPORTED, ATOM[]/32 // _NET_SUPPORTED, ATOM[]/32
// {{{ // {{{
pub struct GetSupported;
pub struct GetSupportedCookie(xcb::x::GetPropertyCookie);
pub struct GetSupportedCookieUnchecked(xcb::x::GetPropertyCookieUnchecked);
#[derive(Debug)] #[derive(Debug)]
pub struct GetSupportedReply { pub struct GetSupportedReply {
pub atoms: Vec<xcb::x::Atom>, pub atoms: Vec<xcb::x::Atom>,
@ -31,24 +27,16 @@ impl From<xcb::x::GetPropertyReply> for GetSupportedReply {
ewmh_get_property! { ewmh_get_property! {
request=GetSupported{ request=GetSupported{
window: root_window, window: root,
property: _NET_SUPPORTED, property: _NET_SUPPORTED,
xtype: ATOM_ATOM xtype: ATOM_ATOM
}, },
reply=GetSupportedReply, reply=GetSupportedReply
cookie=GetSupportedCookie,
cookie_unchecked=GetSupportedCookieUnchecked
} }
// }}} // }}}
// _NET_CLIENT_LIST, WINDOW[]/32 // _NET_CLIENT_LIST, WINDOW[]/32
// {{{ // {{{
pub struct GetClientList;
pub struct GetClientListCookie(xcb::x::GetPropertyCookie);
pub struct GetClientListCookieUnchecked(xcb::x::GetPropertyCookieUnchecked);
#[derive(Debug)] #[derive(Debug)]
pub struct GetClientListReply { pub struct GetClientListReply {
pub clients: Vec<xcb::x::Window>, pub clients: Vec<xcb::x::Window>,
@ -64,24 +52,16 @@ impl From<xcb::x::GetPropertyReply> for GetClientListReply {
ewmh_get_property! { ewmh_get_property! {
request=GetClientList{ request=GetClientList{
window: root_window, window: root,
property: _NET_CLIENT_LIST, property: _NET_CLIENT_LIST,
xtype: ATOM_WINDOW xtype: ATOM_WINDOW
}, },
reply=GetClientListReply, reply=GetClientListReply
cookie=GetClientListCookie,
cookie_unchecked=GetClientListCookieUnchecked
} }
// }}} // }}}
// _NET_CLIENT_LIST_STACKING, WINDOW[]/32 // _NET_CLIENT_LIST_STACKING, WINDOW[]/32
// {{{ // {{{
pub struct GetClientListStacking;
pub struct GetClientListStackingCookie(xcb::x::GetPropertyCookie);
pub struct GetClientListStackingCookieUnchecked(xcb::x::GetPropertyCookieUnchecked);
#[derive(Debug)] #[derive(Debug)]
pub struct GetClientListStackingReply { pub struct GetClientListStackingReply {
pub clients: Vec<xcb::x::Window>, pub clients: Vec<xcb::x::Window>,
@ -97,24 +77,16 @@ impl From<xcb::x::GetPropertyReply> for GetClientListStackingReply {
ewmh_get_property! { ewmh_get_property! {
request=GetClientListStacking{ request=GetClientListStacking{
window: root_window, window: root,
property: _NET_CLIENT_LIST_STACKING, property: _NET_CLIENT_LIST_STACKING,
xtype: ATOM_WINDOW xtype: ATOM_WINDOW
}, },
reply=GetClientListStackingReply, reply=GetClientListStackingReply,
cookie=GetClientListStackingCookie,
cookie_unchecked=GetClientListStackingCookieUnchecked
} }
// }}} // }}}
// _NET_NUMBER_OF_DESKTOPS, CARDINAL/32 // _NET_NUMBER_OF_DESKTOPS, CARDINAL/32
// {{{ // {{{
pub struct GetNumberOfDesktops;
pub struct GetNumberOfDesktopsCookie(xcb::x::GetPropertyCookie);
pub struct GetNumberOfDesktopsCookieUnchecked(xcb::x::GetPropertyCookieUnchecked);
#[derive(Debug)] #[derive(Debug)]
pub struct GetNumberOfDesktopsReply { pub struct GetNumberOfDesktopsReply {
pub desktops: u32, pub desktops: u32,
@ -130,13 +102,11 @@ impl From<xcb::x::GetPropertyReply> for GetNumberOfDesktopsReply {
ewmh_get_property! { ewmh_get_property! {
request=GetNumberOfDesktops{ request=GetNumberOfDesktops{
window: root_window, window: root,
property: _NET_NUMBER_OF_DESKTOPS, property: _NET_NUMBER_OF_DESKTOPS,
xtype: ATOM_CARDINAL xtype: ATOM_CARDINAL
}, },
reply=GetNumberOfDesktopsReply, reply=GetNumberOfDesktopsReply
cookie=GetNumberOfDesktopsCookie,
cookie_unchecked=GetNumberOfDesktopsCookieUnchecked
} }
pub struct SetNumberOfDesktops { pub struct SetNumberOfDesktops {
@ -162,12 +132,6 @@ ewmh_client_message! {
// _NET_DESKTOP_GEOMETRY width, height, CARDINAL[2]/32 // _NET_DESKTOP_GEOMETRY width, height, CARDINAL[2]/32
// {{{ // {{{
pub struct GetDesktopGeometry;
pub struct GetDesktopGeometryCookie(xcb::x::GetPropertyCookie);
pub struct GetDesktopGeometryCookieUnchecked(xcb::x::GetPropertyCookieUnchecked);
#[derive(Debug)] #[derive(Debug)]
pub struct GetDesktopGeometryReply { pub struct GetDesktopGeometryReply {
pub width: u32, pub width: u32,
@ -185,13 +149,11 @@ impl From<xcb::x::GetPropertyReply> for GetDesktopGeometryReply {
ewmh_get_property! { ewmh_get_property! {
request=GetDesktopGeometry{ request=GetDesktopGeometry{
window: root_window, window: root,
property: _NET_DESKTOP_GEOMETRY, property: _NET_DESKTOP_GEOMETRY,
xtype: ATOM_CARDINAL xtype: ATOM_CARDINAL
}, },
reply=GetDesktopGeometryReply, reply=GetDesktopGeometryReply
cookie=GetDesktopGeometryCookie,
cookie_unchecked=GetDesktopGeometryCookieUnchecked
} }
pub struct SetDesktopGeometry { pub struct SetDesktopGeometry {
@ -218,12 +180,6 @@ ewmh_client_message! {
// _NET_DESTKOP_VIEWPORT x, y, CARDINAL[][2]/32 // _NET_DESTKOP_VIEWPORT x, y, CARDINAL[][2]/32
// {{{ // {{{
pub struct GetDesktopViewport;
pub struct GetDesktopViewportCookie(xcb::x::GetPropertyCookie);
pub struct GetDesktopViewportCookieUnchecked(xcb::x::GetPropertyCookieUnchecked);
#[derive(Debug)] #[derive(Debug)]
pub struct GetDesktopViewportReply { pub struct GetDesktopViewportReply {
pub x: u32, pub x: u32,
@ -241,13 +197,11 @@ impl From<xcb::x::GetPropertyReply> for GetDesktopViewportReply {
ewmh_get_property! { ewmh_get_property! {
request=GetDesktopViewport{ request=GetDesktopViewport{
window: root_window, window: root,
property: _NET_DESKTOP_VIEWPORT, property: _NET_DESKTOP_VIEWPORT,
xtype: ATOM_CARDINAL xtype: ATOM_CARDINAL
}, },
reply=GetDesktopViewportReply, reply=GetDesktopViewportReply
cookie=GetDesktopViewportCookie,
cookie_unchecked=GetDesktopViewportCookieUnchecked
} }
pub struct SetDesktopViewport { pub struct SetDesktopViewport {
@ -273,12 +227,6 @@ ewmh_client_message! {
// _NET_CURRENT_DESKTOP desktop, CARDINAL/32 // _NET_CURRENT_DESKTOP desktop, CARDINAL/32
// {{{ // {{{
pub struct GetCurrentDesktop;
pub struct GetCurrentDesktopCookie(xcb::x::GetPropertyCookie);
pub struct GetCurrentDesktopCookieUnchecked(xcb::x::GetPropertyCookieUnchecked);
#[derive(Debug)] #[derive(Debug)]
pub struct GetCurrentDesktopReply { pub struct GetCurrentDesktopReply {
pub desktop: u32, pub desktop: u32,
@ -294,13 +242,11 @@ impl From<xcb::x::GetPropertyReply> for GetCurrentDesktopReply {
ewmh_get_property! { ewmh_get_property! {
request=GetCurrentDesktop{ request=GetCurrentDesktop{
window: root_window, window: root,
property: _NET_CURRENT_DESKTOP, property: _NET_CURRENT_DESKTOP,
xtype: ATOM_CARDINAL xtype: ATOM_CARDINAL
}, },
reply=GetCurrentDesktopReply, reply=GetCurrentDesktopReply
cookie=GetCurrentDesktopCookie,
cookie_unchecked=GetCurrentDesktopCookieUnchecked
} }
pub struct SetCurrentDesktop { pub struct SetCurrentDesktop {
@ -326,12 +272,6 @@ ewmh_client_message! {
// _NET_DESKTOP_NAMES desktop, UTF8_STRING[] // _NET_DESKTOP_NAMES desktop, UTF8_STRING[]
// {{{ // {{{
pub struct GetDesktopNames;
pub struct GetDesktopNamesCookie(xcb::x::GetPropertyCookie);
pub struct GetDesktopNamesCookieUnchecked(xcb::x::GetPropertyCookieUnchecked);
#[derive(Debug)] #[derive(Debug)]
pub struct GetDesktopNamesReply { pub struct GetDesktopNamesReply {
pub names: Vec<String>, pub names: Vec<String>,
@ -347,13 +287,11 @@ impl From<xcb::x::GetPropertyReply> for GetDesktopNamesReply {
ewmh_get_property! { ewmh_get_property! {
request=GetDesktopNames{ request=GetDesktopNames{
window: root_window, window: root,
property: _NET_DESKTOP_NAMES, property: _NET_DESKTOP_NAMES,
xtype: UTF8_STRING xtype: UTF8_STRING
}, },
reply=GetDesktopNamesReply, reply=GetDesktopNamesReply
cookie=GetDesktopNamesCookie,
cookie_unchecked=GetDesktopNamesCookieUnchecked
} }
pub struct SetDesktopNames { pub struct SetDesktopNames {
@ -379,12 +317,6 @@ ewmh_set_property! {
// _NET_ACTIVE_WINDOW, WINDOW/32 // _NET_ACTIVE_WINDOW, WINDOW/32
// {{{ // {{{
pub struct GetActiveWindow;
pub struct GetActiveWindowCookie(xcb::x::GetPropertyCookie);
pub struct GetActiveWindowCookieUnchecked(xcb::x::GetPropertyCookieUnchecked);
#[derive(Debug)] #[derive(Debug)]
pub struct GetActiveWindowReply { pub struct GetActiveWindowReply {
pub window: xcb::x::Window, pub window: xcb::x::Window,
@ -400,13 +332,11 @@ impl From<xcb::x::GetPropertyReply> for GetActiveWindowReply {
ewmh_get_property! { ewmh_get_property! {
request=GetActiveWindow{ request=GetActiveWindow{
window: root_window, window: root,
property: _NET_ACTIVE_WINDOW, property: _NET_ACTIVE_WINDOW,
xtype: ATOM_WINDOW xtype: ATOM_WINDOW
}, },
reply=GetActiveWindowReply, reply=GetActiveWindowReply
cookie=GetActiveWindowCookie,
cookie_unchecked=GetActiveWindowCookieUnchecked
} }
pub struct SetActiveWindow { pub struct SetActiveWindow {
@ -444,13 +374,6 @@ ewmh_client_message! {
// // _NET_WORKAREA, x, y, width, height, CARDINAL[][4]/32 // // _NET_WORKAREA, x, y, width, height, CARDINAL[][4]/32
// {{{ // {{{
pub struct GetWorkarea;
pub struct GetWorkareaCookie(xcb::x::GetPropertyCookie);
pub struct GetWorkareaCookieUnchecked(xcb::x::GetPropertyCookieUnchecked);
#[derive(Debug)] #[derive(Debug)]
pub struct GetWorkareaReply { pub struct GetWorkareaReply {
pub x: u32, pub x: u32,
@ -472,25 +395,16 @@ impl From<xcb::x::GetPropertyReply> for GetWorkareaReply {
ewmh_get_property! { ewmh_get_property! {
request=GetWorkarea{ request=GetWorkarea{
window: root_window, window: root,
property: _NET_WORKAREA, property: _NET_WORKAREA,
xtype: ATOM_CARDINAL xtype: ATOM_CARDINAL
}, },
reply=GetWorkareaReply, reply=GetWorkareaReply
cookie=GetWorkareaCookie,
cookie_unchecked=GetWorkareaCookieUnchecked
} }
// }}} // }}}
// // _NET_SUPPORTING_WM_CHECK, WINDOW/32 // // _NET_SUPPORTING_WM_CHECK, WINDOW/32
// {{{ // {{{
pub struct GetSupportingWmCheck;
pub struct GetSupportingWmCheckCookie(xcb::x::GetPropertyCookie);
pub struct GetSupportingWmCheckCookieUnchecked(xcb::x::GetPropertyCookieUnchecked);
#[derive(Debug)] #[derive(Debug)]
pub struct GetSupportingWmCheckReply { pub struct GetSupportingWmCheckReply {
pub window: xcb::x::Window, pub window: xcb::x::Window,
@ -503,16 +417,19 @@ impl From<xcb::x::GetPropertyReply> for GetSupportingWmCheckReply {
} }
} }
} }
ewmh_get_property! {
request=GetSupportingWmCheck{
window: root,
property: _NET_SUPPORTING_WM_CHECK,
xtype: ATOM_WINDOW
},
reply=GetSupportingWmCheckReply
}
// }}} // }}}
// _NET_VIRTUAL_ROOTS, WINDOW/32 // _NET_VIRTUAL_ROOTS, WINDOW/32
// {{{ // {{{
pub struct GetVirtualRoots;
pub struct GetVirtualRootsCookie(xcb::x::GetPropertyCookie);
pub struct GetVirtualRootsCookieUnchecked(xcb::x::GetPropertyCookieUnchecked);
#[derive(Debug)] #[derive(Debug)]
pub struct GetVirtualRootsReply { pub struct GetVirtualRootsReply {
pub window: xcb::x::Window, pub window: xcb::x::Window,
@ -528,24 +445,16 @@ impl From<xcb::x::GetPropertyReply> for GetVirtualRootsReply {
ewmh_get_property! { ewmh_get_property! {
request=GetVirtualRoots{ request=GetVirtualRoots{
window: root_window, window: root,
property: _NET_VIRTUAL_ROOTS, property: _NET_VIRTUAL_ROOTS,
xtype: ATOM_WINDOW xtype: ATOM_WINDOW
}, },
reply=GetVirtualRootsReply, reply=GetVirtualRootsReply
cookie=GetVirtualRootsCookie,
cookie_unchecked=GetVirtualRootsCookieUnchecked
} }
// }}} // }}}
// _NET_DESKTOP_LAYOUT, orientation, columns, rows, starting_corner, CARDINAL[4]/32 // _NET_DESKTOP_LAYOUT, orientation, columns, rows, starting_corner, CARDINAL[4]/32
// {{{ // {{{
pub struct DesktopLayout;
pub struct DesktopLayoutCookie(xcb::x::GetPropertyCookie);
pub struct DesktopLayoutCookieUnchecked(xcb::x::GetPropertyCookieUnchecked);
#[derive(Debug)] #[derive(Debug)]
pub struct DesktopLayoutReply { pub struct DesktopLayoutReply {
pub orientation: u32, pub orientation: u32,
@ -567,24 +476,16 @@ impl From<xcb::x::GetPropertyReply> for DesktopLayoutReply {
ewmh_get_property! { ewmh_get_property! {
request=DesktopLayout{ request=DesktopLayout{
window: root_window, window: root,
property: _NET_DESKTOP_LAYOUT, property: _NET_DESKTOP_LAYOUT,
xtype: ATOM_CARDINAL xtype: ATOM_CARDINAL
}, },
reply=DesktopLayoutReply, reply=DesktopLayoutReply
cookie=DesktopLayoutCookie,
cookie_unchecked=DesktopLayoutCookieUnchecked
} }
// }}} // }}}
// _NET_SHOWING_DESKTOP desktop, CARDINAL/32 // _NET_SHOWING_DESKTOP desktop, CARDINAL/32
// {{{ // {{{
pub struct GetShowingDesktop;
pub struct GetShowingDesktopCookie(xcb::x::GetPropertyCookie);
pub struct GetShowingDesktopCookieUnchecked(xcb::x::GetPropertyCookieUnchecked);
#[derive(Debug)] #[derive(Debug)]
pub struct GetShowingDesktopReply { pub struct GetShowingDesktopReply {
pub is_showing_desktop: bool, pub is_showing_desktop: bool,
@ -604,13 +505,11 @@ impl From<xcb::x::GetPropertyReply> for GetShowingDesktopReply {
ewmh_get_property! { ewmh_get_property! {
request=GetShowingDesktop{ request=GetShowingDesktop{
window: root_window, window: root,
property: _NET_SHOWING_DESKTOP, property: _NET_SHOWING_DESKTOP,
xtype: ATOM_CARDINAL xtype: ATOM_CARDINAL
}, },
reply=GetShowingDesktopReply, reply=GetShowingDesktopReply
cookie=GetShowingDesktopCookie,
cookie_unchecked=GetShowingDesktopCookieUnchecked
} }
pub struct SetShowingDesktop { pub struct SetShowingDesktop {