diff options
author | Ken Moore <moorekou@gmail.com> | 2015-10-28 17:10:16 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2015-10-28 17:10:16 -0400 |
commit | a703c142e0bcabf7dfc376df2d15892cd3694fb5 (patch) | |
tree | 693e69eba20da244192637c2aeda41f17d39c0d0 /libLumina | |
parent | Add new X11 functions for about 1/2 of the ICCCM standards (diff) | |
download | lumina-a703c142e0bcabf7dfc376df2d15892cd3694fb5.tar.gz lumina-a703c142e0bcabf7dfc376df2d15892cd3694fb5.tar.bz2 lumina-a703c142e0bcabf7dfc376df2d15892cd3694fb5.zip |
Add some more ICCCM functions to LuminaX11.
Diffstat (limited to 'libLumina')
-rw-r--r-- | libLumina/LuminaX11.cpp | 53 | ||||
-rw-r--r-- | libLumina/LuminaX11.h | 18 |
2 files changed, 66 insertions, 5 deletions
diff --git a/libLumina/LuminaX11.cpp b/libLumina/LuminaX11.cpp index 57455f16..f5aab49f 100644 --- a/libLumina/LuminaX11.cpp +++ b/libLumina/LuminaX11.cpp @@ -50,6 +50,36 @@ LXCB::~LXCB(){ xcb_ewmh_connection_wipe(&EWMH); } +// private function +void LXCB::createWMAtoms(){ + ATOMS.clear(); + atoms.clear(); + //List the atoms needed by some WM functions + atoms << "WM_TAKE_FOCUS" << "WM_DELETE_WINDOW"; //WM_PROTOCOLS + + //Create all the requests for the atoms + QList<xcb_intern_atom_reply_t*> reply; + for(int i=0; i<atoms.length(); i++){ + reply << xcb_intern_atom_reply(QX11Info::connection(), \ + xcb_intern_atom(QX11Info::connection(), 0, atoms[i].length(), atoms[i].toLocal8Bit()), NULL); + } + //Now evaluate all the requests and save the atoms + for(int i=0; i<reply.length(); i++){ + if(reply[i]!=0){ + ATOMS << reply[i]->atom; + free(reply[i]); //done with this reply + }else{ + //Invalid atom - could not be created + atoms.removeAt(i); + reply.removeAt(i); + i--; + } + } + + + +} + // === WindowList() === QList<WId> LXCB::WindowList(bool rawlist){ if(DEBUG){ qDebug() << "XCB: WindowList()" << rawlist; } @@ -1145,6 +1175,29 @@ void LXCB::WM_ICCCM_SetClass(WId win, QString name){ xcb_icccm_set_wm_class(QX11Info::connection(), win, name.length(), name.toLocal8Bit()); } +// -- WM_TRANSIENT_FOR +WId WM_ICCCM_GetTransientFor(WId win){ + xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_transient_for_unchecked(QX11Info::connection(), win); + xcb_window_t trans; + if(1!= xcb_icccm_get_wm_transient_for_reply(QX11Info::connection(), cookie, &trans, NULL) ){ + return win; //error in fetching transient window ID (or none found) + }else{ + return trans; + } +} + +void WM_ICCCM_SetTransientFor(WId win, WId transient){ + xcb_icccm_set_wm_transient_for(QX11Info::connection(), win, transient); +} + +// -- WM_SIZE_HINTS + +// -- WM_NORMAL_HINTS + +// -- WM_HINTS + +// -- WM_PROTOCOLS + // -------------------------------------------------------- // NET_WM Standards (newer standards) // -------------------------------------------------------- diff --git a/libLumina/LuminaX11.h b/libLumina/LuminaX11.h index 98dea587..b6431fc6 100644 --- a/libLumina/LuminaX11.h +++ b/libLumina/LuminaX11.h @@ -50,12 +50,14 @@ class LXCB{ public: enum WINDOWSTATE {IGNORE, INVISIBLE, VISIBLE, ACTIVE, ATTENTION}; //note that this in order of priority - + enum ICCCM_STATE {WITHDRAWN, NORMAL, ICONIC}; + enum ICCCM_PROTOCOLS {TAKE_FOCUS, DELETE_WINDOW}; + xcb_ewmh_connection_t EWMH; //This is where all the screen info and atoms are located - + LXCB(); ~LXCB(); - + //== Main Interface functions == // General Information QList<WId> WindowList(bool rawlist = false); //list all non-Lumina windows (rawlist -> all workspaces) @@ -133,10 +135,11 @@ public: QString WM_ICCCM_GetClientMachine(WId win); void WM_ICCCM_SetClientMachine(WId win, QString name); // -- WM_CLASS - QString WM_ICCCM_GetClass(WId win); + QString WM_ICCCM_GetClass(WId win); //Returns: "<instance name>::::<class name>" void WM_ICCCM_SetClass(WId win, QString name); // -- WM_TRANSIENT_FOR - + WId WM_ICCCM_GetTransientFor(WId win); //Returns "win" for errors or no transient + void WM_ICCCM_SetTransientFor(WId win, WId transient); // -- WM_SIZE_HINTS // -- WM_NORMAL_HINTS @@ -150,6 +153,11 @@ public: void WM_Set_Root_Supported(); //set the atom list of supported features on the root window void WM_Set_Window_Supported(WId win); //set the atom list of supported features on the given window +private: + QList<xcb_atom_t> ATOMS; + QStringList atoms; + + void createWMAtoms(); //fill the private lists above }; #endif
\ No newline at end of file |