From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.devel Subject: [PATCH] Fix frameset-restore in the presence of scaling Date: Thu, 18 Jan 2018 15:32:36 +0100 Message-ID: <87efmnb5kr.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1516285927 32022 195.159.176.226 (18 Jan 2018 14:32:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 18 Jan 2018 14:32:07 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.91 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 18 15:32:03 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ecBEG-00070F-3Z for ged-emacs-devel@m.gmane.org; Thu, 18 Jan 2018 15:31:44 +0100 Original-Received: from localhost ([::1]:34365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecBGF-0007pZ-UH for ged-emacs-devel@m.gmane.org; Thu, 18 Jan 2018 09:33:47 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46812) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecBFD-0007oZ-Gr for emacs-devel@gnu.org; Thu, 18 Jan 2018 09:32:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecBFA-0007nw-6n for emacs-devel@gnu.org; Thu, 18 Jan 2018 09:32:43 -0500 Original-Received: from mail-wr0-x234.google.com ([2a00:1450:400c:c0c::234]:33829) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecBF9-0007nN-Vh for emacs-devel@gnu.org; Thu, 18 Jan 2018 09:32:40 -0500 Original-Received: by mail-wr0-x234.google.com with SMTP id 36so22789577wrh.1 for ; Thu, 18 Jan 2018 06:32:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:mail-followup-to:mail-copies-to:gmane-reply-to-list :date:message-id:user-agent:mime-version; bh=AVPUgNhM8n6nyC2h0ZqX/BSMt7gvXztG/DyUvlQhcVE=; b=qRNMrajYH17MQ8AR1C+EaOkD4VGZLvnliPqE0c2sGQgOE1iG+4LH9AmuFEJdmJ1Qva wC26U7xFm5cb+tp4oHMRnGrHzRGDD4Xaj9namCSiDbXAvgnHhjxsjSGYenPKlPrS9PWZ 7r+yyuR2Mv3qNBOj68Zz4dRzGM8cm4TCe4qomUQiFkWaHYtvQQGHxqlDXFq6ZsFrH5q0 qznEt09OZVwQ+cQmM6OGgbirPXQDOPh51ZHHhOFT/40TC3tQGXpxXDPHoF7Y/HtTYJm0 A9Zi7x/0L5Dn9aulz6zjlqChrX7ulAzz6qjvA6TmtrZ8zvP4YhesCT1N6pDYrm0xh8qe bndg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:mail-followup-to:mail-copies-to :gmane-reply-to-list:date:message-id:user-agent:mime-version; bh=AVPUgNhM8n6nyC2h0ZqX/BSMt7gvXztG/DyUvlQhcVE=; b=iZ8jib9um59VkOk4aMFA7h0SGzb1LwGNg7Ft1REFD3pqAOnUBQ3qEsS0LtHJeq2g2A nQLJMWv9oEX+hO5T6ye2YQR6NRstmBjhbe+qf8Ocf0Q7+GrEF+VphEf6FlBInKTI+ILI t61x9ZmDQV7lhC+A8R2Aukbwb1aoapR/O2lx82wGwt4lV4Ob7Og0bnJN4ctQRJmKbWm8 Im1cUiaWhqsfDpKAq/XOqoXKtw8xVl9W2UySusH38iSZyvB9LksGmUxaJyrnhnB12V7e 9If9Eahoyv8Miy429scFJ3J6Ui5rJtHSkIv628jCW8tT5m47tOA27TIunSe+Up64JGPx TFjw== X-Gm-Message-State: AKwxytc0woW10RRwXcNZMw6VbyS5bGIBRzQN+tIfNrLbVU/1cOxnX22W wItZYaguedEn1LLdK5OFDdYAT8Aw X-Google-Smtp-Source: ACJfBotzxjIHdhqqDh8b9qShRHg0vw30f1rPy5/yMlIUeqQXUDQpZ1++8Fu3eavB064mQQwQa6Zavw== X-Received: by 10.223.161.150 with SMTP id u22mr6889715wru.251.1516285958231; Thu, 18 Jan 2018 06:32:38 -0800 (PST) Original-Received: from rpluim-ubuntu ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id s127sm4742991wmf.28.2018.01.18.06.32.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jan 2018 06:32:37 -0800 (PST) Mail-Followup-To: emacs-devel@gnu.org Mail-Copies-To: never Gmane-Reply-To-List: yes X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::234 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." 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" Xref: news.gmane.org gmane.emacs.devel:222074 Archived-At: --=-=-= Content-Type: text/plain Running emacs-26 with GDK_SCALING=2, frameset-restore will position 2nd and subsequent frames incorrectly if they are in the right half of the screen. Turns out that we're querying GTK for the dimensions of the display in order to ensure that frames remain on-screen, and those dimensions need scaling. Patch attached, tested on GTK 3.18, I'd appreciate if someone with a HiDPI screen and GTK >= 3.22 could confirm whether it works for them. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Scale-monitor-dimensions-obtained-from-GTK.patch >From f62eb8f2aa1716bdb2c43ab6eb3f22a17ba434f3 Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Thu, 18 Jan 2018 15:19:29 +0100 Subject: [PATCH] Scale monitor dimensions obtained from GTK * src/xfns.c (Fx_display_monitor_attributes_list): Take scaling factor into account when using GTK to query the monitor dimensions, which allows frameset-restore to position frames correctly. --- src/xfns.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/xfns.c b/src/xfns.c index dd3b36c133..4ea5113265 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -4940,6 +4940,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */) gint width_mm = -1, height_mm = -1; GdkRectangle rec, work; struct MonitorInfo *mi = &monitors[i]; + int scale; #if GTK_CHECK_VERSION (3, 22, 0) GdkMonitor *monitor = gdk_display_get_monitor (gdpy, i); @@ -4985,6 +4986,16 @@ Internal use only, use `display-monitor-attributes-list' instead. */) } #endif + /* GTK returns scaled sizes for the workareas. */ +#if GTK_CHECK_VERSION (3, 22, 0) + scale = gdk_monitor_get_scale_factor (monitor); +#else + scale = gdk_screen_get_monitor_scale_factor (gscreen, i); +#endif + rec.width *= scale; + rec.height *= scale; + work.width *= scale; + work.height *= scale; mi->geom.x = rec.x; mi->geom.y = rec.y; -- 2.16.0.rc1 --=-=-=--