diff options
Diffstat (limited to 'src-qt5/core/libLumina')
-rw-r--r-- | src-qt5/core/libLumina/LuminaX11.cpp | 8 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeEventFilter.cpp | 14 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeEventFilter.h | 46 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeWindowSystem.cpp | 52 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeWindowSystem.h | 4 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootSubWindow.cpp | 4 |
6 files changed, 59 insertions, 69 deletions
diff --git a/src-qt5/core/libLumina/LuminaX11.cpp b/src-qt5/core/libLumina/LuminaX11.cpp index 86af1a00..dd98d12c 100644 --- a/src-qt5/core/libLumina/LuminaX11.cpp +++ b/src-qt5/core/libLumina/LuminaX11.cpp @@ -179,7 +179,7 @@ void LXCB::SetCurrentWorkspace(int number){ event.data.data32[4] = 0; xcb_send_event(QX11Info::connection(), 0, QX11Info::appRootWindow(), XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *) &event); - + //EWMH function (does not seem to be recognized by Fluxbox) xcb_ewmh_request_change_showing_desktop(&EWMH, QX11Info::appScreen(), number); } @@ -190,7 +190,7 @@ QString LXCB::WindowClass(WId win){ QString out; if(win==0){ return ""; } xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_class_unchecked(QX11Info::connection(), win); - if(cookie.sequence == 0){ return out; } + if(cookie.sequence == 0){ return out; } xcb_icccm_get_wm_class_reply_t value; if( 1== xcb_icccm_get_wm_class_reply( QX11Info::connection(), cookie, &value, NULL) ){ out = QString::fromUtf8(value.class_name); @@ -207,7 +207,7 @@ unsigned int LXCB::WindowWorkspace(WId win){ uint32_t wkspace = 0; xcb_get_property_cookie_t scookie = xcb_ewmh_get_wm_state_unchecked(&EWMH, win); xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_desktop_unchecked(&EWMH, win); - if(cookie.sequence == 0){ return wkspace; } + if(cookie.sequence == 0){ return wkspace; } xcb_ewmh_get_wm_desktop_reply(&EWMH, cookie, &wkspace, NULL); xcb_ewmh_get_atoms_reply_t reply; if(1==xcb_ewmh_get_wm_state_reply(&EWMH,scookie, &reply, NULL)){ @@ -217,7 +217,7 @@ unsigned int LXCB::WindowWorkspace(WId win){ } } //qDebug() << " - done: " << wkspace; - return wkspace; + return wkspace; } // === WindowGeometry() === diff --git a/src-qt5/core/libLumina/NativeEventFilter.cpp b/src-qt5/core/libLumina/NativeEventFilter.cpp index c4873d6b..28432222 100644 --- a/src-qt5/core/libLumina/NativeEventFilter.cpp +++ b/src-qt5/core/libLumina/NativeEventFilter.cpp @@ -227,12 +227,26 @@ bool EventFilter::nativeEventFilter(const QByteArray &eventType, void *message, //============================== case XCB_CONFIGURE_NOTIFY: //qDebug() << "Configure Notify Event"; + obj->emit WindowPropertiesChanged( ((xcb_configure_notify_event_t*)ev)->window, + QList<NativeWindow::Property>() << NativeWindow::GlobalPos << NativeWindow::Size, + QList<QVariant>() << QPoint(((xcb_configure_notify_event_t*)ev)->x, ((xcb_configure_notify_event_t*)ev)->y) << + QSize(((xcb_configure_notify_event_t*)ev)->width, ((xcb_configure_notify_event_t*)ev)->height) ); break; //============================== case XCB_CONFIGURE_REQUEST: //qDebug() << "Configure Request Event"; + obj->emit RequestWindowPropertiesChange( ((xcb_configure_request_event_t*)ev)->window, + QList<NativeWindow::Property>() << NativeWindow::GlobalPos << NativeWindow::Size, + QList<QVariant>() << QPoint(((xcb_configure_request_event_t*)ev)->x, ((xcb_configure_request_event_t*)ev)->y) << + QSize(((xcb_configure_request_event_t*)ev)->width, ((xcb_configure_request_event_t*)ev)->height) ); break; //============================== + case XCB_RESIZE_REQUEST: + //qDebug() << "Resize Request Event"; + obj->emit RequestWindowPropertyChange( ((xcb_resize_request_event_t*)ev)->window, + NativeWindow::Size, QSize(((xcb_resize_request_event_t*)ev)->width, ((xcb_resize_request_event_t*)ev)->height) ); + break; +//============================== case XCB_SELECTION_CLEAR: //qDebug() << "Selection Clear Event"; break; diff --git a/src-qt5/core/libLumina/NativeEventFilter.h b/src-qt5/core/libLumina/NativeEventFilter.h index 2c6bfb6b..2b184f99 100644 --- a/src-qt5/core/libLumina/NativeEventFilter.h +++ b/src-qt5/core/libLumina/NativeEventFilter.h @@ -35,6 +35,9 @@ signals: void WindowDestroyed(WId); void WindowPropertyChanged(WId, NativeWindow::Property); void WindowPropertyChanged(WId, NativeWindow::Property, QVariant); + void WindowPropertiesChanged(WId, QList<NativeWindow::Property>, QList<QVariant>); + void RequestWindowPropertyChange(WId, NativeWindow::Property, QVariant); + void RequestWindowPropertiesChange(WId, QList<NativeWindow::Property>, QList<QVariant>); //System Tray Signals void TrayWindowCreated(WId); @@ -60,51 +63,8 @@ public: virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *); - //System Tray Functions - //QList<WId> trayApps(); //return the list of all current tray apps - //bool startSystemTray(); - //bool stopSystemTray(); - - //Window List Functions - //QList<NativeWindow*> windowList(); - private: NativeEventFilter *obj; - /*QList<xcb_atom_t> WinNotifyAtoms, SysNotifyAtoms; - xcb_atom_t _NET_SYSTEM_TRAY_OPCODE; - void InitAtoms(); - - bool BlockInputEvent(WId win = 0); //Checks the current state of the system to see if the event should be stopped - WId InputWindow(WId win = 0); //Checks the window ID and determines if this is an external window or returns 0 (for desktop/root windows) - Lumina::MouseButton MouseKey(int keycode); //convert the keycode into the mouse button code - - //System Tray Variables - WId SystemTrayID; - int TrayDmgID; - QList<WId> RunningTrayApps; - //System Tray functions - void addTrayApp(WId); - bool rmTrayApp(WId); //returns "true" if the tray app was found and removed - void checkDamageID(WId); - - //Window List Variables - QList<NativeWindow*> windows; - QList<WId> waitingToShow; - - //Longer Event handling functions - void SetupNewWindow(xcb_map_request_event_t *ev); - - //bool ParseKeyPressEvent(); - //bool ParseKeyReleaseEvent(); - //bool ParseButtonPressEvent(); - //bool ParseButtonReleaseEvent(); - //bool ParseMotionEvent(); - void ParsePropertyEvent(xcb_property_notify_event_t *ev); - //bool ParseClientMessageEvent(); - //bool ParseDestroyEvent(); - //bool ParseConfigureEvent(); - //bool ParseKeySelectionClearEvent(); - */ }; #endif diff --git a/src-qt5/core/libLumina/NativeWindowSystem.cpp b/src-qt5/core/libLumina/NativeWindowSystem.cpp index a6bcd718..8d732d8c 100644 --- a/src-qt5/core/libLumina/NativeWindowSystem.cpp +++ b/src-qt5/core/libLumina/NativeWindowSystem.cpp @@ -644,21 +644,21 @@ void NativeWindowSystem::NewWindowDetected(WId id){ 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 | \ - XCB_EVENT_MASK_POINTER_MOTION | \ - XCB_EVENT_MASK_BUTTON_MOTION | \ - XCB_EVENT_MASK_EXPOSURE | \ - XCB_EVENT_MASK_STRUCTURE_NOTIFY | \ - XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | \ - XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | \ - XCB_EVENT_MASK_ENTER_WINDOW| \ - XCB_EVENT_MASK_PROPERTY_CHANGE) + XCB_EVENT_MASK_BUTTON_RELEASE | \ + XCB_EVENT_MASK_POINTER_MOTION | \ + XCB_EVENT_MASK_BUTTON_MOTION | \ + XCB_EVENT_MASK_EXPOSURE | \ + XCB_EVENT_MASK_STRUCTURE_NOTIFY | \ + XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | \ + XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | \ + 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); NWindows << win; UpdateWindowProperties(win, NativeWindow::allProperties()); - qDebug() << "New Window [associated ID's]:" << win->property(NativeWindow::RelatedWindows); + qDebug() << "New Window [& associated ID's]:" << win->id() << 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)) ); @@ -730,6 +730,29 @@ void NativeWindowSystem::WindowPropertyChanged(WId id, NativeWindow::Property pr } } +void NativeWindowSystem::WindowPropertiesChanged(WId id, QList<NativeWindow::Property> props, QList<QVariant> vals){ + NativeWindow *win = findWindow(id); + if(win==0){ win = findTrayWindow(id); } + if(win!=0){ + for(int i=0; i<props.length() && i<vals.length(); i++){ win->setProperty(props[i], vals[i]); } + } +} + +void NativeWindowSystem::RequestPropertyChange(WId id, NativeWindow::Property prop, QVariant val){ + //This is just a simplified version of the multiple-property function + RequestPropertiesChange(id, QList<NativeWindow::Property>() << prop, QList<QVariant>() << val); +} + +void NativeWindowSystem::RequestPropertiesChange(WId win, QList<NativeWindow::Property> props, QList<QVariant> vals){ + //Find the window object associated with this id + bool istraywin = false; //just in case we care later if it is a tray window or a regular window + NativeWindow *WIN = findWindow(win); + if(WIN==0){ istraywin = true; WIN = findTrayWindow(win); } + if(WIN==0){ return; } //invalid window ID - no longer available + //Now make any changes as needed + ChangeWindowProperties(WIN, props, vals); +} + void NativeWindowSystem::GotPong(WId id){ if(waitingForPong.contains(id)){ waitingForPong.remove(id); @@ -770,15 +793,6 @@ void NativeWindowSystem::CheckDamageID(WId win){ // === PRIVATE SLOTS === //These are the slots which are built-in and automatically connected when a new NativeWindow is created -void NativeWindowSystem::RequestPropertiesChange(WId win, QList<NativeWindow::Property> props, QList<QVariant> vals){ - //Find the window object associated with this id - bool istraywin = false; //just in case we care later if it is a tray window or a regular window - NativeWindow *WIN = findWindow(win); - if(WIN==0){ istraywin = true; WIN = findTrayWindow(win); } - if(WIN==0){ return; } //invalid window ID - no longer available - //Now make any changes as needed - ChangeWindowProperties(WIN, props, vals); -} void NativeWindowSystem::RequestClose(WId win){ //Send the window a WM_DELETE_WINDOW message diff --git a/src-qt5/core/libLumina/NativeWindowSystem.h b/src-qt5/core/libLumina/NativeWindowSystem.h index 5b71249e..7786c87d 100644 --- a/src-qt5/core/libLumina/NativeWindowSystem.h +++ b/src-qt5/core/libLumina/NativeWindowSystem.h @@ -106,6 +106,9 @@ public slots: 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 WindowPropertiesChanged(WId, QList<NativeWindow::Property>, QList<QVariant>); + void RequestPropertyChange(WId, NativeWindow::Property, QVariant); + void RequestPropertiesChange(WId, QList<NativeWindow::Property>, QList<QVariant>); void GotPong(WId); void NewKeyPress(int keycode, WId win = 0); @@ -116,7 +119,6 @@ public slots: private slots: //These are the slots which are built-in and automatically connected when a new NativeWindow is created - void RequestPropertiesChange(WId, QList<NativeWindow::Property>, QList<QVariant>); void RequestClose(WId); void RequestKill(WId); void RequestPing(WId); diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index f45258a3..66cfbc6a 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -261,11 +261,11 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList this->move( vals[i].toPoint() ); break; case NativeWindow::Size: - //qDebug() << "Got Widget Size:" << 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(); + qDebug() << " - Size after change:" << WinWidget->size() << this->size(); break; case NativeWindow::MinSize: WinWidget->setMinimumSize(vals[i].toSize()); |