From b02fd1721f71e3f120c2fe56d866fac5b3a796d1 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 28 Jun 2017 10:20:24 -0400 Subject: Work on making a new NativeWindow property "RelatedWindows" which is a special property used only for seeing which Window ID's are also associated with a given window. --- src-qt5/core/libLumina/NativeWindow.cpp | 8 +++++--- src-qt5/core/libLumina/NativeWindow.h | 15 ++++++++------- src-qt5/core/libLumina/NativeWindowSystem.h | 4 ++-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src-qt5/core/libLumina/NativeWindow.cpp b/src-qt5/core/libLumina/NativeWindow.cpp index 020e4596..1fcaa552 100644 --- a/src-qt5/core/libLumina/NativeWindow.cpp +++ b/src-qt5/core/libLumina/NativeWindow.cpp @@ -35,11 +35,13 @@ QWindow* NativeWindow::window(){ QVariant NativeWindow::property(NativeWindow::Property prop){ if(hash.contains(prop)){ return hash.value(prop); } + else if(prop == NativeWindow::RelatedWindows){ return QVariant::fromValue(relatedTo); } return QVariant(); //null variant } void NativeWindow::setProperty(NativeWindow::Property prop, QVariant val){ - if(prop == NativeWindow::None || hash.value(prop)==val){ return; } + if(prop == NativeWindow::RelatedWindows){ relatedTo = val.value< QList >(); } + else if(prop == NativeWindow::None || hash.value(prop)==val){ return; } hash.insert(prop, val); emit PropertiesChanged(QList() << prop, QList() << val); } @@ -54,7 +56,7 @@ void NativeWindow::setProperties(QList props, QList() << prop, QList() << val); } @@ -62,7 +64,7 @@ void NativeWindow::requestProperties(QList props, QList< //Verify/adjust inputs as needed for(int i=0; i=vals.length()){ props.removeAt(i); i--; continue; } //no corresponding value for this property - if(props[i] == NativeWindow::None || hash.value(props[i])==vals[i] ){ props.removeAt(i); vals.removeAt(i); i--; continue; } //Invalid property or identical value + if(props[i] == NativeWindow::None || props[i] == NativeWindow::RelatedWindows || hash.value(props[i])==vals[i] ){ props.removeAt(i); vals.removeAt(i); i--; continue; } //Invalid property or identical value } emit RequestPropertiesChange(winid, props, vals); } diff --git a/src-qt5/core/libLumina/NativeWindow.h b/src-qt5/core/libLumina/NativeWindow.h index a3efd234..e6e90825 100644 --- a/src-qt5/core/libLumina/NativeWindow.h +++ b/src-qt5/core/libLumina/NativeWindow.h @@ -30,9 +30,9 @@ public: enum Property{ /*QVariant Type*/ None, /*null*/ - MinSize, /*QSize*/ - MaxSize, /*QSize*/ - Size, /*QSize*/ + MinSize, /*QSize*/ + MaxSize, /*QSize*/ + Size, /*QSize*/ GlobalPos, /*QPoint*/ Title, /*QString*/ ShortTitle, /*QString*/ @@ -41,17 +41,18 @@ public: Workspace, /*int*/ States, /*QList : Current state of the window */ WinTypes, /*QList : Current type of window (typically does not change)*/ - WinActions, /*QList : Current actions that the window allows (Managed/set by the WM)*/ - FrameExtents, /*QList : [Left, Right, Top, Bottom] in pixels */ + WinActions, /*QList : Current actions that the window allows (Managed/set by the WM)*/ + FrameExtents, /*QList : [Left, Right, Top, Bottom] in pixels */ + RelatedWindows, /* QList - better to use the "isRelatedTo(WId)" function instead of reading this directly*/ Active, /*bool*/ Visible /*bool*/ }; static QList allProperties(){ - //Return all the available properties (excluding "None") + //Return all the available properties (excluding "None" and "FrameExtents" (WM control only) ) QList props; props << MinSize << MaxSize << Size << GlobalPos << Title << ShortTitle << Icon << Name << Workspace \ - << States << WinTypes << WinActions << Active << Visible; + << States << WinTypes << WinActions << RelatedWindows << Active << Visible; return props; }; diff --git a/src-qt5/core/libLumina/NativeWindowSystem.h b/src-qt5/core/libLumina/NativeWindowSystem.h index 53abd633..00841903 100644 --- a/src-qt5/core/libLumina/NativeWindowSystem.h +++ b/src-qt5/core/libLumina/NativeWindowSystem.h @@ -26,9 +26,9 @@ private: NativeWindow* findWindow(WId id){ qDebug() << "Find Window:" << id; for(int i=0; iid(); if(NWindows[i]->isRelatedTo(id)){ qDebug() << " -- Got Match!"; return NWindows[i]; } } + qDebug() << " -- Could not find Window!"; return 0; } @@ -69,7 +69,7 @@ private: bool screenLocked; public: - enum Property{ None, CurrentWorkspace, Workspaces, VirtualRoots, WorkAreas }; + //enum Property{ None, CurrentWorkspace, Workspaces, VirtualRoots, WorkAreas }; enum MouseButton{NoButton, LeftButton, RightButton, MidButton, BackButton, ForwardButton, TaskButton, WheelUp, WheelDown, WheelLeft, WheelRight}; NativeWindowSystem(); -- cgit