Add a few configuration options

“enable-accelerated-2d-canvas”
“media-playback-requires-user-gesture”
“enable-site-specific-quirks”

Lookup those at
https://webkitgtk.org/reference/webkit2gtk/stable/WebKitSettings.html
This commit is contained in:
Quentin Rameau 2016-07-05 17:26:54 +02:00
parent 5a02d3e500
commit 4c41d363b7
2 changed files with 18 additions and 0 deletions

View File

@ -8,6 +8,7 @@ static char *cookiefile = "~/.surf/cookies.txt";
/* Webkit default features */ /* Webkit default features */
static Parameter defconfig[ParameterLast] = { static Parameter defconfig[ParameterLast] = {
SETB(AcceleratedCanvas, 1),
SETB(CaretBrowsing, 0), SETB(CaretBrowsing, 0),
SETV(CookiePolicies, "@Aa"), SETV(CookiePolicies, "@Aa"),
SETB(DiskCache, 1), SETB(DiskCache, 1),
@ -20,11 +21,13 @@ static Parameter defconfig[ParameterLast] = {
SETB(JavaScript, 1), SETB(JavaScript, 1),
SETB(KioskMode, 0), SETB(KioskMode, 0),
SETB(LoadImages, 1), SETB(LoadImages, 1),
SETB(MediaManualPlay, 0),
SETB(Plugins, 1), SETB(Plugins, 1),
SETV(PreferredLanguages, ((char *[]){ NULL })), SETV(PreferredLanguages, ((char *[]){ NULL })),
SETB(RunInFullscreen, 0), SETB(RunInFullscreen, 0),
SETB(ScrollBars, 1), SETB(ScrollBars, 1),
SETB(ShowIndicators, 1), SETB(ShowIndicators, 1),
SETB(SiteQuirks, 1),
SETB(SpellChecking, 0), SETB(SpellChecking, 0),
SETV(SpellLanguages, ((char *[]){ "en_US", NULL })), SETV(SpellLanguages, ((char *[]){ "en_US", NULL })),
SETB(StrictSSL, 0), SETB(StrictSSL, 0),

15
surf.c
View File

@ -58,6 +58,7 @@ enum {
}; };
typedef enum { typedef enum {
AcceleratedCanvas,
CaretBrowsing, CaretBrowsing,
CookiePolicies, CookiePolicies,
DiskCache, DiskCache,
@ -70,11 +71,13 @@ typedef enum {
JavaScript, JavaScript,
KioskMode, KioskMode,
LoadImages, LoadImages,
MediaManualPlay,
Plugins, Plugins,
PreferredLanguages, PreferredLanguages,
RunInFullscreen, RunInFullscreen,
ScrollBars, ScrollBars,
ShowIndicators, ShowIndicators,
SiteQuirks,
SpellChecking, SpellChecking,
SpellLanguages, SpellLanguages,
StrictSSL, StrictSSL,
@ -611,6 +614,9 @@ setparameter(Client *c, int refresh, ParamName p, const Arg *a)
WebKitSettings *s = webkit_web_view_get_settings(c->view); WebKitSettings *s = webkit_web_view_get_settings(c->view);
switch (p) { switch (p) {
case AcceleratedCanvas:
webkit_settings_set_enable_accelerated_2d_canvas(s, a->b);
break;
case CaretBrowsing: case CaretBrowsing:
webkit_settings_set_enable_caret_browsing(s, a->b); webkit_settings_set_enable_caret_browsing(s, a->b);
refresh = 0; refresh = 0;
@ -655,6 +661,9 @@ setparameter(Client *c, int refresh, ParamName p, const Arg *a)
case LoadImages: case LoadImages:
webkit_settings_set_auto_load_images(s, a->b); webkit_settings_set_auto_load_images(s, a->b);
break; break;
case MediaManualPlay:
webkit_settings_set_media_playback_requires_user_gesture(s, a->b);
break;
case Plugins: case Plugins:
webkit_settings_set_enable_plugins(s, a->b); webkit_settings_set_enable_plugins(s, a->b);
break; break;
@ -672,6 +681,9 @@ setparameter(Client *c, int refresh, ParamName p, const Arg *a)
return; /* do not update */ return; /* do not update */
case ShowIndicators: case ShowIndicators:
break; break;
case SiteQuirks:
webkit_settings_set_enable_site_specific_quirks(s, a->b);
break;
case SpellChecking: case SpellChecking:
webkit_web_context_set_spell_checking_enabled( webkit_web_context_set_spell_checking_enabled(
webkit_web_view_get_context(c->view), a->b); webkit_web_view_get_context(c->view), a->b);
@ -900,6 +912,9 @@ newview(Client *c, WebKitWebView *rv)
"enable-html5-local-storage", curconfig[DiskCache].val.b, "enable-html5-local-storage", curconfig[DiskCache].val.b,
"enable-javascript", curconfig[JavaScript].val.b, "enable-javascript", curconfig[JavaScript].val.b,
"enable-plugins", curconfig[Plugins].val.b, "enable-plugins", curconfig[Plugins].val.b,
"enable-accelerated-2d-canvas", curconfig[AcceleratedCanvas].val.b,
"enable-site-specific-quirks", curconfig[SiteQuirks].val.b,
"media-playback-requires-user-gesture", curconfig[MediaManualPlay].val.b,
NULL); NULL);
/* For mor interesting settings, have a look at /* For mor interesting settings, have a look at
* http://webkitgtk.org/reference/webkit2gtk/stable/WebKitSettings.html */ * http://webkitgtk.org/reference/webkit2gtk/stable/WebKitSettings.html */