diff options
author | Henry Hu <henry.hu.sh@gmail.com> | 2016-05-15 21:24:49 -0400 |
---|---|---|
committer | Henry Hu <henry.hu.sh@gmail.com> | 2016-05-15 21:24:49 -0400 |
commit | f84a7e09de624a8d9b2b3d40e349ccd641330a2d (patch) | |
tree | effef02d9d3e422e9985e00c46c439548f0b12bb /src-qt5 | |
parent | Merge pull request #223 from HenryHu/master (diff) | |
download | lumina-f84a7e09de624a8d9b2b3d40e349ccd641330a2d.tar.gz lumina-f84a7e09de624a8d9b2b3d40e349ccd641330a2d.tar.bz2 lumina-f84a7e09de624a8d9b2b3d40e349ccd641330a2d.zip |
use WM_CHANGE_STATE to minimize window
Diffstat (limited to 'src-qt5')
-rw-r--r-- | src-qt5/core/libLumina/LuminaX11.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src-qt5/core/libLumina/LuminaX11.cpp b/src-qt5/core/libLumina/LuminaX11.cpp index 5d1ac6f3..1892f135 100644 --- a/src-qt5/core/libLumina/LuminaX11.cpp +++ b/src-qt5/core/libLumina/LuminaX11.cpp @@ -55,7 +55,7 @@ void LXCB::createWMAtoms(){ ATOMS.clear(); atoms.clear(); //List the atoms needed by some WM functions - atoms << "WM_TAKE_FOCUS" << "WM_DELETE_WINDOW" << "WM_PROTOCOLS"; //WM_PROTOCOLS + atoms << "WM_TAKE_FOCUS" << "WM_DELETE_WINDOW" << "WM_PROTOCOLS" << "WM_CHANGE_STATE"; //WM_PROTOCOLS //Create all the requests for the atoms QList<xcb_intern_atom_reply_t*> reply; @@ -675,23 +675,20 @@ void LXCB::KillClient(WId win){ void LXCB::MinimizeWindow(WId win){ //request that the window be unmapped/minimized if(DEBUG){ qDebug() << "XCB: MinimizeWindow()"; } if(win==0){ return; } + if(atoms.isEmpty()){ createWMAtoms(); } //need these atoms //Note: Fluxbox completely removes this window from the open list if unmapped manually // xcb_unmap_window(QX11Info::connection(), win); //xcb_flush(QX11Info::connection()); //make sure the command is sent out right away //Need to send a client message event for the window so the WM picks it up xcb_client_message_event_t event; - event.response_type = XCB_CLIENT_MESSAGE; - event.format = 32; - event.window = win; - event.type = EWMH._NET_WM_STATE; - event.data.data32[0] = 1; //set to toggle (switch back and forth) - event.data.data32[1] = EWMH._NET_WM_STATE_HIDDEN; - event.data.data32[2] = 0; - event.data.data32[3] = 0; - event.data.data32[4] = 0; + event.response_type = XCB_CLIENT_MESSAGE; + event.format = 32; + event.window = win; + event.type = ATOMS[atoms.indexOf("WM_CHANGE_STATE")]; + event.data.data32[0] = XCB_ICCCM_WM_STATE_ICONIC; - xcb_send_event(QX11Info::connection(), 0, QX11Info::appRootWindow(), XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *) &event); + xcb_send_event(QX11Info::connection(), 0, QX11Info::appRootWindow(), XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *) &event); } // === ActivateWindow() === |