aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/libLumina/RootSubWindow.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-03-03 14:25:29 -0500
committerKen Moore <ken@ixsystems.com>2017-03-03 14:25:29 -0500
commite51eb7f9b51dc29be83a00abf2ebf95cc17d0ba7 (patch)
tree65276d138bec55ca4a37e5788269aaf027eb0a9f /src-qt5/core/libLumina/RootSubWindow.cpp
parentUpdate the .gitignore file a bit. (diff)
downloadlumina-e51eb7f9b51dc29be83a00abf2ebf95cc17d0ba7.tar.gz
lumina-e51eb7f9b51dc29be83a00abf2ebf95cc17d0ba7.tar.bz2
lumina-e51eb7f9b51dc29be83a00abf2ebf95cc17d0ba7.zip
Another large batch of updates to the Native Window "plumbing":
1) Handle all property changes in bulk groups for efficiency 2) Add simplification functions for changing single properties. 3) Automatically prune redundant property settings from signals 4) Add another property or two, and simplify the number of "extra" signals/functions for non-property changes/requests. 5) Starting cleaning up the new NativeWindowSystem class to use the new plumbing, and get it ready for the XCB "guts" to be copied in.
Diffstat (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp')
-rw-r--r--src-qt5/core/libLumina/RootSubWindow.cpp43
1 files changed, 22 insertions, 21 deletions
diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp
index 7ec25a71..ba682077 100644
--- a/src-qt5/core/libLumina/RootSubWindow.cpp
+++ b/src-qt5/core/libLumina/RootSubWindow.cpp
@@ -21,12 +21,9 @@ RootSubWindow::RootSubWindow(QWidget *root, NativeWindow *win) : QFrame(root){
closing = false;
WinWidget = QWidget::createWindowContainer( WIN->window(), this);
initWindowFrame();
- LoadProperties( QList< NativeWindow::Property>() << NativeWindow::Title << NativeWindow::Icon \
- << NativeWindow::MinSize << NativeWindow::MaxSize << NativeWindow::Size );
+ LoadProperties( NativeWindow::allProperties() );
//Hookup the signals/slots
- connect(WIN, SIGNAL(PropertyChanged(NativeWindow::Property, QVariant)), this, SLOT(propertyChanged(NativeWindow::Property, QVariant)));
- //Make sure the visibily property only gets loaded after it is added to the root area
- propertyChanged(NativeWindow::Visible, WIN->property(NativeWindow::Visible));
+ connect(WIN, SIGNAL(PropertiesChanged(QList<NativeWindow::Property>, QList<QVariant>)), this, SLOT(PropertiesChanged(QList<NativeWindow::Property>, QList<QVariant>)));
}
RootSubWindow::~RootSubWindow(){
@@ -167,9 +164,11 @@ void RootSubWindow::initWindowFrame(){
}
void RootSubWindow::LoadProperties( QList< NativeWindow::Property> list){
+ QList<QVariant> vals;
for(int i=0; i<list.length(); i++){
- propertyChanged( list[i], WIN->property(list[i]) );
+ vals << WIN->property(list[i]);
}
+ propertiesChanged(list, vals);
}
// === PUBLIC SLOTS ===
@@ -189,7 +188,7 @@ void RootSubWindow::toggleMaximize(){
}
void RootSubWindow::triggerClose(){
- WIN->emit RequestClose(WIN->id());
+ WIN->requestClose();
}
void RootSubWindow::toggleSticky(){
@@ -197,7 +196,7 @@ void RootSubWindow::toggleSticky(){
}
void RootSubWindow::activate(){
- WIN->emit RequestActivate(WIN->id());
+ WIN->requestProperty(NativeWindow::Active, true);
}
//Mouse Interactivity
@@ -223,37 +222,39 @@ void RootSubWindow::startResizing(){
// === PRIVATE SLOTS ===
-void RootSubWindow::propertyChanged(NativeWindow::Property prop, QVariant val){
- if(val.isNull()){ return; } //not the same as a default/empty value - the property has just not been set yet
- qDebug() << "Set Window Property:" << prop << val;
- switch(prop){
+void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList<QVariant> vals){
+ for(int i=0; i<props.length() && i<vals.length(); i++){
+ if(vals[i].isNull()){ return; } //not the same as a default/empty value - the property has just not been set yet
+ //qDebug() << "Set Window Property:" << props[i] << vals[i];
+ switch(props[i]){
case NativeWindow::Visible:
- if(val.toBool()){ this->show(); }
+ if(vals[i].toBool()){ this->show(); }
else{ this->hide(); }
break;
case NativeWindow::Title:
- titleLabel->setText(val.toString());
+ titleLabel->setText(vals[i].toString());
break;
case NativeWindow::Icon:
- otherB->setIcon(val.value< QIcon>());
+ otherB->setIcon(vals[i].value< QIcon>());
break;
case NativeWindow::Size:
- WinWidget->resize(val.toSize());
+ WinWidget->resize(vals[i].toSize());
break;
case NativeWindow::MinSize:
- WinWidget->setMinimumSize(val.toSize());
+ WinWidget->setMinimumSize(vals[i].toSize());
break;
case NativeWindow::MaxSize:
- WinWidget->setMaximumSize(val.toSize());
+ WinWidget->setMaximumSize(vals[i].toSize());
break;
case NativeWindow::Active:
- WinWidget->setFocus();
+ if(vals[i].toBool()){ WinWidget->setFocus(); }
break;
/*case NativeWindow::WindowFlags:
this->setWindowFlags( val.value< Qt::WindowFlags >() );
break;*/
default:
- qDebug() << "Window Property Unused:" << prop << val;
+ qDebug() << "Window Property Unused:" << props[i] << vals[i];
+ }
}
}
@@ -358,7 +359,7 @@ void RootSubWindow::mouseMoveEvent(QMouseEvent *ev){
void RootSubWindow::mouseReleaseEvent(QMouseEvent *ev){
//Check for a right-click event
- qDebug() << "Frame Mouse Release Event";
+ //qDebug() << "Frame Mouse Release Event";
ev->accept();
if( (activeState==Normal) && (titleBar->geometry().contains(ev->pos())) && (ev->button()==Qt::RightButton) ){
otherM->popup(ev->globalPos());
bgstack15