From 4d18bf5994229f8c74af88edd6444a976dae73f6 Mon Sep 17 00:00:00 2001 From: Armin Friedl Date: Sun, 22 May 2022 15:07:07 +0200 Subject: [PATCH] Use `paste` to simplify `ewmh_get_property` --- Cargo.toml | 1 + src/ewmh/proto/application_props.rs | 74 ++------ src/ewmh/proto/macros.rs | 254 +++++++++++++++------------- src/ewmh/proto/root_props.rs | 173 ++++--------------- 4 files changed, 193 insertions(+), 309 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 75771f1..f142d9b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ homepage = "https://git.friedl.net/incubator/xcb-wm" [dependencies] xcb = "1" +paste = "1" [features] icccm = [] diff --git a/src/ewmh/proto/application_props.rs b/src/ewmh/proto/application_props.rs index c42dbf3..d9a01e2 100644 --- a/src/ewmh/proto/application_props.rs +++ b/src/ewmh/proto/application_props.rs @@ -8,12 +8,10 @@ use crate::ewmh::proto::util::{strings_to_x_buffer, x_buffer_to_strings}; use crate::ewmh::traits::*; use crate::ewmh::Connection; +use paste::paste; // Needed for macros + // _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)] pub struct GetWmNameReply { pub name: String, @@ -29,13 +27,11 @@ impl From for GetWmNameReply { ewmh_get_property! { request=GetWmName{ - window: client_window, + window: client, property: _NET_WM_NAME, xtype: UTF8_STRING }, - reply=GetWmNameReply, - cookie=GetWmNameCookie, - cookie_unchecked=GetWmNameCookieUnchecked + reply=GetWmNameReply } pub struct SetWmName { @@ -64,10 +60,6 @@ ewmh_set_property! { // _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)] pub struct GetWmVisibleNameReply { pub name: String, @@ -83,22 +75,16 @@ impl From for GetWmVisibleNameReply { ewmh_get_property! { request=GetWmVisibleName{ - window: root_window, + window: client, property: _NET_WM_VISIBLE_NAME, xtype: UTF8_STRING }, - reply=GetWmVisibleNameReply, - cookie=GetWmVisibleNameCookie, - cookie_unchecked=GetWmVisibleNameCookieUnchecked + reply=GetWmVisibleNameReply } // }}} // _NET_WM_ICON_NAME, UTF8_STRING // {{{ -pub struct GetWmIconName; -pub struct GetWmIconNameCookie(xcb::x::GetPropertyCookie); -pub struct GetWmIconNameCookieUnchecked(xcb::x::GetPropertyCookieUnchecked); - #[derive(Debug)] pub struct GetWmIconNameReply { pub name: String, @@ -114,22 +100,16 @@ impl From for GetWmIconNameReply { ewmh_get_property! { request=GetWmIconName{ - window: root_window, + window: client, property: _NET_WM_ICON_NAME, xtype: UTF8_STRING }, - reply=GetWmIconNameReply, - cookie=GetWmIconNameCookie, - cookie_unchecked=GetWmIconNameCookieUnchecked + reply=GetWmIconNameReply } // }}} // _NET_WM_VISIBLE_ICON_NAME, UTF8_STRING // {{{ -pub struct GetWmVisibleIconName; -pub struct GetWmVisibleIconNameCookie(xcb::x::GetPropertyCookie); -pub struct GetWmVisibleIconNameCookieUnchecked(xcb::x::GetPropertyCookieUnchecked); - #[derive(Debug)] pub struct GetWmVisibleIconNameReply { pub name: String, @@ -145,22 +125,16 @@ impl From for GetWmVisibleIconNameReply { ewmh_get_property! { request=GetWmVisibleIconName{ - window: root_window, + window: client, property: _NET_WM_VISIBLE_ICON_NAME, xtype: UTF8_STRING }, - reply=GetWmVisibleIconNameReply, - cookie=GetWmVisibleIconNameCookie, - cookie_unchecked=GetWmVisibleIconNameCookieUnchecked + reply=GetWmVisibleIconNameReply } // }}} // _NET_WM_DESKTOP, CARDINAL/32 // {{{ -pub struct GetWmDesktop; -pub struct GetWmDesktopCookie(xcb::x::GetPropertyCookie); -pub struct GetWmDesktopCookieUnchecked(xcb::x::GetPropertyCookieUnchecked); - #[derive(Debug)] pub struct GetWmDesktopReply { pub desktop: u32, @@ -176,13 +150,11 @@ impl From for GetWmDesktopReply { ewmh_get_property! { request=GetWmDesktop{ - window: root_window, + window: client, property: _NET_WM_DESKTOP, xtype: ATOM_CARDINAL }, - reply=GetWmDesktopReply, - cookie=GetWmDesktopCookie, - cookie_unchecked=GetWmDesktopCookieUnchecked + reply=GetWmDesktopReply } pub struct SetWmDesktop { @@ -230,11 +202,6 @@ ewmh_client_message! { // _NET_WM_WINDOW_TYPE, ATOM[]/32 // {{{ - -pub struct GetWmWindowType; -pub struct GetWmWindowTypeCookie(xcb::x::GetPropertyCookie); -pub struct GetWmWindowTypeCookieUnchecked(xcb::x::GetPropertyCookieUnchecked); - #[derive(Debug)] pub struct GetWmWindowTypeReply { pub window_types: Vec, @@ -250,13 +217,11 @@ impl From for GetWmWindowTypeReply { ewmh_get_property! { request=GetWmWindowType{ - window: root_window, + window: client, property: _NET_WM_WINDOW_TYPE, xtype: ATOM_ATOM }, - reply=GetWmWindowTypeReply, - cookie=GetWmWindowTypeCookie, - cookie_unchecked=GetWmWindowTypeCookieUnchecked + reply=GetWmWindowTypeReply } pub struct SetWmWindowType { @@ -285,11 +250,6 @@ ewmh_set_property! { // _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)] pub struct GetWmStateReply { pub states: Vec, @@ -305,13 +265,11 @@ impl From for GetWmStateReply { ewmh_get_property! { request=GetWmState{ - window: client_window, + window: client, property: _NET_WM_STATE, xtype: ATOM_ATOM }, - reply=GetWmStateReply, - cookie=GetWmStateCookie, - cookie_unchecked=GetWmStateCookieUnchecked + reply=GetWmStateReply } pub struct SetWmState { diff --git a/src/ewmh/proto/macros.rs b/src/ewmh/proto/macros.rs index fa42761..5f74c25 100644 --- a/src/ewmh/proto/macros.rs +++ b/src/ewmh/proto/macros.rs @@ -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 { (root_window, $property:ident, UTF8_STRING) => { 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} + } + }; +} diff --git a/src/ewmh/proto/root_props.rs b/src/ewmh/proto/root_props.rs index 4ed2d12..a4fedef 100644 --- a/src/ewmh/proto/root_props.rs +++ b/src/ewmh/proto/root_props.rs @@ -8,14 +8,10 @@ use crate::ewmh::proto::util::{strings_to_x_buffer, x_buffer_to_strings}; use crate::ewmh::traits::*; use crate::ewmh::Connection; +use paste::paste; // Needed for macros + // _NET_SUPPORTED, ATOM[]/32 // {{{ -pub struct GetSupported; - -pub struct GetSupportedCookie(xcb::x::GetPropertyCookie); - -pub struct GetSupportedCookieUnchecked(xcb::x::GetPropertyCookieUnchecked); - #[derive(Debug)] pub struct GetSupportedReply { pub atoms: Vec, @@ -31,24 +27,16 @@ impl From for GetSupportedReply { ewmh_get_property! { request=GetSupported{ - window: root_window, + window: root, property: _NET_SUPPORTED, xtype: ATOM_ATOM }, - reply=GetSupportedReply, - cookie=GetSupportedCookie, - cookie_unchecked=GetSupportedCookieUnchecked + reply=GetSupportedReply } // }}} // _NET_CLIENT_LIST, WINDOW[]/32 // {{{ -pub struct GetClientList; - -pub struct GetClientListCookie(xcb::x::GetPropertyCookie); - -pub struct GetClientListCookieUnchecked(xcb::x::GetPropertyCookieUnchecked); - #[derive(Debug)] pub struct GetClientListReply { pub clients: Vec, @@ -64,24 +52,16 @@ impl From for GetClientListReply { ewmh_get_property! { request=GetClientList{ - window: root_window, + window: root, property: _NET_CLIENT_LIST, xtype: ATOM_WINDOW }, - reply=GetClientListReply, - cookie=GetClientListCookie, - cookie_unchecked=GetClientListCookieUnchecked + reply=GetClientListReply } // }}} // _NET_CLIENT_LIST_STACKING, WINDOW[]/32 // {{{ -pub struct GetClientListStacking; - -pub struct GetClientListStackingCookie(xcb::x::GetPropertyCookie); - -pub struct GetClientListStackingCookieUnchecked(xcb::x::GetPropertyCookieUnchecked); - #[derive(Debug)] pub struct GetClientListStackingReply { pub clients: Vec, @@ -97,24 +77,16 @@ impl From for GetClientListStackingReply { ewmh_get_property! { request=GetClientListStacking{ - window: root_window, + window: root, property: _NET_CLIENT_LIST_STACKING, xtype: ATOM_WINDOW }, reply=GetClientListStackingReply, - cookie=GetClientListStackingCookie, - cookie_unchecked=GetClientListStackingCookieUnchecked } // }}} // _NET_NUMBER_OF_DESKTOPS, CARDINAL/32 // {{{ -pub struct GetNumberOfDesktops; - -pub struct GetNumberOfDesktopsCookie(xcb::x::GetPropertyCookie); - -pub struct GetNumberOfDesktopsCookieUnchecked(xcb::x::GetPropertyCookieUnchecked); - #[derive(Debug)] pub struct GetNumberOfDesktopsReply { pub desktops: u32, @@ -130,13 +102,11 @@ impl From for GetNumberOfDesktopsReply { ewmh_get_property! { request=GetNumberOfDesktops{ - window: root_window, + window: root, property: _NET_NUMBER_OF_DESKTOPS, xtype: ATOM_CARDINAL }, - reply=GetNumberOfDesktopsReply, - cookie=GetNumberOfDesktopsCookie, - cookie_unchecked=GetNumberOfDesktopsCookieUnchecked + reply=GetNumberOfDesktopsReply } pub struct SetNumberOfDesktops { @@ -162,12 +132,6 @@ ewmh_client_message! { // _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)] pub struct GetDesktopGeometryReply { pub width: u32, @@ -185,13 +149,11 @@ impl From for GetDesktopGeometryReply { ewmh_get_property! { request=GetDesktopGeometry{ - window: root_window, + window: root, property: _NET_DESKTOP_GEOMETRY, xtype: ATOM_CARDINAL }, - reply=GetDesktopGeometryReply, - cookie=GetDesktopGeometryCookie, - cookie_unchecked=GetDesktopGeometryCookieUnchecked + reply=GetDesktopGeometryReply } pub struct SetDesktopGeometry { @@ -218,12 +180,6 @@ ewmh_client_message! { // _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)] pub struct GetDesktopViewportReply { pub x: u32, @@ -241,13 +197,11 @@ impl From for GetDesktopViewportReply { ewmh_get_property! { request=GetDesktopViewport{ - window: root_window, + window: root, property: _NET_DESKTOP_VIEWPORT, xtype: ATOM_CARDINAL }, - reply=GetDesktopViewportReply, - cookie=GetDesktopViewportCookie, - cookie_unchecked=GetDesktopViewportCookieUnchecked + reply=GetDesktopViewportReply } pub struct SetDesktopViewport { @@ -273,12 +227,6 @@ ewmh_client_message! { // _NET_CURRENT_DESKTOP desktop, CARDINAL/32 // {{{ -pub struct GetCurrentDesktop; - -pub struct GetCurrentDesktopCookie(xcb::x::GetPropertyCookie); - -pub struct GetCurrentDesktopCookieUnchecked(xcb::x::GetPropertyCookieUnchecked); - #[derive(Debug)] pub struct GetCurrentDesktopReply { pub desktop: u32, @@ -294,13 +242,11 @@ impl From for GetCurrentDesktopReply { ewmh_get_property! { request=GetCurrentDesktop{ - window: root_window, + window: root, property: _NET_CURRENT_DESKTOP, xtype: ATOM_CARDINAL }, - reply=GetCurrentDesktopReply, - cookie=GetCurrentDesktopCookie, - cookie_unchecked=GetCurrentDesktopCookieUnchecked + reply=GetCurrentDesktopReply } pub struct SetCurrentDesktop { @@ -326,12 +272,6 @@ ewmh_client_message! { // _NET_DESKTOP_NAMES desktop, UTF8_STRING[] // {{{ -pub struct GetDesktopNames; - -pub struct GetDesktopNamesCookie(xcb::x::GetPropertyCookie); - -pub struct GetDesktopNamesCookieUnchecked(xcb::x::GetPropertyCookieUnchecked); - #[derive(Debug)] pub struct GetDesktopNamesReply { pub names: Vec, @@ -347,13 +287,11 @@ impl From for GetDesktopNamesReply { ewmh_get_property! { request=GetDesktopNames{ - window: root_window, + window: root, property: _NET_DESKTOP_NAMES, xtype: UTF8_STRING }, - reply=GetDesktopNamesReply, - cookie=GetDesktopNamesCookie, - cookie_unchecked=GetDesktopNamesCookieUnchecked + reply=GetDesktopNamesReply } pub struct SetDesktopNames { @@ -379,12 +317,6 @@ ewmh_set_property! { // _NET_ACTIVE_WINDOW, WINDOW/32 // {{{ -pub struct GetActiveWindow; - -pub struct GetActiveWindowCookie(xcb::x::GetPropertyCookie); - -pub struct GetActiveWindowCookieUnchecked(xcb::x::GetPropertyCookieUnchecked); - #[derive(Debug)] pub struct GetActiveWindowReply { pub window: xcb::x::Window, @@ -400,13 +332,11 @@ impl From for GetActiveWindowReply { ewmh_get_property! { request=GetActiveWindow{ - window: root_window, + window: root, property: _NET_ACTIVE_WINDOW, xtype: ATOM_WINDOW }, - reply=GetActiveWindowReply, - cookie=GetActiveWindowCookie, - cookie_unchecked=GetActiveWindowCookieUnchecked + reply=GetActiveWindowReply } pub struct SetActiveWindow { @@ -444,13 +374,6 @@ ewmh_client_message! { // // _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)] pub struct GetWorkareaReply { pub x: u32, @@ -472,25 +395,16 @@ impl From for GetWorkareaReply { ewmh_get_property! { request=GetWorkarea{ - window: root_window, + window: root, property: _NET_WORKAREA, xtype: ATOM_CARDINAL }, - reply=GetWorkareaReply, - cookie=GetWorkareaCookie, - cookie_unchecked=GetWorkareaCookieUnchecked + reply=GetWorkareaReply } - // }}} // // _NET_SUPPORTING_WM_CHECK, WINDOW/32 // {{{ -pub struct GetSupportingWmCheck; - -pub struct GetSupportingWmCheckCookie(xcb::x::GetPropertyCookie); - -pub struct GetSupportingWmCheckCookieUnchecked(xcb::x::GetPropertyCookieUnchecked); - #[derive(Debug)] pub struct GetSupportingWmCheckReply { pub window: xcb::x::Window, @@ -503,16 +417,19 @@ impl From for GetSupportingWmCheckReply { } } } + +ewmh_get_property! { + request=GetSupportingWmCheck{ + window: root, + property: _NET_SUPPORTING_WM_CHECK, + xtype: ATOM_WINDOW + }, + reply=GetSupportingWmCheckReply +} // }}} // _NET_VIRTUAL_ROOTS, WINDOW/32 // {{{ -pub struct GetVirtualRoots; - -pub struct GetVirtualRootsCookie(xcb::x::GetPropertyCookie); - -pub struct GetVirtualRootsCookieUnchecked(xcb::x::GetPropertyCookieUnchecked); - #[derive(Debug)] pub struct GetVirtualRootsReply { pub window: xcb::x::Window, @@ -528,24 +445,16 @@ impl From for GetVirtualRootsReply { ewmh_get_property! { request=GetVirtualRoots{ - window: root_window, + window: root, property: _NET_VIRTUAL_ROOTS, xtype: ATOM_WINDOW }, - reply=GetVirtualRootsReply, - cookie=GetVirtualRootsCookie, - cookie_unchecked=GetVirtualRootsCookieUnchecked + reply=GetVirtualRootsReply } // }}} // _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)] pub struct DesktopLayoutReply { pub orientation: u32, @@ -567,24 +476,16 @@ impl From for DesktopLayoutReply { ewmh_get_property! { request=DesktopLayout{ - window: root_window, + window: root, property: _NET_DESKTOP_LAYOUT, xtype: ATOM_CARDINAL }, - reply=DesktopLayoutReply, - cookie=DesktopLayoutCookie, - cookie_unchecked=DesktopLayoutCookieUnchecked + reply=DesktopLayoutReply } // }}} // _NET_SHOWING_DESKTOP desktop, CARDINAL/32 // {{{ -pub struct GetShowingDesktop; - -pub struct GetShowingDesktopCookie(xcb::x::GetPropertyCookie); - -pub struct GetShowingDesktopCookieUnchecked(xcb::x::GetPropertyCookieUnchecked); - #[derive(Debug)] pub struct GetShowingDesktopReply { pub is_showing_desktop: bool, @@ -604,13 +505,11 @@ impl From for GetShowingDesktopReply { ewmh_get_property! { request=GetShowingDesktop{ - window: root_window, + window: root, property: _NET_SHOWING_DESKTOP, xtype: ATOM_CARDINAL }, - reply=GetShowingDesktopReply, - cookie=GetShowingDesktopCookie, - cookie_unchecked=GetShowingDesktopCookieUnchecked + reply=GetShowingDesktopReply } pub struct SetShowingDesktop {