Commit d399141d authored by Colin Walters's avatar Colin Walters
Browse files

Add meta_window_get_stable_sequence

Useful for plugins which want to order windows in a stable
fashion.

https://bugzilla.gnome.org/show_bug.cgi?id=595882
parent ac3eac71
......@@ -150,6 +150,15 @@ struct _MetaDisplay
guint32 current_time;
/* We maintain a sequence counter, incremented for each #MetaWindow
* created. This is exposed by meta_window_get_stable_sequence()
* but is otherwise not used inside mutter.
*
* It can be useful to plugins which want to sort windows in a
* stable fashion.
*/
guint32 window_sequence_counter;
/* Pings which we're waiting for a reply from */
GSList *pending_pings;
......
......@@ -316,6 +316,9 @@ struct _MetaWindow
*/
int unmaps_pending;
/* See docs for meta_window_get_stable_sequence() */
guint32 stable_sequence;
/* set to the most recent user-interaction event timestamp that we
know about for this window */
guint32 net_wm_user_time;
......
......@@ -802,6 +802,10 @@ meta_window_new_with_attrs (MetaDisplay *display,
meta_display_register_x_window (display, &window->xwindow, window);
/* Assign this #MetaWindow a sequence number which can be used
* for sorting.
*/
window->stable_sequence = ++display->window_sequence_counter;
/* assign the window to its group, or create a new group if needed
*/
......@@ -8532,6 +8536,26 @@ meta_window_set_user_time (MetaWindow *window,
g_object_notify (G_OBJECT (window), "user-time");
}
/**
* meta_window_get_stable_sequence:
* @window: A #MetaWindow
*
* The stable sequence number is a monotonicially increasing
* unique integer assigned to each #MetaWindow upon creation.
*
* This number can be useful for sorting windows in a stable
* fashion.
*
* Returns: Internal sequence number for this window
*/
guint32
meta_window_get_stable_sequence (MetaWindow *window)
{
g_return_val_if_fail (META_IS_WINDOW (window), 0);
return window->stable_sequence;
}
/* Sets the demands_attention hint on a window, but only
* if it's at least partially obscured (see #305882).
*/
......
......@@ -118,6 +118,7 @@ const char *meta_window_get_title (MetaWindow *window);
MetaWindow *meta_window_get_transient_for (MetaWindow *window);
void meta_window_delete (MetaWindow *window,
guint32 timestamp);
guint meta_window_get_stable_sequence (MetaWindow *window);
guint32 meta_window_get_user_time (MetaWindow *window);
int meta_window_get_pid (MetaWindow *window);
const char *meta_window_get_client_machine (MetaWindow *window);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment