diff --git a/src/core/display-private.h b/src/core/display-private.h index 1c8e225e8..a4c79593e 100644 --- a/src/core/display-private.h +++ b/src/core/display-private.h @@ -57,6 +57,7 @@ typedef struct MetaEdgeResistanceData MetaEdgeResistanceData; typedef enum { META_LIST_DEFAULT = 0, /* normal windows */ META_LIST_INCLUDE_OVERRIDE_REDIRECT = 1 << 0, /* normal and O-R */ + META_LIST_SORTED = 1 << 1, /* sort list by mru */ } MetaListWindowsFlags; #define _NET_WM_STATE_REMOVE 0 /* remove/unset property */ diff --git a/src/core/display.c b/src/core/display.c index 79720edf6..57423eef6 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -150,6 +150,9 @@ static void update_cursor_theme (void); static void prefs_changed_callback (MetaPreference pref, void *data); +static int mru_cmp (gconstpointer a, + gconstpointer b); + static void meta_display_get_property(GObject *object, guint prop_id, @@ -1061,6 +1064,9 @@ meta_display_list_windows (MetaDisplay *display, tmp = next; } + if (flags & META_LIST_SORTED) + winlist = g_slist_sort (winlist, mru_cmp); + return winlist; }