From 743e058af560875c275cc1070ea069fbe629f5d6 Mon Sep 17 00:00:00 2001 From: Lucas Murray Date: Sat, 3 Oct 2009 14:32:24 +0000 Subject: [PATCH] Detect when _MOTIF_WM_HINTS gains or loses the no border hint. Patch by Daniel Erat. BUG: 201523 svn path=/trunk/KDE/kdebase/workspace/; revision=1030932 --- client.cpp | 17 ++++++++++++----- client.h | 3 ++- utils.cpp | 11 ++++++----- utils.h | 11 ++++++++--- 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/client.cpp b/client.cpp index fcf37730c7..573b828943 100644 --- a/client.cpp +++ b/client.cpp @@ -152,6 +152,7 @@ Client::Client( Workspace* ws ) modal = false; noborder = false; app_noborder = false; + motif_noborder = false; urgency = false; ignore_focus_stealing = false; demands_attention = false; @@ -1617,12 +1618,18 @@ void Client::getWMHints() void Client::getMotifHints() { - bool mnoborder, mresize, mmove, mminimize, mmaximize, mclose; - Motif::readFlags( client, mnoborder, mresize, mmove, mminimize, mmaximize, mclose ); - if( mnoborder ) + bool mgot_noborder, mnoborder, mresize, mmove, mminimize, mmaximize, mclose; + Motif::readFlags( client, mgot_noborder, mnoborder, mresize, mmove, mminimize, mmaximize, mclose ); + if( mgot_noborder ) { - noborder = true; - app_noborder = true; + motif_noborder = mnoborder; + // If we just got a hint telling us to hide decorations, we do so. + if ( motif_noborder ) + noborder = true; + // If the Motif hint is now telling us to show decorations, we only do so if the app didn't + // instruct us to hide decorations in some other way, though. + else if ( !motif_noborder && !app_noborder ) + noborder = false; } if( !hasNETSupport() ) { // NETWM apps should set type and size constraints diff --git a/client.h b/client.h index 662af5e311..13a3d67549 100644 --- a/client.h +++ b/client.h @@ -536,7 +536,8 @@ class Client uint hidden : 1; ///< Forcibly hidden by calling hide() uint modal : 1; ///< NET::Modal uint noborder : 1; - uint app_noborder : 1; ///< The app requested no border using something (window type, motif hints) + uint app_noborder : 1; ///< App requested no border via window type, shape extension, etc. + uint motif_noborder : 1; ///< App requested no border via Motif WM hints uint urgency : 1; ///< XWMHints, UrgencyHint uint ignore_focus_stealing : 1; ///< Don't apply focus stealing prevention to this client uint demands_attention : 1; diff --git a/utils.cpp b/utils.cpp index 075368b8d4..ee3520d8b5 100644 --- a/utils.cpp +++ b/utils.cpp @@ -77,8 +77,8 @@ StrutRect::StrutRect( const StrutRect& other ) // Motif //************************************ -void Motif::readFlags( WId w, bool& noborder, bool& resize, bool& move, - bool& minimize, bool& maximize, bool& close ) +void Motif::readFlags( WId w, bool& got_noborder, bool& noborder, + bool& resize, bool& move, bool& minimize, bool& maximize, bool& close ) { Atom type; int format; @@ -92,6 +92,7 @@ void Motif::readFlags( WId w, bool& noborder, bool& resize, bool& move, if ( data ) hints = (MwmHints*) data; } + got_noborder = false; noborder = false; resize = true; move = true; @@ -117,10 +118,10 @@ void Motif::readFlags( WId w, bool& noborder, bool& resize, bool& move, if( hints->functions & MWM_FUNC_CLOSE ) close = set_value; } - if ( hints->flags & MWM_HINTS_DECORATIONS ) + if ( hints->flags & MWM_HINTS_DECORATIONS ) { - if ( hints->decorations == 0 ) - noborder = true; + got_noborder = true; + noborder = !hints->decorations; } XFree( data ); } diff --git a/utils.h b/utils.h index 89981687e9..1cf0877193 100644 --- a/utils.h +++ b/utils.h @@ -192,9 +192,14 @@ const int ShapeInput = 2; class Motif { public: - static void readFlags( WId w, bool& noborder, bool& resize, bool& move, - bool& minimize, bool& maximize, bool& close ); - struct MwmHints + // Read a window's current settings from its _MOTIF_WM_HINTS + // property. If it explicitly requests that decorations be shown + // or hidden, 'got_noborder' is set to true and 'noborder' is set + // appropriately. + static void readFlags( WId w, bool& got_noborder, bool& noborder, + bool& resize, bool& move, bool& minimize, bool& maximize, + bool& close ); + struct MwmHints { ulong flags; ulong functions;