diff options
Diffstat (limited to 'src-qt5/core')
-rw-r--r-- | src-qt5/core/libLumina/LuminaX11.cpp | 2 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeEventFilter.cpp | 9 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeEventFilter.h | 1 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeWindow.cpp | 10 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeWindow.h | 8 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeWindowSystem.cpp | 142 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeWindowSystem.h | 19 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootSubWindow.cpp | 60 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootSubWindow.h | 7 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootWindow.cpp | 4 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/LSession.cpp | 1 |
11 files changed, 221 insertions, 42 deletions
diff --git a/src-qt5/core/libLumina/LuminaX11.cpp b/src-qt5/core/libLumina/LuminaX11.cpp index b5dd62cd..86af1a00 100644 --- a/src-qt5/core/libLumina/LuminaX11.cpp +++ b/src-qt5/core/libLumina/LuminaX11.cpp @@ -497,7 +497,7 @@ QIcon LXCB::WindowIcon(WId win){ uint* dat = iter.data; //dat+=2; //remember the first 2 element offset for(int i=0; i<image.byteCount()/4; ++i, ++dat){ - ((uint*)image.bits())[i] = *dat; + ((uint*)image.bits())[i] = *dat; } icon.addPixmap(QPixmap::fromImage(image)); //layer this pixmap onto the icon //Now see if there are any more icons available diff --git a/src-qt5/core/libLumina/NativeEventFilter.cpp b/src-qt5/core/libLumina/NativeEventFilter.cpp index c289c450..c4873d6b 100644 --- a/src-qt5/core/libLumina/NativeEventFilter.cpp +++ b/src-qt5/core/libLumina/NativeEventFilter.cpp @@ -76,7 +76,10 @@ 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; obj->emit WindowPropertyChanged(ev->window, prop); + }else{ + //qDebug() << "Unknown Property Change:" << ev->window << ev->atom; } } @@ -175,7 +178,7 @@ bool EventFilter::nativeEventFilter(const QByteArray &eventType, void *message, //============================== case XCB_MAP_NOTIFY: qDebug() << "Window Map Event:" << ((xcb_map_notify_event_t *)ev)->window; - obj->emit WindowPropertyChanged( ((xcb_map_notify_event_t *)ev)->window, NativeWindow::Visible ); + obj->emit WindowPropertyChanged( ((xcb_map_notify_event_t *)ev)->window, NativeWindow::Visible, true); break; //This is just a notification that a window was mapped - nothing needs to change here case XCB_MAP_REQUEST: qDebug() << "Window Map Request Event"; @@ -188,7 +191,7 @@ bool EventFilter::nativeEventFilter(const QByteArray &eventType, void *message, //============================== case XCB_UNMAP_NOTIFY: qDebug() << "Window Unmap Event:" << ((xcb_unmap_notify_event_t *)ev)->window; - obj->emit WindowPropertyChanged( ((xcb_map_notify_event_t *)ev)->window, NativeWindow::Visible ); + obj->emit WindowPropertyChanged( ((xcb_map_notify_event_t *)ev)->window, NativeWindow::Visible, false); break; //============================== case XCB_DESTROY_NOTIFY: @@ -205,7 +208,7 @@ bool EventFilter::nativeEventFilter(const QByteArray &eventType, void *message, break; //============================== case XCB_PROPERTY_NOTIFY: - qDebug() << "Property Notify Event:"; + //qDebug() << "Property Notify Event:"; ParsePropertyEvent((xcb_property_notify_event_t*)ev, obj); break; //============================== diff --git a/src-qt5/core/libLumina/NativeEventFilter.h b/src-qt5/core/libLumina/NativeEventFilter.h index 2d5fbc61..2c6bfb6b 100644 --- a/src-qt5/core/libLumina/NativeEventFilter.h +++ b/src-qt5/core/libLumina/NativeEventFilter.h @@ -34,6 +34,7 @@ signals: void WindowCreated(WId); void WindowDestroyed(WId); void WindowPropertyChanged(WId, NativeWindow::Property); + void WindowPropertyChanged(WId, NativeWindow::Property, QVariant); //System Tray Signals void TrayWindowCreated(WId); diff --git a/src-qt5/core/libLumina/NativeWindow.cpp b/src-qt5/core/libLumina/NativeWindow.cpp index 1fcaa552..68610ce2 100644 --- a/src-qt5/core/libLumina/NativeWindow.cpp +++ b/src-qt5/core/libLumina/NativeWindow.cpp @@ -9,6 +9,7 @@ // === PUBLIC === NativeWindow::NativeWindow(WId id) : QObject(){ winid = id; + frameid = 0; WIN = QWindow::fromWinId(winid); } @@ -18,11 +19,11 @@ NativeWindow::~NativeWindow(){ } void NativeWindow::addFrameWinID(WId fid){ - relatedTo << fid; + frameid = fid; } bool NativeWindow::isRelatedTo(WId tmp){ - return (relatedTo.contains(tmp) || winid == tmp); + return (relatedTo.contains(tmp) || winid == tmp || frameid == tmp); } WId NativeWindow::id(){ @@ -65,6 +66,11 @@ void NativeWindow::requestProperties(QList<NativeWindow::Property> props, QList< for(int i=0; i<props.length(); i++){ if(i>=vals.length()){ props.removeAt(i); i--; continue; } //no corresponding value for this property if(props[i] == NativeWindow::None || props[i] == NativeWindow::RelatedWindows || hash.value(props[i])==vals[i] ){ props.removeAt(i); vals.removeAt(i); i--; continue; } //Invalid property or identical value + if( (props[i] == NativeWindow::Visible || props[i] == NativeWindow::Active) && frameid !=0){ + //These particular properties needs to change the frame - not the window itself + emit RequestPropertiesChange(frameid, QList<NativeWindow::Property>() << props[i], QList<QVariant>() << vals[i]); + props.removeAt(i); vals.removeAt(i); i--; + } } emit RequestPropertiesChange(winid, props, vals); } diff --git a/src-qt5/core/libLumina/NativeWindow.h b/src-qt5/core/libLumina/NativeWindow.h index e6e90825..a1cb7c1a 100644 --- a/src-qt5/core/libLumina/NativeWindow.h +++ b/src-qt5/core/libLumina/NativeWindow.h @@ -29,7 +29,7 @@ public: enum Action {A_MOVE, A_RESIZE, A_MINIMIZE, A_SHADE, A_STICK, A_MAX_VERT, A_MAX_HORZ, A_FULLSCREEN, A_CHANGE_DESKTOP, A_CLOSE, A_ABOVE, A_BELOW}; enum Property{ /*QVariant Type*/ - None, /*null*/ + None=0, /*null*/ MinSize, /*QSize*/ MaxSize, /*QSize*/ Size, /*QSize*/ @@ -79,7 +79,7 @@ public slots: private: QHash <NativeWindow::Property, QVariant> hash; QWindow *WIN; - WId winid; + WId winid, frameid; QList<WId> relatedTo; signals: @@ -92,9 +92,9 @@ signals: //Action Requests (not automatically emitted - typically used to ask the WM to do something) //Note: "WId" should be the NativeWindow id() void RequestClose(WId); //Close the window - void RequestKill(WId); //Kill the window/app (usually from being unresponsive) + void RequestKill(WId); //Kill the window/app (usually from being unresponsive) void RequestPing(WId); //Verify that the window is still active (such as not closing after a request - + void RequestReparent(WId, WId, QPoint); //client window, frame window, relative origin point in frame // System Tray Icon Embed/Unembed Requests //void RequestEmbed(WId, QWidget*); //void RequestUnEmbed(WId, QWidget*); diff --git a/src-qt5/core/libLumina/NativeWindowSystem.cpp b/src-qt5/core/libLumina/NativeWindowSystem.cpp index 13d6221c..a6bcd718 100644 --- a/src-qt5/core/libLumina/NativeWindowSystem.cpp +++ b/src-qt5/core/libLumina/NativeWindowSystem.cpp @@ -87,6 +87,16 @@ public: return (ATOMS.keys().length() == atoms.length()); } + WId getTransientFor(WId win){ + xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_transient_for_unchecked(QX11Info::connection(), win); + xcb_window_t trans; + if(1!= xcb_icccm_get_wm_transient_for_reply(QX11Info::connection(), cookie, &trans, NULL) ){ + return win; //error in fetching transient window ID (or none found) + }else{ + return trans; + } +} + bool register_wm(){ uint32_t value_list[1] = {ROOT_WIN_EVENT_MASK}; xcb_generic_error_t *status = xcb_request_check( QX11Info::connection(), xcb_change_window_attributes_checked(QX11Info::connection(), root_window, XCB_CW_EVENT_MASK, value_list)); @@ -253,6 +263,25 @@ NativeWindowSystem::MouseButton NativeWindowSystem::MouseToQt(int keycode){ } // === PRIVATE === +NativeWindow* NativeWindowSystem::findWindow(WId id){ + //qDebug() << "Find Window:" << id; + for(int i=0; i<NWindows.length(); i++){ + if(NWindows[i]->isRelatedTo(id)){ qDebug() << " -- Got Window Match!" << id; return NWindows[i]; } + } + //Check to see if this is a transient for some other window + WId tid = obj->getTransientFor(id); + if(tid!=id){ return findWindow(tid); } //call it recursively as needed + //qDebug() << " -- Could not find Window!"; + return 0; +} + +NativeWindow* NativeWindowSystem::findTrayWindow(WId id){ + for(int i=0; i<TWindows.length(); i++){ + if(TWindows[i]->isRelatedTo(id)){ return TWindows[i]; } + } + return 0; +} + void NativeWindowSystem::UpdateWindowProperties(NativeWindow* win, QList< NativeWindow::Property > props){ //Put the properties in logical groups as appropriate (some XCB calls return multiple properties) if(props.contains(NativeWindow::Title)){ @@ -285,7 +314,7 @@ void NativeWindowSystem::UpdateWindowProperties(NativeWindow* win, QList< Native xcb_icccm_get_text_property_reply_wipe(&reply); } } - win->setProperty(NativeWindow::Name, name); + win->setProperty(NativeWindow::Title, name); } //end TITLE property if(props.contains(NativeWindow::ShortTitle)){ @@ -415,8 +444,85 @@ void NativeWindowSystem::UpdateWindowProperties(NativeWindow* win, QList< Native }*/ win->setProperty(NativeWindow::Workspace, wkspace); } + + if(props.contains(NativeWindow::RelatedWindows)){ + WId orig = win->id(); + WId tid = obj->getTransientFor(orig); + QList<WId> list; + while(tid != orig){ + list << tid; + orig = tid; + tid = obj->getTransientFor(orig); + } + win->setProperty(NativeWindow::RelatedWindows, QVariant::fromValue(list)); + } + if(props.contains(NativeWindow::Visible)){ + xcb_get_window_attributes_reply_t *attr = xcb_get_window_attributes_reply(QX11Info::connection(), xcb_get_window_attributes(QX11Info::connection(), win->id()) , NULL); + if(attr != 0){ + win->setProperty(NativeWindow::Visible, attr->map_state == XCB_MAP_STATE_VIEWABLE); + free(attr); + } + } } +void NativeWindowSystem::ChangeWindowProperties(NativeWindow* win, QList< NativeWindow::Property > props, QList<QVariant> vals){ + qDebug() << "Change Window Properties:" << props << vals; + if(props.contains(NativeWindow::Title)){ + + } + if(props.contains(NativeWindow::ShortTitle)){ + + } + if(props.contains(NativeWindow::Icon)){ + + } + if(props.contains(NativeWindow::MinSize) || props.contains(NativeWindow::MaxSize) + || props.contains(NativeWindow::Size) || props.contains(NativeWindow::GlobalPos) ){ + + } + if(props.contains(NativeWindow::Name)){ + + } + if(props.contains(NativeWindow::Workspace)){ + int num = vals[ props.indexOf(NativeWindow::Workspace) ].toInt(); + xcb_ewmh_set_wm_desktop(&obj->EWMH, win->id(), (num<0 ? 0xFFFFFFFF : qAbs(num) ) ); + } + if(props.contains(NativeWindow::RelatedWindows)){ + + } + if(props.contains(NativeWindow::Visible)){ + qDebug() << "Check Window Visibility:" << vals[ props.indexOf(NativeWindow::Visible) ]; + if( vals[ props.indexOf(NativeWindow::Visible) ].toBool() ){ + qDebug() << " - Map it!"; + xcb_map_window(QX11Info::connection(), win->id()); + }else{ + qDebug() << " - Unmap it!"; + xcb_unmap_window(QX11Info::connection(), win->id()); + } + } + if(props.contains(NativeWindow::Active)){ + //Only one window can be "Active" at a time - so only do anything if this window wants to be active + if(vals[props.indexOf(NativeWindow::Active)].toBool() ){ + xcb_ewmh_set_active_window(&obj->EWMH, QX11Info::appScreen(), win->id()); + //Also send the active window a message to take input focus + //Send the window a WM_TAKE_FOCUS message + xcb_client_message_event_t event; + event.response_type = XCB_CLIENT_MESSAGE; + event.format = 32; + event.window = win->id(); + event.type = obj->ATOMS["WM_PROTOCOLS"]; + event.data.data32[0] = obj->ATOMS["WM_TAKE_FOCUS"]; + event.data.data32[1] = XCB_TIME_CURRENT_TIME; //CurrentTime; + event.data.data32[2] = 0; + event.data.data32[3] = 0; + event.data.data32[4] = 0; + + xcb_send_event(QX11Info::connection(), 0, win->id(), XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *) &event); + xcb_flush(QX11Info::connection()); + } + } + +} // === PUBLIC SLOTS === //These are the slots which are typically only used by the desktop system itself or the NativeEventFilter @@ -534,6 +640,8 @@ void NativeWindowSystem::NewWindowDetected(WId id){ if(attr == 0){ return; } //could not get attributes of window if(attr->override_redirect){ free(attr); return; } //window has override redirect set (do not manage) free(attr); + //Now go ahead and create/populate the container for this window + NativeWindow *win = new NativeWindow(id); //Register for events from this window #define NORMAL_WIN_EVENT_MASK (XCB_EVENT_MASK_BUTTON_PRESS | \ XCB_EVENT_MASK_BUTTON_RELEASE | \ @@ -543,14 +651,20 @@ void NativeWindowSystem::NewWindowDetected(WId id){ XCB_EVENT_MASK_STRUCTURE_NOTIFY | \ XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | \ XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | \ - XCB_EVENT_MASK_ENTER_WINDOW) + XCB_EVENT_MASK_ENTER_WINDOW| \ + XCB_EVENT_MASK_PROPERTY_CHANGE) uint32_t value_list[1] = {NORMAL_WIN_EVENT_MASK}; xcb_change_window_attributes(QX11Info::connection(), id, XCB_CW_EVENT_MASK, value_list); - //Now go ahead and create/populate the container for this window - NativeWindow *win = new NativeWindow(id); NWindows << win; UpdateWindowProperties(win, NativeWindow::allProperties()); + qDebug() << "New Window [associated ID's]:" << win->property(NativeWindow::RelatedWindows); + //Now setup the connections with this window + connect(win, SIGNAL(RequestClose(WId)), this, SLOT(RequestClose(WId)) ); + connect(win, SIGNAL(RequestKill(WId)), this, SLOT(RequestKill(WId)) ); + connect(win, SIGNAL(RequestPing(WId)), this, SLOT(RequestPing(WId)) ); + connect(win, SIGNAL(RequestReparent(WId, WId, QPoint)), this, SLOT(RequestReparent(WId, WId, QPoint)) ); + connect(win, SIGNAL(RequestPropertiesChange(WId, QList<NativeWindow::Property>, QList<QVariant>)), this, SLOT(RequestPropertiesChange(WId, QList<NativeWindow::Property>, QList<QVariant>)) ); emit NewWindowAvailable(win); } @@ -608,6 +722,14 @@ void NativeWindowSystem::WindowPropertyChanged(WId id, NativeWindow::Property pr } } +void NativeWindowSystem::WindowPropertyChanged(WId id, NativeWindow::Property prop, QVariant val){ + NativeWindow *win = findWindow(id); + if(win==0){ win = findTrayWindow(id); } + if(win!=0){ + win->setProperty(prop, val); + } +} + void NativeWindowSystem::GotPong(WId id){ if(waitingForPong.contains(id)){ waitingForPong.remove(id); @@ -655,9 +777,7 @@ void NativeWindowSystem::RequestPropertiesChange(WId win, QList<NativeWindow::Pr if(WIN==0){ istraywin = true; WIN = findTrayWindow(win); } if(WIN==0){ return; } //invalid window ID - no longer available //Now make any changes as needed - // TODO - qDebug() << "Request Properties Changed:" << props << vals; - qDebug() << " - Not implemented yet"; + ChangeWindowProperties(WIN, props, vals); } void NativeWindowSystem::RequestClose(WId win){ @@ -691,3 +811,11 @@ void NativeWindowSystem::RequestPing(WId win){ } pingTimer->start(); } + +void NativeWindowSystem::RequestReparent(WId client, WId parent, QPoint relorigin){ + xcb_reparent_window(QX11Info::connection(), client, parent, relorigin.x(), relorigin.y()); + //Now enable compositing between these two windows as well + // TODO + + xcb_map_window(QX11Info::connection(), parent); +} diff --git a/src-qt5/core/libLumina/NativeWindowSystem.h b/src-qt5/core/libLumina/NativeWindowSystem.h index 00841903..5b71249e 100644 --- a/src-qt5/core/libLumina/NativeWindowSystem.h +++ b/src-qt5/core/libLumina/NativeWindowSystem.h @@ -23,21 +23,9 @@ private: QList<NativeWindow*> TWindows; //Simplifications to find an already-created window object - NativeWindow* findWindow(WId id){ - qDebug() << "Find Window:" << id; - for(int i=0; i<NWindows.length(); i++){ - if(NWindows[i]->isRelatedTo(id)){ qDebug() << " -- Got Match!"; return NWindows[i]; } - } - qDebug() << " -- Could not find Window!"; - return 0; - } + NativeWindow* findWindow(WId id); - NativeWindow* findTrayWindow(WId id){ - for(int i=0; i<TWindows.length(); i++){ - if(TWindows[i]->isRelatedTo(id)){ return TWindows[i]; } - } - return 0; - } + NativeWindow* findTrayWindow(WId id); //Now define a simple private_objects class so that each implementation // has a storage container for defining/placing private objects as needed @@ -64,6 +52,7 @@ private: // Since some properties may be easier to update in bulk // let the native system interaction do them in whatever logical groups are best void UpdateWindowProperties(NativeWindow* win, QList< NativeWindow::Property > props); + void ChangeWindowProperties(NativeWindow* win, QList< NativeWindow::Property > props, QList<QVariant> vals); //Generic private variables bool screenLocked; @@ -116,6 +105,7 @@ public slots: void NewTrayWindowDetected(WId); //will automatically create the new NativeWindow object void WindowCloseDetected(WId); //will update the lists and make changes if needed void WindowPropertyChanged(WId, NativeWindow::Property); //will rescan the window and update the object as needed + void WindowPropertyChanged(WId, NativeWindow::Property, QVariant); //will save that property/value to the right object void GotPong(WId); void NewKeyPress(int keycode, WId win = 0); @@ -130,6 +120,7 @@ private slots: void RequestClose(WId); void RequestKill(WId); void RequestPing(WId); + void RequestReparent(WId, WId, QPoint); //client, parent, relative origin point in parent signals: void NewWindowAvailable(NativeWindow*); diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index fdb9ac76..04deacf9 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -8,7 +8,8 @@ #include <QDebug> #include <QApplication> #include <QVBoxLayout> -#include <QVBoxLayout> +#include <QHBoxLayout> +#include <QTimer> #define WIN_BORDER 5 @@ -19,12 +20,14 @@ 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); + //WinWidget = QWidget::createWindowContainer( WIN->window(), this); initWindowFrame(); - LoadProperties( NativeWindow::allProperties() ); //Hookup the signals/slots connect(WIN, SIGNAL(PropertiesChanged(QList<NativeWindow::Property>, QList<QVariant>)), this, SLOT(propertiesChanged(QList<NativeWindow::Property>, QList<QVariant>))); - WIN->addFrameWinID(this->winId()); + WIN->addFrameWinID(WinWidget->winId()); + WIN->emit RequestReparent(WIN->id(), WinWidget->winId(), QPoint(0,0)); + LoadAllProperties(); + //QTimer::singleShot(20, this, SLOT(LoadAllProperties()) ); } RootSubWindow::~RootSubWindow(){ @@ -126,7 +129,7 @@ void RootSubWindow::setMouseCursor(ModState state, bool override){ void RootSubWindow::initWindowFrame(){ //qDebug() << "Create RootSubWindow Frame"; mainLayout = new QVBoxLayout(this); - titleBar = new QHBoxLayout(this); + titleBar = new QHBoxLayout(); closeB = new QToolButton(this); maxB = new QToolButton(this); minB = new QToolButton(this); @@ -137,6 +140,7 @@ void RootSubWindow::initWindowFrame(){ otherB->setMenu(otherM); otherB->setPopupMode(QToolButton::InstantPopup); otherB->setAutoRaise(true); + WinWidget = new QWidget(this); connect(closeB, SIGNAL(clicked()), this, SLOT(triggerClose()) ); connect(maxB, SIGNAL(clicked()), this, SLOT(toggleMaximize()) ); connect(minB, SIGNAL(clicked()), this, SLOT(toggleMinimize()) ); @@ -169,9 +173,12 @@ void RootSubWindow::initWindowFrame(){ void RootSubWindow::LoadProperties( QList< NativeWindow::Property> list){ QList<QVariant> vals; for(int i=0; i<list.length(); i++){ + if(list[i] == NativeWindow::Visible){ list.removeAt(i); i--; continue; } vals << WIN->property(list[i]); + qDebug() << "Property:" << list[i] << vals[i]; } propertiesChanged(list, vals); + WIN->requestProperty(NativeWindow::Visible, true); } // === PUBLIC SLOTS === @@ -181,6 +188,13 @@ void RootSubWindow::clientClosed(){ this->close(); } +void RootSubWindow::LoadAllProperties(){ + QList< NativeWindow::Property> list = WIN->allProperties(); + /*list.removeAll(NativeWindow::Visible); + list << NativeWindow::Visible;*/ + LoadProperties(list); +} + //Button Actions - public so they can be tied to key shortcuts and stuff as well void RootSubWindow::toggleMinimize(){ @@ -227,21 +241,31 @@ void RootSubWindow::startResizing(){ // === PRIVATE SLOTS === 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() << "RootSubWindow: Property Changed:" << props[i] << vals[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]; switch(props[i]){ case NativeWindow::Visible: - if(vals[i].toBool()){ this->show(); } + qDebug() << "Got Visibility Change:" << vals[i]; + if(vals[i].toBool()){ WinWidget->setVisible(true); this->show(); } else{ this->hide(); } break; case NativeWindow::Title: titleLabel->setText(vals[i].toString()); break; case NativeWindow::Icon: + //qDebug() << "Got Icon Change:" << vals[i]; otherB->setIcon(vals[i].value< QIcon>()); break; + case NativeWindow::GlobalPos: + //qDebug() << "Got Global Pos:" << vals[i].toPoint(); + this->move( vals[i].toPoint() ); + break; case NativeWindow::Size: - WinWidget->resize(vals[i].toSize()); + //qDebug() << "Got Widget Size:" << vals[i].toSize(); + //WinWidget->setSizeHint( vals[i].toSize() ); + //WinWidget->resize(vals[i].toSize() ); + this->resize( vals[i].toSize()+QSize( this->width()-WinWidget->width(), this->height()-WinWidget->height() ) ); + //qDebug() << " - Size after change:" << WinWidget->size() << this->size(); break; case NativeWindow::MinSize: WinWidget->setMinimumSize(vals[i].toSize()); @@ -250,7 +274,7 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList WinWidget->setMaximumSize(vals[i].toSize()); break; case NativeWindow::Active: - if(vals[i].toBool()){ WinWidget->setFocus(); } + //if(vals[i].toBool()){ WinWidget->setFocus(); } break; /*case NativeWindow::WindowFlags: this->setWindowFlags( val.value< Qt::WindowFlags >() ); @@ -380,3 +404,19 @@ void RootSubWindow::leaveEvent(QEvent *ev){ setMouseCursor(Normal); } } + +/*void RootSubWindow::hideEvent(QHideEvent *ev){ + WIN->requestProperty(NativeWindow::Visible, false); + QFrame::hideEvent(ev); +}*/ + +void RootSubWindow::resizeEvent(QResizeEvent *ev){ + qDebug() << "Got Resize Event:" << ev->size(); + WIN->requestProperty(NativeWindow::Size, WinWidget->size()); + QFrame::resizeEvent(ev); +} +/*void RootSubWindow::showEvent(QShowEvent *ev){ + WIN->requestProperty(NativeWindow::Visible, true); + QFrame::showEvent(ev); +}*/ + diff --git a/src-qt5/core/libLumina/RootSubWindow.h b/src-qt5/core/libLumina/RootSubWindow.h index 779f783b..e1b992c9 100644 --- a/src-qt5/core/libLumina/RootSubWindow.h +++ b/src-qt5/core/libLumina/RootSubWindow.h @@ -53,6 +53,7 @@ private: public slots: void clientClosed(); + void LoadAllProperties(); //Button Actions - public so they can be tied to key shortcuts and stuff as well void toggleMinimize(); @@ -74,6 +75,12 @@ protected: void mouseReleaseEvent(QMouseEvent*); void leaveEvent(QEvent *ev); + //void hideEvent(QHideEvent *ev); + void resizeEvent(QResizeEvent *ev); + //void showEvent(QShowEvent *ev); + //void moveEvent(QMoveEvent *ev); + + }; #endif diff --git a/src-qt5/core/libLumina/RootWindow.cpp b/src-qt5/core/libLumina/RootWindow.cpp index 65fb6083..17a9ecd7 100644 --- a/src-qt5/core/libLumina/RootWindow.cpp +++ b/src-qt5/core/libLumina/RootWindow.cpp @@ -177,7 +177,9 @@ void RootWindow::NewWindow(NativeWindow *win){ connect(win, SIGNAL(WindowClosed(WId)), this, SLOT(CloseWindow(WId)) ); WINDOWS << subwin; } - subwin->show(); + //win->setProperty(NativeWindow::Visible, true); + //win->requestProperty( NativeWindow::Active, true); + win->requestProperties(QList<NativeWindow::Property>() << NativeWindow::Visible << NativeWindow::Active, QList<QVariant>() << true << true); } void RootWindow::CloseWindow(WId win){ diff --git a/src-qt5/core/lumina-desktop-unified/LSession.cpp b/src-qt5/core/lumina-desktop-unified/LSession.cpp index ab117df0..27c6dd8d 100644 --- a/src-qt5/core/lumina-desktop-unified/LSession.cpp +++ b/src-qt5/core/lumina-desktop-unified/LSession.cpp @@ -241,6 +241,7 @@ void LSession::setupGlobalConnections(){ connect(Lumina::NEF, SIGNAL(WindowCreated(WId)), Lumina::NWS, SLOT(NewWindowDetected(WId))); connect(Lumina::NEF, SIGNAL(WindowDestroyed(WId)), Lumina::NWS, SLOT(WindowCloseDetected(WId))); connect(Lumina::NEF, SIGNAL(WindowPropertyChanged(WId, NativeWindow::Property)), Lumina::NWS, SLOT(WindowPropertyChanged(WId, NativeWindow::Property))); + connect(Lumina::NEF, SIGNAL(WindowPropertyChanged(WId, NativeWindow::Property, QVariant)), Lumina::NWS, SLOT(WindowPropertyChanged(WId, NativeWindow::Property, QVariant))); connect(Lumina::NEF, SIGNAL(TrayWindowCreated(WId)), Lumina::NWS, SLOT(NewTrayWindowDetected(WId))); connect(Lumina::NEF, SIGNAL(TrayWindowDestroyed(WId)), Lumina::NWS, SLOT(WindowCloseDetected(WId))); connect(Lumina::NEF, SIGNAL(PossibleDamageEvent(WId)), Lumina::NWS, SLOT(CheckDamageID(WId))); |