menus and launching: the time since a submenu opened and the time a program takes to start are measured with the monotonic clock, so setting the clock meanwhile does not shorten or lengthen them

This commit is contained in:
Daemonratte 2026-10-17 11:16:09 +02:00
commit 2b9d739cb0
No known key found for this signature in database
3 changed files with 5 additions and 3 deletions

View file

@ -178,10 +178,12 @@ free_startup_timeout (void *data)
g_free (std);
}
/* for the time a startup takes: not the wall clock, which may be set
* meanwhile */
static gint64
get_current_time_usec (void)
{
return g_get_real_time ();
return g_get_monotonic_time ();
}
static gboolean

View file

@ -1504,7 +1504,7 @@ gtk_menu_item_real_popup_submenu (GtkWidget *widget,
{
gint64 *popup_time = g_slice_new0 (gint64);
*popup_time = g_get_real_time ();
*popup_time = g_get_monotonic_time ();
g_object_set_data_full (G_OBJECT (menu_item->submenu),
"gtk-menu-exact-popup-time", popup_time,

View file

@ -719,7 +719,7 @@ gtk_menu_shell_button_release (GtkWidget *widget,
if (popup_time)
{
usec_since_popup = g_get_real_time () - *popup_time;
usec_since_popup = g_get_monotonic_time () - *popup_time;
g_object_set_data (G_OBJECT (submenu),
"gtk-menu-exact-popup-time", NULL);