implemented desktop cascading and uncluttering.

svn path=/trunk/kdebase/kwin/; revision=35765
This commit is contained in:
Preston Brown 1999-12-03 21:08:07 +00:00
parent 410a80a76d
commit f0cdd75197
4 changed files with 63 additions and 13 deletions

View file

@ -11,45 +11,48 @@ Atoms::Atoms()
int n = 0;
atoms[n] = &wm_protocols;
names[n++] = "WM_PROTOCOLS";
names[n++] = (char *) "WM_PROTOCOLS";
atoms[n] = &wm_delete_window;
names[n++] = "WM_DELETE_WINDOW";
names[n++] = (char *) "WM_DELETE_WINDOW";
atoms[n] = &wm_take_focus;
names[n++] = "WM_TAKE_FOCUS";
names[n++] = (char *) "WM_TAKE_FOCUS";
atoms[n] = &wm_change_state;
names[n++] = "WM_CHANGE_STATE";
names[n++] = (char *) "WM_CHANGE_STATE";
// compatibility
atoms[n] = &kwm_win_icon;
names[n++] = "KWM_WIN_ICON";
names[n++] = (char *) "KWM_WIN_ICON";
// compatibility
atoms[n] = &kwm_running;
names[n++] = "KWM_RUNNING";
names[n++] = (char *) "KWM_RUNNING";
atoms[n] = &kwm_command;
names[n++] = (char *) "KWM_COMMAND";
atoms[n] = &net_number_of_desktops;
names[n++] = "_NET_NUMBER_OF_DESKTOPS";
names[n++] = (char *) "_NET_NUMBER_OF_DESKTOPS";
atoms[n] = &net_current_desktop;
names[n++] = "_NET_CURRENT_DESKTOP";
names[n++] = (char *) "_NET_CURRENT_DESKTOP";
atoms[n] = &net_active_window;
names[n++] = "_NET_ACTIVE_WINDOW";
names[n++] = (char *) "_NET_ACTIVE_WINDOW";
atoms[n] = &net_wm_context_help;
names[n++] = "_NET_WM_CONTEXT_HELP";
names[n++] = (char *) "_NET_WM_CONTEXT_HELP";
atoms[n] = &net_client_list;
names[n++] = "_NET_CLIENT_LIST";
names[n++] = (char *) "_NET_CLIENT_LIST";
atoms[n] = &net_client_list_stacking;
names[n++] = "_NET_CLIENT_LIST_STACKING";
names[n++] = (char *) "_NET_CLIENT_LIST_STACKING";
atoms[n] = &net_kde_docking_windows;
names[n++] = "_NET_KDE_DOCKING_WINDOWS";
names[n++] = (char *) "_NET_KDE_DOCKING_WINDOWS";
XInternAtoms( qt_xdisplay(), names, n, FALSE, atoms_return );
for (int i = 0; i < n; i++ )

View file

@ -11,6 +11,7 @@ public:
Atom wm_take_focus;
Atom wm_change_state;
Atom kwm_win_icon; // compatibility
Atom kwm_command; // compatibility
Atom kwm_running;
Atom net_number_of_desktops;
@ -21,6 +22,7 @@ public:
Atom net_wm_context_help;
Atom net_kde_docking_windows;
};

View file

@ -1201,6 +1201,32 @@ void Workspace::cascadePlacement (Client* c, bool re_init) {
cci[d].pos = QPoint( xp + delta_x, yp + delta_y );
}
void Workspace::deskCleanup(CleanupType ct)
{
QValueList<Client *>::Iterator it(clients.fromLast());
for (; it != clients.begin(); --it) {
QString s;
char *name = 0;
if ( XFetchName( qt_xdisplay(), (*it)->window(), &name ) && name ) {
s = QString::fromLatin1( name );
XFree( name );
}
if (s == "Kicker" ||
s == "THE DESKTOP")
continue;
if((!(*it)->isOnDesktop(currentDesktop())) ||
((*it)->isIconified()) ||
((*it)->isSticky()) )
continue;
else {
if (ct == Cascade)
cascadePlacement(*it);
else if (ct == Unclutter)
smartPlacement(*it);
}
}
}
/*!
Raises the client \a c taking layers, transient windows and window
@ -1424,6 +1450,21 @@ bool Workspace::clientMessage( XClientMessageEvent msg )
return TRUE;
}
if (msg.message_type == atoms->kwm_command) {
char c[21];
int i;
for (i=0;i<20;i++)
c[i] = msg.data.b[i];
c[i] = '\0';
QString com = c;
if (com == "deskUnclutter") {
deskCleanup(Unclutter);
} else if (com == "deskCascade") {
deskCleanup(Cascade);
}
return TRUE;
}
return FALSE;
}

View file

@ -160,6 +160,9 @@ private:
void smartPlacement(Client* c);
void cascadePlacement(Client* c, bool re_init = false);
enum CleanupType { Cascade, Unclutter };
void deskCleanup(CleanupType);
void focusToNull();
Client* desktop_client;
int current_desktop;
@ -188,6 +191,7 @@ private:
QValueList<CascadingInfo> cci;
// -cascading
Atom kwm_command;
};
inline WId Workspace::rootWin() const