From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/85673 Path: news.gmane.org!not-for-mail From: asjo@koldfront.dk (Adam =?utf-8?Q?Sj=C3=B8gren?=) Newsgroups: gmane.emacs.devel,gmane.emacs.gnus.general Subject: Re: Scaling stuff for high dpi screens Date: Fri, 30 Jan 2015 00:57:14 +0100 Organization: koldfront - analysis & revolution, Copenhagen, Denmark Message-ID: <87siet3ztx.fsf@topper.koldfront.dk> References: <87vbu5m25o.fsf@topper.koldfront.dk> <871twqefd6.fsf@topper.koldfront.dk> <87lhulyz7g.fsf@topper.koldfront.dk> <8761brwhiz.fsf@building.gnus.org> <878ugncmwv.fsf@fencepost.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1422575873 17124 80.91.229.3 (29 Jan 2015 23:57:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 29 Jan 2015 23:57:53 +0000 (UTC) Cc: ding@gnus.org To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 30 00:57:53 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YGyy8-0002CC-Fr for ged-emacs-devel@m.gmane.org; Fri, 30 Jan 2015 00:57:52 +0100 Original-Received: from localhost ([::1]:34088 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGyy8-0007Q1-1t for ged-emacs-devel@m.gmane.org; Thu, 29 Jan 2015 18:57:52 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGyxq-0007PG-2Q for emacs-devel@gnu.org; Thu, 29 Jan 2015 18:57:38 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGyxk-0002SJ-UQ for emacs-devel@gnu.org; Thu, 29 Jan 2015 18:57:33 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:36042) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGyxk-0002Qm-OD for emacs-devel@gnu.org; Thu, 29 Jan 2015 18:57:28 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YGyxj-0001jE-8U for emacs-devel@gnu.org; Fri, 30 Jan 2015 00:57:27 +0100 Original-Received: from 2505ds5-by.0.fullrate.dk ([89.150.142.116]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 30 Jan 2015 00:57:27 +0100 Original-Received: from asjo by 2505ds5-by.0.fullrate.dk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 30 Jan 2015 00:57:27 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 62 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 2505ds5-by.0.fullrate.dk OpenPGP: id=49D0746121BDE416; url=http://asjo.koldfront.dk/gpg.asc Mail-Follow-Up-To: never X-Now-Playing: Pik WC, Helilifted (Various) X-Face: )qY&CseJ?.:=8F#^~GcSA?F=9eu'{KAFfL1C3/A&:nE?PW\i65"ba0NS)97, Q(^@xk}n4Ou rPuR#V8I(J_@~H($[ym:`K_+]*kjvW>xH5jbgLBVFGXY:(#4P>zVBklLbdL&XxL\M)%T}3S/IS9lMJ ^St'=VZBR List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:182013 gmane.emacs.gnus.general:85673 Archived-At: David writes: > (/ (display-pixel-width) (/ (display-mm-width) 25.4)) Here are my observations so far: a) When starting Emacs by using "emacs" on the command line, display-pixel-width and display-mm-width returns what I expect (3200, 406). b) after-make-frame-functions are not called when I start Emacs using "emacs" on the command line and the first frame appears. If I subsequently create a new frame with C-x 5 2, or emacsclient --create-frame --alternate-editor="", they are called, and the widths are as expected. c) If I use 'emacsclient --create-frame --alternate-editor=""' to start Emacs, then after-make-frame-functions are called, but when I call display-pixel-width and display-mm-width in such a function, I get (10, nil) back. If I subsequently make a new frame with C-x 5 2, or emacsclient --create-frame --alternate-editor="", then the expected values are returned. I don't understand b), but don't mind much, as it is easy to call my function on the first frame created in my init.el. I don't understand c) either, but it is quite annoying, because I can't find a suitable way/hook in which to call display-pixel/mm-width at a time where they give the results I expect. This is what I have been playing around with in my init.el: (defun get-x11-dpi () (let ((pixel-width (display-pixel-width)) (mm-width (display-mm-width))) (message "display-pixel-width: %s" pixel-width) (message "display-mm-width: %s" mm-width) (if (and pixel-width mm-width) (round (/ (display-pixel-width) (/ (display-mm-width) 25.4))) 100))) ; Activate scaling: (defun asjo-new-frame-setup-scaling (new-frame) (set-frame-parameter new-frame 'image-dpi-scale-magnitude (if (> (get-x11-dpi) 100) 2.0 1.0))) ; This does not work for the first emacsclient frame, but it does for ; subsequent frames, it is not run for first emacs frame either: (add-hook 'after-make-frame-functions 'asjo-new-frame-setup-scaling) ; This is for non-emacsclient startup: (asjo-new-frame-setup-scaling nil) Best regards, Adam -- "I think I've learned by now Adam Sjøgren There's never an easy way" asjo@koldfront.dk