aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core')
-rw-r--r--src-qt5/core/libLumina/LuminaSingleApplication.cpp2
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/DesktopManager.cpp4
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.cpp6
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.h5
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp30
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h10
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/ContextMenu.qml13
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml10
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/StatusTray.qml41
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/TrayIcon.qml15
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp23
11 files changed, 126 insertions, 33 deletions
diff --git a/src-qt5/core/libLumina/LuminaSingleApplication.cpp b/src-qt5/core/libLumina/LuminaSingleApplication.cpp
index 6107aff8..927815a2 100644
--- a/src-qt5/core/libLumina/LuminaSingleApplication.cpp
+++ b/src-qt5/core/libLumina/LuminaSingleApplication.cpp
@@ -22,7 +22,7 @@ LSingleApplication::LSingleApplication(int &argc, char **argv, QString appname)
QString username = QString::number(getuid());
//For locking the process use the official process name - not the user input (no masking)
appname = this->applicationName();
- cfile = cfile.arg( username, appname, QString::number(QX11Info::appScreen()) );
+ cfile = cfile.arg( username, appname, QString(getenv("DISPLAY")).replace(":","") );
lockfile = new QLockFile(cfile+"-lock");
lockfile->setStaleLockTime(0); //long-lived processes
for(int i=1; i<argc; i++){
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/DesktopManager.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/DesktopManager.cpp
index ad2bc445..be315596 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/DesktopManager.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/DesktopManager.cpp
@@ -138,7 +138,9 @@ void DesktopManager::syncWindowList(){
}
void DesktopManager::syncTrayWindowList(){
-
+ QList<NativeWindowObject*> allWins = Lumina::NWS->currentTrayWindows();
+ qDebug() << "Synced Tray Window List:" << allWins.length();
+ RootDesktopObject::instance()->setTrayWindows(allWins);
}
// === PRIVATE SLOTS ===
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.cpp
index 83c15601..9664e506 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.cpp
@@ -10,7 +10,7 @@
RootWindow::RootWindow() : QObject(){
root_win = QWindow::fromWinId( QX11Info::appRootWindow() );
- root_view = new QQuickView(new QWindow()); //make it a child of the root window
+ root_view = new QQuickView(); //make it a child of the root window
root_obj = RootDesktopObject::instance();
syncRootSize();
connect(root_win, SIGNAL(widthChanged(int)), this, SLOT(syncRootSize()) );
@@ -31,7 +31,7 @@ RootWindow::~RootWindow(){
void RootWindow::start(){
root_view->setSource(QUrl("qrc:///qml/RootDesktop.qml"));
root_win->show();
- root_view->parent()->show();
+ if(root_view->parent()!=0){ root_view->parent()->show(); }
root_view->show();
}
@@ -41,7 +41,7 @@ void RootWindow::syncRootSize(){
QRect unif;
for(int i=0; i<screens.length(); i++){ unif = unif.united(screens[i]->geometry()); }
if(unif.width() != root_view->width() || unif.height() != root_view->height()){
- root_view->parent()->setGeometry(0,0,unif.width(), unif.height());
+ if(root_view->parent()!=0){ root_view->parent()->setGeometry(0,0,unif.width(), unif.height()); }
root_view->setGeometry(0, 0, unif.width(), unif.height() );
emit RootResized(root_view->geometry());
}
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.h b/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.h
index 0e48c000..41c75a46 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.h
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.h
@@ -22,7 +22,10 @@ public:
void start();
- WId viewID(){ return root_view->parent()->winId(); }
+ WId viewID(){
+ if(root_view->parent()!=0){ return root_view->parent()->winId(); }
+ return root_view->winId();
+ }
public slots:
void syncRootSize();
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp
index e1960ba0..77dd2d79 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp
@@ -85,6 +85,26 @@ NativeWindowObject* RootDesktopObject::window(QString id){
return 0;
}
+QStringList RootDesktopObject::trayWindows(){
+ //qDebug() << "Request Panels:" << panel_objects.length();
+ QStringList names;
+ for(int i=0; i<tray_window_objects.length(); i++){ names << QString::number(tray_window_objects[i]->id()); }
+ return names;
+}
+
+NativeWindowObject* RootDesktopObject::trayWindow(QString id){
+ //qDebug() << "Got Panel Request:" << id;
+ WId chk = id.toInt(); //numerical ID's in this case
+ for(int i=0; i<tray_window_objects.length(); i++){
+ if(tray_window_objects[i]->id()==chk){ return tray_window_objects[i]; }
+ }
+ return 0;
+}
+
+bool RootDesktopObject::hasTrayWindows(){
+ return !tray_window_objects.isEmpty();
+}
+
OSInterface* RootDesktopObject::os_interface(){
return OSInterface::instance();
}
@@ -149,8 +169,16 @@ void RootDesktopObject::setWindows(QList<NativeWindowObject*> list){
mousePositionChanged(true);
}
+void RootDesktopObject::setTrayWindows(QList<NativeWindowObject*> list){
+ tray_window_objects = list;
+ emit trayWindowsChanged();
+ mousePositionChanged(true);
+}
+
+
void RootDesktopObject::logout(){
- emit startLogout();
+ //Emit the logout signal in a few ms (let the display close/sync first)
+ QTimer::singleShot(50, this, SIGNAL(startLogout()));
}
void RootDesktopObject::lockscreen(){
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h
index f9852e11..7914f3f6 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h
@@ -17,7 +17,9 @@ class RootDesktopObject : public QObject{
//Define all the QML Properties here (interface between QML and the C++ methods below)
Q_PROPERTY( QStringList screens READ screens NOTIFY screensChanged)
Q_PROPERTY( QStringList panels READ panels NOTIFY panelsChanged)
- Q_PROPERTY( QStringList windows READ windows NOTIFY windowsChanged);
+ Q_PROPERTY( QStringList windows READ windows NOTIFY windowsChanged)
+ Q_PROPERTY( QStringList trayWindows READ trayWindows NOTIFY trayWindowsChanged)
+ Q_PROPERTY( bool hasTrayWindows READ hasTrayWindows NOTIFY trayWindowsChanged)
public:
//main contructor/destructor
@@ -36,6 +38,9 @@ public:
Q_INVOKABLE PanelObject* panel(QString id);
Q_INVOKABLE QStringList windows();
Q_INVOKABLE NativeWindowObject* window(QString id);
+ Q_INVOKABLE QStringList trayWindows();
+ Q_INVOKABLE NativeWindowObject* trayWindow(QString id);
+ Q_INVOKABLE bool hasTrayWindows();
//QML Globals Access
Q_INVOKABLE OSInterface* os_interface();
@@ -50,6 +55,7 @@ private:
QList<ScreenObject*> s_objects;
QList<PanelObject*> panel_objects;
QList<NativeWindowObject*> window_objects;
+ QList<NativeWindowObject*> tray_window_objects;
QPointer<NativeWindowObject> last_window_up;
public slots:
@@ -62,6 +68,7 @@ public slots:
QList<PanelObject*> panelObjectList(){ return panel_objects; }
void setWindows(QList<NativeWindowObject*> list);
+ void setTrayWindows(QList<NativeWindowObject*> list);
private slots:
@@ -69,6 +76,7 @@ signals:
void screensChanged();
void panelsChanged();
void windowsChanged();
+ void trayWindowsChanged();
void startLogout();
void mouseMoved();
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/ContextMenu.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/ContextMenu.qml
index 778d7568..ee98a8db 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/ContextMenu.qml
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/ContextMenu.qml
@@ -6,22 +6,25 @@
//===========================================
import QtQuick 2.2
import QtQuick.Window 2.2
-import QtQuick.Controls 1
+import QtQuick.Controls 2
import Lumina.Backend.RootDesktopObject 2.0
+
+
Menu {
id: contextMenu
+
MenuItem {
text: "Launch Terminal"
- iconName: "utilities-terminal"
+ //iconName: "utilities-terminal"
onTriggered: {
RootObject.launchApp("application/terminal")
}
}
MenuItem {
text: "Launch File Browser"
- iconName: "user-home"
+ //iconName: "user-home"
onTriggered: {
RootObject.launchApp("inode/directory")
}
@@ -29,7 +32,7 @@ Menu {
MenuItem {
text: "Lock Screen"
- iconName: "system-lock-screen"
+ //iconName: "system-lock-screen"
onTriggered: {
RootObject.lockscreen()
}
@@ -37,7 +40,7 @@ Menu {
MenuItem {
text: "Logout"
- iconName: "system-log-out"
+ //iconName: "system-log-out"
onTriggered: {
RootObject.logout()
}
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml
index ddb2a490..7310fd50 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml
@@ -17,7 +17,7 @@
//===========================================
import QtQuick 2.2
import QtQuick.Window 2.2
-import QtQuick.Controls 1
+import QtQuick.Controls 2
import "." as QML
@@ -34,10 +34,10 @@ Rectangle {
anchors.fill: rootCanvas
acceptedButtons: Qt.RightButton
onClicked: {
- //contextMenu.x = mouseX
- //contextMenu.y = mouseY
- //contextMenu.open()
- contextMenu.popup()
+ contextMenu.x = mouseX
+ contextMenu.y = mouseY
+ contextMenu.open()
+ //contextMenu.popup()
}
onPositionChanged: {
RootObject.mousePositionChanged()
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/StatusTray.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/StatusTray.qml
index e1e7cd10..0bec74f2 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/StatusTray.qml
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/StatusTray.qml
@@ -8,6 +8,10 @@
//===========================================
import QtQuick 2.2
import QtQuick.Layouts 1.3
+import QtQuick.Controls 2
+
+import Lumina.Backend.RootDesktopObject 2.0
+import Lumina.Backend.NativeWindowObject 2.0
import "./status_tray" as QML
@@ -45,8 +49,41 @@ Rectangle {
Layout.preferredHeight: status_tray.prefsize
Layout.preferredWidth: status_tray.prefsize
}
- //System Tray Menu Popup
-
+ //System Tray Menu Button
+ ToolButton{
+ id: "trayButton"
+ text: "Tray"
+ //iconName: "view-more-vertical"
+ visible: RootObject.hasTrayWindows
+ onClicked: trayMenu.open()
+ Menu{
+ id: "trayMenu"
+ //MenuItem{ text: "sample" }
+ //MenuItem{ text: "sample2" }
+ //Rectangle{ color: "blue"; width: 50; height: 50 }
+ GridLayout{
+ columns: 4
+ Repeater{
+ model: RootObject.trayWindows
+ QML.TrayIcon{
+
+ winObj: RootObject.trayWindow(modelData)
+ parent: trayMenu
+ Layout.preferredWidth: 48
+ Layout.preferredHeight: 48
+ }
+ }
+ }
+ }
+ } //end of system tray menu button
+ /*Repeater{
+ model: RootObject.trayWindows
+ QML.TrayIcon{
+ winObj: RootObject.trayWindow(modelData)
+ Layout.preferredHeight: status_tray.prefsize
+ Layout.preferredWidth: status_tray.prefsize
+ }
+ }*/
} //end of layout
}
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/TrayIcon.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/TrayIcon.qml
index 26c50907..6012ba5d 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/TrayIcon.qml
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/TrayIcon.qml
@@ -5,21 +5,30 @@
// See the LICENSE file for full details
//===========================================
import QtQuick 2.2
-import QtQuick.Controls 1
+import QtQuick.Controls 2
import Lumina.Backend.NativeWindowObject 2.0
Image{
property NativeWindowObject winObj
source: winObj.icon
+ id: "trayIcon"
+ fillMode: Qt.PreserveAspectFit
+ smooth: true
+ cache: false
+ asynchronous: false
+ //text: winObj.name
+
+ onXChanged: { }
MouseArea{
+ //property point globalPos
anchors.fill: parent
acceptedButtons: Qt.NoButton
onEntered: {
//Need to ensure the invisible native window is over this place right now
- point pt: parent.mapToGlobal(0,0)
- winObj.updateGeometry( pt.x(), pt.y(), parent.width(), parent.height(), true);
+ console.log("Enter Tray Icon:", parent.mapToGlobal(0,0));
+ winObj.updateGeometry( parent.mapToGlobal(0,0).x, parent.mapToGlobal(0,0).y, parent.width(), parent.height(), true)
}
}
}
diff --git a/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp b/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp
index b08f9109..9e2e7bba 100644
--- a/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-events/NativeWindowSystem.cpp
@@ -294,7 +294,8 @@ NativeWindowObject* NativeWindowSystem::findWindow(WId id, bool checkRelated){
NativeWindowObject* NativeWindowSystem::findTrayWindow(WId id){
for(int i=0; i<TWindows.length(); i++){
- if(TWindows[i]->isRelatedTo(id)){ return TWindows[i]; }
+ if(TWindows[i]->id()==id){ return TWindows[i]; }
+ else if(TWindows[i]->isRelatedTo(id)){ return TWindows[i]; }
}
return 0;
}
@@ -806,29 +807,31 @@ void NativeWindowSystem::NewWindowDetected(WId id){
void NativeWindowSystem::NewTrayWindowDetected(WId id){
//Make sure this can be managed first
+ qDebug() << "New Tray Window Detected:" << id;
if(findTrayWindow(id) != 0){ return; } //already managed
- xcb_get_window_attributes_cookie_t cookie = xcb_get_window_attributes(QX11Info::connection(), id);
+ qDebug() << " - Setup new tray window";
+ /*xcb_get_window_attributes_cookie_t cookie = xcb_get_window_attributes(QX11Info::connection(), id);
xcb_get_window_attributes_reply_t *attr = xcb_get_window_attributes_reply(QX11Info::connection(), cookie, NULL);
- if(attr == 0){ return; } //could not get attributes of window
- if(attr->override_redirect){ free(attr); return; } //window has override redirect set (do not manage)
- free(attr);
+ if(attr == 0){ qDebug() << " - [WARN] No tray window attributes"; return; } //could not get attributes of window
+ if(attr->override_redirect){ qDebug() << " - [WARN] Override Redirect"; free(attr); return; } //window has override redirect set (do not manage)
+ qDebug() << " - free attr";
+ free(attr);*/
//Register for events from this window
- #define TRAY_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 | \
+ #define TRAY_WIN_EVENT_MASK (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] = {TRAY_WIN_EVENT_MASK};
+ qDebug() << " - change tray window attributes";
xcb_change_window_attributes(QX11Info::connection(), id, XCB_CW_EVENT_MASK, value_list);
//Now go ahead and create/populate the container for this window
NativeWindowObject *win = new NativeWindowObject(id);
TWindows << win;
+ qDebug() << " - update tray window properties";
UpdateWindowProperties(win, NativeWindowObject::allProperties());
+ qDebug() << " - emit new tray window signal";
emit NewTrayWindowAvailable(win);
}
bgstack15