View | Details | Raw Unified | Return to bug 221548 | Differences between
and this patch

Collapse All | Expand All

(-)www/surf/Makefile (-39 / +25 lines)
Lines 2-66 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	surf
4
PORTNAME=	surf
5
PORTVERSION=	0.7
5
DISTVERSION=	2.0
6
CATEGORIES=	www
6
CATEGORIES=	www
7
MASTER_SITES=	http://dl.suckless.org/${PORTNAME}/
7
MASTER_SITES=	http://dl.suckless.org/${PORTNAME}/
8
PKGNAMESUFFIX=	-browser
8
PKGNAMESUFFIX=	-browser
9
9
10
MAINTAINER=	ports@FreeBSD.org
10
MAINTAINER=	dg@syrec.org
11
COMMENT=	Simple Web browser based on WebKit/Gtk+
11
COMMENT=	Simple Web browser based on WebKit2/GTK+
12
12
13
LICENSE=	MIT
13
LICENSE=	MIT
14
LICENSE_FILE=	${WRKSRC}/LICENSE
14
LICENSE_FILE=	${WRKSRC}/LICENSE
15
15
16
LIB_DEPENDS=	libwebkitgtk-1.0.so:www/webkit-gtk2
16
LIB_DEPENDS=	libwebkit2gtk-4.0.so:www/webkit2-gtk3 \
17
RUN_DEPENDS=	dmenu:x11/dmenu
17
		libsoup-2.4.so:devel/libsoup
18
RUN_DEPENDS=	dmenu:x11/dmenu \
19
		curl:ftp/curl \
20
		xterm:x11/xterm
18
21
19
USE_GNOME=	gtk20
22
USES=		pkgconfig
23
USE_GNOME=	gtk30 pango cairo gdkpixbuf2
20
USE_XORG=	x11
24
USE_XORG=	x11
21
USES=		pkgconfig
22
25
26
CONFLICTS=	surf-1* # math/surf
27
28
PLIST_FILES=	bin/surf \
29
		man/man1/surf.1.gz \
30
		share/pixmaps/surf.png
23
PORTDOCS=	FAQ.md README TODO.md
31
PORTDOCS=	FAQ.md README TODO.md
24
PORTEXAMPLES=	surf-open.sh
32
PORTEXAMPLES=	surf-open.sh
25
PLIST_FILES=	bin/surf man/man1/surf.1.gz share/pixmaps/surf.png
26
33
27
DESKTOP_ENTRIES="Surf" "" "${PREFIX}/share/pixmaps/surf.png" "surf" "" true
34
DESKTOP_ENTRIES="Surf" "" "${PREFIX}/share/pixmaps/surf.png" "surf" "" true
28
35
29
CONFLICTS=	surf-1* # math/surf
36
OPTIONS_DEFINE=	DOCS EXAMPLES
30
37
31
OPTIONS_DEFINE=	BUILTIN_DOWNLOAD DOCS EXAMPLES
32
OPTIONS_SINGLE=	TOOLKIT
33
OPTIONS_SINGLE_TOOLKIT=	GTK2 GTK3
34
OPTIONS_DEFAULT=	GTK2
35
36
# http://surf.suckless.org/patches/download
37
# http://surf.suckless.org/patches/smoothscrolling-via-GTK3
38
BUILTIN_DOWNLOAD_DESC=	Built-in download support
39
BUILTIN_DOWNLOAD_CFLAGS=	-DBUILTIN_DOWNLOAD
40
GTK2_LIB_DEPENDS=	libwebkitgtk-1.0.so:www/webkit-gtk2
41
GTK2_USE=		gnome=gtk20
42
GTK2_MAKE_ENV=		GTKINC="$$(pkg-config --cflags webkit-1.0)" \
43
			GTKLIB="$$(pkg-config --libs webkit-1.0)"
44
GTK3_LIB_DEPENDS=	libwebkitgtk-3.0.so:www/webkit-gtk3
45
GTK3_USE=		gnome=gtk30
46
GTK3_MAKE_ENV=		GTKINC="$$(pkg-config --cflags webkitgtk-3.0)" \
47
			GTKLIB="$$(pkg-config --libs webkitgtk-3.0)"
48
TOOLKIT_DESC=		Gtk+ toolkit
49
50
.include <bsd.port.options.mk>
51
52
pre-everything::
38
pre-everything::
53
	@${ECHO_MSG} "You can build surf with your own config.h using the SURF_CONF knob:"
39
	@${ECHO_MSG} "You can build surf with your own config.h using the SURF_CONF knob:"
54
	@${ECHO_MSG} "make SURF_CONF=/path/to/surf/config.h install clean"
40
	@${ECHO_MSG} "make SURF_CONF=/path/to/surf/config.h install clean"
41
	@${ECHO_MSG} "Note: Pre-${PORTVERSION} config.h-files may not work."
55
42
56
post-extract:
43
post-extract:
57
.if defined(SURF_CONF)
44
.if defined(SURF_CONF)
58
	@${ECHO_MSG} "creating config.h from ${SURF_CONF}"
45
	@${ECHO_MSG} "creating config.h from ${SURF_CONF}"
59
	@${CP} ${SURF_CONF} ${WRKSRC}/config.h
46
	@${LN} -sf ${SURF_CONF} ${WRKSRC}/config.h
60
.endif
47
.endif
61
48
62
post-patch:
49
post-patch:
63
	${REINPLACE_CMD} -e \
50
	@${REINPLACE_CMD} -e \
64
		'/^PREFIX/s| =| ?=| ; \
51
		'/^PREFIX/s| =| ?=| ; \
65
		/^MANPREFIX/s|/share/man|/man| ; \
52
		/^MANPREFIX/s|/share/man|/man| ; \
66
		/^X11/s|/usr/X11R6/|$${LOCALBASE}/| ; \
53
		/^X11/s|/usr/X11R6/|$${LOCALBASE}/| ; \
Lines 74-92 Link Here
74
		/^LDFLAGS/s| =| +=| ; \
61
		/^LDFLAGS/s| =| +=| ; \
75
		/^LDFLAGS/s|-g || ; \
62
		/^LDFLAGS/s|-g || ; \
76
		/^CC/s| =| ?=|' ${WRKSRC}/config.mk
63
		/^CC/s| =| ?=|' ${WRKSRC}/config.mk
64
	@${REINPLACE_CMD} -e 's|st -e|xterm -e|' ${WRKSRC}/config.def.h
77
65
78
post-install:
66
post-install:
79
	${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/surf
67
	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/surf
80
	(cd ${WRKSRC} && ${INSTALL_DATA} surf.png \
68
	(cd ${WRKSRC} && ${INSTALL_DATA} surf.png ${STAGEDIR}${PREFIX}/share/pixmaps)
81
		${STAGEDIR}${PREFIX}/share/pixmaps)
82
69
83
post-install-DOCS-on:
70
post-install-DOCS-on:
84
	${MKDIR} ${STAGEDIR}${DOCSDIR}
71
	@${MKDIR} ${STAGEDIR}${DOCSDIR}
85
	(cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${STAGEDIR}${DOCSDIR})
72
	(cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${STAGEDIR}${DOCSDIR})
86
73
87
post-install-EXAMPLES-on:
74
post-install-EXAMPLES-on:
88
	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
75
	@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
89
	(cd ${WRKSRC} && ${INSTALL_DATA} ${PORTEXAMPLES} \
76
	(cd ${WRKSRC} && ${INSTALL_DATA} ${PORTEXAMPLES} ${STAGEDIR}${EXAMPLESDIR})
90
		${STAGEDIR}${EXAMPLESDIR})
91
77
92
.include <bsd.port.mk>
78
.include <bsd.port.mk>
(-)www/surf/distinfo (-2 / +3 lines)
Lines 1-2 Link Here
1
SHA256 (surf-0.7.tar.gz) = 95608546fb64d01c7a8153c356be0e284ebe120c3c596a94eb3f3ad47e1c494a
1
TIMESTAMP = 1502724289
2
SIZE (surf-0.7.tar.gz) = 18792
2
SHA256 (surf-2.0.tar.gz) = faee4c7a62c38fc9791eff1ad06787c3c9b2b79f338806827f5152a7bc54951d
3
SIZE (surf-2.0.tar.gz) = 19056
(-)www/surf/files/patch-config.def.h (-73 lines)
Lines 1-73 Link Here
1
--- config.def.h.orig	2015-12-19 14:59:30 UTC
2
+++ config.def.h
3
@@ -22,6 +22,10 @@ static char *cafile         = "/etc/ssl/
4
 static Bool strictssl       = FALSE; /* Refuse untrusted SSL connections */
5
 static time_t sessiontime   = 3600;
6
 
7
+#ifdef BUILTIN_DOWNLOAD
8
+static char *downdir        = "/tmp";
9
+#endif
10
+
11
 /* Webkit default features */
12
 static Bool enablescrollbars      = TRUE;
13
 static Bool enablespatialbrowsing = TRUE;
14
@@ -84,6 +88,51 @@ static SiteStyle styles[] = {
15
  */
16
 static Key keys[] = {
17
 	/* modifier             keyval      function    arg             Focus */
18
+#if GTK_MAJOR_VERSION >= 3
19
+	{ MODKEY|GDK_SHIFT_MASK,GDK_KEY_r,      reload,     { .b = TRUE } },
20
+	{ MODKEY,               GDK_KEY_r,      reload,     { .b = FALSE } },
21
+	{ MODKEY|GDK_SHIFT_MASK,GDK_KEY_p,      print,      { 0 } },
22
+
23
+	{ MODKEY,               GDK_KEY_p,      clipboard,  { .b = TRUE } },
24
+	{ MODKEY,               GDK_KEY_y,      clipboard,  { .b = FALSE } },
25
+
26
+	{ MODKEY|GDK_SHIFT_MASK,GDK_KEY_j,      zoom,       { .i = -1 } },
27
+	{ MODKEY|GDK_SHIFT_MASK,GDK_KEY_k,      zoom,       { .i = +1 } },
28
+	{ MODKEY|GDK_SHIFT_MASK,GDK_KEY_q,      zoom,       { .i = 0  } },
29
+	{ MODKEY,               GDK_KEY_minus,  zoom,       { .i = -1 } },
30
+	{ MODKEY,               GDK_KEY_plus,   zoom,       { .i = +1 } },
31
+
32
+	{ MODKEY,               GDK_KEY_l,      navigate,   { .i = +1 } },
33
+	{ MODKEY,               GDK_KEY_h,      navigate,   { .i = -1 } },
34
+
35
+	{ MODKEY,               GDK_KEY_j,      scroll_v,   { .i = +1 } },
36
+	{ MODKEY,               GDK_KEY_k,      scroll_v,   { .i = -1 } },
37
+	{ MODKEY,               GDK_KEY_b,      scroll_v,   { .i = -10000 } },
38
+	{ MODKEY,               GDK_KEY_space,  scroll_v,   { .i = +10000 } },
39
+	{ MODKEY,               GDK_KEY_i,      scroll_h,   { .i = +1 } },
40
+	{ MODKEY,               GDK_KEY_u,      scroll_h,   { .i = -1 } },
41
+
42
+	{ 0,                    GDK_KEY_F11,    fullscreen, { 0 } },
43
+	{ 0,                    GDK_KEY_Escape, stop,       { 0 } },
44
+	{ MODKEY,               GDK_KEY_o,      source,     { 0 } },
45
+	{ MODKEY|GDK_SHIFT_MASK,GDK_KEY_o,      inspector,  { 0 } },
46
+
47
+	{ MODKEY,               GDK_KEY_g,      spawn,      SETPROP("_SURF_URI", "_SURF_GO") },
48
+	{ MODKEY,               GDK_KEY_f,      spawn,      SETPROP("_SURF_FIND", "_SURF_FIND") },
49
+	{ MODKEY,               GDK_KEY_slash,  spawn,      SETPROP("_SURF_FIND", "_SURF_FIND") },
50
+
51
+	{ MODKEY,               GDK_KEY_n,      find,       { .b = TRUE } },
52
+	{ MODKEY|GDK_SHIFT_MASK,GDK_KEY_n,      find,       { .b = FALSE } },
53
+
54
+	{ MODKEY|GDK_SHIFT_MASK,GDK_KEY_c,      toggle,     { .v = "enable-caret-browsing" } },
55
+	{ MODKEY|GDK_SHIFT_MASK,GDK_KEY_i,      toggle,     { .v = "auto-load-images" } },
56
+	{ MODKEY|GDK_SHIFT_MASK,GDK_KEY_s,      toggle,     { .v = "enable-scripts" } },
57
+	{ MODKEY|GDK_SHIFT_MASK,GDK_KEY_v,      toggle,     { .v = "enable-plugins" } },
58
+	{ MODKEY|GDK_SHIFT_MASK,GDK_KEY_a,      togglecookiepolicy, { 0 } },
59
+	{ MODKEY|GDK_SHIFT_MASK,GDK_KEY_m,      togglestyle, { 0 } },
60
+	{ MODKEY|GDK_SHIFT_MASK,GDK_KEY_b,      togglescrollbars, { 0 } },
61
+	{ MODKEY|GDK_SHIFT_MASK,GDK_KEY_g,      togglegeolocation, { 0 } },
62
+#else
63
 	{ MODKEY|GDK_SHIFT_MASK,GDK_r,      reload,     { .b = TRUE } },
64
 	{ MODKEY,               GDK_r,      reload,     { .b = FALSE } },
65
 	{ MODKEY|GDK_SHIFT_MASK,GDK_p,      print,      { 0 } },
66
@@ -127,6 +176,7 @@ static Key keys[] = {
67
 	{ MODKEY|GDK_SHIFT_MASK,GDK_m,      togglestyle, { 0 } },
68
 	{ MODKEY|GDK_SHIFT_MASK,GDK_b,      togglescrollbars, { 0 } },
69
 	{ MODKEY|GDK_SHIFT_MASK,GDK_g,      togglegeolocation, { 0 } },
70
+#endif
71
 };
72
 
73
 /* button definitions */
(-)www/surf/files/patch-surf.c (-329 lines)
Lines 1-329 Link Here
1
--- surf.c.orig	2015-12-19 14:59:30 UTC
2
+++ surf.c
3
@@ -6,6 +6,9 @@
4
 #include <X11/X.h>
5
 #include <X11/Xatom.h>
6
 #include <gtk/gtk.h>
7
+#if GTK_MAJOR_VERSION >= 3
8
+#include <gtk/gtkx.h>
9
+#endif
10
 #include <gdk/gdkx.h>
11
 #include <gdk/gdk.h>
12
 #include <gdk/gdkkeysyms.h>
13
@@ -99,7 +102,11 @@ typedef struct {
14
 static Display *dpy;
15
 static Atom atoms[AtomLast];
16
 static Client *clients = NULL;
17
+#if GTK_MAJOR_VERSION >= 3
18
+static Window embed = 0;
19
+#else
20
 static GdkNativeWindow embed = 0;
21
+#endif
22
 static gboolean showxid = FALSE;
23
 static char winid[64];
24
 static gboolean usingproxy = 0;
25
@@ -213,6 +220,10 @@ static void windowobjectcleared(GtkWidge
26
                                 JSContextRef js, JSObjectRef win, Client *c);
27
 static void zoom(Client *c, const Arg *arg);
28
 
29
+#ifdef BUILTIN_DOWNLOAD
30
+static void download(WebKitDownload *o, GParamSpec *pspec, Client *c);
31
+#endif
32
+
33
 /* configuration, allows nested code to access above variables */
34
 #include "config.h"
35
 
36
@@ -451,6 +462,52 @@ cookiepolicy_set(const SoupCookieJarAcce
37
 	return 'A';
38
 }
39
 
40
+#ifdef BUILTIN_DOWNLOAD
41
+struct client_size_tuple {
42
+	Client* c;
43
+	gint s;
44
+};
45
+
46
+static void
47
+late_download_update(WebKitWebView* view, GParamSpec *pspec, struct client_size_tuple* t){
48
+	char script[1024]; char* s= script;
49
+	snprintf(script, 1024, "c(%d, %d)", t->s, t->s);
50
+	const Arg a= {.v = (void*) &s};
51
+	eval(t->c, &a);
52
+	free(t);
53
+}
54
+
55
+static void
56
+download(WebKitDownload *o, GParamSpec *pspec, Client *c) {
57
+	WebKitDownloadStatus status;
58
+	char script[2048]; char* s= script;
59
+
60
+	status = webkit_download_get_status(o);
61
+	if(status == WEBKIT_DOWNLOAD_STATUS_STARTED || status == WEBKIT_DOWNLOAD_STATUS_CREATED) {
62
+		snprintf(script, 2048, "u(%d, %d, %d)",
63
+			(gint)webkit_download_get_current_size(o),
64
+			(gint)webkit_download_get_total_size(o),
65
+			(gint)(webkit_download_get_progress(o) * 100));
66
+		const Arg a= {.v = (void*) &s};
67
+		eval(c, &a);
68
+	}
69
+	else if (status == WEBKIT_DOWNLOAD_STATUS_FINISHED){
70
+		if( webkit_web_view_get_load_status(c->view) == WEBKIT_LOAD_FINISHED ){
71
+			snprintf(script, 2048, "c(%d, %d)",
72
+				(gint)webkit_download_get_current_size(o),
73
+				(gint)webkit_download_get_total_size(o));
74
+			const Arg a= {.v = (void*) &s};
75
+			eval(c, &a);
76
+		}
77
+		else {
78
+			struct client_size_tuple* t= calloc(1, sizeof(struct client_size_tuple));
79
+			t->c= c; t->s= (gint)webkit_download_get_current_size(o);
80
+			g_signal_connect(c->view, "document-load-finished", G_CALLBACK(late_download_update), t);
81
+		}
82
+	}
83
+}
84
+#endif
85
+
86
 void
87
 evalscript(JSContextRef js, char *script, char* scriptname)
88
 {
89
@@ -625,7 +682,11 @@ getatom(Client *c, int a)
90
 	unsigned long ldummy;
91
 	unsigned char *p = NULL;
92
 
93
+#if GTK_MAJOR_VERSION >= 3
94
+	XGetWindowProperty(dpy, GDK_WINDOW_XID(gtk_widget_get_window(GTK_WIDGET(c->win))),
95
+#else
96
 	XGetWindowProperty(dpy, GDK_WINDOW_XID(GTK_WIDGET(c->win)->window),
97
+#endif
98
 	                   atoms[a], 0L, BUFSIZ, False, XA_STRING,
99
 	                   &adummy, &idummy, &ldummy, &ldummy, &p);
100
 	if (p)
101
@@ -685,12 +746,114 @@ handleplumb(Client *c, WebKitWebView *w,
102
 gboolean
103
 initdownload(WebKitWebView *view, WebKitDownload *o, Client *c)
104
 {
105
+#ifdef BUILTIN_DOWNLOAD
106
+	gchar *uri, *path;
107
+	const gchar *filename;
108
+	Client *n;
109
+	const char template[] =
110
+"<html>" \
111
+"<head>" \
112
+"<title>Download - %s</title>" \
113
+"<script>" \
114
+"function formText(x){" \
115
+"  if(x >= 1073741824)  { return (Math.floor(x/10737418.24)/100) + \"G\"; }" \
116
+"  else if(x >= 1048576){ return (Math.floor(x/10485.76)/100) + \"M\"; }" \
117
+"  else if(x >= 1024)   { return (Math.floor(x/10.24)/100) + \"k\"; }" \
118
+"  else                 { return x+\"b\"; }" \
119
+"}" \
120
+"function updateText(c,t){" \
121
+"  txt= formText(c) + \"/\" + formText(t);" \
122
+"  DLTEXT.textContent= txt;" \
123
+"  /* center text in bar */" \
124
+"  DLTEXT.setAttribute('x', 102-4.4*txt.length)" \
125
+"}" \
126
+"function c(c, t){" \
127
+"  DLGRAD.setAttribute('x2', 230);" \
128
+"  DLGRAD.setAttribute('x1', 205);" \
129
+"  updateText(c,t);" \
130
+"  document.getElementById('stop1').setAttribute('style', \"stop-color:#2020ff;\");" \
131
+"}" \
132
+"function u(c,t,p){" \
133
+"  DLGRAD.setAttribute('x2', Math.floor(p*205/100) + 25);" \
134
+"  DLGRAD.setAttribute('x1', Math.floor(p*205/100));" \
135
+"  updateText(c,t);" \
136
+"}" \
137
+"</script>" \
138
+"</head>" \
139
+"<body>" \
140
+"<center>" \
141
+"<h2>Downloading</h2>" \
142
+"<h3>%s</h3>" \
143
+"to %s<br/>" \
144
+"<svg" \
145
+"   xmlns:cc=\"http://creativecommons.org/ns#\"" \
146
+"   xmlns:svg=\"http://www.w3.org/2000/svg\"" \
147
+"   xmlns=\"http://www.w3.org/2000/svg\"" \
148
+"   xmlns:xlink=\"http://www.w3.org/1999/xlink\"" \
149
+"   width=\"210\"" \
150
+"   height=\"60\"" \
151
+"   id=\"download\">" \
152
+"  <defs>" \
153
+"    <linearGradient" \
154
+"       id=\"dlgradient\"" \
155
+"       x1=\"0\"" \
156
+"       y1=\"0\"" \
157
+"       x2=\"25\"" \
158
+"       y2=\"0\"" \
159
+"       gradientUnits=\"userSpaceOnUse\">" \
160
+"      <stop style=\"stop-color:#00ff00;\" offset=\"0\" id=\"stop1\" />" \
161
+"      <stop style=\"stop-color:#00ff00;stop-opacity:0;\" offset=\"1\" id=\"stop2\" />" \
162
+"    </linearGradient>" \
163
+"  </defs>" \
164
+"    <rect" \
165
+"       style=\"fill:url(#dlgradient);stroke:#000000;stroke-width:3\"" \
166
+"       id=\"rect2985\"" \
167
+"       width=\"200\"" \
168
+"       height=\"50\"" \
169
+"       x=\"5\"" \
170
+"       y=\"5\"" \
171
+"       ry=\"25\" />" \
172
+"    <text id=\"dltext\" x=\"92\" y=\"35\">0/0</text>" \
173
+"</svg>" \
174
+"</center>" \
175
+"<script>" \
176
+"DLGRAD= document.getElementById('dlgradient');" \
177
+"DLTEXT= document.getElementById('dltext');" \
178
+"</script>" \
179
+"</body>" \
180
+"</html>";
181
+	char html[sizeof(template)+2048];
182
+	filename = webkit_download_get_suggested_filename(o);
183
+
184
+	path = g_build_filename(downdir, filename, NULL);
185
+	uri = g_filename_to_uri(path, NULL, NULL);
186
+
187
+	webkit_download_set_destination_uri(o, uri);
188
+	webkit_download_start(o);
189
+
190
+	n = newclient();
191
+	snprintf(html, sizeof(template)+2048, template, filename, filename, path);
192
+	webkit_web_view_load_string(n->view, html, NULL, NULL, NULL);
193
+
194
+	g_signal_connect(o, "notify::progress", G_CALLBACK(download), n);
195
+	g_signal_connect(o, "notify::status", G_CALLBACK(download), n);
196
+
197
+	n->title = g_strdup_printf("Downloading %s", filename);
198
+	n->progress = 0;
199
+	updatetitle(n);
200
+
201
+	g_free(path);
202
+	g_free(uri);
203
+ 
204
+	return TRUE;
205
+#else
206
 	Arg arg;
207
 
208
 	updatewinid(c);
209
 	arg = (Arg)DOWNLOAD((char *)webkit_download_get_uri(o), geturi(c));
210
 	spawn(c, &arg);
211
 	return FALSE;
212
+#endif
213
 }
214
 
215
 void
216
@@ -873,6 +1036,9 @@ newclient(void)
217
 	GdkScreen *screen;
218
 	gdouble dpi;
219
 	char *ua;
220
+#if GTK_MAJOR_VERSION >= 3
221
+	GdkWindow *window;
222
+#endif
223
 
224
 	if (!(c = calloc(1, sizeof(Client))))
225
 		die("Cannot malloc!\n");
226
@@ -900,6 +1066,10 @@ newclient(void)
227
 		 */
228
 		gtk_window_set_role(GTK_WINDOW(c->win), "Surf");
229
 	}
230
+#if GTK_MAJOR_VERSION >= 3
231
+	gtk_widget_realize(GTK_WIDGET(c->win));
232
+	window = gtk_widget_get_window(GTK_WIDGET(c->win));
233
+#endif
234
 	gtk_window_set_default_size(GTK_WINDOW(c->win), 800, 600);
235
 	g_signal_connect(G_OBJECT(c->win),
236
 	                 "destroy",
237
@@ -912,10 +1082,18 @@ newclient(void)
238
 		addaccelgroup(c);
239
 
240
 	/* Pane */
241
+#if GTK_MAJOR_VERSION >= 3
242
+	c->pane = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
243
+#else
244
 	c->pane = gtk_vpaned_new();
245
+#endif
246
 
247
 	/* VBox */
248
+#if GTK_MAJOR_VERSION >= 3
249
+	c->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
250
+#else
251
 	c->vbox = gtk_vbox_new(FALSE, 0);
252
+#endif
253
 	gtk_paned_pack1(GTK_PANED(c->pane), c->vbox, TRUE, TRUE);
254
 
255
 	/* Webview */
256
@@ -997,8 +1175,13 @@ newclient(void)
257
 	gtk_widget_show(c->win);
258
 	gtk_window_set_geometry_hints(GTK_WINDOW(c->win), NULL, &hints,
259
 	                              GDK_HINT_MIN_SIZE);
260
+#if GTK_MAJOR_VERSION >= 3
261
+	gdk_window_set_events(window, GDK_ALL_EVENTS_MASK);
262
+	gdk_window_add_filter(window, processx, c);
263
+#else
264
 	gdk_window_set_events(GTK_WIDGET(c->win)->window, GDK_ALL_EVENTS_MASK);
265
 	gdk_window_add_filter(GTK_WIDGET(c->win)->window, processx, c);
266
+#endif
267
 	webkit_web_view_set_full_content_zoom(c->view, TRUE);
268
 
269
 	runscript(frame);
270
@@ -1032,7 +1215,11 @@ newclient(void)
271
 	 * It is equivalent to firefox's "layout.css.devPixelsPerPx" setting.
272
 	 */
273
 	if (zoomto96dpi) {
274
+#if GTK_MAJOR_VERSION >= 3
275
+		screen = gdk_window_get_screen(window);
276
+#else
277
 		screen = gdk_window_get_screen(GTK_WIDGET(c->win)->window);
278
+#endif
279
 		dpi = gdk_screen_get_resolution(screen);
280
 		if (dpi != -1) {
281
 			g_object_set(G_OBJECT(settings),
282
@@ -1071,7 +1258,11 @@ newclient(void)
283
 	if (showxid) {
284
 		gdk_display_sync(gtk_widget_get_display(c->win));
285
 		printf("%u\n",
286
+#if GTK_MAJOR_VERSION >= 3
287
+		       (guint)GDK_WINDOW_XID(window));
288
+#else
289
 		       (guint)GDK_WINDOW_XID(GTK_WIDGET(c->win)->window));
290
+#endif
291
 		fflush(NULL);
292
                 if (fclose(stdout) != 0) {
293
 			die("Error closing stdout");
294
@@ -1282,7 +1473,11 @@ void
295
 setatom(Client *c, int a, const char *v)
296
 {
297
 	XSync(dpy, False);
298
+#if GTK_MAJOR_VERSION >= 3
299
+	XChangeProperty(dpy, GDK_WINDOW_XID(gtk_widget_get_window(GTK_WIDGET(c->win))),
300
+#else
301
 	XChangeProperty(dpy, GDK_WINDOW_XID(GTK_WIDGET(c->win)->window),
302
+#endif
303
 	                atoms[a], XA_STRING, 8, PropModeReplace,
304
 	                (unsigned char *)v, strlen(v) + 1);
305
 }
306
@@ -1301,7 +1496,11 @@ setup(void)
307
 	sigchld(0);
308
 	gtk_init(NULL, NULL);
309
 
310
+#if GTK_MAJOR_VERSION >= 3
311
+	dpy = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
312
+#else
313
 	dpy = GDK_DISPLAY();
314
+#endif
315
 
316
 	/* atoms */
317
 	atoms[AtomFind] = XInternAtom(dpy, "_SURF_FIND", False);
318
@@ -1624,7 +1823,11 @@ void
319
 updatewinid(Client *c)
320
 {
321
 	snprintf(winid, LENGTH(winid), "%u",
322
+#if GTK_MAJOR_VERSION >= 3
323
+	         (int)GDK_WINDOW_XID(gtk_widget_get_window(GTK_WIDGET(c->win))));
324
+#else
325
 	         (int)GDK_WINDOW_XID(GTK_WIDGET(c->win)->window));
326
+#endif
327
 }
328
 
329
 void
(-)www/surf/pkg-descr (-1 / +1 lines)
Lines 1-4 Link Here
1
surf is a simple web browser based on WebKit/GTK+. It is able to display
1
surf is a simple web browser based on WebKit2/GTK+. It is able to display
2
websites and follow links. It supports the XEmbed protocol which makes
2
websites and follow links. It supports the XEmbed protocol which makes
3
it possible to embed it in another application. Furthermore, one can
3
it possible to embed it in another application. Furthermore, one can
4
point surf to another URI by setting its XProperties.
4
point surf to another URI by setting its XProperties.

Return to bug 221548