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: Fri, 23 Oct 2020 12:39:44 -0400 Message-ID: <17B57ACD-3249-463A-9F23-7EA9B3E0C9A1@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> 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="19895"; mail-complaints-to="usenet@ciao.gmane.io" Cc: chad , cpitclaudel@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Oct 23 19:00:05 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 1kW0Q9-00054c-17 for ged-emacs-devel@m.gmane-mx.org; Fri, 23 Oct 2020 19:00:05 +0200 Original-Received: from localhost ([::1]:53158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kW0Q8-0002SM-20 for ged-emacs-devel@m.gmane-mx.org; Fri, 23 Oct 2020 13:00:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51706) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kW06X-00034P-SC for emacs-devel@gnu.org; Fri, 23 Oct 2020 12:39:49 -0400 Original-Received: from mail-qk1-x72b.google.com ([2607:f8b0:4864:20::72b]:38044) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kW06V-0002i0-UE; Fri, 23 Oct 2020 12:39:49 -0400 Original-Received: by mail-qk1-x72b.google.com with SMTP id f21so1722416qko.5; Fri, 23 Oct 2020 09:39:47 -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=2NzyBRbZ4Fe5nyJ//+ePP0GjKZzo0ZIZhrWd7AkR4B0=; b=iei5ky6JLOwfp0cCtWW19REXLbUHVhrrwh+dWkb0/mQHedXcXbrL/+afbqXNAgvCJt j+HBi1A90Le/5GJI3Bg2qhNQlGA7ER5Tj9gTxa7rEEgbJUzDT2lvfPOk0FfKDGGYWQpF uqgDUjwK0+9bg6HIFcjHxD1OS1WjAF3DUzq8Vx9n5+yvKeg9Igw3jMGsirPsFMfthDQp zPQci4jIvVIOJF7WFmeYelkYj4MwsF0pMCCGvuhDobs8YlI0uMVQW6ZySEhr125kFirw ehRB2HKLfDKQa8wZgJaOeGE5+QahXLTnwaC3qAZjfi23Dlua6sz9PHlkXHMbtPURmMqz FV4w== 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=2NzyBRbZ4Fe5nyJ//+ePP0GjKZzo0ZIZhrWd7AkR4B0=; b=gmv7x2tEG0ercZuXlbh4ViaG5UbvHseupHeGxjQekXixzwUSLhudPmRGoVS6VDbdcC vs3CWYsUZ5pejWqN8m9ZPupy3JfHSKVo9jDPQHxhu6cYvL1DeUpXs157pK5Ppe5+qwo1 sQJ2CQgAqwJXndqlNq5AnlAozjUA6gpYGcxm2RbUJrQ0n+NRiLg556T9Zo4+ZyywMEIG gePRzhwSmGlE18kcT+ohNkK2aZjpPLFsS+3OyQXV+WqGMPYMc4O5oH3BiyEfhVtwO/kw 9jZWcBFS+pAt3cK8cQvstSxrYpAZ9jlPV6B8GKHzRgZ6xOXQvG1Eq181Rmo5EUqpm85N hIDg== X-Gm-Message-State: AOAM531yBjzy33wWRBdauLI8mVwzz6vJT4x1+4+gPqc2R6ri67yEuhMo AotzHknVxkeLJKFmq2eCrfhEjCRYwA9zx65KMRM= X-Google-Smtp-Source: ABdhPJxl2M+akNpm7rLoy0uR2z0cCFcLibZrmoPDkNGSm3XKRAZKD67s7MJ7uvtxO+gXRPbZqCe74w== X-Received: by 2002:a05:620a:1510:: with SMTP id i16mr2821731qkk.363.1603471186185; Fri, 23 Oct 2020 09:39:46 -0700 (PDT) Original-Received: from [192.168.1.10] (c-174-60-229-153.hsd1.pa.comcast.net. [174.60.229.153]) by smtp.gmail.com with ESMTPSA id v92sm769204qte.33.2020.10.23.09.39.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Oct 2020 09:39:45 -0700 (PDT) In-Reply-To: <83zharvkcc.fsf@gnu.org> X-Mailer: Apple Mail (2.3608.120.23.2.4) Received-SPF: pass client-ip=2607:f8b0:4864:20::72b; envelope-from=casouri@gmail.com; helo=mail-qk1-x72b.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: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FREEMAIL_REPLY=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:258369 Archived-At: > On May 1, 2020, at 9:46 AM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Wed, 22 Apr 2020 16:38:10 -0400 >> Cc: yandros@gmail.com, >> cpitclaudel@gmail.com, >> emacs-devel@gnu.org >>=20 >> Here is a patch for the high-res icons. Put both icon files under = /etc/images/custom. >>=20 >> In the patch I modified widget-image-find to look for @2x images. Can = we even modify find-image so it looks for @2x images (as an opt-in = feature)? That way Other applications (Magit, gdb-mi, etc) that uses = images icons in buffer and fringe could have high-res icons without = changing a line of code (assuming they use find-image). >=20 > I think Emacs should look in the hi-res subdirectory when the display > is high resolution. A defcustom sounds like a wrong way to handle > this issue. Thinking more about this, a hi-res subdirectory is useful for organizing = files, but shouldn=E2=80=99t be used for determining where to find = high-res images. I suppose you mean to have separate image-load-path and = high-res-image-load-path? That would be inconvenient for package = authors, if they want to use image in their package, they need to create = two subdirectories for high and low resolution image, add them to the = two load-path, and use find-image. OTOH, if we use a single image = load-path and search for the @2x variant before the regular image, = package authors only need to name their images img.png and img@2x.png, = and put them under the package directory (since package directory is = already in load-path).=20 That=E2=80=99s about how to find the high-res variant of an image, = determining whether we want to use a high-res variant is another story. = On hidpi screens, the OS tells you the resolution of an area is 100x100, = but the physical pixels in that area could be in fact 200x200. That=E2=80=99= s why an 100x100 image looks blurry. I don=E2=80=99t think there is a = reliable way to tell the current screen=E2=80=99s pixel density. So I = think a custom option is the most reliable and stable approach. If the = user wants this, they just set that variable. Concretely, I mean a custom option like this: (defcustom image-resolution-scaling-factor 1 "If greater than 1, try display high-res alternatives. E.g., if the value is 2, `find-image' tries to find file@2x.png for file.png." :type '(choice number (const :tag "1x" 1) (const :tag "2x" 2) (const :tag "3x" 3)) :version "28.1") Yuan=