X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=surf.c;h=1a9b17a3ad23e504802be384204f6d6b12645425;hb=7001df98d1cb8121f4555e76c47a31f0975a85dc;hp=53dda18271ad1104708d1bd8a964c00fa7bb2b22;hpb=c234737bea41e605310a7372adf8af8036cf2212;p=surf.git diff --git a/surf.c b/surf.c index 53dda18..1a9b17a 100644 --- a/surf.c +++ b/surf.c @@ -658,6 +658,8 @@ newclient(void) { WebKitWebSettings *settings; WebKitWebFrame *frame; GdkGeometry hints = { 1, 1 }; + GdkScreen *screen; + gdouble dpi; char *uri, *ua; if(!(c = calloc(1, sizeof(Client)))) @@ -802,6 +804,19 @@ newclient(void) { g_object_set(G_OBJECT(settings), "default-font-size", defaultfontsize, NULL); + /* While stupid, CSS specifies that a pixel represents 1/96 of an inch. + * This ensures websites are not unusably small with a high DPI screen. + * It is equivalent to firefox's "layout.css.devPixelsPerPx" setting. */ + if(zoomto96dpi) { + screen = gdk_window_get_screen(GTK_WIDGET(c->win)->window); + dpi = gdk_screen_get_resolution(screen); + if(dpi != -1) { + g_object_set(G_OBJECT(settings), "enforce-96-dpi", true, + NULL); + webkit_web_view_set_zoom_level(c->view, dpi/96); + } + } + if(enableinspector) { c->inspector = WEBKIT_WEB_INSPECTOR( webkit_web_view_get_inspector(c->view)); @@ -843,7 +858,7 @@ newclient(void) { static void newwindow(Client *c, const Arg *arg, gboolean noembed) { guint i = 0; - const char *cmd[12], *uri; + const char *cmd[14], *uri; const Arg a = { .v = (void *)cmd }; char tmp[64]; @@ -865,6 +880,8 @@ newwindow(Client *c, const Arg *arg, gboolean noembed) { cmd[i++] = "-s"; if(showxid) cmd[i++] = "-x"; + cmd[i++] = "-c"; + cmd[i++] = cookiefile; cmd[i++] = "--"; uri = arg->v ? (char *)arg->v : c->linkhover; if(uri)