From 0bce08ce5c6fa073b0c9e299ab619d35ecdceef6 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 31 Aug 2017 08:47:21 -0400 Subject: A but more work on Lumina2: 1. Get the menu-based task manager up and running. 2. Get the minimize button setup with normal functionality now (since we can restore it) 3. Get the maximize button logic setup - still testing this 4. Get the window movement animation system setup - still testing this for the maximize functionality 5. Cleanup a bit more of the backend "pause" for windows during animations. --- .../src-desktop/ContextMenu.cpp | 22 ++++++++++++++++++++++ .../src-desktop/ContextMenu.h | 2 ++ 2 files changed, 24 insertions(+) (limited to 'src-qt5/core/lumina-desktop-unified') diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.cpp index 1b5512ff..143a3667 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.cpp @@ -64,6 +64,17 @@ void DesktopContextMenu::UpdateMenu(bool fast){ this->addAction(LXDG::findIcon("system-log-out",""), tr("Leave"), this, SIGNAL(showLeaveDialog()) ); } +// === PRIVATE === +void DesktopContextMenu::AddWindowToMenu(NativeWindow *win){ + QString label = win->property(NativeWindow::ShortTitle).toString(); + if(label.isEmpty()){ label = win->property(NativeWindow::Title).toString(); } + if(label.isEmpty()){ label = win->property(NativeWindow::Name).toString(); } + QAction *tmp = winMenu->addAction( win->property(NativeWindow::Icon).value(), label, win, SLOT(toggleVisibility()) ); + //Need to change the visual somehow to indicate whether it is visible or not + //bool visible = win->property(NativeWindow::Visible).toBool(); + // TODO +} + // === PUBLIC === DesktopContextMenu::DesktopContextMenu(QWidget *parent) : QMenu(parent){ if(parent!=0){ @@ -150,4 +161,15 @@ void DesktopContextMenu::updateWinMenu(){ winMenu = new QMenu(this); winMenu->setTitle( tr("Task Manager") ); } + winMenu->clear(); + QList wins = Lumina::NWS->currentWindows(); + unsigned int wkspace = Lumina::NWS->currentWorkspace(); + for(int i=0; iproperty(NativeWindow::Workspace).toUInt() != wkspace + && wins.at(i)->property(NativeWindow::States).value< QList >().contains(NativeWindow::S_STICKY) ){ + continue; + } + AddWindowToMenu(wins.at(i)); + } } diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.h b/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.h index ee6fdcc9..78756e8c 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.h +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.h @@ -21,6 +21,8 @@ private: QMenu *appMenu, *winMenu; bool usewinmenu; + void AddWindowToMenu(NativeWindow*); + public: DesktopContextMenu(QWidget *parent = 0); ~DesktopContextMenu(); -- cgit