Fix #264 fall back to age ordered list if stacked list does not work

This commit is contained in:
Dave Davenport 2015-11-10 23:52:52 +01:00
parent 971d6df471
commit 09ab44bf92
3 changed files with 15 additions and 5 deletions

View File

@ -34,6 +34,7 @@ int window_get_cardinal_prop ( Display *display, Window w, Atom atom, unsigned l
X ( _NET_NUMBER_OF_DESKTOPS ), \
X ( _NET_CURRENT_DESKTOP ), \
X ( _NET_ACTIVE_WINDOW ), \
X ( _NET_CLIENT_LIST ), \
X ( _NET_WM_NAME ), \
X ( _NET_WM_STATE ), \
X ( _NET_WM_STATE_SKIP_TASKBAR ), \

View File

@ -161,8 +161,8 @@ static void get_apps_dir ( DRunModePrivateData *pd, const char *bp )
}
else {
( pd->cmd_list )[( pd->cmd_list_length )] = g_markup_printf_escaped (
"%s <span weight='light' size='small'><i>(%s)</i></span>",
n, gn ? gn : "" );
"%s <span weight='light' size='small'><i>(%s)</i></span>",
n, gn ? gn : "" );
}
g_free ( n ); g_free ( gn );
}

View File

@ -379,7 +379,7 @@ static char ** _window_mode_get_data ( unsigned int *length, Switcher *sw, unsig
Window root = RootWindow ( display, XScreenNumberOfScreen ( screen ) );
// find window list
Atom type;
int nwins;
int nwins = 0;
Window wins[100];
int count = 0;
Window curr_win_id = 0;
@ -401,8 +401,17 @@ static char ** _window_mode_get_data ( unsigned int *length, Switcher *sw, unsig
current_desktop = 0;
}
if ( window_get_prop ( display, root, netatoms[_NET_CLIENT_LIST_STACKING], &type, &nwins, wins, 100 * sizeof ( Window ) )
&& type == XA_WINDOW ) {
unsigned int nw = 100 * sizeof ( Window );
// First try Stacking order.. If this fails.
if ( !( window_get_prop ( display, root, netatoms[_NET_CLIENT_LIST_STACKING], &type, &nwins, wins, nw )
&& type == XA_WINDOW ) ) {
// Try to get order by age.
if ( !( window_get_prop ( display, root, netatoms[_NET_CLIENT_LIST], &type, &nwins, wins, nw )
&& type == XA_WINDOW ) ) {
nwins = 0;
}
}
if ( nwins > 0 ) {
char pattern[50];
int i;
unsigned int classfield = 0;