From 700a87f27c4c5d63b8350d37f06410081951addb Mon Sep 17 00:00:00 2001 From: miguel Date: Sat, 10 Mar 2018 19:00:32 +0100 Subject: first commit --- surf.c.diff | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 surf.c.diff (limited to 'surf.c.diff') 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 ++#include ++ + #include + #include + #include +@@ -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); ++ ++} -- cgit v1.2.3