[Xfce4-commits] [xfce/xfwm4] 01/01: compositor: reinstate “--vblank” option

noreply at xfce.org noreply at xfce.org
Sat Apr 27 22:07:21 CEST 2019


This is an automated email from the git hooks/post-receive script.

o   l   i   v   i   e   r       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfwm4.

commit 30e1d49d03fbaf55a7c21f90f57cbbc5101339ea
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Sat Apr 27 22:03:54 2019 +0200

    compositor: reinstate “--vblank” option
    
    Some distributions have shipped an unstable version of xfwm4 with the
    “--vblank” command line option, and there are references of that option
    out in the wild already.
    
    Restore that command line option, it's also useful for quick tests.
    
    Signed-off-by: Olivier Fourdan <fourdan at xfce.org>
---
 src/main.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/src/main.c b/src/main.c
index ae7c252..ee1ae62 100644
--- a/src/main.c
+++ b/src/main.c
@@ -89,6 +89,7 @@ enum {
 };
 
 static gint compositor = COMPOSITOR_MODE_MANUAL;
+static vblankMode vblank_mode = VBLANK_AUTO;
 #define XFWM4_ERROR      (xfwm4_error_quark ())
 
 #ifndef DEBUG
@@ -461,6 +462,43 @@ compositor_callback (const gchar  *name,
 
     return succeed;
 }
+
+static gboolean
+vblank_callback (const gchar  *name,
+                 const gchar  *value,
+                 gpointer      user_data,
+                 GError      **error)
+{
+    gboolean succeed = TRUE;
+
+    g_return_val_if_fail (value != NULL, FALSE);
+
+#ifdef HAVE_PRESENT_EXTENSION
+    if (strcmp (value, "xpresent") == 0)
+    {
+        vblank_mode = VBLANK_XPRESENT;
+    }
+    else
+#endif /* HAVE_PRESENT_EXTENSION */
+#ifdef HAVE_EPOXY
+    if (strcmp (value, "glx") == 0)
+    {
+        vblank_mode = VBLANK_GLX;
+    }
+    else
+#endif /* HAVE_EPOXY */
+    if (strcmp (value, "off") == 0)
+    {
+        vblank_mode = VBLANK_OFF;
+    }
+    else
+    {
+        g_set_error (error, XFWM4_ERROR, 0, "Unrecognized compositor option \"%s\"", value);
+        succeed = FALSE;
+    }
+
+    return succeed;
+}
 #endif /* HAVE_COMPOSITOR */
 
 static gboolean
@@ -555,6 +593,11 @@ initialize (gint compositor_mode, gboolean replace_wm)
             return -2;
         }
 
+        if (vblank_mode != VBLANK_AUTO)
+        {
+            screen_info->vblank_mode = vblank_mode;
+        }
+
         if (compositor_mode == COMPOSITOR_MODE_AUTO)
         {
             compositorManageScreen (screen_info);
@@ -652,6 +695,14 @@ main (int argc, char **argv)
         { "daemon", '\0', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, daemon_callback, N_("Fork to the background (not supported)"), NULL },
 #ifdef HAVE_COMPOSITOR
         { "compositor", '\0', 0, G_OPTION_ARG_CALLBACK, compositor_callback, N_("Set the compositor mode"), "on|off|auto" },
+        { "vblank", '\0', 0, G_OPTION_ARG_CALLBACK, vblank_callback, N_("Set the vblank mode"), "off"
+#ifdef HAVE_PRESENT_EXTENSION
+          "|xpresent"
+#endif /* HAVE_PRESENT_EXTENSION */
+#ifdef HAVE_EPOXY
+          "|glx"
+#endif /* HAVE_EPOXY */
+        },
 #endif /* HAVE_COMPOSITOR */
         { "replace", '\0', 0, G_OPTION_ARG_NONE, &replace_wm, N_("Replace the existing window manager"), NULL },
         { "version", 'V', 0, G_OPTION_ARG_NONE, &version, N_("Print version information and exit"), NULL },

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list