jenkins-core-weekly: update to 2.491
[oi-userland.git] / components / desktop / mate / mate-desktop / patches / 02-xrandr-probing.patch
blob540e11f8ee38c311899903cb0a978306b5fffc93
1 --- mate-desktop-1.12.1/libmate-desktop/mate-rr.c.~1~ 2015-11-30 10:10:03.000000000 +0300
2 +++ mate-desktop-1.12.1/libmate-desktop/mate-rr.c 2015-12-05 17:39:12.583263260 +0300
3 @@ -515,10 +515,35 @@
4 static ScreenInfo *
5 screen_info_new (MateRRScreen *screen, gboolean needs_reprobe, GError **error)
7 + GTimeVal cur_time_val;
8 + gint64 cur, prev;
10 + g_assert (screen != NULL);
12 + if ( screen->priv->info != NULL ) {
13 + g_get_current_time(&cur_time_val);
14 + cur = (gint64) cur_time_val.tv_sec * G_USEC_PER_SEC + cur_time_val.tv_usec;
15 + prev =(gint64) screen->priv->last_update_time.tv_sec * G_USEC_PER_SEC + screen->priv->last_update_time.tv_usec;
17 + /* Only referesh the info after 2 seconds have elapsed since last
18 + * update, otherwise it will cause a lot of extra probing on the X
19 + * server.
20 + */
21 + if (((cur - prev) < 0) || ((cur - prev) > 2000000)) {
22 + screen->priv->last_update_time = cur_time_val;
23 + }
24 + else {
25 + /* Don't return any update, which should result in caller using
26 + * existing data
27 + */
28 + g_warning("Call to screen_info_new is too frequent, skipping...");
29 + return( NULL );
30 + }
31 + }
33 ScreenInfo *info = g_new0 (ScreenInfo, 1);
34 MateRRScreenPrivate *priv;
36 - g_assert (screen != NULL);
38 priv = screen->priv;
40 @@ -688,6 +713,9 @@
42 priv->info = screen_info_new (self, TRUE, error);
44 + /* Initialize the last udpate time */
45 + g_get_current_time (&(priv->last_update_time));
47 if (!priv->info) {
48 return FALSE;
51 --- mate-desktop-1.24.0/libmate-desktop/mate-rr-private.h 2020-02-10 11:33:51.000000000 +0000
52 +++ mate-desktop-1.24.0/libmate-desktop/mate-rr-private.h.new 2020-02-15 21:23:48.202041412 +0000
53 @@ -46,6 +46,7 @@ struct MateRRScreenPrivate
54 int rr_major_version;
55 int rr_minor_version;
57 + GTimeVal last_update_time;
58 Atom connector_type_atom;