pinosaur
/
surf.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix usage(), -m and -M for styles were absent.
[surf.git]
/
surf.c
diff --git
a/surf.c
b/surf.c
index
55ffd84
..
ff2496d
100644
(file)
--- a/
surf.c
+++ b/
surf.c
@@
-155,6
+155,7
@@
static void gettogglestat(Client *c);
static void getpagestat(Client *c);
static char *geturi(Client *c);
static const gchar *getstyle(const char *uri);
static void getpagestat(Client *c);
static char *geturi(Client *c);
static const gchar *getstyle(const char *uri);
+static void setstyle(Client *c, const char *style);
static void handleplumb(Client *c, WebKitWebView *w, const gchar *uri);
static void handleplumb(Client *c, WebKitWebView *w, const gchar *uri);
@@
-662,6
+663,14
@@
getstyle(const char *uri)
return "";
}
return "";
}
+void
+setstyle(Client *c, const char *style)
+{
+ WebKitWebSettings *settings = webkit_web_view_get_settings(c->view);
+
+ g_object_set(G_OBJECT(settings), "user-stylesheet-uri", style, NULL);
+}
+
void
handleplumb(Client *c, WebKitWebView *w, const gchar *uri)
{
void
handleplumb(Client *c, WebKitWebView *w, const gchar *uri)
{
@@
-776,7
+785,6
@@
loadstatuschange(WebKitWebView *view, GParamSpec *pspec, Client *c)
WebKitWebFrame *frame;
WebKitWebDataSource *src;
WebKitNetworkRequest *request;
WebKitWebFrame *frame;
WebKitWebDataSource *src;
WebKitNetworkRequest *request;
- WebKitWebSettings *set = webkit_web_view_get_settings(c->view);
SoupMessage *msg;
char *uri;
SoupMessage *msg;
char *uri;
@@
-793,10
+801,8
@@
loadstatuschange(WebKitWebView *view, GParamSpec *pspec, Client *c)
}
setatom(c, AtomUri, uri);
}
setatom(c, AtomUri, uri);
- if (enablestyles) {
- g_object_set(G_OBJECT(set), "user-stylesheet-uri",
- getstyle(uri), NULL);
- }
+ if (enablestyles)
+ setstyle(c, getstyle(uri));
break;
case WEBKIT_LOAD_FINISHED:
c->progress = 100;
break;
case WEBKIT_LOAD_FINISHED:
c->progress = 100;
@@
-997,11
+1003,6
@@
newclient(void)
if (!(ua = getenv("SURF_USERAGENT")))
ua = useragent;
g_object_set(G_OBJECT(settings), "user-agent", ua, NULL);
if (!(ua = getenv("SURF_USERAGENT")))
ua = useragent;
g_object_set(G_OBJECT(settings), "user-agent", ua, NULL);
- if (enablestyles) {
- g_object_set(G_OBJECT(settings),
- "user-stylesheet-uri", getstyle("about:blank"),
- NULL);
- }
g_object_set(G_OBJECT(settings),
"auto-load-images", loadimages, NULL);
g_object_set(G_OBJECT(settings),
g_object_set(G_OBJECT(settings),
"auto-load-images", loadimages, NULL);
g_object_set(G_OBJECT(settings),
@@
-1018,6
+1019,8
@@
newclient(void)
"default-font-size", defaultfontsize, NULL);
g_object_set(G_OBJECT(settings),
"resizable-text-areas", 1, NULL);
"default-font-size", defaultfontsize, NULL);
g_object_set(G_OBJECT(settings),
"resizable-text-areas", 1, NULL);
+ if (enablestyles)
+ setstyle(c, getstyle("about:blank"));
/*
* While stupid, CSS specifies that a pixel represents 1/96 of an inch.
/*
* While stupid, CSS specifies that a pixel represents 1/96 of an inch.
@@
-1050,10
+1053,8
@@
newclient(void)
c->isinspecting = false;
}
c->isinspecting = false;
}
- if (runinfullscreen) {
- c->fullscreen = 0;
+ if (runinfullscreen)
fullscreen(c, NULL);
fullscreen(c, NULL);
- }
setatom(c, AtomFind, "");
setatom(c, AtomUri, "about:blank");
setatom(c, AtomFind, "");
setatom(c, AtomUri, "about:blank");
@@
-1531,11
+1532,8
@@
togglescrollbars(Client *c, const Arg *arg)
void
togglestyle(Client *c, const Arg *arg)
{
void
togglestyle(Client *c, const Arg *arg)
{
- WebKitWebSettings *settings = webkit_web_view_get_settings(c->view);
-
enablestyles = !enablestyles;
enablestyles = !enablestyles;
- g_object_set(G_OBJECT(settings), "user-stylesheet-uri",
- enablestyles ? getstyle(geturi(c)) : "", NULL);
+ setstyle(c, enablestyles ? getstyle(geturi(c)) : "");
updatetitle(c);
}
updatetitle(c);
}
@@
-1624,7
+1622,7
@@
updatewinid(Client *c)
void
usage(void)
{
void
usage(void)
{
- die("usage: %s [-bB
fFgGiIkK
nNpPsSvx] [-a cookiepolicies ] "
+ die("usage: %s [-bB
dDfFgGiIkKmM
nNpPsSvx] [-a cookiepolicies ] "
"[-c cookiefile] [-e xid] [-r scriptfile] [-t stylefile] "
"[-u useragent] [-z zoomlevel] [uri]\n", basename(argv0));
}
"[-c cookiefile] [-e xid] [-r scriptfile] [-t stylefile] "
"[-u useragent] [-z zoomlevel] [uri]\n", basename(argv0));
}
@@
-1685,10
+1683,10
@@
main(int argc, char *argv[])
embed = strtol(EARGF(usage()), NULL, 0);
break;
case 'f':
embed = strtol(EARGF(usage()), NULL, 0);
break;
case 'f':
- runinfullscreen =
1
;
+ runinfullscreen =
0
;
break;
case 'F':
break;
case 'F':
- runinfullscreen =
0
;
+ runinfullscreen =
1
;
break;
case 'g':
allowgeolocation = 0;
break;
case 'g':
allowgeolocation = 0;