diff options
-rw-r--r-- | src-qt5/core/libLumina/NativeEmbedWidget.cpp | 3 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeEmbedWidget.h | 3 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeEventFilter.cpp | 55 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeWindow.h | 7 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeWindowSystem.cpp | 43 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootSubWindow.cpp | 126 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootSubWindow.h | 5 |
7 files changed, 118 insertions, 124 deletions
diff --git a/src-qt5/core/libLumina/NativeEmbedWidget.cpp b/src-qt5/core/libLumina/NativeEmbedWidget.cpp index 194652f0..2f3691ae 100644 --- a/src-qt5/core/libLumina/NativeEmbedWidget.cpp +++ b/src-qt5/core/libLumina/NativeEmbedWidget.cpp @@ -40,7 +40,7 @@ inline void registerClientEvents(WId id){ //Simplification functions for the XCB/XLib interactions void NativeEmbedWidget::syncWinSize(QSize sz){ if(WIN==0){ return; } - qDebug() << "Sync Window Size:" << sz; + //qDebug() << "Sync Window Size:" << sz; xcb_configure_window_value_list_t valList; valList.x = 0; valList.y = 0; @@ -53,6 +53,7 @@ void NativeEmbedWidget::syncWinSize(QSize sz){ } void NativeEmbedWidget::syncWidgetSize(QSize sz){ + //qDebug() << "Sync Widget Size:" << sz; this->resize(sz); } diff --git a/src-qt5/core/libLumina/NativeEmbedWidget.h b/src-qt5/core/libLumina/NativeEmbedWidget.h index 6919249b..55d655f2 100644 --- a/src-qt5/core/libLumina/NativeEmbedWidget.h +++ b/src-qt5/core/libLumina/NativeEmbedWidget.h @@ -37,6 +37,9 @@ public: bool detachWindow(); bool isEmbedded(); //status of the embed +public slots: + void resyncWindow(){ syncWinSize(this->size()); } + protected: void resizeEvent(QResizeEvent *ev); void showEvent(QShowEvent *ev); diff --git a/src-qt5/core/libLumina/NativeEventFilter.cpp b/src-qt5/core/libLumina/NativeEventFilter.cpp index b85965ef..d6c2da50 100644 --- a/src-qt5/core/libLumina/NativeEventFilter.cpp +++ b/src-qt5/core/libLumina/NativeEventFilter.cpp @@ -76,7 +76,7 @@ inline void ParsePropertyEvent(xcb_property_notify_event_t *ev, NativeEventFilte else if( ev->atom == EWMH._NET_WM_STATE){ prop = NativeWindow::States; } //Send out the signal if necessary if(prop!=NativeWindow::None){ - qDebug() << "Detected Property Change:" << ev->window << prop; + if(DEBUG){ qDebug() << "Detected Property Change:" << ev->window << prop; } obj->emit WindowPropertyChanged(ev->window, prop); }else{ //qDebug() << "Unknown Property Change:" << ev->window << ev->atom; @@ -157,7 +157,7 @@ bool EventFilter::nativeEventFilter(const QByteArray &eventType, void *message, break; case XCB_MOTION_NOTIFY: //This is a mouse movement event - qDebug() << "Motion Notify Event"; + if(DEBUG){ qDebug() << "Motion Notify Event"; } obj->emit MouseMovement(); break; case XCB_ENTER_NOTIFY: @@ -270,54 +270,3 @@ bool EventFilter::nativeEventFilter(const QByteArray &eventType, void *message, return false; //never stop event handling (this will not impact the X events themselves - just the internal Qt application) } - - -//========= -// PRIVATE -//========= - - -// WINDOW HANDLING FUNCTIONS -/*void EventFilter::SetupNewWindow(xcb_map_request_event_t *ev){ - WId win = ev->window; - - bool ok = obj->XCB->WM_ManageWindow(win, true); - //Quick check if this is a transient window if we could not manage it directly - if(!ok){ - WId tran = obj->XCB->WM_ICCCM_GetTransientFor(win); - if(tran!=win && tran!=0){ - win = tran; - ok = obj->XCB->WM_ManageWindow(win); - } - } - qDebug() << "New Window:" << win << obj->XCB->WM_ICCCM_GetClass(win) << " Managed:" << ok; - obj->XCB->WM_Set_Active_Window(win); - //Determing the requested geometry/location/management within the event, - NativeWindow *nwin = new NativeWindow(win); - QObject::connect(nwin, SIGNAL(RequestClose(WId)), obj, SLOT(TryCloseWindow(WId)) ); - QObject::connect(nwin, SIGNAL(RequestActivate(WId)), obj, SLOT(TryActivateWindow(WId)) ); - windows << nwin; - bool show_now = !Lumina::SS->isLocked(); - if(!show_now){ waitingToShow << win; } //add to the list to get set visible later - //populate the native window settings as they are right now - nwin->setProperty(NativeWindow::Active, true); - nwin->setProperty(NativeWindow::Visible, show_now); - nwin->setProperty(NativeWindow::Workspace, obj->XCB->CurrentWorkspace()); - icccm_size_hints hints = obj->XCB->WM_ICCCM_GetNormalHints(win); - if(!hints.isValid()){ hints = obj->XCB->WM_ICCCM_GetSizeHints(win); } - if(hints.validMinSize()){ nwin->setProperty(NativeWindow::MinSize, QSize(hints.min_width,hints.min_height)); } - if(hints.validMaxSize()){ nwin->setProperty(NativeWindow::MaxSize, QSize(hints.max_width,hints.max_height)); } - if(hints.validBaseSize()){ nwin->setProperty(NativeWindow::Size, QSize(hints.base_width,hints.base_height)); } - else if(hints.validSize()){ nwin->setProperty(NativeWindow::Size, QSize(hints.width, hints.height)); } - nwin->setProperty(NativeWindow::Icon, obj->XCB->WM_Get_Icon(win)); - QString title = obj->XCB->WM_Get_Name(win); - if(title.isEmpty()){ title = obj->XCB->WM_Get_Visible_Name(win); } - if(title.isEmpty()){ title = obj->XCB->WM_ICCCM_GetName(win); } - nwin->setProperty(NativeWindow::Title, title); - title = obj->XCB->WM_Get_Icon_Name(win); - if(title.isEmpty()){ title = obj->XCB->WM_Get_Visible_Icon_Name(win); } - if(title.isEmpty()){ title = obj->XCB->WM_ICCCM_GetIconName(win); } - nwin->setProperty(NativeWindow::ShortTitle, title); - - obj->emit WindowCreated(nwin); -}*/ diff --git a/src-qt5/core/libLumina/NativeWindow.h b/src-qt5/core/libLumina/NativeWindow.h index 5fa194c9..47359b7d 100644 --- a/src-qt5/core/libLumina/NativeWindow.h +++ b/src-qt5/core/libLumina/NativeWindow.h @@ -107,4 +107,11 @@ signals: //void RequestEmbed(WId, QWidget*); //void RequestUnEmbed(WId, QWidget*); }; + +// Declare the enumerations as Qt MetaTypes +Q_DECLARE_METATYPE(NativeWindow::Type); +Q_DECLARE_METATYPE(NativeWindow::Action); +Q_DECLARE_METATYPE(NativeWindow::State); +Q_DECLARE_METATYPE(NativeWindow::Property); + #endif diff --git a/src-qt5/core/libLumina/NativeWindowSystem.cpp b/src-qt5/core/libLumina/NativeWindowSystem.cpp index bf827a1b..e0f3fe91 100644 --- a/src-qt5/core/libLumina/NativeWindowSystem.cpp +++ b/src-qt5/core/libLumina/NativeWindowSystem.cpp @@ -260,8 +260,8 @@ NativeWindow* NativeWindowSystem::findWindow(WId id, bool checkRelated){ } //Check to see if this is a transient for some other window if(checkRelated){ - WId tid = obj->getTransientFor(id); - if(tid!=id){ return findWindow(tid, checkRelated); } //call it recursively as needed + //WId tid = obj->getTransientFor(id); + //if(tid!=id){ return findWindow(tid, checkRelated); } //call it recursively as needed //qDebug() << " -- Could not find Window!"; } return 0; @@ -438,7 +438,7 @@ void NativeWindowSystem::UpdateWindowProperties(NativeWindow* win, QList< Native } if(props.contains(NativeWindow::FrameExtents)){ //Just assign default values to this - need to automate it later - win->setProperty(NativeWindow::FrameExtents, QVariant::fromValue<QList<int> >(QList<int>() << 5 << 5 << 5+QFontMetrics(QFont()).height() << 5) ); + //win->setProperty(NativeWindow::FrameExtents, QVariant::fromValue<QList<int> >(QList<int>() << 5 << 5 << 5+QFontMetrics(QFont()).height() << 5) ); } if(props.contains(NativeWindow::RelatedWindows)){ WId orig = win->id(); @@ -458,6 +458,11 @@ void NativeWindowSystem::UpdateWindowProperties(NativeWindow* win, QList< Native free(attr); } } + if(props.contains(NativeWindow::WinTypes)){ + QList< NativeWindow::Type> types; + types << NativeWindow::T_NORMAL; //make this load appropriately later + win->setProperty(NativeWindow::WinTypes, QVariant::fromValue< QList<NativeWindow::Type> >(types) ); + } } void NativeWindowSystem::ChangeWindowProperties(NativeWindow* win, QList< NativeWindow::Property > props, QList<QVariant> vals){ @@ -472,29 +477,27 @@ void NativeWindowSystem::ChangeWindowProperties(NativeWindow* win, QList< Native if(props.contains(NativeWindow::Icon)){ } - if(props.contains(NativeWindow::Size) ){//|| props.contains(NativeWindow::GlobalPos) ){ + if(props.contains(NativeWindow::Size) || props.contains(NativeWindow::GlobalPos) ){ xcb_configure_window_value_list_t valList; - valList.x = 0; + valList.x = 0; //Note that this is the relative position - should always be 0,0 relative to the embed widget valList.y = 0; - uint16_t mask = 0; - //if(props.contains(NativeWindow::Size)){ - QSize sz = vals[ props.indexOf(NativeWindow::Size) ] .toSize(); - valList.width = sz.width(); - valList.height = sz.height(); - mask = mask | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; - /*}else{ - valList.width = win->property(NativeWindow::Size).toSize().width(); - valList.height = win->property(NativeWindow::Size).toSize().height(); - }*/ + QSize sz = win->property(NativeWindow::Size).toSize(); + if(props.contains(NativeWindow::Size)){ + sz = vals[ props.indexOf(NativeWindow::Size) ] .toSize(); + } + valList.width = sz.width(); + valList.height = sz.height(); /*if(props.contains(NativeWindow::GlobalPos)){ QPoint pt = vals[ props.indexOf(NativeWindow::GlobalPos) ] .toPoint(); valList.x = pt.x(); - valList.y = pt.y();*/ - mask = mask | XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y; - /*}else{ + valList.y = pt.y(); + }else{ valList.x = win->property(NativeWindow::GlobalPos).toPoint().x(); valList.y = win->property(NativeWindow::GlobalPos).toPoint().y(); }*/ + uint16_t mask = 0; + mask = mask | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT | XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y; + qDebug() << "Configure window Geometry:" << sz; xcb_configure_window_aux(QX11Info::connection(), win->id(), mask, &valList); } if(props.contains(NativeWindow::Name)){ @@ -725,7 +728,7 @@ void NativeWindowSystem::WindowCloseDetected(WId id){ void NativeWindowSystem::WindowPropertyChanged(WId id, NativeWindow::Property prop){ //NOTE: This is triggered by the NativeEventFilter - not by changes to the NativeWindow objects themselves - NativeWindow *win = findWindow(id); + NativeWindow *win = findWindow(id, prop!=NativeWindow::Visible); if(win==0){ win = findTrayWindow(id); } if(win!=0){ UpdateWindowProperties(win, QList<NativeWindow::Property>() << prop); @@ -733,7 +736,7 @@ void NativeWindowSystem::WindowPropertyChanged(WId id, NativeWindow::Property pr } void NativeWindowSystem::WindowPropertyChanged(WId id, NativeWindow::Property prop, QVariant val){ - NativeWindow *win = findWindow(id); + NativeWindow *win = findWindow(id,prop!=NativeWindow::Visible); if(win==0){ win = findTrayWindow(id); } if(win!=0){ win->setProperty(prop, val); diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 11bfde29..8c7c9b1a 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -22,14 +22,12 @@ RootSubWindow::RootSubWindow(QWidget *root, NativeWindow *win) : QFrame(root){ //Create the QWindow and QWidget containers for the window WIN = win; closing = false; - //WinWidget = QWidget::createWindowContainer( WIN->window(), this); initWindowFrame(); //Hookup the signals/slots connect(WIN, SIGNAL(PropertiesChanged(QList<NativeWindow::Property>, QList<QVariant>)), this, SLOT(propertiesChanged(QList<NativeWindow::Property>, QList<QVariant>))); WinWidget->embedWindow(WIN); qDebug() << "[NEW WINDOW]" << WIN->id() << WinWidget->winId() << this->winId(); LoadAllProperties(); - //this->show(); } RootSubWindow::~RootSubWindow(){ @@ -48,10 +46,10 @@ RootSubWindow::ModState RootSubWindow::getStateAtPoint(QPoint pt, bool setoffset //above the frame itself - need to figure out which quadrant it is in (8-directions) if(pt.y() < WIN_BORDER){ //One of the top options - if(pt.x() < WIN_BORDER){ + if(pt.x() < this->width()/5){ if(setoffset){ offset.setX(pt.x()); offset.setY(pt.y()); } //difference from top-left corner return ResizeTopLeft; - }else if(pt.x() > (this->width()-WIN_BORDER)){ + }else if(pt.x() > (this->width()*4.0/5.0)){ if(setoffset){ offset.setX(this->width()-pt.x()); offset.setY(pt.y()); } //difference from top-right corner return ResizeTopRight; }else{ @@ -60,10 +58,10 @@ RootSubWindow::ModState RootSubWindow::getStateAtPoint(QPoint pt, bool setoffset } }else if(pt.y() > (this->height()-WIN_BORDER) ){ //One of the bottom options - if(pt.x() < WIN_BORDER){ + if(pt.x() < this->width()/5){ if(setoffset){ offset.setX(pt.x()); offset.setY(this->height()-pt.y()); } //difference from bottom-left corner return ResizeBottomLeft; - }else if(pt.x() > (this->width()-WIN_BORDER)){ + }else if(pt.x() > (this->width()*4.0/5.0)){ if(setoffset){ offset.setX(this->width()-pt.x()); offset.setY(this->height()-pt.y()); } //difference from bottom-right corner return ResizeBottomRight; }else{ @@ -131,8 +129,13 @@ void RootSubWindow::setMouseCursor(ModState state, bool override){ void RootSubWindow::initWindowFrame(){ //qDebug() << "Create RootSubWindow Frame"; + this->setContentsMargins(0,0,0,0); mainLayout = new QVBoxLayout(this); - titleBar = new QHBoxLayout(); + mainLayout->setContentsMargins(0,0,0,0); + titleBar = new QWidget(this); + titleBar->setContentsMargins(0,0,0,0); + titleBarL = new QHBoxLayout(titleBar); + titleBarL->setContentsMargins(0,0,0,0); closeB = new QToolButton(this); maxB = new QToolButton(this); minB = new QToolButton(this); @@ -152,13 +155,14 @@ void RootSubWindow::initWindowFrame(){ connect(maxB, SIGNAL(clicked()), this, SLOT(toggleMaximize()) ); connect(minB, SIGNAL(clicked()), this, SLOT(toggleMinimize()) ); //Now assemble the frame layout based on the current settings - titleBar->addWidget(otherB); - titleBar->addWidget(titleLabel); - titleBar->addWidget(minB); - titleBar->addWidget(maxB); - titleBar->addWidget(closeB); + titleBarL->addWidget(otherB); + titleBarL->addWidget(titleLabel); + titleBarL->addWidget(minB); + titleBarL->addWidget(maxB); + titleBarL->addWidget(closeB); WinWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - mainLayout->addLayout(titleBar); + titleBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + mainLayout->addWidget(titleBar); mainLayout->addWidget(WinWidget); //Now all the stylesheet options this->setObjectName("WindowFrame"); @@ -167,15 +171,20 @@ void RootSubWindow::initWindowFrame(){ maxB->setObjectName("Button_Maximize"); otherM->setObjectName("Menu_Actions"); titleLabel->setObjectName("Label_Title"); - this->setStyleSheet("QWidget#WindowFrame{background-color: rgba(0,0,0,125);} QWidget#Label_Title{background-color: transparent; color: white; } QToolButton{background-color: transparent; border: 1px solid transparent; border-radius: 3px; } QToolButton::hover{background-color: rgba(255,255,255,150); } QToolButton::pressed{ background-color: white; } QToolButton::menu-arrow{ image: none; }"); + this->setStyleSheet("QFrame#WindowFrame{background-color: rgba(0,0,0,125)} QWidget#Label_Title{background-color: transparent; color: white; } QToolButton{background-color: transparent; border: 1px solid transparent; border-radius: 3px; } QToolButton::hover{background-color: rgba(255,255,255,150); } QToolButton::pressed{ background-color: white; } QToolButton::menu-arrow{ image: none; }"); //And adjust the margins - mainLayout->setContentsMargins(WIN_BORDER,WIN_BORDER,WIN_BORDER,WIN_BORDER); //default border mainLayout->setSpacing(0); - titleBar->setSpacing(1); - titleBar->setContentsMargins(0,0,0,0); + titleBarL->setSpacing(1); + this->setFrameStyle(QFrame::NoFrame); + this->setLineWidth(0); + this->setMidLineWidth(0); this->setFrameRect(QRect(0,0,0,0)); - this->setFrameShape(QFrame::NoFrame); - this->setContentsMargins(0,0,0,0); + + //Setup the timer object to syncronize info + moveTimer = new QTimer(this); + moveTimer->setSingleShot(true); + moveTimer->setInterval(100); //1/10 second + connect(moveTimer, SIGNAL(timeout()), WinWidget, SLOT(resyncWindow()) ); //Now load the icons for the button LIconCache::instance()->loadIcon(closeB, "window-close"); @@ -184,26 +193,34 @@ void RootSubWindow::initWindowFrame(){ LIconCache::instance()->loadIcon(otherB, "list"); } +void RootSubWindow::enableFrame(bool on){ + //Make the individual frame elements visible as needed + if(on){ this->setContentsMargins(WIN_BORDER,WIN_BORDER,WIN_BORDER,WIN_BORDER); }//default border + else{ this->setContentsMargins(0, 0, 0, 0); } + titleBar->setVisible(on); + //And now calculate/save the frame extents + QList<int> extents; extents << 0 << 0 << 0 << 0; //left, right, top, bottom + if(on){ + extents[0] = WIN_BORDER; + extents[1] = WIN_BORDER; + extents[2] = WIN_BORDER + titleBar->height(); + extents[3] = WIN_BORDER; + } + qDebug() << "SET FRAME EXTENTS:" << extents; + WIN->requestProperty(NativeWindow::FrameExtents, QVariant::fromValue< QList<int> >(extents) ); //save on raw window itself + WIN->setProperty(NativeWindow::FrameExtents, QVariant::fromValue< QList<int> >(extents) ); //save to structure now +} + void RootSubWindow::LoadProperties( QList< NativeWindow::Property> list){ QList<QVariant> vals; + //Always ensure that visibility changes are evaluated last + bool addvisible = false; for(int i=0; i<list.length(); i++){ - if(list[i] == NativeWindow::Visible){ list.removeAt(i); i--; continue; } + if(list[i] == NativeWindow::Visible){ list.removeAt(i); i--; addvisible = true; continue; } vals << WIN->property(list[i]); - /*if(list[i] == NativeWindow::FrameExtents){ - qDebug() << "Check Frame Extents:" << vals[i]; - if(vals[i].isNull()){ - qDebug() << " - supply default frame extents"; - QList<int> frame; frame << WinWidget->geometry().x() << this->width()-WinWidget->geometry().x()-WinWidget->geometry().width() << WinWidget->y() << this->height() - WinWidget->y() - WinWidget->geometry().height(); - vals[i] = QVariant::fromValue< QList<int> >(frame); //use this by default - WIN->requestProperty(NativeWindow::FrameExtents, QVariant::fromValue< QList<int> >(frame)); //make sure these values get saved permanently - WIN->setProperty(NativeWindow::FrameExtents, QVariant::fromValue< QList<int> >(frame)); - qDebug() << " - Default values:" << frame; - } - }*/ - //qDebug() << "Property:" << list[i] << vals[i]; } + //if(addvisible){ list << NativeWindow::Visible; vals << WIN->property(NativeWindow::Visible); } propertiesChanged(list, vals); - WIN->requestProperty(NativeWindow::Visible, true); } // === PUBLIC SLOTS === @@ -220,9 +237,12 @@ void RootSubWindow::clientClosed(){ } void RootSubWindow::LoadAllProperties(){ - QList< NativeWindow::Property> list = WIN->allProperties(); - list << NativeWindow::FrameExtents; + QList< NativeWindow::Property> list; + list << NativeWindow::WinTypes << NativeWindow::WinActions << NativeWindow::States + << NativeWindow::MinSize << NativeWindow::MaxSize << NativeWindow::Title << NativeWindow::ShortTitle + << NativeWindow::Icon << NativeWindow::Size << NativeWindow::GlobalPos << NativeWindow::Visible << NativeWindow::Active; LoadProperties(list); + WIN->requestProperty(NativeWindow::Visible, true); } //Button Actions - public so they can be tied to key shortcuts and stuff as well @@ -271,10 +291,10 @@ void RootSubWindow::startResizing(){ 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()){ continue; } //not the same as a default/empty value - the property has just not been set yet - qDebug() << "RootSubWindow: Property Changed:" << props[i] << vals[i]; + //qDebug() << "RootSubWindow: Property Changed:" << props[i] << vals[i]; switch(props[i]){ case NativeWindow::Visible: - qDebug() << "Got Visibility Change:" << vals[i] << this->geometry() << WIN->geometry(); + //qDebug() << "Got Visibility Change:" << vals[i] << this->geometry() << WIN->geometry(); if(vals[i].toBool()){ animResetProp = WIN->geometry(); //this->geometry(); anim->setPropertyName("geometry"); @@ -312,9 +332,12 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList vals << vals.takeAt(i); i--; }else if(anim->state() != QPropertyAnimation::Running){ - qDebug() << "Got Widget Size Change:" << vals[i].toSize() << WinWidget->size(); - this->resize( WIN->geometry().size() ); - qDebug() << " - Size after change:" << WinWidget->size() << this->size() << WIN->geometry(); + if(vals[i].toSize() != WinWidget->size()){ + qDebug() << "Got Widget Size Change:" << vals[i].toSize() << WinWidget->size(); + WinWidget->resize(vals[i].toSize()); + this->resize( WIN->geometry().size() ); + qDebug() << " - Size after change:" << WinWidget->size() << this->size() << WIN->geometry(); + } } break; case NativeWindow::MinSize: @@ -326,7 +349,7 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList case NativeWindow::Active: //if(vals[i].toBool()){ WinWidget->setFocus(); } break; - case NativeWindow::FrameExtents: + /*case NativeWindow::FrameExtents: qDebug() << " - FRAME CHANGE"; if(vals[i].isNull()){ vals[i] = QVariant::fromValue<QList<int> >( QList<int>() << WinWidget->geometry().x() << this->width()-WinWidget->geometry().x()-WinWidget->geometry().width() << WinWidget->y() << this->height() - WinWidget->y() - WinWidget->geometry().height() ); @@ -334,10 +357,10 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList } qDebug() << "Setting Frame Extents:" << vals[i].value<QList<int> >(); mainLayout->setContentsMargins( vals[i].value< QList<int> >().at(0),vals[i].value< QList<int> >().at(2) - titleLabel->height(),vals[i].value< QList<int> >().at(1),vals[i].value< QList<int> >().at(3)); - break; - /*case NativeWindow::WindowFlags: - this->setWindowFlags( val.value< Qt::WindowFlags >() ); break;*/ + case NativeWindow::WinTypes: + enableFrame(vals[i].value< QList<NativeWindow::Type> >().contains(NativeWindow::T_NORMAL) ); + break; default: qDebug() << "Window Property Unused:" << props[i] << vals[i]; } @@ -473,7 +496,7 @@ void RootSubWindow::mouseReleaseEvent(QMouseEvent *ev){ activeState = Normal; QApplication::restoreOverrideCursor(); setMouseCursor( getStateAtPoint(ev->pos()) ); - if(QWidget::mouseGrabber() == this){ this->releaseMouse(); } + if(QFrame::mouseGrabber() == this){ this->releaseMouse(); } } void RootSubWindow::leaveEvent(QEvent *ev){ @@ -490,9 +513,9 @@ void RootSubWindow::leaveEvent(QEvent *ev){ void RootSubWindow::resizeEvent(QResizeEvent *ev){ //qDebug() << "Got Resize Event:" << ev->size(); - if(WinWidget->size() != WIN->property(NativeWindow::Size).toSize() && anim->state()!=QAbstractAnimation::Running){ + /*if(WinWidget->size() != WIN->property(NativeWindow::Size).toSize() && anim->state()!=QAbstractAnimation::Running){ WIN->requestProperty(NativeWindow::Size, WinWidget->size()); - } + }*/ QFrame::resizeEvent(ev); } @@ -502,7 +525,12 @@ void RootSubWindow::resizeEvent(QResizeEvent *ev){ }*/ void RootSubWindow::moveEvent(QMoveEvent *ev){ - //qDebug() << "Got Move Event:" << ev->pos() << WinWidget->mapToGlobal(QPoint(0,0)); - if(!closing && anim->state()!=QAbstractAnimation::Running){ WIN->setProperty(NativeWindow::GlobalPos, WinWidget->mapToGlobal(QPoint(0,0)) ); } + qDebug() << "Got Move Event:" << ev->pos() << WinWidget->geometry(); QFrame::moveEvent(ev); + if(!closing && anim->state()!=QAbstractAnimation::Running){ + moveTimer->start(); + //WinWidget->resyncWindow(); + //WIN->requestProperty(NativeWindow::GlobalPos, ev->pos() ); + } + } diff --git a/src-qt5/core/libLumina/RootSubWindow.h b/src-qt5/core/libLumina/RootSubWindow.h index cef6f2ff..804dcc9d 100644 --- a/src-qt5/core/libLumina/RootSubWindow.h +++ b/src-qt5/core/libLumina/RootSubWindow.h @@ -44,14 +44,17 @@ private: NativeEmbedWidget *WinWidget; bool closing; //Title bar objects - QBoxLayout *titleBar, *mainLayout; + QBoxLayout *titleBarL, *mainLayout; QToolButton *closeB, *maxB, *minB, *otherB; QLabel *titleLabel; QMenu *otherM; //menu of other actions + QWidget *titleBar; //Other random objects (animations,etc) QPropertyAnimation *anim; QVariant animResetProp; + QTimer *moveTimer; void initWindowFrame(); + void enableFrame(bool); void LoadProperties( QList< NativeWindow::Property> list); |