summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnselm R Garbe <anselm@garbe.us>2013-07-20 08:52:10 +0200
committerAnselm R Garbe <anselm@garbe.us>2013-07-20 08:52:10 +0200
commit7001df98d1cb8121f4555e76c47a31f0975a85dc (patch)
tree31e18e74ab3e6db246de955d032b627c94e9074e
parent2e978627ddd4d18470b0d49008d9c285ed774c3d (diff)
downloadsurf-7001df98d1cb8121f4555e76c47a31f0975a85dc.tar.gz
surf-7001df98d1cb8121f4555e76c47a31f0975a85dc.tar.bz2
surf-7001df98d1cb8121f4555e76c47a31f0975a85dc.zip
applied Nick's 96dpi patch, thanks
-rw-r--r--config.def.h1
-rw-r--r--surf.c15
2 files changed, 16 insertions, 0 deletions
diff --git a/config.def.h b/config.def.h
index 08ff707..49ffa49 100644
--- a/config.def.h
+++ b/config.def.h
@@ -10,6 +10,7 @@ static char *cafile = "/etc/ssl/certs/ca-certificates.crt";
static char *strictssl = FALSE; /* Refuse untrusted SSL connections */
static Bool kioskmode = FALSE; /* Ignore shortcuts */
static Bool showindicators = TRUE; /* Show indicators in window title */
+static Bool zoomto96dpi = TRUE; /* Zoom pages to always emulate 96dpi */
static guint defaultfontsize = 12;
diff --git a/surf.c b/surf.c
index 939a06f..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));