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
This commit is contained in:
Lucas Murray 2009-10-03 14:32:24 +00:00
parent 52653a13b4
commit 743e058af5
4 changed files with 28 additions and 14 deletions

View file

@ -152,6 +152,7 @@ Client::Client( Workspace* ws )
modal = false; modal = false;
noborder = false; noborder = false;
app_noborder = false; app_noborder = false;
motif_noborder = false;
urgency = false; urgency = false;
ignore_focus_stealing = false; ignore_focus_stealing = false;
demands_attention = false; demands_attention = false;
@ -1617,12 +1618,18 @@ void Client::getWMHints()
void Client::getMotifHints() void Client::getMotifHints()
{ {
bool mnoborder, mresize, mmove, mminimize, mmaximize, mclose; bool mgot_noborder, mnoborder, mresize, mmove, mminimize, mmaximize, mclose;
Motif::readFlags( client, mnoborder, mresize, mmove, mminimize, mmaximize, mclose ); Motif::readFlags( client, mgot_noborder, mnoborder, mresize, mmove, mminimize, mmaximize, mclose );
if( mnoborder ) if( mgot_noborder )
{ {
noborder = true; motif_noborder = mnoborder;
app_noborder = true; // 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() ) if( !hasNETSupport() )
{ // NETWM apps should set type and size constraints { // NETWM apps should set type and size constraints

View file

@ -536,7 +536,8 @@ class Client
uint hidden : 1; ///< Forcibly hidden by calling hide() uint hidden : 1; ///< Forcibly hidden by calling hide()
uint modal : 1; ///< NET::Modal uint modal : 1; ///< NET::Modal
uint noborder : 1; 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 urgency : 1; ///< XWMHints, UrgencyHint
uint ignore_focus_stealing : 1; ///< Don't apply focus stealing prevention to this client uint ignore_focus_stealing : 1; ///< Don't apply focus stealing prevention to this client
uint demands_attention : 1; uint demands_attention : 1;

View file

@ -77,8 +77,8 @@ StrutRect::StrutRect( const StrutRect& other )
// Motif // Motif
//************************************ //************************************
void Motif::readFlags( WId w, bool& noborder, bool& resize, bool& move, void Motif::readFlags( WId w, bool& got_noborder, bool& noborder,
bool& minimize, bool& maximize, bool& close ) bool& resize, bool& move, bool& minimize, bool& maximize, bool& close )
{ {
Atom type; Atom type;
int format; int format;
@ -92,6 +92,7 @@ void Motif::readFlags( WId w, bool& noborder, bool& resize, bool& move,
if ( data ) if ( data )
hints = (MwmHints*) data; hints = (MwmHints*) data;
} }
got_noborder = false;
noborder = false; noborder = false;
resize = true; resize = true;
move = true; move = true;
@ -117,10 +118,10 @@ void Motif::readFlags( WId w, bool& noborder, bool& resize, bool& move,
if( hints->functions & MWM_FUNC_CLOSE ) if( hints->functions & MWM_FUNC_CLOSE )
close = set_value; close = set_value;
} }
if ( hints->flags & MWM_HINTS_DECORATIONS ) if ( hints->flags & MWM_HINTS_DECORATIONS )
{ {
if ( hints->decorations == 0 ) got_noborder = true;
noborder = true; noborder = !hints->decorations;
} }
XFree( data ); XFree( data );
} }

11
utils.h
View file

@ -192,9 +192,14 @@ const int ShapeInput = 2;
class Motif class Motif
{ {
public: public:
static void readFlags( WId w, bool& noborder, bool& resize, bool& move, // Read a window's current settings from its _MOTIF_WM_HINTS
bool& minimize, bool& maximize, bool& close ); // property. If it explicitly requests that decorations be shown
struct MwmHints // 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 flags;
ulong functions; ulong functions;