diff options
author | Ken Moore <ken@ixsystems.com> | 2017-03-06 23:59:28 -0800 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-03-06 23:59:28 -0800 |
commit | fa1375b9a35dee9cc2f94930ccdd3207ff6a326c (patch) | |
tree | 31d0e9888d0e04f993b8bd40f5e7fb8da22d70c9 /src-qt5/core | |
parent | Add support for reading the "Workspace" property (_NET_WM_DESKTOP). (diff) | |
download | lumina-fa1375b9a35dee9cc2f94930ccdd3207ff6a326c.tar.gz lumina-fa1375b9a35dee9cc2f94930ccdd3207ff6a326c.tar.bz2 lumina-fa1375b9a35dee9cc2f94930ccdd3207ff6a326c.zip |
Finish up some more of the admin functions for the NativeWindowSystem (event registration, window create/close handling, etc)
Diffstat (limited to 'src-qt5/core')
-rw-r--r-- | src-qt5/core/libLumina/NativeWindowSystem.cpp | 71 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeWindowSystem.h | 3 |
2 files changed, 65 insertions, 9 deletions
diff --git a/src-qt5/core/libLumina/NativeWindowSystem.cpp b/src-qt5/core/libLumina/NativeWindowSystem.cpp index b7b2e6ec..7c7f11f7 100644 --- a/src-qt5/core/libLumina/NativeWindowSystem.cpp +++ b/src-qt5/core/libLumina/NativeWindowSystem.cpp @@ -410,20 +410,75 @@ void NativeWindowSystem::RegisterVirtualRoot(WId){ } //NativeWindowEventFilter interactions -void NativeWindowSystem::NewWindowDetected(WId){ - +void NativeWindowSystem::NewWindowDetected(WId id){ + //Make sure this can be managed first + if(findWindow(id) != 0){ return; } //already managed + //Register for events from this window + #define FRAME_WIN_EVENT_MASK (XCB_EVENT_MASK_BUTTON_PRESS | \ + XCB_EVENT_MASK_BUTTON_RELEASE | \ + XCB_EVENT_MASK_POINTER_MOTION | \ + XCB_EVENT_MASK_BUTTON_MOTION | \ + XCB_EVENT_MASK_EXPOSURE | \ + XCB_EVENT_MASK_STRUCTURE_NOTIFY | \ + XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | \ + XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | \ + XCB_EVENT_MASK_ENTER_WINDOW) + + uint32_t value_list[1] = {FRAME_WIN_EVENT_MASK}; + xcb_change_window_attributes(QX11Info::connection(), id, XCB_CW_EVENT_MASK, value_list); + //Now go ahead and create/populate the container for this window + NativeWindow *win = new NativeWindow(id); + NWindows << win; + UpdateWindowProperties(win, NativeWindow::allProperties()); + emit NewWindowAvailable(win); } -void NativeWindowSystem::NewTrayWindowDetected(WId){ - +void NativeWindowSystem::NewTrayWindowDetected(WId id){ + //Make sure this can be managed first + if(findTrayWindow(id) != 0){ return; } //already managed + //Register for events from this window + #define FRAME_WIN_EVENT_MASK (XCB_EVENT_MASK_BUTTON_PRESS | \ + XCB_EVENT_MASK_BUTTON_RELEASE | \ + XCB_EVENT_MASK_POINTER_MOTION | \ + XCB_EVENT_MASK_BUTTON_MOTION | \ + XCB_EVENT_MASK_EXPOSURE | \ + XCB_EVENT_MASK_STRUCTURE_NOTIFY | \ + XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | \ + XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | \ + XCB_EVENT_MASK_ENTER_WINDOW) + + uint32_t value_list[1] = {FRAME_WIN_EVENT_MASK}; + xcb_change_window_attributes(QX11Info::connection(), id, XCB_CW_EVENT_MASK, value_list); + //Now go ahead and create/populate the container for this window + NativeWindow *win = new NativeWindow(id); + TWindows << win; + UpdateWindowProperties(win, NativeWindow::allProperties()); + emit NewTrayWindowAvailable(win); } -void NativeWindowSystem::WindowCloseDetected(WId){ - +void NativeWindowSystem::WindowCloseDetected(WId id){ + NativeWindow *win = findWindow(id); + if(win!=0){ + NWindows.removeAll(win); + win->emit WindowClosed(id); + win->deleteLater(); + }else{ + win = findTrayWindow(id); + if(win!=0){ + TWindows.removeAll(win); + win->emit WindowClosed(id); + win->deleteLater(); + } + } } -void NativeWindowSystem::WindowPropertiesChanged(WId, NativeWindow::Property){ - +void NativeWindowSystem::WindowPropertyChanged(WId id, NativeWindow::Property prop){ + //NOTE: This is triggered by the NativeWindowEventFilter - not by changes to the NativeWindow objects themselves + NativeWindow *win = findWindow(id); + if(win==0){ win = findTrayWindow(id); } + if(win!=0){ + UpdateWindowProperties(win, QList<NativeWindow::Property>() << prop); + } } /*void NativeWindowSystem::NewKeyPress(int keycode, WId win){ diff --git a/src-qt5/core/libLumina/NativeWindowSystem.h b/src-qt5/core/libLumina/NativeWindowSystem.h index 58f623c3..f5d4c8ae 100644 --- a/src-qt5/core/libLumina/NativeWindowSystem.h +++ b/src-qt5/core/libLumina/NativeWindowSystem.h @@ -76,7 +76,7 @@ public slots: void NewWindowDetected(WId); //will automatically create the new NativeWindow object void NewTrayWindowDetected(WId); //will automatically create the new NativeWindow object void WindowCloseDetected(WId); //will update the lists and make changes if needed - void WindowPropertiesChanged(WId, NativeWindow::Property); //will rescan the window and update the object as needed + void WindowPropertyChanged(WId, NativeWindow::Property); //will rescan the window and update the object as needed /* void NewKeyPress(int keycode, WId win = 0); void NewKeyRelease(int keycode, WId win = 0); void NewMousePress(int buttoncode, WId win = 0); @@ -92,6 +92,7 @@ private slots: signals: void NewWindowAvailable(NativeWindow*); + void NewTrayWindowAvailable(NativeWindow*); void NewInputEvent(); //a mouse or keypress was detected (lock-state independent); void KeyPressDetected(Qt::Key, WId); //only emitted if lockstate = false void KeyReleaseDetected(Qt::Key, WId); //only emitted if lockstate = false |