aboutsummaryrefslogtreecommitdiff
path: root/lumina-wm-INCOMPLETE/main.cpp
blob: e4eee4eeb95dc70cf0716d1ec71ab920179b60ed (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
//===========================================
//  Lumina-DE source code
//  Copyright (c) 2015, Ken Moore
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================

#include "GlobalDefines.h"
//Initialize any global structures here
LXCB *LWM::SYSTEM = 0;

//Local includes
#include "WMSession.h"
#include "LWindow.h"
#include <QDialog>


//#define DEBUG 0
int main(int argc, char ** argv)
{
    qDebug() << "Starting lumina-wm...";
    LTHEME::LoadCustomEnvSettings();
    LSingleApplication a(argc, argv, "lumina-wm");
    if(!a.isPrimaryProcess()){ return 0; } //Inputs forwarded on to the primary already
    LuminaThemeEngine themes(&a);
    
    //Setup the special settings prefix location
    QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina");
    //Setup the global structures
    LWM::SYSTEM = new LXCB();
    if(argc>1 && QString::fromLocal8Bit(argv[1])=="testwin"){
      //Simple override to test out the window class
      qDebug() << "Starting window test...";
      QLabel dlg(0, Qt::Window | Qt::BypassWindowManagerHint); //this test should be ignored by the current WM
      dlg.setText("Sample Window");
      dlg.setWindowTitle("Test");
      dlg.setGeometry(100,100,200,100);
      dlg.setStyleSheet("background: rgba(255,255,255,100); color: black;");
      dlg.show();
      qDebug() << " - Loading window frame...";
      LWindow win(dlg.winId()); //have it wrap around the dialog
      qDebug() << " - Show frame...";
      win.windowChanged(LWM::Show);
      qDebug() << " - Start event loop...";
      a.setQuitOnLastWindowClosed(true);
      return a.exec();
    }
    WMSession w;
    w.start();
    QObject::connect(&themes, SIGNAL(updateIcons()), &w, SLOT(reloadIcons()) );
    QObject::connect(&a, SIGNAL(InputsAvailable(QStringList)), &w, SLOT(newInputsAvailable(QStringList)) );
    int retCode = a.exec();
    
    return retCode;
}
bgstack15