summaryrefslogtreecommitdiff
path: root/surf.c.diff
diff options
context:
space:
mode:
authormiguel <miguel@localhost>2018-03-10 19:00:32 +0100
committermiguel <miguel@localhost>2018-03-10 19:00:32 +0100
commit700a87f27c4c5d63b8350d37f06410081951addb (patch)
tree0bb7fa858936b37391fb93058056346ee4c5755d /surf.c.diff
first commit
Diffstat (limited to 'surf.c.diff')
-rw-r--r--surf.c.diff71
1 files changed, 71 insertions, 0 deletions
diff --git a/surf.c.diff b/surf.c.diff
new file mode 100644
index 0000000..329df08
--- /dev/null
+++ b/surf.c.diff
@@ -0,0 +1,71 @@
+diff --git a/surf.c b/surf.c
+index f01a91c..76d4706 100644
+--- a/surf.c
++++ b/surf.c
+@@ -2,6 +2,10 @@
+ *
+ * To understand surf, start reading main().
+ */
++
++#include <sys/ipc.h>
++#include <sys/shm.h>
++
+ #include <sys/file.h>
+ #include <sys/types.h>
+ #include <sys/wait.h>
+@@ -223,6 +227,7 @@ static void togglefullscreen(Client *c, const Arg *a);
+ static void togglecookiepolicy(Client *c, const Arg *a);
+ static void toggleinspector(Client *c, const Arg *a);
+ static void find(Client *c, const Arg *a);
++static void domlinks(Client *c, const Arg *a);
+
+ /* Buttons */
+ static void clicknavigate(Client *c, const Arg *a, WebKitHitTestResult *h);
+@@ -2052,3 +2057,47 @@ main(int argc, char *argv[])
+
+ return 0;
+ }
++
++void
++domlinks(Client *c, const Arg *a)
++{
++ static int goto_link=0;
++ int digit=a->i;
++
++ // follow link
++ if(digit==99)
++ {
++ printf("follow link %i\n",goto_link);
++
++ key_t my_ftok = ftok("~/surf-webext-dom-shared-mem",'a');
++ int mem_seg=shmget(my_ftok,1024*1024,IPC_CREAT|0660);
++ if(mem_seg==-1)
++ {
++ g_print("shmget failed\n");
++ }
++ char *shared_buf=shmat(mem_seg,NULL,0);
++ if(shared_buf==(void*)-1)
++ {
++ g_print("shmat failed\n");
++ }
++
++ printf("linking to : %s\n",&(shared_buf[goto_link*1024]));
++ Arg aa = {.v = &(shared_buf[goto_link*1024]) };
++ loaduri(c, &aa);
++ goto_link=0;
++ return;
++ }
++
++ // adjust link number
++ if(goto_link==0)
++ {
++ goto_link=digit;
++ }
++ else
++ {
++ goto_link*=10;
++ goto_link+=digit;
++ }
++ printf("update link num to: %i\n",goto_link);
++
++}