aboutsummaryrefslogtreecommitdiff
path: root/libLumina
diff options
context:
space:
mode:
Diffstat (limited to 'libLumina')
-rw-r--r--libLumina/LuminaX11.cpp38
-rw-r--r--libLumina/LuminaX11.h7
2 files changed, 40 insertions, 5 deletions
diff --git a/libLumina/LuminaX11.cpp b/libLumina/LuminaX11.cpp
index 11c0f0ef..62f21d49 100644
--- a/libLumina/LuminaX11.cpp
+++ b/libLumina/LuminaX11.cpp
@@ -1197,6 +1197,44 @@ void WM_ICCCM_SetTransientFor(WId win, WId transient){
// -- WM_HINTS
// -- WM_PROTOCOLS
+LXCB::ICCCM_PROTOCOLS LXCB::WM_ICCCM_GetProtocols(WId win){
+ if(atoms.isEmpty()){ createWMAtoms(); }
+ xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_protocols(QX11Info::connection(), win, EWMH.WM_PROTOCOLS);
+ xcb_icccm_get_wm_protocols_reply_t reply;
+ LXCB::ICCCM_PROTOCOLS flags;
+ if(1==xcb_icccm_get_wm_protocols_reply(QX11Info::connection(), cookie, &reply, NULL) ){
+ for(unsigned int i=0; i<reply.atoms_len; i++){
+ if(reply.atoms[i]==ATOMS[atoms.indexOf("WM_TAKE_FOCUS")]){ flags = flags | TAKE_FOCUS; }
+ else if(reply.atoms[i]==ATOMS[atoms.indexOf("WM_DELETE_WINDOW")]){ flags = flags | DELETE_WINDOW; }
+ }
+ }
+ return flags;
+}
+
+void LXCB::WM_ICCCM_SetProtocols(WId win, LXCB::ICCCM_PROTOCOLS flags){
+ if(atoms.isEmpty()){ createWMAtoms(); }
+ xcb_atom_t *list;
+ int num;
+ if(flags.testFlag(TAKE_FOCUS) && flags.testFlag(DELETE_WINDOW)){
+ num = 2;
+ list = new xcb_atom_t[2];
+ list[0] = ATOMS[atoms.indexOf("WM_TAKE_FOCUS")];
+ list[1] = ATOMS[atoms.indexOf("WM_DELETE_WINDOW")];
+ }else if(flags.testFlag(TAKE_FOCUS)){
+ num = 1;
+ list = new xcb_atom_t[1];
+ list[0] = ATOMS[atoms.indexOf("WM_TAKE_FOCUS")];
+ }else if(flags.testFlag(DELETE_WINDOW)){
+ num = 1;
+ list = new xcb_atom_t[1];
+ list[0] = ATOMS[atoms.indexOf("WM_DELETE_WINDOW")];
+ }else{
+ num = 0;
+ list = new xcb_atom_t[0];
+ }
+ xcb_icccm_set_wm_protocols(QX11Info::connection(), win, EWMH.WM_PROTOCOLS, num, list);
+
+}
// --------------------------------------------------------
// NET_WM Standards (newer standards)
diff --git a/libLumina/LuminaX11.h b/libLumina/LuminaX11.h
index 201b8576..914ceaa2 100644
--- a/libLumina/LuminaX11.h
+++ b/libLumina/LuminaX11.h
@@ -22,10 +22,6 @@
#include <QPainter>
#include <QObject>
#include <QFlags>
-// Addition includes for compilations (cause issues with X11 libs later)
-//#include <QDir>
-//#include <QEvent>
-//#include <QHeaderView>
#include <xcb/xcb_ewmh.h>
@@ -144,7 +140,8 @@ public:
// -- WM_HINTS
// -- WM_PROTOCOLS
-
+ ICCCM_PROTOCOLS WM_ICCCM_GetProtocols(WId win);
+ void WM_ICCCM_SetProtocols(WId win, ICCCM_PROTOCOLS flags);
//NET_WM Standards (newer standards)
void WM_Set_Root_Supported(); //set the atom list of supported features on the root window
bgstack15