aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop
diff options
context:
space:
mode:
authorJesse Smith <jsmith@resonatingmedia.com>2015-07-18 12:53:11 -0300
committerJesse Smith <jsmith@resonatingmedia.com>2015-07-18 12:53:11 -0300
commit676baf4bb756e98b5df08b8e7c38d5050eae150a (patch)
treeabacf948fb92f6fdea22125179ef45a4bc3183c5 /lumina-desktop
parentUpdated dependency and build instructors for Fedora. (diff)
parentFix up a calculation of the new window geometry - add in checks for those str... (diff)
downloadlumina-676baf4bb756e98b5df08b8e7c38d5050eae150a.tar.gz
lumina-676baf4bb756e98b5df08b8e7c38d5050eae150a.tar.bz2
lumina-676baf4bb756e98b5df08b8e7c38d5050eae150a.zip
Merge branch 'master' of https://github.com/pcbsd/lumina
Diffstat (limited to 'lumina-desktop')
-rw-r--r--lumina-desktop/LDesktop.cpp8
-rw-r--r--lumina-desktop/LPanel.cpp15
-rw-r--r--lumina-desktop/LSession.cpp73
-rw-r--r--lumina-desktop/LSession.h2
-rw-r--r--lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h3
-rw-r--r--lumina-desktop/fluxboxconf/fluxbox-keys60
-rw-r--r--lumina-desktop/lumina-desktop.pro4
7 files changed, 94 insertions, 71 deletions
diff --git a/lumina-desktop/LDesktop.cpp b/lumina-desktop/LDesktop.cpp
index ec56b7b0..7b21b862 100644
--- a/lumina-desktop/LDesktop.cpp
+++ b/lumina-desktop/LDesktop.cpp
@@ -292,8 +292,8 @@ void LDesktop::InitDesktop(){
bgWindow = new QWidget();
bgWindow->setObjectName("bgWindow");
bgWindow->setContextMenuPolicy(Qt::CustomContextMenu);
- bgWindow->setWindowFlags(Qt::FramelessWindowHint);
- LX11::SetAsDesktop(bgWindow->winId());
+ bgWindow->setWindowFlags(Qt::WindowStaysOnBottomHint | Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
+ LSession::handle()->XCB->SetAsDesktop(bgWindow->winId());
bgWindow->setGeometry(desktop->screenGeometry(desktopnumber));
connect(bgWindow, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowMenu()) );
if(DEBUG){ qDebug() << "Create bgDesktop"; }
@@ -361,8 +361,6 @@ void LDesktop::UpdateMenu(bool fast){
if(!desktoplocked){
deskMenu->addAction(LXDG::findIcon("document-encrypt",""),tr("Lock Desktop"), this, SLOT(ToggleDesktopLock()) );
deskMenu->addAction(LXDG::findIcon("snap-orthogonal",""),tr("Snap Plugins to Grid"), this, SLOT(AlignDesktopPlugins()) );
- deskMenu->addAction(LXDG::findIcon("shapes",""), tr("Tile Plugins"), bgDesktop, SLOT(tileSubWindows()) );
- deskMenu->addAction(LXDG::findIcon("window-duplicate",""), tr("Cascade Plugins"), bgDesktop, SLOT(cascadeSubWindows()) );
}else{ deskMenu->addAction(LXDG::findIcon("document-decrypt",""),tr("Unlock Desktop"), this, SLOT(ToggleDesktopLock()) ); }
deskMenu->addSeparator();
deskMenu->addAction(LXDG::findIcon("system-log-out",""), tr("Log Out"), this, SLOT(SystemLogout()) );
@@ -649,6 +647,8 @@ void LDesktop::UpdateDesktopPluginArea(){
for(int i=0; i<PANELS.length(); i++){ PANELS[i]->update(); }
//Also need to re-arrange any desktop plugins to ensure that nothing is out of the screen area
AlignDesktopPlugins();
+ //Make sure to re-disable any WM control flags
+ LSession::handle()->XCB->SetDisableWMActions(bgWindow->winId());
}
void LDesktop::UpdateBackground(){
diff --git a/lumina-desktop/LPanel.cpp b/lumina-desktop/LPanel.cpp
index 11a5a988..94db8ce0 100644
--- a/lumina-desktop/LPanel.cpp
+++ b/lumina-desktop/LPanel.cpp
@@ -38,7 +38,8 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){
this->setAttribute(Qt::WA_X11DoNotAcceptFocus);
this->setAttribute(Qt::WA_X11NetWmWindowTypeDock);
this->setAttribute(Qt::WA_AlwaysShowToolTips);
- this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
+ this->setWindowFlags(Qt::FramelessWindowHint | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint);
+ //this->setWindowFlags(Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint);
this->setWindowTitle("LuminaPanel");
this->setObjectName("LuminaPanelBackgroundWidget");
@@ -51,11 +52,9 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){
panelArea->setLayout(layout);
//Set special window flags on the panel for proper usage
this->show();
- //this->setFocusPolicy(Qt::NoFocus);
+ LSession::handle()->XCB->SetAsPanel(this->winId());
LSession::handle()->XCB->SetAsSticky(this->winId());
- //LSession::handle()->XCB->SetAsPanel(this->winId());
- LX11::SetAsPanel(this->winId());
-
+
QTimer::singleShot(1,this, SLOT(UpdatePanel()) ); //start this in a new thread
connect(screen, SIGNAL(resized(int)), this, SLOT(UpdatePanel()) ); //in case the screen resolution changes
}
@@ -188,12 +187,8 @@ void LPanel::UpdatePanel(){
}
}
//With QT5, we need to make sure to reset window properties on occasion
+ //LSession::handle()->XCB->SetDisableWMActions(this->winId()); //ensure no WM actions
//LSession::handle()->XCB->SetAsSticky(this->winId());
- //LX11::SetAsPanel(this->winId());
- //First test/update all the window attributes as necessary
- //if(!this->testAttribute(Qt::WA_X11DoNotAcceptFocus)){ this->setAttribute(Qt::WA_X11DoNotAcceptFocus); }
- //if(!this->testAttribute(Qt::WA_X11NetWmWindowTypeDock)){ this->setAttribute(Qt::WA_X11NetWmWindowTypeDock); }
- //if(!this->testAttribute(Qt::WA_AlwaysShowToolTips)){ this->setAttribute(Qt::WA_AlwaysShowToolTips); }
//Now update the appearance of the toolbar
if(settings->value(PPREFIX+"customcolor", false).toBool()){
diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp
index aa1c1e0c..a0424667 100644
--- a/lumina-desktop/LSession.cpp
+++ b/lumina-desktop/LSession.cpp
@@ -320,6 +320,15 @@ void LSession::watcherChange(QString changed){
}
}
+void LSession::checkWindowGeoms(){
+ //Only do one window per run (this will be called once per new window - with time delays between)
+ if(checkWin.isEmpty()){ return; }
+ if(RunningApps.contains(checkWin[0]) ){ //just to make sure it did not close during the delay
+ adjustWindowGeom( checkWin[0] );
+ }
+ checkWin.removeAt(0);
+}
+
void LSession::checkUserFiles(){
//internal version conversion examples:
// [1.0.0 -> 1000000], [1.2.3 -> 1002003], [0.6.1 -> 6001]
@@ -450,11 +459,18 @@ void LSession::registerDesktopWindows(){
}
void LSession::adjustWindowGeom(WId win, bool maximize){
+ if(DEBUG){ qDebug() << "AdjustWindowGeometry():" << win << maximize; }
//Quick hack for making sure that new windows are not located underneath any panels
// Get the window location
- QRect geom = XCB->WindowGeometry(win, true); //always include the frame if possible
- if(DEBUG){ qDebug() << "Check Window Geometry:" << XCB->WindowClass(win) << !geom.isNull(); }
- if(geom.isNull()){ return; } //Could not get geometry
+ QRect geom = XCB->WindowGeometry(win, false);
+ //Get the frame size
+ QList<int> frame = XCB->WindowFrameGeometry(win); //[top,bottom,left,right] sizes of the frame
+ //Calculate the full geometry (window + frame)
+ QRect fgeom = QRect(geom.x()-frame[2], geom.y()-frame[0], geom.width()+frame[2]+frame[3], geom.height()+frame[0]+frame[1]);
+ if(DEBUG){
+ qDebug() << "Check Window Geometry:" << XCB->WindowClass(win) << !geom.isNull() << geom << fgeom;
+ }
+ if(geom.isNull()){ return; } //Could not get geometry for some reason
//Get the available geometry for the screen the window is on
QRect desk;
for(int i=0; i<DESKTOPS.length(); i++){
@@ -462,9 +478,11 @@ void LSession::adjustWindowGeom(WId win, bool maximize){
//Window is on this screen
if(DEBUG){ qDebug() << " - On Screen:" << DESKTOPS[i]->Screen(); }
desk = DESKTOPS[i]->availableScreenGeom();
+ if(DEBUG){ qDebug() << " - Screen Geom:" << desk; }
break;
}
}
+ if(desk.isNull()){ return; } //Unable to deteremine screen
//Adjust the window location if necessary
if(maximize){
if(DEBUG){ qDebug() << " - Maximizing New Window:" << desk.width() << desk.height(); }
@@ -472,28 +490,36 @@ void LSession::adjustWindowGeom(WId win, bool maximize){
XCB->MoveResizeWindow(win, geom);
XCB->MaximizeWindow(win, true); //directly set the appropriate "maximized" flags (bypassing WM)
- }else if(!desk.contains(geom) ){
- if(DEBUG){
- qDebug() << " - Desk:" << desk.x() << desk.y() << desk.width() << desk.height();
- qDebug() << " - Geom:" << geom.x() << geom.y() << geom.width() << geom.height();
- }
- QList<int> frame = XCB->WindowFrameGeometry(win);
- if(DEBUG){ qDebug() << " - Frame:" << frame; }
+ }else if(!desk.contains(fgeom) ){
//Adjust origin point for left/top margins
- if(geom.y() < desk.y()){ geom.moveTop(desk.y()); } //move down to the edge (top panel)
- if(geom.x() < desk.x()){ geom.moveLeft(desk.x()); } //move right to the edge (left panel)
+ if(fgeom.y() < desk.y()){ geom.moveTop(desk.y()+frame[0]); fgeom.moveTop(desk.y()); } //move down to the edge (top panel)
+ if(fgeom.x() < desk.x()){ geom.moveLeft(desk.x()+frame[2]); fgeom.moveLeft(desk.x()); } //move right to the edge (left panel)
//Adjust size for bottom margins (within reason, since window titles are on top normally)
// if(geom.right() > desk.right() && (geom.width() > 100)){ geom.setRight(desk.right()); }
- if(geom.bottom() > desk.bottom() && geom.height() > 10){
- //Also adjust the sizing for the frame (the moveResize fuction is for the base window only)
- geom.setBottom(desk.bottom()-frame[0]-frame[1]);
+ if(fgeom.bottom() > desk.bottom() && geom.height() > 10){
+ if(DEBUG){ qDebug() << "Adjust Y:" << fgeom << geom << desk; }
+ int diff = fgeom.bottom()-desk.bottom(); //amount of overlap
+ if(DEBUG){ qDebug() << "Y-Diff:" << diff; }
+ if(diff < 0){ diff = -diff; } //need a positive value
+ if( (fgeom.height()+ diff)< desk.height()){
+ //just move the window - there is room for it above
+ geom.setBottom(desk.bottom()-frame[1]);
+ fgeom.setBottom(desk.bottom());
+ }else if(geom.height() < diff){ //window bigger than the difference
+ //Need to resize the window - keeping the origin point the same
+ geom.setHeight( geom.height()-diff-1 ); //shrink it by the difference (need an extra pixel somewhere)
+ fgeom.setHeight( fgeom.height()-diff );
+ }
}
//Now move/resize the window
- if(DEBUG){ qDebug() << " - New Geom:" << geom.x() << geom.y() << geom.width() << geom.height(); }
- XCB->MoveResizeWindow(win, geom);
+ if(DEBUG){
+ qDebug() << " - New Geom:" << geom << fgeom;
+ }
+ //Note: Fluxbox treats this weird, the origin point needs to be the total (frame included),
+ // but the size needs to be the raw (no frame) value
+ XCB->MoveResizeWindow(win, QRect(fgeom.topLeft(), geom.size()) );
}
-
}
void LSession::SessionEnding(){
@@ -541,13 +567,7 @@ void LSession::systemWindow(){
void LSession::playAudioFile(QString filepath){
//Setup the audio output systems for the desktop
if(DEBUG){ qDebug() << "Play Audio File"; }
- //if(audioThread==0){ qDebug() << " - Initialize audio systems"; audioThread = new QThread(); init = true; }
if(mediaObj==0){ qDebug() << " - Initialize media player"; mediaObj = new QMediaPlayer(); }
- /*if(mediaObj && init){ //in case it errors for some reason
- qDebug() << " -- Move audio objects to separate thread";
- mediaObj->moveToThread(audioThread);
- audioThread->start();
- }*/
if(mediaObj !=0 ){
if(DEBUG){ qDebug() << " - starting playback:" << filepath; }
mediaObj->setVolume(100);
@@ -569,7 +589,10 @@ void LSession::WindowPropertyEvent(){
LSession::restoreOverrideCursor(); //restore the mouse cursor back to normal (new window opened?)
//Perform sanity checks on any new window geometries
for(int i=0; i<newapps.length() && !TrayStopping; i++){
- if(!RunningApps.contains(newapps[i])){ adjustWindowGeom(newapps[i]); }
+ if(!RunningApps.contains(newapps[i])){
+ checkWin << newapps[i];
+ QTimer::singleShot(500, this, SLOT(checkWindowGeoms()) );
+ }
}
}
RunningApps = newapps;
diff --git a/lumina-desktop/LSession.h b/lumina-desktop/LSession.h
index 867f4bd9..b7e6de63 100644
--- a/lumina-desktop/LSession.h
+++ b/lumina-desktop/LSession.h
@@ -111,6 +111,7 @@ private:
//Task Manager Variables
QList<WId> RunningApps;
+ QList<WId> checkWin;
QFileInfoList desktopFiles;
void CleanupSession();
@@ -125,6 +126,7 @@ public slots:
private slots:
void watcherChange(QString);
+ void checkWindowGeoms();
//System Tray Functions
void startSystemTray();
diff --git a/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h b/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h
index 3a14b26c..0e6cda2f 100644
--- a/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h
+++ b/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h
@@ -23,8 +23,10 @@ public:
this->layout()->setContentsMargins(0,0,0,0);
container = new QQuickWidget(this);
container->setResizeMode(QQuickWidget::SizeRootObjectToView);
+ connect(container, SIGNAL(statusChanged(QQuickWidget::Status)), this, SLOT(statusChange(QQuickWidget::Status)) );
this->layout()->addWidget(container);
container->setSource(QUrl::fromLocalFile( LUtils::findQuickPluginFile(ID.section("---",0,0)) ));
+ QApplication::processEvents(); //to check for errors right away
this->setInitialSize(container->initialSize().width(), container->initialSize().height());
}
@@ -37,6 +39,7 @@ private slots:
void statusChange(QQuickWidget::Status status){
if(status == QQuickWidget::Error){
qDebug() << "Quick Widget Error:" << this->ID();
+ container->setSource(QUrl()); //clear out the script - experienced an error
}
}
diff --git a/lumina-desktop/fluxboxconf/fluxbox-keys b/lumina-desktop/fluxboxconf/fluxbox-keys
index f0ec3519..97c53b2e 100644
--- a/lumina-desktop/fluxboxconf/fluxbox-keys
+++ b/lumina-desktop/fluxboxconf/fluxbox-keys
@@ -15,24 +15,20 @@ OnTitlebar Mouse2 :StartTabbing
OnTitlebar Double Mouse1 :Shade
OnTitlebar Mouse3 :WindowMenu
-!mouse actions added by fluxbox-update_configs
-OnWindow Mod1 Mouse1 :MacroCmd {Raise} {Focus} {StartMoving}
-OnWindow Mod1 Mouse3 :MacroCmd {Raise} {Focus} {StartResizing BottomRight}
-
# scroll on the toolbar to change current window
OnToolbar Mouse4 :PrevWindow {static groups} (workspace=[current]) (iconhidden=no) !! FBCV13 !!
OnToolbar Mouse5 :NextWindow {static groups} (workspace=[current]) (iconhidden=no) !! FBCV13 !!
# alt + left/right click to move/resize a window
-OnWindow Mod1 Mouse1 :MacroCmd {Raise} {Focus} {StartMoving}
-OnWindowBorder Move1 :StartMoving
+OnWindow Mod1 Mouse1 :If {Matches (Layer=Normal)} {MacroCmd {Raise} {Focus} {StartMoving}}
+OnWindow Mod1 Mouse3 :If {Matches (Layer=Normal)} {MacroCmd {Raise} {Focus} {StartResizing NearestCorner}}
-OnWindow Mod1 Mouse3 :MacroCmd {Raise} {Focus} {StartResizing NearestCorner}
+OnWindowBorder Move1 :StartMoving
OnLeftGrip Move1 :StartResizing bottomleft
OnRightGrip Move1 :StartResizing bottomright
# alt + middle click to lower the window
-OnWindow Mod1 Mouse2 :Lower
+OnWindow Mod1 Mouse2 :If {Matches (Layer=Normal)} {Lower}
# control-click a window's titlebar and drag to attach windows
OnTitlebar Control Mouse1 :StartTabbing
@@ -59,8 +55,8 @@ Mod4 Tab :NextTab
Mod4 Shift Tab :PrevTab
# Arrange/Tile Current windows
-Mod4 Left :ArrangeWindowsStackRight (Layer=Normal)
-Mod4 Right :ArrangeWindowsStackLeft (Layer=Normal)
+Mod1 Left :ArrangeWindowsStackRight (Layer=Normal)
+Mod1 Right :ArrangeWindowsStackLeft (Layer=Normal)
# go to a specific tab in the current window
Mod4 1 :Tab 1
@@ -80,23 +76,23 @@ Mod1 F1 :Exec xterm
Mod1 F2 :Exec lumina-search
# current window commands
-Mod1 F4 :Close
-Mod1 F5 :Kill
-Mod1 F9 :Minimize
-Mod1 F10 :Maximize
-Mod1 F11 :Fullscreen
+Mod1 F4 :If {Matches (Layer=Normal)} {Close}
+Mod1 F5 :If {Matches (Layer=Normal)} {Kill}
+Mod1 F9 :If {Matches (Layer=Normal)} {Minimize}
+Mod1 F10 :If {Matches (Layer=Normal)} {Maximize}
+Mod1 F11 :If {Matches (Layer=Normal)} {Fullscreen}
# change to previous/next workspace
Control Mod1 Left :PrevWorkspace
Control Mod1 Right :NextWorkspace
# send the current window to previous/next workspace
-Mod4 Left :SendToPrevWorkspace
-Mod4 Right :SendToNextWorkspace
+Mod4 Left :If {Matches (Layer=Normal)} {SendToPrevWorkspace}
+Mod4 Right :If {Matches (Layer=Normal)} {SendToNextWorkspace}
# send the current window and follow it to previous/next workspace
-Control Mod4 Left :TakeToPrevWorkspace
-Control Mod4 Right :TakeToNextWorkspace
+Control Mod4 Left :If {Matches (Layer=Normal)} {TakeToPrevWorkspace}
+Control Mod4 Right :If {Matches (Layer=Normal)} {TakeToNextWorkspace}
# change to a specific workspace
Control F1 :Workspace 1
@@ -127,19 +123,19 @@ Mod4 F11 :SendToWorkspace 11
Mod4 F12 :SendToWorkspace 12
# send the current window and change to a specific workspace
-Control Mod4 F1 :TakeToWorkspace 1
-Control Mod4 F2 :TakeToWorkspace 2
-Control Mod4 F3 :TakeToWorkspace 3
-Control Mod4 F4 :TakeToWorkspace 4
-Control Mod4 F5 :TakeToWorkspace 5
-Control Mod4 F6 :TakeToWorkspace 6
-Control Mod4 F7 :TakeToWorkspace 7
-Control Mod4 F8 :TakeToWorkspace 8
-Control Mod4 F9 :TakeToWorkspace 9
-Control Mod4 F10 :TakeToWorkspace 10
-Control Mod4 F11 :TakeToWorkspace 11
-Control Mod4 F12 :TakeToWorkspace 12
+Control Mod4 F1 :If {Matches (Layer=Normal)} {TakeToWorkspace 1}
+Control Mod4 F2 :If {Matches (Layer=Normal)} {TakeToWorkspace 2}
+Control Mod4 F3 :If {Matches (Layer=Normal)} {TakeToWorkspace 3}
+Control Mod4 F4 :If {Matches (Layer=Normal)} {TakeToWorkspace 4}
+Control Mod4 F5 :If {Matches (Layer=Normal)} {TakeToWorkspace 5}
+Control Mod4 F6 :If {Matches (Layer=Normal)} {TakeToWorkspace 6}
+Control Mod4 F7 :If {Matches (Layer=Normal)} {TakeToWorkspace 7}
+Control Mod4 F8 :If {Matches (Layer=Normal)} {TakeToWorkspace 8}
+Control Mod4 F9 :If {Matches (Layer=Normal)} {TakeToWorkspace 9}
+Control Mod4 F10 :If {Matches (Layer=Normal)} {TakeToWorkspace 10}
+Control Mod4 F11 :If {Matches (Layer=Normal)} {TakeToWorkspace 11}
+Control Mod4 F12 :If {Matches (Layer=Normal)} {TakeToWorkspace 12}
Print :Exec lumina-screenshot
-
+Pause :Exec xscreensaver-command -lock
diff --git a/lumina-desktop/lumina-desktop.pro b/lumina-desktop/lumina-desktop.pro
index 204a449b..dc20fd98 100644
--- a/lumina-desktop/lumina-desktop.pro
+++ b/lumina-desktop/lumina-desktop.pro
@@ -216,3 +216,7 @@ dotrans.path=$$PREFIX/share/Lumina-DE/i18n/
dotrans.extra=cd i18n && $${LRELEASE} -nounfinished *.ts && cp *.qm $(INSTALL_ROOT)$$PREFIX/share/Lumina-DE/i18n/
INSTALLS += target desktop icons wallpapers defaults conf fluxconf dotrans
+
+NO_I18N{
+ INSTALLS -= dotrans
+} \ No newline at end of file
bgstack15