mirror of
https://github.com/brl/mutter.git
synced 2024-11-13 09:46:08 -05:00
Export methods interact with user_time
This is useful when calling some of the lower level mutter functions, e.g. controlling window stacking. https://bugzilla.gnome.org/show_bug.cgi?id=616050
This commit is contained in:
parent
0c14640352
commit
edcb351107
@ -303,22 +303,15 @@ struct _MetaDisplayClass
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
/* Xserver time can wraparound, thus comparing two timestamps needs to take
|
||||
* this into account. Here's a little macro to help out. If no wraparound
|
||||
* has occurred, this is equivalent to
|
||||
* time1 < time2
|
||||
* Of course, the rest of the ugliness of this macro comes from accounting
|
||||
* for the fact that wraparound can occur and the fact that a timestamp of
|
||||
* 0 must be special-cased since it means older than anything else.
|
||||
*
|
||||
* Note that this is NOT an equivalent for time1 <= time2; if that's what
|
||||
* you need then you'll need to swap the order of the arguments and negate
|
||||
* the result.
|
||||
*/
|
||||
#define XSERVER_TIME_IS_BEFORE_ASSUMING_REAL_TIMESTAMPS(time1, time2) \
|
||||
( (( (time1) < (time2) ) && ( (time2) - (time1) < ((guint32)-1)/2 )) || \
|
||||
(( (time1) > (time2) ) && ( (time1) - (time2) > ((guint32)-1)/2 )) \
|
||||
)
|
||||
/**
|
||||
* XSERVER_TIME_IS_BEFORE:
|
||||
*
|
||||
* See the docs for meta_display_xserver_time_is_before().
|
||||
*/
|
||||
#define XSERVER_TIME_IS_BEFORE(time1, time2) \
|
||||
( (time1) == 0 || \
|
||||
(XSERVER_TIME_IS_BEFORE_ASSUMING_REAL_TIMESTAMPS(time1, time2) && \
|
||||
|
@ -1320,6 +1320,43 @@ meta_grab_op_is_moving (MetaGrabOp op)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_display_xserver_time_is_before:
|
||||
* @display: a #MetaDisplay
|
||||
* @time1: An event timestamp
|
||||
* @time2: An event timestamp
|
||||
*
|
||||
* Xserver time can wraparound, thus comparing two timestamps needs to take
|
||||
* this into account. If no wraparound has occurred, this is equivalent to
|
||||
* time1 < time2
|
||||
* Otherwise, we need to account for the fact that wraparound can occur
|
||||
* and the fact that a timestamp of 0 must be special-cased since it
|
||||
* means "older than anything else".
|
||||
*
|
||||
* Note that this is NOT an equivalent for time1 <= time2; if that's what
|
||||
* you need then you'll need to swap the order of the arguments and negate
|
||||
* the result.
|
||||
*/
|
||||
gboolean
|
||||
meta_display_xserver_time_is_before (MetaDisplay *display,
|
||||
guint32 time1,
|
||||
guint32 time2)
|
||||
{
|
||||
return XSERVER_TIME_IS_BEFORE(time1, time2);
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_display_get_last_user_time:
|
||||
* @display: a #MetaDisplay
|
||||
*
|
||||
* Returns: Timestamp of the last user interaction event with a window
|
||||
*/
|
||||
guint32
|
||||
meta_display_get_last_user_time (MetaDisplay *display)
|
||||
{
|
||||
return display->last_user_time;
|
||||
}
|
||||
|
||||
/* Get time of current event, or CurrentTime if none. */
|
||||
guint32
|
||||
meta_display_get_current_time (MetaDisplay *display)
|
||||
|
@ -82,6 +82,12 @@ gboolean meta_display_xwindow_is_a_no_focus_window (MetaDisplay *display,
|
||||
int meta_display_get_damage_event_base (MetaDisplay *display);
|
||||
int meta_display_get_shape_event_base (MetaDisplay *display);
|
||||
Atom meta_display_get_atom (MetaDisplay *display, MetaAtom meta_atom);
|
||||
|
||||
gboolean meta_display_xserver_time_is_before (MetaDisplay *display,
|
||||
guint32 time1,
|
||||
guint32 time2);
|
||||
|
||||
guint32 meta_display_get_last_user_time (MetaDisplay *display);
|
||||
guint32 meta_display_get_current_time (MetaDisplay *display);
|
||||
guint32 meta_display_get_current_time_roundtrip (MetaDisplay *display);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user