diff options
Diffstat (limited to 'src-qt5/core/libLumina/NativeWindowSystem.h')
-rw-r--r-- | src-qt5/core/libLumina/NativeWindowSystem.h | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/src-qt5/core/libLumina/NativeWindowSystem.h b/src-qt5/core/libLumina/NativeWindowSystem.h index 2f89b42c..59e54ca4 100644 --- a/src-qt5/core/libLumina/NativeWindowSystem.h +++ b/src-qt5/core/libLumina/NativeWindowSystem.h @@ -12,6 +12,8 @@ #define _LUMINA_NATIVE_WINDOW_SYSTEM_H #include "NativeWindow.h" +#include <QDateTime> +#include <QTimer> class NativeWindowSystem : public QObject{ Q_OBJECT @@ -39,12 +41,30 @@ private: class p_objects; p_objects* obj; + //Internal timers/variables for managing pings + QTimer *pingTimer; + QHash<WId, QDateTime> waitingForPong; + void checkPings(){ + QDateTime cur = QDateTime::currentDateTime(); + QList<WId> waiting = waitingForPong.keys(); + for(int i=0; i<waiting.length(); i++){ + if(waitingForPong.value(waiting[i]) < cur){ + waitingForPong.remove(waiting[i]); //Timeout on this window + if(waitingForPong.isEmpty() && pingTimer!=0){ pingTimer->stop(); } + NativeWindow *win = findWindow(waiting[i]); + if(win==0){ win = findTrayWindow(waiting[i]); } + if(win!=0){ win->emit WindowNotResponding(waiting[i]); } + } + } + } + // Since some properties may be easier to update in bulk // let the native system interaction do them in whatever logical groups are best void UpdateWindowProperties(NativeWindow* win, QList< NativeWindow::Property > props); public: enum Property{ None, CurrentWorkspace, Workspaces, VirtualRoots, WorkAreas }; + enum MouseButton{NoButton, LeftButton, RightButton, MidButton, BackButton, ForwardButton, TaskButton, WheelUp, WheelDown, WheelLeft, WheelRight}; NativeWindowSystem(); ~NativeWindowSystem(); @@ -57,6 +77,10 @@ public: QList<NativeWindow*> currentWindows(){ return NWindows; } QList<NativeWindow*> currentTrayWindows(){ return TWindows; } + //Small simplification functions + static Qt::Key KeycodeToQt(int keycode); + static NativeWindowSystem::MouseButton MouseToQt(int button); + public slots: //These are the slots which are typically only used by the desktop system itself or the NativeWindowEventFilter @@ -71,11 +95,13 @@ 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 NewKeyPress(int keycode, WId win = 0); + void WindowPropertyChanged(WId, NativeWindow::Property); //will rescan the window and update the object as needed + void GotPong(WId); + +/* void NewKeyPress(int keycode, WId win = 0); void NewKeyRelease(int keycode, WId win = 0); void NewMousePress(int buttoncode, WId win = 0); - void NewMouseRelease(int buttoncode, WId win = 0); + void NewMouseRelease(int buttoncode, WId win = 0);*/ void CheckDamageID(WId); private slots: @@ -87,6 +113,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 |