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
icc-effect-5.14.5
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;
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

View File

@ -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;

View File

@ -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 );
}

11
utils.h
View File

@ -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;