diff options
author | Ken Moore <ken@ixsystems.com> | 2017-03-06 23:09:50 -0800 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-03-06 23:09:50 -0800 |
commit | 73b81d6b113bc79b2670476ad4d6e8fd176bfd7f (patch) | |
tree | c734dee405d64c3c24ef84dc52cb5542def75123 | |
parent | Add a bunch more of the XCB guts to the NativeWindowSystem (Title, ShortTitle... (diff) | |
download | lumina-73b81d6b113bc79b2670476ad4d6e8fd176bfd7f.tar.gz lumina-73b81d6b113bc79b2670476ad4d6e8fd176bfd7f.tar.bz2 lumina-73b81d6b113bc79b2670476ad4d6e8fd176bfd7f.zip |
Add support for reading window geometry information to the NativeWindowSystem (GlobalPos, Size, MinSize, MaxSize)
-rw-r--r-- | src-qt5/core/libLumina/LuminaX11.cpp | 1 | ||||
-rw-r--r-- | src-qt5/core/libLumina/NativeWindowSystem.cpp | 27 |
2 files changed, 26 insertions, 2 deletions
diff --git a/src-qt5/core/libLumina/LuminaX11.cpp b/src-qt5/core/libLumina/LuminaX11.cpp index 7c4d1b45..ab6cd880 100644 --- a/src-qt5/core/libLumina/LuminaX11.cpp +++ b/src-qt5/core/libLumina/LuminaX11.cpp @@ -1391,7 +1391,6 @@ icccm_size_hints LXCB::WM_ICCCM_GetSizeHints(WId win){ // -- 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); diff --git a/src-qt5/core/libLumina/NativeWindowSystem.cpp b/src-qt5/core/libLumina/NativeWindowSystem.cpp index eea0933d..d7c95fb8 100644 --- a/src-qt5/core/libLumina/NativeWindowSystem.cpp +++ b/src-qt5/core/libLumina/NativeWindowSystem.cpp @@ -349,7 +349,32 @@ void NativeWindowSystem::UpdateWindowProperties(NativeWindow* win, QList< Native win->setProperty(NativeWindow::Icon, icon); } //end ICON property - + if(props.contains(NativeWindow::MinSize) || props.contains(NativeWindow::MaxSize) + || props.contains(NativeWindow::Size) || props.contains(NativeWindow::GlobalPos) ){ + //Try the ICCCM "Normal Hints" structure first (newer spec?) + xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_normal_hints_unchecked(QX11Info::connection(), win->id()); + xcb_size_hints_t reply; + bool ok = false; + if(1==xcb_icccm_get_wm_normal_hints_reply(QX11Info::connection(), cookie, &reply, NULL) ){ ok = true; } + else{ + //Could not find normal hints, try the older "size hints" instead + cookie = xcb_icccm_get_wm_size_hints_unchecked(QX11Info::connection(), win->id(), XCB_ATOM_WM_SIZE_HINTS); + if(1==xcb_icccm_get_wm_size_hints_reply(QX11Info::connection(), cookie, &reply, NULL) ){ ok = true; } + } + if(ok){ + bool initsize = win->property(NativeWindow::Size).isNull(); //initial window size + if( (reply.flags&XCB_ICCCM_SIZE_HINT_US_POSITION)==XCB_ICCCM_SIZE_HINT_US_POSITION ){ win->setProperty(NativeWindow::GlobalPos, QPoint(reply.x,reply.y)); } + if( (reply.flags&XCB_ICCCM_SIZE_HINT_US_SIZE)==XCB_ICCCM_SIZE_HINT_US_SIZE ){ win->setProperty(NativeWindow::Size, QSize(reply.width, reply.height)); } + if( (reply.flags&XCB_ICCCM_SIZE_HINT_P_POSITION)==XCB_ICCCM_SIZE_HINT_P_POSITION ){ win->setProperty(NativeWindow::GlobalPos, QPoint(reply.x,reply.y)); } + if( (reply.flags&XCB_ICCCM_SIZE_HINT_P_SIZE)==XCB_ICCCM_SIZE_HINT_P_SIZE ){ win->setProperty(NativeWindow::Size, QSize(reply.width, reply.height)); } + if( (reply.flags&XCB_ICCCM_SIZE_HINT_P_MIN_SIZE)==XCB_ICCCM_SIZE_HINT_P_MIN_SIZE ){ win->setProperty(NativeWindow::MinSize, QSize(reply.min_width, reply.min_height)); } + if( (reply.flags&XCB_ICCCM_SIZE_HINT_P_MAX_SIZE)==XCB_ICCCM_SIZE_HINT_P_MAX_SIZE ){ win->setProperty(NativeWindow::MaxSize, QSize(reply.max_width, reply.max_height)); } + if( (reply.flags&XCB_ICCCM_SIZE_HINT_BASE_SIZE)==XCB_ICCCM_SIZE_HINT_BASE_SIZE && initsize ){ win->setProperty(NativeWindow::Size, QSize(reply.base_width, reply.base_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_P_WIN_GRAVITY)==XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY ){ hints.win_gravity=reply.win_gravity; } + } + } //end of geometry properties } |