surf-notifications-20230403-665a709.diff (3843B)
1 From 3233530cdaa1dc06f007cfa54ee923b66b95dbf2 Mon Sep 17 00:00:00 2001 2 From: Randolph Sapp <rs@ti.com> 3 Date: Mon, 3 Apr 2023 15:29:39 -0500 4 Subject: [PATCH] surf: update notifications patch for latest 5 6 Update "notifications" patch for use with surf version 7 665a709b522a6fa18c671f1fc41297603292d0e8 8 9 Signed-off-by: Randolph Sapp <rs@ti.com> 10 --- 11 config.def.h | 2 ++ 12 surf.c | 16 +++++++++++++++- 13 2 files changed, 17 insertions(+), 1 deletion(-) 14 15 diff --git a/config.def.h b/config.def.h 16 index ca77061..12a598d 100644 17 --- a/config.def.h 18 +++ b/config.def.h 19 @@ -36,6 +36,7 @@ static Parameter defconfig[ParameterLast] = { 20 [KioskMode] = { { .i = 0 }, }, 21 [LoadImages] = { { .i = 1 }, }, 22 [MediaManualPlay] = { { .i = 1 }, }, 23 + [Notifications] = { { .i = 0 } }, 24 [PreferredLanguages] = { { .v = (char *[]){ NULL } }, }, 25 [RunInFullscreen] = { { .i = 0 }, }, 26 [ScrollBars] = { { .i = 1 }, }, 27 @@ -178,6 +179,7 @@ static Key keys[] = { 28 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_s, toggle, { .i = JavaScript } }, 29 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_i, toggle, { .i = LoadImages } }, 30 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_b, toggle, { .i = ScrollBars } }, 31 + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_l, toggle, { .i = Notifications } }, 32 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_t, toggle, { .i = StrictTLS } }, 33 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_m, toggle, { .i = Style } }, 34 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_d, toggle, { .i = DarkMode } }, 35 diff --git a/surf.c b/surf.c 36 index 001f776..7d34c9b 100644 37 --- a/surf.c 38 +++ b/surf.c 39 @@ -72,6 +72,7 @@ typedef enum { 40 KioskMode, 41 LoadImages, 42 MediaManualPlay, 43 + Notifications, 44 PreferredLanguages, 45 RunInFullscreen, 46 ScrollBars, 47 @@ -245,7 +246,7 @@ static void clicknewwindow(Client *c, const Arg *a, WebKitHitTestResult *h); 48 static void clickexternplayer(Client *c, const Arg *a, WebKitHitTestResult *h); 49 50 static char winid[64]; 51 -static char togglestats[11]; 52 +static char togglestats[12]; 53 static char pagestats[2]; 54 static Atom atoms[AtomLast]; 55 static Window embed; 56 @@ -680,6 +681,7 @@ gettogglestats(Client *c) 57 togglestats[7] = curconfig[FrameFlattening].val.i ? 'F' : 'f'; 58 togglestats[8] = curconfig[Certificate].val.i ? 'X' : 'x'; 59 togglestats[9] = curconfig[StrictTLS].val.i ? 'T' : 't'; 60 + togglestats[10] = curconfig[Notifications].val.i ? 'L' : 'l'; 61 } 62 63 void 64 @@ -828,6 +830,9 @@ setparameter(Client *c, int refresh, ParamName p, const Arg *a) 65 webkit_settings_set_media_playback_requires_user_gesture( 66 c->settings, a->i); 67 break; 68 + case Notifications: 69 + refresh = 0; 70 + return; 71 case PreferredLanguages: 72 return; /* do nothing */ 73 case RunInFullscreen: 74 @@ -1035,6 +1040,7 @@ newwindow(Client *c, const Arg *a, int noembed) 75 cmd[i++] = scriptfile; 76 } 77 cmd[i++] = curconfig[JavaScript].val.i ? "-S" : "-s"; 78 + cmd[i++] = curconfig[Notifications].val.i ? "-L" : "-l"; 79 cmd[i++] = curconfig[StrictTLS].val.i ? "-T" : "-t"; 80 if (fulluseragent && g_strcmp0(fulluseragent, "")) { 81 cmd[i++] = "-u"; 82 @@ -1628,6 +1634,8 @@ permissionrequested(WebKitWebView *v, WebKitPermissionRequest *r, Client *c) 83 else if (webkit_user_media_permission_is_for_video_device( 84 WEBKIT_USER_MEDIA_PERMISSION_REQUEST(r))) 85 param = AccessWebcam; 86 + } else if (WEBKIT_IS_NOTIFICATION_PERMISSION_REQUEST(r)) { 87 + param = Notifications; 88 } else { 89 return FALSE; 90 } 91 @@ -2092,6 +2100,12 @@ main(int argc, char *argv[]) 92 defconfig[KioskMode].val.i = 1; 93 defconfig[KioskMode].prio = 2; 94 break; 95 + case 'l': 96 + defconfig[Notifications].val.i = 0; 97 + break; 98 + case 'L': 99 + defconfig[Notifications].val.i = 1; 100 + break; 101 case 'm': 102 defconfig[Style].val.i = 0; 103 defconfig[Style].prio = 2; 104 -- 105 2.40.0 106