From ed5ecf7ea7a482b4649e66ecb35fbc60af680684 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Mon, 25 Apr 2016 13:08:12 -0400 Subject: Rearrange the Lumina source tree quite a bit: Now the utilites are arranged by category (core, core-utils, desktop-utils), so all the -utils may be excluded by a package system (or turned into separate packages) as needed. --- src-qt5/core/lumina-desktop/LWinInfo.cpp | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src-qt5/core/lumina-desktop/LWinInfo.cpp (limited to 'src-qt5/core/lumina-desktop/LWinInfo.cpp') diff --git a/src-qt5/core/lumina-desktop/LWinInfo.cpp b/src-qt5/core/lumina-desktop/LWinInfo.cpp new file mode 100644 index 00000000..3ff0c2d7 --- /dev/null +++ b/src-qt5/core/lumina-desktop/LWinInfo.cpp @@ -0,0 +1,48 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2014, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "LWinInfo.h" + +#include + +#include "LSession.h" + +//Information Retrieval + // Don't cache these results because they can change regularly +QString LWinInfo::text(){ + if(window==0){ return ""; } + QString nm = LSession::handle()->XCB->WindowVisibleIconName(window); + if(nm.simplified().isEmpty()){ nm = LSession::handle()->XCB->WindowIconName(window); } + if(nm.simplified().isEmpty()){ nm = LSession::handle()->XCB->WindowVisibleName(window); } + if(nm.simplified().isEmpty()){ nm = LSession::handle()->XCB->WindowName(window); } + if(nm.simplified().isEmpty()){ nm = LSession::handle()->XCB->OldWindowIconName(window); } + if(nm.simplified().isEmpty()){ nm = LSession::handle()->XCB->OldWindowName(window); } + //Make sure that the text is a reasonable size (40 char limit) + if(nm.length()>40){ nm = nm.left(40)+"..."; } + return nm; +} + +QIcon LWinInfo::icon(bool &noicon){ + if(window==0){ noicon = true; return QIcon();} + noicon = false; + QIcon ico = LSession::handle()->XCB->WindowIcon(window); + //Check for a null icon, and supply one if necessary + if(ico.isNull()){ ico = LXDG::findIcon( this->Class().toLower(),""); } + if(ico.isNull()){ico = LXDG::findIcon("preferences-system-windows",""); noicon=true;} + return ico; +} + +QString LWinInfo::Class(){ + return LSession::handle()->XCB->WindowClass(window); +} + +LXCB::WINDOWVISIBILITY LWinInfo::status(bool update){ + if(window==0){ return LXCB::IGNORE; } + if(update || cstate == LXCB::IGNORE){ + cstate = LSession::handle()->XCB->WindowState(window); + } + return cstate; +} \ No newline at end of file -- cgit