diff options
-rw-r--r-- | libLumina/LuminaX11.cpp | 62 | ||||
-rw-r--r-- | libLumina/LuminaX11.h | 32 | ||||
-rw-r--r-- | lumina-fm/widgets/DDListWidgets.h | 2 | ||||
-rw-r--r-- | lumina-wm-INCOMPLETE/LWindow.cpp | 19 | ||||
-rw-r--r-- | lumina-wm-INCOMPLETE/LXcbEventFilter.cpp | 4 |
5 files changed, 95 insertions, 24 deletions
diff --git a/libLumina/LuminaX11.cpp b/libLumina/LuminaX11.cpp index b9068424..021e031d 100644 --- a/libLumina/LuminaX11.cpp +++ b/libLumina/LuminaX11.cpp @@ -1317,9 +1317,63 @@ void LXCB::WM_ICCCM_SetTransientFor(WId win, WId transient){ xcb_icccm_set_wm_transient_for(QX11Info::connection(), win, transient); } -// -- WM_SIZE_HINTS - -// -- WM_NORMAL_HINTS +// -- WM_SIZE_HINTS (older property?) +icccm_size_hints LXCB::WM_ICCCM_GetSizeHints(WId win){ + //most values in structure are -1 if not set + icccm_size_hints hints; + xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_size_hints_unchecked(QX11Info::connection(), win, XCB_ATOM_WM_SIZE_HINTS); + xcb_size_hints_t reply; + if(1==xcb_icccm_get_wm_size_hints_reply(QX11Info::connection(), cookie, &reply, NULL) ){ + //Now go though and move any data into the output struct + if( (reply.flags&XCB_ICCCM_SIZE_HINT_US_POSITION)==XCB_ICCCM_SIZE_HINT_US_POSITION ){ hints.x=reply.x; hints.y=reply.y; } + if( (reply.flags&XCB_ICCCM_SIZE_HINT_US_SIZE)==XCB_ICCCM_SIZE_HINT_US_SIZE ){ hints.width=reply.width; hints.height=reply.height; } + if( (reply.flags&XCB_ICCCM_SIZE_HINT_P_POSITION)==XCB_ICCCM_SIZE_HINT_P_POSITION ){ hints.x=reply.x; hints.y=reply.y; } + if( (reply.flags&XCB_ICCCM_SIZE_HINT_P_SIZE)==XCB_ICCCM_SIZE_HINT_P_SIZE ){ hints.width=reply.width; hints.height=reply.height; } + if( (reply.flags&XCB_ICCCM_SIZE_HINT_P_MIN_SIZE)==XCB_ICCCM_SIZE_HINT_P_MIN_SIZE ){ hints.min_width=reply.min_width; hints.min_height=reply.min_height; } + if( (reply.flags&XCB_ICCCM_SIZE_HINT_P_MAX_SIZE)==XCB_ICCCM_SIZE_HINT_P_MAX_SIZE ){ hints.max_width=reply.max_width; hints.max_height=reply.max_height; } + if( (reply.flags&XCB_ICCCM_SIZE_HINT_P_RESIZE_INC)==XCB_ICCCM_SIZE_HINT_P_RESIZE_INC ){ hints.width_inc=reply.width_inc; hints.height_inc=reply.height_inc; } + if( (reply.flags&XCB_ICCCM_SIZE_HINT_P_ASPECT)==XCB_ICCCM_SIZE_HINT_P_ASPECT ){ hints.min_aspect_num=reply.min_aspect_num; hints.min_aspect_den=reply.min_aspect_den; hints.max_aspect_num=reply.max_aspect_num; hints.max_aspect_den=reply.max_aspect_den;} + if( (reply.flags&XCB_ICCCM_SIZE_HINT_BASE_SIZE)==XCB_ICCCM_SIZE_HINT_BASE_SIZE ){ hints.base_width=reply.base_width; hints.base_height=reply.base_height; } + if( (reply.flags&XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY)==XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY ){ hints.win_gravity=reply.win_gravity; } + //free(reply); + } + return hints; +} + +//void WM_ICCCM_SetSizeHints(WId win, icccm_size_hints hints); + +// -- WM_NORMAL_HINTS (newer property? - check for this before falling back on WM_SIZE_HINTS) +icccm_size_hints LXCB::WM_ICCCM_GetNormalHints(WId win){ +//most values in structure are -1 if not set + //most values in structure are -1 if not set + icccm_size_hints hints; + xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_normal_hints_unchecked(QX11Info::connection(), win); + xcb_size_hints_t reply; + if(1==xcb_icccm_get_wm_normal_hints_reply(QX11Info::connection(), cookie, &reply, NULL) ){ + //Now go though and move any data into the output struct + if( (reply.flags&XCB_ICCCM_SIZE_HINT_US_POSITION)==XCB_ICCCM_SIZE_HINT_US_POSITION ){ hints.x=reply.x; hints.y=reply.y; } + if( (reply.flags&XCB_ICCCM_SIZE_HINT_US_SIZE)==XCB_ICCCM_SIZE_HINT_US_SIZE ){ hints.width=reply.width; hints.height=reply.height; } + if( (reply.flags&XCB_ICCCM_SIZE_HINT_P_POSITION)==XCB_ICCCM_SIZE_HINT_P_POSITION ){ hints.x=reply.x; hints.y=reply.y; } + if( (reply.flags&XCB_ICCCM_SIZE_HINT_P_SIZE)==XCB_ICCCM_SIZE_HINT_P_SIZE ){ hints.width=reply.width; hints.height=reply.height; } + if( (reply.flags&XCB_ICCCM_SIZE_HINT_P_MIN_SIZE)==XCB_ICCCM_SIZE_HINT_P_MIN_SIZE ){ hints.min_width=reply.min_width; hints.min_height=reply.min_height; } + if( (reply.flags&XCB_ICCCM_SIZE_HINT_P_MAX_SIZE)==XCB_ICCCM_SIZE_HINT_P_MAX_SIZE ){ hints.max_width=reply.max_width; hints.max_height=reply.max_height; } + if( (reply.flags&XCB_ICCCM_SIZE_HINT_P_RESIZE_INC)==XCB_ICCCM_SIZE_HINT_P_RESIZE_INC ){ hints.width_inc=reply.width_inc; hints.height_inc=reply.height_inc; } + if( (reply.flags&XCB_ICCCM_SIZE_HINT_P_ASPECT)==XCB_ICCCM_SIZE_HINT_P_ASPECT ){ hints.min_aspect_num=reply.min_aspect_num; hints.min_aspect_den=reply.min_aspect_den; hints.max_aspect_num=reply.max_aspect_num; hints.max_aspect_den=reply.max_aspect_den;} + if( (reply.flags&XCB_ICCCM_SIZE_HINT_BASE_SIZE)==XCB_ICCCM_SIZE_HINT_BASE_SIZE ){ hints.base_width=reply.base_width; hints.base_height=reply.base_height; } + if( (reply.flags&XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY)==XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY ){ hints.win_gravity=reply.win_gravity; } + //free(reply); + } + return hints; +} + +/*void LXCB::WM_ICCCM_SetNormalHints(WId win, icccm_size_hints hints){ + //Convert the data structure into the proper format + xcb_size_hints_t xhints; + if(hints.x>=0 || hints.y>=0){ xcb_icccm_size_hints_set_position(&xhints, 1, hints.x, hints.y); } + //if(hints.width>=0 + + xcb_icccm_set_wm_normal_hints(QX11Info::connection(), win, &xhints); +}*/ // -- WM_HINTS @@ -2110,4 +2164,4 @@ WId LXCB::WM_Get_CM_Owner(){ void LXCB::WM_Set_CM_Owner(WId win){ xcb_ewmh_set_wm_cm_owner(&EWMH, QX11Info::appScreen(), win, XCB_TIME_CURRENT_TIME,0,0); -}
\ No newline at end of file +} diff --git a/libLumina/LuminaX11.h b/libLumina/LuminaX11.h index c799f485..f702ddf1 100644 --- a/libLumina/LuminaX11.h +++ b/libLumina/LuminaX11.h @@ -47,21 +47,27 @@ public: ~strut_geom(){} }; -/*class icccm_hints{ +class icccm_size_hints{ public: int x, y, width, height, min_width, min_height, max_width, max_height; + //Note: The "x","y","width", and "height" values are considered depreciated in the ICCCM specs int width_inc, height_inc, min_aspect_num, min_aspect_den, max_aspect_num, max_aspect_den; int base_width, base_height; - unsigned int flags; //QFlags(LXCB::SIZE_HINT) combination unsigned int win_gravity; //LXCB::GRAVITY value - icccm_hints(){ - x=y=width=height=min_width=max_width=min_height=max_height = 0; - width_inc=height_inc=min_aspect_num=min_aspect_den=max_aspect_num=max_aspect_den = 0; - flags = win_gravity = 0; + icccm_size_hints(){ + x=y=width=height=min_width=max_width=min_height=max_height = -1; + width_inc=height_inc=min_aspect_num=min_aspect_den=max_aspect_num=max_aspect_den = -1; + win_gravity = 0; } - ~icccm_hinits(){} -};*/ + ~icccm_size_hints(){} + bool isValid(){ + //See if any of the values are different from the init values + return ( x>=0 || y>=0 || width>=0 || height>=0 || min_width>=0 || min_height>=0 || max_width>=0 || max_height>=0 \ + || width_inc>=0 || height_inc>=0 || min_aspect_num>=0 || min_aspect_den>=0 || max_aspect_num>=0 || max_aspect_den>=0 \ + || base_width>=0 || base_height>=0 || win_gravity>0 ); + } +}; //XCB Library replacement for LX11 (Qt5 uses XCB instead of XLib) class LXCB{ @@ -180,10 +186,12 @@ public: // -- WM_TRANSIENT_FOR WId WM_ICCCM_GetTransientFor(WId win); //Returns "win" for errors or no transient void WM_ICCCM_SetTransientFor(WId win, WId transient); - // -- WM_SIZE_HINTS - - // -- WM_NORMAL_HINTS - + // -- WM_SIZE_HINTS (older property?) + icccm_size_hints WM_ICCCM_GetSizeHints(WId win); //most values in structure are -1 if not set + //void WM_ICCCM_SetSizeHints(WId win, icccm_size_hints hints); + // -- WM_NORMAL_HINTS (newer property? - check for this before falling back on WM_SIZE_HINTS) + icccm_size_hints WM_ICCCM_GetNormalHints(WId win); //most values in structure are -1 if not set + //void WM_ICCCM_SetNormalHints(WId win, icccm_size_hints hints); // -- WM_HINTS (contains WM_STATE) // -- WM_PROTOCOLS diff --git a/lumina-fm/widgets/DDListWidgets.h b/lumina-fm/widgets/DDListWidgets.h index 2c51e8cc..e3de9b0e 100644 --- a/lumina-fm/widgets/DDListWidgets.h +++ b/lumina-fm/widgets/DDListWidgets.h @@ -85,7 +85,7 @@ protected: QString home = QDir::homePath(); if( this->whatsThis().startsWith(home) ){ ev->setDropAction(Qt::MoveAction); } else{ ev->setDropAction(Qt::CopyAction); } - ev->accept(); //allow this to be dropped here + ev->acceptProposedAction(); //allow this to be dropped here }else{ ev->ignore(); } diff --git a/lumina-wm-INCOMPLETE/LWindow.cpp b/lumina-wm-INCOMPLETE/LWindow.cpp index 2a89e2a4..ee7f7592 100644 --- a/lumina-wm-INCOMPLETE/LWindow.cpp +++ b/lumina-wm-INCOMPLETE/LWindow.cpp @@ -91,10 +91,19 @@ void LWindowFrame::InitWindow(){ VL->setContentsMargins(1,1,2,2); VL->setSpacing(0); //Have the window take the same initial size of the client window - QRect geom = LWM::SYSTEM->WM_Window_Geom(CID); - this->setGeometry( geom ); - qDebug() << "First Geom:" << geom; - if(geom.width() < 100 && geom.height() < 100){ this->resize(100,100); } + qDebug() << " - Load Size Hints"; + icccm_size_hints SH = LWM::SYSTEM->WM_ICCCM_GetNormalHints(CID); + qDebug() << " - - Got Normal Hints"; + if(!SH.isValid()){ SH = LWM::SYSTEM->WM_ICCCM_GetSizeHints(CID); } + qDebug() << " - - Start resizing..."; + if(SH.base_width>=0 && SH.base_height>=0){ this->resize(SH.base_width, SH.base_height); } + else if(SH.min_width>=0 && SH.min_height>=0){ this->resize(SH.min_width, SH.min_height); } + else if(SH.width>=0 && SH.height>=0){ this->resize(SH.width, SH.height); } + else{ + QRect geom = LWM::SYSTEM->WM_Window_Geom(CID); + this->setGeometry( geom ); + } + qDebug() << " - done"; //Now embed the native window into the frame WIN = QWindow::fromWinId(CID); @@ -462,4 +471,4 @@ void LWindowFrame::mouseReleaseEvent(QMouseEvent *ev){ activeState = Normal; QApplication::restoreOverrideCursor(); setMouseCursor( getStateAtPoint(ev->pos()) ); -}
\ No newline at end of file +} diff --git a/lumina-wm-INCOMPLETE/LXcbEventFilter.cpp b/lumina-wm-INCOMPLETE/LXcbEventFilter.cpp index 6d6cef55..abbe5a5a 100644 --- a/lumina-wm-INCOMPLETE/LXcbEventFilter.cpp +++ b/lumina-wm-INCOMPLETE/LXcbEventFilter.cpp @@ -183,7 +183,8 @@ bool XCBEventFilter::nativeEventFilter(const QByteArray &eventType, void *messag //============================== } } - return stopevent; + return false; + //never stop event handling (this will not impact the X events themselves - just the internal screensaver/WM/widgets) } bool XCBEventFilter::BlockInputEvent(WId win){ @@ -191,7 +192,6 @@ bool XCBEventFilter::BlockInputEvent(WId win){ // - Always let the screensaver know about the event first (need to reset timers and such) obj->emit NewInputEvent(); // - Check the state of the screensaver - if(obj->SSLocked){ qDebug() << "SS Locked"; return true; } // - Check the state of any fullscreen apps else if( win!=0 && !obj->FS_WINS.isEmpty()){ |