diff --git a/atoms.cpp b/atoms.cpp index d7d2e75180..83d57269a9 100644 --- a/atoms.cpp +++ b/atoms.cpp @@ -1,6 +1,6 @@ /***************************************************************** kwin - the KDE window manager - + Copyright (C) 1999, 2000 Matthias Ettrich ******************************************************************/ #include @@ -37,6 +37,9 @@ Atoms::Atoms() atoms[n] = &kwm_command; names[n++] = (char *) "KWM_COMMAND"; + + atoms[n] = &motif_wm_hints; + names[n++] = (char *) "_MOTIF_WM_HINTS"; atoms[n] = &net_number_of_desktops; names[n++] = (char *) "_NET_NUMBER_OF_DESKTOPS"; diff --git a/atoms.h b/atoms.h index 980247d21b..4ae39e9e5e 100644 --- a/atoms.h +++ b/atoms.h @@ -1,6 +1,6 @@ /***************************************************************** kwin - the KDE window manager - + Copyright (C) 1999, 2000 Matthias Ettrich ******************************************************************/ #ifndef ATOMS_H @@ -18,6 +18,8 @@ public: Atom kwm_win_icon; // compatibility Atom kwm_command; // compatibility Atom kwm_running; + + Atom motif_wm_hints; Atom net_number_of_desktops; Atom net_current_desktop; diff --git a/workspace.cpp b/workspace.cpp index e0a9870b5a..a3472bde23 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -54,6 +54,38 @@ int Shape::shapeEvent() 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. @@ -73,6 +105,10 @@ static void updateTime() Client* Workspace::clientFactory( Workspace *ws, WId w ) { + if ( Motif::noBorder( w ) ) + return new NoBorderClient( ws, w ); + + // hack TODO hints QString s = KWM::title( w ); if ( s == "THE DESKTOP" ) { @@ -2068,7 +2104,7 @@ SessionInfo* Workspace::takeSessionInfo( Client* c ) QCString windowRole = c->windowRole(); for (SessionInfo* info = session.first(); info; info = session.next() ) { - if ( info->sessionId == sessionId && + if ( info->sessionId == sessionId && ( ( info->windowRole.isEmpty() && windowRole.isEmpty() ) || (info->windowRole == windowRole ) ) ) return session.take(); diff --git a/workspace.h b/workspace.h index 31f1cbea1a..4c4f3df2d9 100644 --- a/workspace.h +++ b/workspace.h @@ -1,6 +1,6 @@ /***************************************************************** kwin - the KDE window manager - + Copyright (C) 1999, 2000 Matthias Ettrich ******************************************************************/ #ifndef WORKSPACE_H @@ -67,6 +67,11 @@ public: static int shapeEvent(); }; +class Motif { +public: + static bool noBorder( WId w ); +}; + class Workspace : public QObject { Q_OBJECT @@ -128,9 +133,9 @@ public: void performWindowOperation( Client* c, Options::WindowOperation op ); Client* clientFactory(Workspace *ws, WId w); - + void storeSession( KConfig* config ); - + SessionInfo* takeSessionInfo( Client* ); public slots: