From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: High-res Customize icons Date: Tue, 27 Oct 2020 15:17:37 -0400 Message-ID: <5AEB1CE7-D76C-4EE4-97F3-CCB86AEB6382@gmail.com> References: <6AEA7E43-DB35-458F-AFF2-B45DCBDC136F@gmail.com> <83a734fecm.fsf@gnu.org> <9713d235-11d4-b593-210a-e389c265e8ad@gmail.com> <83368vfxtl.fsf@gnu.org> <83imhre827.fsf@gnu.org> <83a733e56k.fsf@gnu.org> <834ktbe2ve.fsf@gnu.org> <83zharvkcc.fsf@gnu.org> <17B57ACD-3249-463A-9F23-7EA9B3E0C9A1@gmail.com> <83sga4izmc.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30642"; mail-complaints-to="usenet@ciao.gmane.io" Cc: chad , =?utf-8?Q?Cl=C3=A9ment_Pit-Claudel?= , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 27 20:28:49 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kXUeG-0007qt-Dj for ged-emacs-devel@m.gmane-mx.org; Tue, 27 Oct 2020 20:28:48 +0100 Original-Received: from localhost ([::1]:55814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXUeF-0004YA-FF for ged-emacs-devel@m.gmane-mx.org; Tue, 27 Oct 2020 15:28:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45056) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXUTW-000711-NX for emacs-devel@gnu.org; Tue, 27 Oct 2020 15:17:42 -0400 Original-Received: from mail-qk1-x729.google.com ([2607:f8b0:4864:20::729]:45927) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kXUTU-0002xt-CZ; Tue, 27 Oct 2020 15:17:42 -0400 Original-Received: by mail-qk1-x729.google.com with SMTP id 188so2292201qkk.12; Tue, 27 Oct 2020 12:17:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=lJBz1c2KTmHCuJ1iXBDa68uiDO6/+XhhuLCsFqX+/UM=; b=fnbumV/KIokNjMRi8+A4Vt6IW1xDC/IqR58cM8IG9EYYKXVFNvsvcdO8tqKzkBBX+x iW9eI5JdDVv3mnkMaNoCM0t8Icb+KAxPBsSdlm7WUozx/GY5BLY/XzloIxoT8IjWcOE1 BtRodX0QD6vBVwLGQ8qxW9zavC/XIVeFOkrxTtfcBgMpCNwfK3B6V3vEtb/nZ7LX/4As C9lo8h3d+a41y5+EKDyEV/PgaU+bvk4RyY0qPvUN8XxIxArAkCaqlo+ajkO0xUy75RAe EGYrp+fIA/b8tZYY/p7aoxnOD42ZV6+J4SGNtA/2bUXtSrH+RuOQ+ESkL9uGiZnwzNxo 2KDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=lJBz1c2KTmHCuJ1iXBDa68uiDO6/+XhhuLCsFqX+/UM=; b=rcmQL8Ibq64rDxt0mKETxAuwJ6r5mI0xv8NsxKov0e94Jifb3YL7KCYLE5j/ZDUQ5d gERzgSWwO7AnjxYaemWlwsgEOlLXhWp9ONzSXkChFY/cGUXo6P0gbaAjWwwHJ508IHSm Y4Jae4PU7GTvcmz0uxNwFz8cqo8eBoDfJk6Vqzpeg8+po9pCg0N0rlnUCRnGgkyPTmuU aV8qoCaOCpmEitCnq/c9w5T7bxBEi+HneelJIRBHNQZiTxX9e355bunIlLdG3EHj+AmZ SwZR4/xGz4CR7cuQaMuaHGsc8mFAzzdDSViSXWUAghFB54rRZqET7C6yT8rqeM/f/QBW EbKw== X-Gm-Message-State: AOAM530ROL29cNbMATS0ueT8Eu+sZi2z0QBINDDATav+0V2Ar7teOReh 4NSxQ72vMLdA/nfFGvLuIdqreqFNMYqzXbl3 X-Google-Smtp-Source: ABdhPJx35J10uwHFrJMuaJE3kRPtjClxyQ/ZN921SA2pl1AndyafAAn0/VH9r2ik1sb66uoBAXoTww== X-Received: by 2002:a37:4854:: with SMTP id v81mr3799612qka.20.1603826258490; Tue, 27 Oct 2020 12:17:38 -0700 (PDT) Original-Received: from ?IPv6:2601:98a:4200:9210:edbe:7f67:c177:9f? ([2601:98a:4200:9210:edbe:7f67:c177:9f]) by smtp.gmail.com with ESMTPSA id l14sm1438917qti.34.2020.10.27.12.17.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Oct 2020 12:17:38 -0700 (PDT) In-Reply-To: <83sga4izmc.fsf@gnu.org> X-Mailer: Apple Mail (2.3608.120.23.2.4) Received-SPF: pass client-ip=2607:f8b0:4864:20::729; envelope-from=casouri@gmail.com; helo=mail-qk1-x729.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:258517 Archived-At: >=20 > The reason I said defcustom didn't sound like TRT was because I think > Emacs should handle this automatically. It should automatically load > the high resolution images when appropriate. Where it finds those > images and by what logic is a secondary question. >=20 I dug a bit further and it seems to do with Cocoa on Mac. On other = engines the resolution is simply the resolution of the monitor, but = Cocoa add an abstraction layer and the resolution an applications = detects aren=E2=80=99t the actual physical resolution. So for high-res icons we want to simply use the @2x image on Linux and = use @2x image but with :scale 0.5 on Cocoa. If we use normal image on = high-res monitor, the image is too small on Linux, and if we are on = Cocoa, the image is blurry. To detect high-res screens on other platforms, we currently have a = function that measures the pixel height of a default line: if it=E2=80=99s= greater than 15 pixels, we consider the screen high-res and find-image = will scale the returned image by :scale 2. Cocoa provides an API for querying the scaling factor, if it is 2, we = should load the @2x image and add :scale 0.5. It=E2=80=99s kind of a mess. What do you think? How about exposing that Cocoa API to lisp and handle accordingly in = find-image? Some thing like: (let (img) (if (eq (window-system) 'ns) ;; Cocoa (let ((pixel-scaling-factor (ns-scaling-factor))) (if (> pixel-scaling-factor 1.0) (append (find-2x-image) '(:scale 0.5)) (find-normal-image))) ;; Other (let ((image-scaling-factor (image-compute-scaling-factor image-scaling-factor))) (if (> image-scaling-factor 2) (append (find-2x-image) '(:scale 2)) (find-normal-image))))) Yuan=