support for the MOTIF noBorder hint

svn path=/trunk/kdebase/kwin/; revision=45820
This commit is contained in:
Matthias Ettrich 2000-04-06 18:29:04 +00:00
parent 6a5046ebb6
commit 6d299fc9a4
4 changed files with 52 additions and 6 deletions

View file

@ -1,6 +1,6 @@
/***************************************************************** /*****************************************************************
kwin - the KDE window manager kwin - the KDE window manager
Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org> Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
******************************************************************/ ******************************************************************/
#include <qapplication.h> #include <qapplication.h>
@ -37,6 +37,9 @@ Atoms::Atoms()
atoms[n] = &kwm_command; atoms[n] = &kwm_command;
names[n++] = (char *) "KWM_COMMAND"; names[n++] = (char *) "KWM_COMMAND";
atoms[n] = &motif_wm_hints;
names[n++] = (char *) "_MOTIF_WM_HINTS";
atoms[n] = &net_number_of_desktops; atoms[n] = &net_number_of_desktops;
names[n++] = (char *) "_NET_NUMBER_OF_DESKTOPS"; names[n++] = (char *) "_NET_NUMBER_OF_DESKTOPS";

View file

@ -1,6 +1,6 @@
/***************************************************************** /*****************************************************************
kwin - the KDE window manager kwin - the KDE window manager
Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org> Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
******************************************************************/ ******************************************************************/
#ifndef ATOMS_H #ifndef ATOMS_H
@ -18,6 +18,8 @@ public:
Atom kwm_win_icon; // compatibility Atom kwm_win_icon; // compatibility
Atom kwm_command; // compatibility Atom kwm_command; // compatibility
Atom kwm_running; Atom kwm_running;
Atom motif_wm_hints;
Atom net_number_of_desktops; Atom net_number_of_desktops;
Atom net_current_desktop; Atom net_current_desktop;

View file

@ -54,6 +54,38 @@ int Shape::shapeEvent()
return kwin_shape_event; return kwin_shape_event;
} }
bool Motif::noBorder( WId w )
{
struct MwmHints {
ulong flags;
ulong functions;
ulong decorations;
long input_mode;
ulong status;
};
Atom type;
int format;
unsigned long length, after;
unsigned char* data;
MwmHints* hints = 0;
if ( XGetWindowProperty( qt_xdisplay(), w, atoms->motif_wm_hints, 0, 5,
FALSE, atoms->motif_wm_hints, &type, &format,
&length, &after, &data ) == Success ) {
if ( data )
hints = (MwmHints*) data;
}
bool result = FALSE;
if ( hints ) {
if ( hints->flags & (1L << 1 ) ) { // // MWM_HINTS_DECORATIONS;
if ( hints->decorations == 0 )
result = TRUE;
}
XFree( data );
}
return result;
}
/*! /*!
Updates kwin_time by receiving a current timestamp from the server. Updates kwin_time by receiving a current timestamp from the server.
@ -73,6 +105,10 @@ static void updateTime()
Client* Workspace::clientFactory( Workspace *ws, WId w ) Client* Workspace::clientFactory( Workspace *ws, WId w )
{ {
if ( Motif::noBorder( w ) )
return new NoBorderClient( ws, w );
// hack TODO hints // hack TODO hints
QString s = KWM::title( w ); QString s = KWM::title( w );
if ( s == "THE DESKTOP" ) { if ( s == "THE DESKTOP" ) {
@ -2068,7 +2104,7 @@ SessionInfo* Workspace::takeSessionInfo( Client* c )
QCString windowRole = c->windowRole(); QCString windowRole = c->windowRole();
for (SessionInfo* info = session.first(); info; info = session.next() ) { for (SessionInfo* info = session.first(); info; info = session.next() ) {
if ( info->sessionId == sessionId && if ( info->sessionId == sessionId &&
( ( info->windowRole.isEmpty() && windowRole.isEmpty() ) ( ( info->windowRole.isEmpty() && windowRole.isEmpty() )
|| (info->windowRole == windowRole ) ) ) || (info->windowRole == windowRole ) ) )
return session.take(); return session.take();

View file

@ -1,6 +1,6 @@
/***************************************************************** /*****************************************************************
kwin - the KDE window manager kwin - the KDE window manager
Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org> Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
******************************************************************/ ******************************************************************/
#ifndef WORKSPACE_H #ifndef WORKSPACE_H
@ -67,6 +67,11 @@ public:
static int shapeEvent(); static int shapeEvent();
}; };
class Motif {
public:
static bool noBorder( WId w );
};
class Workspace : public QObject class Workspace : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -128,9 +133,9 @@ public:
void performWindowOperation( Client* c, Options::WindowOperation op ); void performWindowOperation( Client* c, Options::WindowOperation op );
Client* clientFactory(Workspace *ws, WId w); Client* clientFactory(Workspace *ws, WId w);
void storeSession( KConfig* config ); void storeSession( KConfig* config );
SessionInfo* takeSessionInfo( Client* ); SessionInfo* takeSessionInfo( Client* );
public slots: public slots: