aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-11-12 11:37:01 -0500
committerKen Moore <moorekou@gmail.com>2015-11-12 11:37:01 -0500
commitaa5f07d00e44be25992e0271d2f814f354c08009 (patch)
tree320f008b8d9a0f6400ecf0d889afed741277e254
parentFinish adding the rest of the Root window EWMH standards support into the Lum... (diff)
downloadlumina-aa5f07d00e44be25992e0271d2f814f354c08009.tar.gz
lumina-aa5f07d00e44be25992e0271d2f814f354c08009.tar.bz2
lumina-aa5f07d00e44be25992e0271d2f814f354c08009.zip
Add ~50% of the client EWMH window property support.
-rw-r--r--libLumina/LuminaX11.cpp69
-rw-r--r--libLumina/LuminaX11.h14
2 files changed, 81 insertions, 2 deletions
diff --git a/libLumina/LuminaX11.cpp b/libLumina/LuminaX11.cpp
index 048333b4..a5592c8e 100644
--- a/libLumina/LuminaX11.cpp
+++ b/libLumina/LuminaX11.cpp
@@ -1504,15 +1504,82 @@ void LXCB::WM_Set_Window_Supported(WId win){
}
// _NET_WM_NAME
+QString LXCB::WM_Get_Name(WId win){
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_name_unchecked(&EWMH, win);
+ xcb_ewmh_get_utf8_strings_reply_t reply;
+ QString out;
+ if(1==xcb_ewmh_get_wm_name_reply(&EWMH, cookie,&reply, NULL) ){
+ out = QString::fromUtf8(reply.strings);
+ }
+ return out;
+}
+void LXCB::WM_Set_Name(WId win, QString txt){
+ xcb_ewmh_set_wm_name(&EWMH, win, txt.length(), txt.toUtf8().data());
+}
// _NET_WM_VISIBLE_NAME
+QString LXCB::WM_Get_Visible_Name(WId win){
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_visible_name_unchecked(&EWMH, win);
+ xcb_ewmh_get_utf8_strings_reply_t reply;
+ QString out;
+ if(1==xcb_ewmh_get_wm_visible_name_reply(&EWMH, cookie,&reply, NULL) ){
+ out = QString::fromUtf8(reply.strings);
+ }
+ return out;
+}
+void LXCB::WM_Set_Visible_Name(WId win, QString txt){
+ xcb_ewmh_set_wm_visible_name(&EWMH, win, txt.length(), txt.toUtf8().data());
+}
// _NET_WM_ICON_NAME
+QString LXCB::WM_Get_Icon_Name(WId win){
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_icon_name_unchecked(&EWMH, win);
+ xcb_ewmh_get_utf8_strings_reply_t reply;
+ QString out;
+ if(1==xcb_ewmh_get_wm_icon_name_reply(&EWMH, cookie,&reply, NULL) ){
+ out = QString::fromUtf8(reply.strings);
+ }
+ return out;
+}
+void LXCB::WM_Set_Icon_Name(WId win, QString txt){
+ xcb_ewmh_set_wm_icon_name(&EWMH, win, txt.length(), txt.toUtf8().data());
+}
// _NET_WM_VISIBLE_ICON_NAME
+QString LXCB::WM_Get_Visible_Icon_Name(WId win){
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_visible_icon_name_unchecked(&EWMH, win);
+ xcb_ewmh_get_utf8_strings_reply_t reply;
+ QString out;
+ if(1==xcb_ewmh_get_wm_visible_icon_name_reply(&EWMH, cookie,&reply, NULL) ){
+ out = QString::fromUtf8(reply.strings);
+ }
+ return out;
+}
+void LXCB::WM_Set_Visible_Icon_Name(WId win, QString txt){
+ xcb_ewmh_set_wm_visible_icon_name(&EWMH, win, txt.length(), txt.toUtf8().data());
+}
// _NET_WM_DESKTOP
-
+int LXCB::WM_Get_Desktop(WId win){
+ //returns -1 if window on all desktops
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_desktop_unchecked(&EWMH, win);
+ uint32_t num = 0;
+ int out = -1;
+ if(1==xcb_ewmh_get_wm_desktop_reply(&EWMH, cookie, &num, NULL) ){
+ if(num!=0xFFFFFFFF){ out = num; }
+ }else{
+ //Error in fetching property (not set?)
+ // - put it on the current screen
+ out = WM_Get_Current_Desktop();
+ }
+ return out;
+}
+
+void LXCB::WM_Set_Desktop(WId win, int num){
+ //use -1 to set it for all desktops
+ xcb_ewmh_set_wm_desktop(&EWMH, win, (num<0 ? 0xFFFFFFFF : qAbs(num) ) );
+}
+
// _NET_WM_WINDOW_TYPE
// _NET_WM_STATE
diff --git a/libLumina/LuminaX11.h b/libLumina/LuminaX11.h
index be1ea069..6ec8ca32 100644
--- a/libLumina/LuminaX11.h
+++ b/libLumina/LuminaX11.h
@@ -238,15 +238,27 @@ public:
// -- WINDOW PROPERTIES
// _NET_SUPPORTED
void WM_Set_Window_Supported(WId win); //set the atom list of supported features on the given window
+
// _NET_WM_NAME
+ QString WM_Get_Name(WId win);
+ void WM_Set_Name(WId win, QString txt);
// _NET_WM_VISIBLE_NAME
+ QString WM_Get_Visible_Name(WId win);
+ void WM_Set_Visible_Name(WId win, QString txt);
// _NET_WM_ICON_NAME
+ QString WM_Get_Icon_Name(WId win);
+ void WM_Set_Icon_Name(WId win, QString txt);
// _NET_WM_VISIBLE_ICON_NAME
+ QString WM_Get_Visible_Icon_Name(WId win);
+ void WM_Set_Visible_Icon_Name(WId win, QString txt);
// _NET_WM_DESKTOP
+ // Note: This refers to the virtual workspace, not the monitor/screen number
+ int WM_Get_Desktop(WId win); //returns -1 if window on all desktops
+ void WM_Set_Desktop(WId win, int num); //use -1 to set it for all desktops
// _NET_WM_WINDOW_TYPE
@@ -283,7 +295,7 @@ private:
void createWMAtoms(); //fill the private lists above
};
-//Now also declare the flags for Qt to use
+//Now also declare the flags for Qt to be able to use normal operations on them
Q_DECLARE_OPERATORS_FOR_FLAGS(LXCB::ICCCM_PROTOCOLS);
Q_DECLARE_OPERATORS_FOR_FLAGS(LXCB::MOVERESIZE_WINDOW_FLAGS);
bgstack15