about summary refs log tree commit diff
path: root/surf.c
diff options
context:
space:
mode:
authorEnno Boland (Gottox) <gottox@s01.de>2009-06-09 22:08:59 +0200
committerEnno Boland (Gottox) <gottox@s01.de>2009-06-09 22:08:59 +0200
commite6feabb4f6ef0a19202fb1e3b11ad8b9f4771dc7 (patch)
treeee96ee29393c7378555a1b41d1cd74543329c567 /surf.c
parentgetting rid or most gpointers, sorting functions alphabetical, using gchar * ... (diff)
downloadsurf-e6feabb4f6ef0a19202fb1e3b11ad8b9f4771dc7.tar.gz
surf-e6feabb4f6ef0a19202fb1e3b11ad8b9f4771dc7.tar.bz2
surf-e6feabb4f6ef0a19202fb1e3b11ad8b9f4771dc7.zip
added apos p/y-patch, thanks :)
Diffstat (limited to 'surf.c')
-rw-r--r--surf.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/surf.c b/surf.c
index 4bbe95d..ec846ad 100644
--- a/surf.c
+++ b/surf.c
@@ -53,6 +53,7 @@ static void loadfile(Client *c, const gchar *f);
 static void loaduri(Client *c, const gchar *uri);
 static Client *newclient();
 static WebKitWebView *newwindow(WebKitWebView  *v, WebKitWebFrame *f, Client *c);
+static void pasteurl(GtkClipboard *clipboard, const gchar *text, gpointer d);
 static GdkFilterReturn processx(GdkXEvent *xevent, GdkEvent *event, gpointer d);
 static void progresschange(WebKitWebView *view, gint p, Client *c);
 static void setup(void);
@@ -198,6 +199,12 @@ keypress(GtkWidget* w, GdkEventKey *ev, Client *c) {
 	}
 	if(ev->state & GDK_CONTROL_MASK) {
 		switch(ev->keyval) {
+		case GDK_p:
+			gtk_clipboard_request_text(gtk_clipboard_get(GDK_SELECTION_PRIMARY), pasteurl, c);
+			return TRUE;
+		case GDK_y:
+			gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_PRIMARY), webkit_web_view_get_uri(c->view), -1);
+			return TRUE;
 		case GDK_r:
 		case GDK_R:
 			if((ev->state & GDK_SHIFT_MASK))
@@ -399,6 +406,13 @@ newwindow(WebKitWebView  *v, WebKitWebFrame *f, Client *c) {
 	return n->view;
 }
 
+ 
+void
+pasteurl(GtkClipboard *clipboard, const gchar *text, gpointer d) {
+	if(text!=NULL)
+		loaduri((Client *)d, text);
+}
+
 GdkFilterReturn
 processx(GdkXEvent *e, GdkEvent *event, gpointer d) {
 	Client *c = (Client *)d;