aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/LWinInfo.cpp
blob: 4ea91c1ff31d41ce773f319b78148ccd23c94e43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//===========================================
//  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 <LuminaX11.h>

#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.isEmpty()){ nm = LSession::handle()->XCB->WindowIconName(window); }
  if(nm.isEmpty()){ nm = LSession::handle()->XCB->WindowVisibleName(window); }
  if(nm.isEmpty()){ nm = LSession::handle()->XCB->WindowName(window); }
  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::WINDOWSTATE LWinInfo::status(bool update){
  if(window==0){ return LXCB::IGNORE; }
  if(update || cstate == LXCB::IGNORE){
    cstate = LSession::handle()->XCB->WindowState(window);
  }
  return cstate;
  //LX11::WINDOWSTATE ws = LX11::GetWindowState(window);
 /*Lumina::STATES state;
  switch(ws){
    case LXCB::VISIBLE:
	    state = Lumina::VISIBLE; break;
    case LXCB::INVISIBLE:
	    state = Lumina::INVISIBLE; break;
    case LXCB::ACTIVE:
	    state = Lumina::ACTIVE; break;
    case LXCB::ATTENTION:
	    state = Lumina::NOTIFICATION; break;
    default:
	    state = Lumina::NOSHOW;
  }*/
  //qDebug() << "Window State:" << ws << state;
  //return ws;
}
bgstack15