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 27238064f229fd4ecd9932ac52de46776fa1c7de Author: Olivier Fourdan <four...@xfce.org> Date: Sun Dec 9 19:08:13 2018 +0100 compositor: Use settings for vblank mode Remove the command line options “--vblank” which is not flexible enough and use xfconf/settings in place. This requires restarting xfwm4 after changing the value though, for the change to take effect (vblank option is applied only at startup). Signed-off-by: Olivier Fourdan <four...@xfce.org> --- defaults/defaults | 1 + src/compositor.c | 34 +++++++++++++++++++++++++++++----- src/compositor.h | 10 ++-------- src/display.c | 1 - src/display.h | 2 -- src/main.c | 47 ----------------------------------------------- src/screen.h | 11 +++++++++++ src/settings.c | 12 +++++++++++- 8 files changed, 54 insertions(+), 64 deletions(-) diff --git a/defaults/defaults b/defaults/defaults index 3058073..cf3d870 100644 --- a/defaults/defaults +++ b/defaults/defaults @@ -68,6 +68,7 @@ toggle_workspaces=false unredirect_overlays=true urgent_blink=false use_compositing=true +vblank_mode=auto workspace_count=4 wrap_cycle=true wrap_layout=true diff --git a/src/compositor.c b/src/compositor.c index 8126455..1b09a59 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -4392,8 +4392,8 @@ compositorManageScreen (ScreenInfo *screen_info) #ifdef HAVE_PRESENT_EXTENSION screen_info->use_present = display_info->have_present && - (display_info->vblank_method == VBLANK_AUTO || - display_info->vblank_method == VBLANK_XPRESENT); + (screen_info->vblank_mode == VBLANK_AUTO || + screen_info->vblank_mode == VBLANK_XPRESENT); if (screen_info->use_present) { screen_info->present_pending = FALSE; @@ -4410,9 +4410,8 @@ compositorManageScreen (ScreenInfo *screen_info) #ifdef HAVE_XSYNC display_info->have_xsync && #endif /* HAVE_XSYNC */ - (display_info->vblank_method == VBLANK_AUTO || - display_info->vblank_method == VBLANK_GLX); - + (screen_info->vblank_mode == VBLANK_AUTO || + screen_info->vblank_mode == VBLANK_GLX); if (screen_info->use_glx) { screen_info->glx_context = None; @@ -4792,3 +4791,28 @@ compositorTestServer (DisplayInfo *display_info) return FALSE; #endif /* HAVE_COMPOSITOR */ } + +vblankMode +compositorVblankMode (const gchar *vblank_mode) +{ +#ifdef HAVE_PRESENT_EXTENSION + if (g_ascii_strcasecmp (vblank_mode, "xpresent") == 0) + { + return VBLANK_XPRESENT; + } + else +#endif /* HAVE_PRESENT_EXTENSION */ +#ifdef HAVE_EPOXY + if (g_ascii_strcasecmp (vblank_mode, "glx") == 0) + { + return VBLANK_GLX; + } + else +#endif /* HAVE_EPOXY */ + if (g_ascii_strcasecmp (vblank_mode, "off") == 0) + { + return VBLANK_OFF; + } + + return VBLANK_AUTO; +} diff --git a/src/compositor.h b/src/compositor.h index 9212d66..0445fe5 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -34,14 +34,6 @@ #include "screen.h" #include "client.h" -enum -{ - VBLANK_OFF = 0, - VBLANK_AUTO, - VBLANK_XPRESENT, - VBLANK_GLX -}; - gboolean compositorIsUsable (DisplayInfo *); gboolean compositorIsActive (ScreenInfo *); void compositorAddWindow (DisplayInfo *, @@ -87,4 +79,6 @@ void compositorWindowSetOpacity (DisplayInfo *, void compositorRebuildScreen (ScreenInfo *); gboolean compositorTestServer (DisplayInfo *); +vblankMode compositorVblankMode (const gchar *); + #endif /* INC_COMPOSITOR_H */ diff --git a/src/display.c b/src/display.c index 0bb1698..b885307 100644 --- a/src/display.c +++ b/src/display.c @@ -1073,4 +1073,3 @@ myDisplayGetKeymap (DisplayInfo *display_info) return gdk_keymap_get_default (); #endif } - diff --git a/src/display.h b/src/display.h index 7fdeb9a..23e0f21 100644 --- a/src/display.h +++ b/src/display.h @@ -320,7 +320,6 @@ struct _DisplayInfo guint32 last_user_time; gboolean enable_compositor; - gint vblank_method; #ifdef HAVE_RENDER gint render_error_base; @@ -427,5 +426,4 @@ gint myDisplayErrorTrapPop (DisplayInfo *); void myDisplayErrorTrapPopIgnored (DisplayInfo *); void myDisplayBeep (DisplayInfo *); GdkKeymap *myDisplayGetKeymap (DisplayInfo *); - #endif /* INC_DISPLAY_H */ diff --git a/src/main.c b/src/main.c index 4f2b897..ae7c252 100644 --- a/src/main.c +++ b/src/main.c @@ -89,7 +89,6 @@ enum { }; static gint compositor = COMPOSITOR_MODE_MANUAL; -static gint vblank_method = VBLANK_AUTO; #define XFWM4_ERROR (xfwm4_error_quark ()) #ifndef DEBUG @@ -462,43 +461,6 @@ 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_method = VBLANK_XPRESENT; - } - else -#endif /* HAVE_PRESENT_EXTENSION */ -#ifdef HAVE_EPOXY - if (strcmp (value, "glx") == 0) - { - vblank_method = VBLANK_GLX; - } - else -#endif /* HAVE_EPOXY */ - if (strcmp (value, "off") == 0) - { - vblank_method = VBLANK_OFF; - } - else - { - g_set_error (error, XFWM4_ERROR, 0, "Unrecognized compositor option \"%s\"", value); - succeed = FALSE; - } - - return succeed; -} #endif /* HAVE_COMPOSITOR */ static gboolean @@ -537,7 +499,6 @@ initialize (gint compositor_mode, gboolean replace_wm) { display_info->enable_compositor = FALSE; } - display_info->vblank_method = vblank_method; compositorSetCompositeMode (display_info, (compositor_mode == COMPOSITOR_MODE_MANUAL)); #else /* HAVE_COMPOSITOR */ display_info->enable_compositor = FALSE; @@ -691,14 +652,6 @@ 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 }, diff --git a/src/screen.h b/src/screen.h index 01bc61c..3c8a843 100644 --- a/src/screen.h +++ b/src/screen.h @@ -68,6 +68,15 @@ struct _gaussian_conv { double *data; }; typedef struct _gaussian_conv gaussian_conv; + +typedef enum +{ + VBLANK_OFF = 0, + VBLANK_AUTO, + VBLANK_XPRESENT, + VBLANK_GLX, + VBLANK_ERROR, +} vblankMode; #endif /* HAVE_COMPOSITOR */ struct _ScreenInfo @@ -205,6 +214,8 @@ struct _ScreenInfo gboolean use_glx; gboolean use_present; + vblankMode vblank_mode; + #ifdef HAVE_EPOXY gboolean texture_inverted; diff --git a/src/settings.c b/src/settings.c index 8474c2e..7dbcffc 100644 --- a/src/settings.c +++ b/src/settings.c @@ -702,7 +702,7 @@ loadSettings (ScreenInfo *screen_info) {"snap_to_border", NULL, G_TYPE_BOOLEAN, TRUE}, {"snap_to_windows", NULL, G_TYPE_BOOLEAN, TRUE}, {"snap_width", NULL, G_TYPE_INT, TRUE}, - {"sync_to_vblank", NULL, G_TYPE_BOOLEAN, TRUE}, + {"vblank_mode", NULL, G_TYPE_STRING, FALSE}, {"theme", NULL, G_TYPE_STRING, TRUE}, {"tile_on_move", NULL, G_TYPE_BOOLEAN, TRUE}, {"title_alignment", NULL, G_TYPE_STRING, TRUE}, @@ -880,6 +880,12 @@ loadSettings (ScreenInfo *screen_info) workspaceSetCount (screen_info, (guint) MAX (getIntValue ("workspace_count", rc), 1)); } + value = getStringValue ("vblank_mode", rc); + if (value) + { + screen_info->vblank_mode = compositorVblankMode (value); + } + freeRc (rc); return TRUE; } @@ -1114,6 +1120,10 @@ cb_xfwm4_channel_property_changed(XfconfChannel *channel, const gchar *property_ { /* These properties are not configurable via xfconf */ } + else if (!strcmp (name, "vblank_mode")) + { + /* This property is set at startup only */ + } else { g_warning("The property '%s' of type string is not supported", property_name); -- To stop receiving notification emails like this one, please contact the administrator of this repository. _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits