aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2015-04-24 18:53:38 -0400
committerKen Moore <ken@pcbsd.org>2015-04-24 18:53:38 -0400
commit56a5408045a0d2327842bd5fa3c86a48cd6a375f (patch)
tree7b044888749f9b92ac504a58a17cfd4e29348ce7 /lumina-desktop
parentUpdate the Fluxbox startup command to use the new "-no-slit" and "-no-toolbar... (diff)
downloadlumina-56a5408045a0d2327842bd5fa3c86a48cd6a375f.tar.gz
lumina-56a5408045a0d2327842bd5fa3c86a48cd6a375f.tar.bz2
lumina-56a5408045a0d2327842bd5fa3c86a48cd6a375f.zip
Before activating the panel on mouse-over, save the ID of the currently active window and then re-activate that other window when the mouse leaves the panel.
Diffstat (limited to 'lumina-desktop')
-rw-r--r--lumina-desktop/LDesktop.cpp44
-rw-r--r--lumina-desktop/LDesktop.h8
-rw-r--r--lumina-desktop/LPanel.cpp21
-rw-r--r--lumina-desktop/LPanel.h6
-rw-r--r--lumina-desktop/LSession.cpp5
-rw-r--r--lumina-desktop/desktop-plugins/LDPlugin.h25
6 files changed, 94 insertions, 15 deletions
diff --git a/lumina-desktop/LDesktop.cpp b/lumina-desktop/LDesktop.cpp
index c2ef4a2a..21372bf1 100644
--- a/lumina-desktop/LDesktop.cpp
+++ b/lumina-desktop/LDesktop.cpp
@@ -1,6 +1,6 @@
//===========================================
// Lumina-DE source code
-// Copyright (c) 2012-2014, Ken Moore
+// Copyright (c) 2012-2015, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
@@ -60,6 +60,7 @@ void LDesktop::show(){
void LDesktop::prepareToClose(){
//Get any panels ready to close
+ issyncing = true; //Stop handling any watcher events
for(int i=0; i<PANELS.length(); i++){ PANELS[i]->prepareToClose(); delete PANELS.takeAt(i); i--; }
//Now close down any desktop plugins
desktoplocked = true; //make sure that plugin settings are preserved during removal
@@ -105,6 +106,40 @@ void LDesktop::SystemApplication(QAction* act){
}
}
+void LDesktop::checkResolution(){
+ //Compare the current screen resolution with the last one used/saved
+ //NOTE: This should only be performed after all the elements have been initialized/created.
+ int oldWidth = settings->value(DPREFIX+"screen/lastWidth",-1).toInt();
+ int oldHeight = settings->value(DPREFIX+"screen/lastHeight",-1).toInt();
+ QRect scrn = LSession::desktop()->screenGeometry(desktopnumber);
+ issyncing = true;
+ settings->setValue(DPREFIX+"screen/lastWidth",scrn.width());
+ settings->setValue(DPREFIX+"screen/lastHeight",scrn.height());
+
+ if(oldWidth<1 || oldHeight<1 || scrn.width()<1 || scrn.height()<1){
+ //nothing to do - something invalid
+ }else if(scrn.width()==oldWidth && scrn.height()==oldHeight){
+ //nothing to do - same as before
+ }else{
+ //Calculate the scale factor between the old/new sizes in each dimension
+ // and forward that on to all the interface elements
+ double xscale = scrn.width()/((double) oldWidth);
+ double yscale = scrn.height()/((double) oldHeight);
+ //Update any panels
+ for(int i=0; i<PANELS.length(); i++){
+ PANELS[i]->scalePanel(xscale, yscale);
+ }
+ //Update any desktop plugins
+ for(int i=0; i<PLUGINS.length(); i++){
+ PLUGINS[i]->scalePlugin(xscale, yscale);
+ }
+ //QTimer::singleShot(1,this, SLOT(UpdateDesktop()) );
+ //QTimer::singleShot(2,this, SLOT(UpdatePanels()) );
+ }
+ LSession::processEvents();
+ issyncing = false;
+}
+
void LDesktop::CreateDesktopPluginContainer(LDPlugin *plug){
//Verify that a container does not already exist for this plugin
QList<QMdiSubWindow*> wins = bgDesktop->subWindowList();
@@ -165,8 +200,11 @@ void LDesktop::InitDesktop(){
//Start the update processes
QTimer::singleShot(10,this, SLOT(UpdateMenu()) );
QTimer::singleShot(0,this, SLOT(UpdateBackground()) );
- QTimer::singleShot(1,this, SLOT(UpdateDesktop()) );
- QTimer::singleShot(2,this, SLOT(UpdatePanels()) );
+ //QTimer::singleShot(1,this, SLOT(UpdateDesktop()) );
+ //QTimer::singleShot(2,this, SLOT(UpdatePanels()) );
+ UpdatePanels();
+ UpdateDesktop();
+ //checkResolution();
}
void LDesktop::SettingsChanged(){
diff --git a/lumina-desktop/LDesktop.h b/lumina-desktop/LDesktop.h
index 456c61e9..ae8e5e83 100644
--- a/lumina-desktop/LDesktop.h
+++ b/lumina-desktop/LDesktop.h
@@ -1,6 +1,6 @@
//===========================================
// Lumina-DE source code
-// Copyright (c) 2012, Ken Moore
+// Copyright (c) 2012-2015, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
@@ -49,8 +49,10 @@ public slots:
void SystemLogout();
void SystemTerminal();
void SystemFileManager();
- void SystemApplication(QAction*);
-
+ void SystemApplication(QAction*);
+
+ void checkResolution();
+
private:
QSettings *settings;
QTimer *bgtimer;
diff --git a/lumina-desktop/LPanel.cpp b/lumina-desktop/LPanel.cpp
index d5be8670..e301ad29 100644
--- a/lumina-desktop/LPanel.cpp
+++ b/lumina-desktop/LPanel.cpp
@@ -1,6 +1,6 @@
//===========================================
// Lumina-DE source code
-// Copyright (c) 2012, Ken Moore
+// Copyright (c) 2012-2015, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
@@ -15,6 +15,7 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){
this->setMouseTracking(true);
if(DEBUG){ qDebug() << " - Creating Panel:" << scr << num; }
bgWindow = parent; //save for later
+ tmpID = 0;
//Setup the widget overlay for the entire panel to provide transparency effects
panelArea = new QWidget(this);
QBoxLayout *tmp = new QBoxLayout(QBoxLayout::LeftToRight);
@@ -27,8 +28,6 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){
screen = LSession::desktop();
PPREFIX = "panel"+QString::number(screennum)+"."+QString::number(num)+"/";
defaultpanel = (screen->screenGeometry(screennum).x()==0 && num==0);
- //if(settings->value("defaultpanel",QString::number(screen->primaryScreen())+".0").toString()==QString::number(screennum)+"."+QString::number(num) ){ defaultpanel=true;}
- //else{defaultpanel=false; }
horizontal=true; //use this by default initially
hidden = false; //use this by default
//Setup the panel
@@ -76,6 +75,19 @@ void LPanel::prepareToClose(){
}
}
+void LPanel::scalePanel(double xscale, double yscale){
+ int ht = settings->value(PPREFIX+"height", 30).toInt(); //this is technically the distance into the screen from the edge
+ QString loc = settings->value(PPREFIX+"location","").toString();
+ if(loc=="top" || loc=="bottom"){
+ ht = qRound(ht*yscale);
+ }else{
+ ht = qRound(ht*xscale);
+ }
+ settings->setValue(PPREFIX+"height", ht);
+ settings->sync();
+ QTimer::singleShot(0, this, SLOT(UpdatePanel()) );
+}
+
//===========
// PUBLIC SLOTS
//===========
@@ -284,6 +296,7 @@ void LPanel::enterEvent(QEvent *event){
//Move the panel out so it is fully available
this->move(showpoint);
}
+ tmpID = LSession::handle()->XCB->ActiveWindow();
this->activateWindow();
event->accept(); //just to quiet the compile warning
}
@@ -300,6 +313,8 @@ void LPanel::leaveEvent(QEvent *event){
//Move the panel back to it's "hiding" spot
this->move(hidepoint);
}
+ if(tmpID!=0){ LSession::handle()->XCB->ActivateWindow(tmpID); }
+ tmpID = 0;
event->accept(); //just to quiet the compile warning
}
diff --git a/lumina-desktop/LPanel.h b/lumina-desktop/LPanel.h
index ed1a8906..9b46eb45 100644
--- a/lumina-desktop/LPanel.h
+++ b/lumina-desktop/LPanel.h
@@ -1,6 +1,6 @@
//===========================================
// Lumina-DE source code
-// Copyright (c) 2012, Ken Moore
+// Copyright (c) 2012-2015, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
@@ -40,6 +40,7 @@ private:
int screennum;
int panelnum;
QList<LPPlugin*> PLUGINS;
+ WId tmpID; //temporary window ID
public:
LPanel(QSettings *file, int scr = 0, int num =0, QWidget *parent=0); //settings file, screen number, panel number
@@ -50,7 +51,8 @@ public:
}
void prepareToClose();
-
+ void scalePanel(double xscale, double yscale);
+
public slots:
void UpdatePanel(); //Load the settings file and update the panel appropriately
void UpdateLocale(); //Locale Changed externally
diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp
index 8b05b5ef..a09ab7bf 100644
--- a/lumina-desktop/LSession.cpp
+++ b/lumina-desktop/LSession.cpp
@@ -1,6 +1,6 @@
//===========================================
// Lumina-DE source code
-// Copyright (c) 2012-2014, Ken Moore
+// Copyright (c) 2012-2015, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
@@ -401,12 +401,13 @@ void LSession::updateDesktops(){
for(int i=0; i<DESKTOPS.length(); i++){
if(DESKTOPS[i]->Screen() >= DW->screenCount()){
qDebug() << " - Close desktop on screen:" << DESKTOPS[i]->Screen();
- DESKTOPS[i]->prepareToClose(); //hide();
+ DESKTOPS[i]->prepareToClose();
delete DESKTOPS.takeAt(i);
i--;
}else{
qDebug() << " - Show desktop on screen:" << DESKTOPS[i]->Screen();
DESKTOPS[i]->show();
+ //QTimer::singleShot(0,DESKTOPS[i], SLOT(checkResolution()));
}
}
WM->updateWM(); //Make sure fluxbox also gets prompted to re-load screen config
diff --git a/lumina-desktop/desktop-plugins/LDPlugin.h b/lumina-desktop/desktop-plugins/LDPlugin.h
index 9660a85c..38cfa433 100644
--- a/lumina-desktop/desktop-plugins/LDPlugin.h
+++ b/lumina-desktop/desktop-plugins/LDPlugin.h
@@ -8,7 +8,7 @@
// Simply subclass this when creating a new plugin to enable correct
// visibility and usage within the desktop window
//===========================================
-// WARNING: Do *not* setup a custom context menu for plugins!
+// WARNING: Do *not* setup a custom context menu for the entire plugins area!
// This can prevent access to the general desktop context menu if
// the plugin was maximized to fill the desktop area!
//===========================================
@@ -58,6 +58,27 @@ public:
settings->sync();
}
}
+
+ virtual void scalePlugin(double xscale, double yscale){
+ //This can be re-implemented in the subclassed plugin as necessary
+ // Example: If there are icons in the plugin which should also be re-scaled
+
+ int val = settings->value("location/width",0).toInt();
+ if(val>0){ val = qRound(val*xscale); }
+ settings->setValue("location/width",val);
+
+ val = settings->value("location/height",0).toInt();
+ if(val>0){ val = qRound(val*yscale); }
+ settings->setValue("location/height",val);
+
+ val = settings->value("location/x",0).toInt();
+ if(val>0){ val = qRound(val*xscale); }
+ settings->setValue("location/x",val);
+
+ val = settings->value("location/y",0).toInt();
+ if(val>0){ val = qRound(val*yscale); }
+ settings->setValue("location/y",val);
+ }
public slots:
virtual void LocaleChange(){
@@ -74,4 +95,4 @@ signals:
};
-#endif \ No newline at end of file
+#endif
bgstack15