diff --git a/sm.cpp b/sm.cpp --- a/sm.cpp +++ b/sm.cpp @@ -56,6 +56,32 @@ return config; } +static const char* const window_type_names[] = { + "Unknown", "Normal" , "Desktop", "Dock", "Toolbar", "Menu", "Dialog", + "Override", "TopMenu", "Utility", "Splash" +}; +// change also the two functions below when adding new entries + +static const char* windowTypeToTxt(NET::WindowType type) +{ + if (type >= NET::Unknown && type <= NET::Splash) + return window_type_names[ type + 1 ]; // +1 (unknown==-1) + if (type == -2) // undefined (not really part of NET::WindowType) + return "Undefined"; + qFatal("Unknown Window Type"); + return NULL; +} + +static NET::WindowType txtToWindowType(const char* txt) +{ + for (int i = NET::Unknown; + i <= NET::Splash; + ++i) + if (qstrcmp(txt, window_type_names[ i + 1 ]) == 0) // +1 + return static_cast< NET::WindowType >(i); + return static_cast< NET::WindowType >(-2); // undefined +} + void Workspace::saveState(QSessionManager &sm) { // If the session manager is ksmserver, save stacking @@ -273,6 +299,15 @@ addSessionInfo(cg); } +static bool sessionInfoWindowTypeMatch(Client* c, SessionInfo* info) +{ + if (info->windowType == -2) { + // undefined (not really part of NET::WindowType) + return !c->isSpecialWindow(); + } + return info->windowType == c->windowType(); +} + /** * Returns a SessionInfo for client \a c. The returned session * info is removed from the storage. It's up to the caller to delete it. @@ -340,44 +375,6 @@ return realInfo; } -bool Workspace::sessionInfoWindowTypeMatch(Client* c, SessionInfo* info) -{ - if (info->windowType == -2) { - // undefined (not really part of NET::WindowType) - return !c->isSpecialWindow(); - } - return info->windowType == c->windowType(); -} - -static const char* const window_type_names[] = { - "Unknown", "Normal" , "Desktop", "Dock", "Toolbar", "Menu", "Dialog", - "Override", "TopMenu", "Utility", "Splash" -}; -// change also the two functions below when adding new entries - -const char* Workspace::windowTypeToTxt(NET::WindowType type) -{ - if (type >= NET::Unknown && type <= NET::Splash) - return window_type_names[ type + 1 ]; // +1 (unknown==-1) - if (type == -2) // undefined (not really part of NET::WindowType) - return "Undefined"; - qFatal("Unknown Window Type"); - return NULL; -} - -NET::WindowType Workspace::txtToWindowType(const char* txt) -{ - for (int i = NET::Unknown; - i <= NET::Splash; - ++i) - if (qstrcmp(txt, window_type_names[ i + 1 ]) == 0) // +1 - return static_cast< NET::WindowType >(i); - return static_cast< NET::WindowType >(-2); // undefined -} - - - - // KWin's focus stealing prevention causes problems with user interaction // during session save, as it prevents possible dialogs from getting focus. // Therefore it's temporarily disabled during session saving. Start of diff --git a/workspace.h b/workspace.h --- a/workspace.h +++ b/workspace.h @@ -552,9 +552,6 @@ void addSessionInfo(KConfigGroup &cg); QList session; - static const char* windowTypeToTxt(NET::WindowType type); - static NET::WindowType txtToWindowType(const char* txt); - static bool sessionInfoWindowTypeMatch(Client* c, SessionInfo* info); void updateXStackingOrder();