all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Yuan Fu <casouri@gmail.com>
Cc: "Eli Zaretskii" <eliz@gnu.org>,
	"Clément Pit-Claudel" <cpitclaudel@gmail.com>,
	chad <yandros@gmail.com>,
	emacs-devel@gnu.org
Subject: Re: High-res Customize icons
Date: Wed, 28 Oct 2020 00:05:18 +0000	[thread overview]
Message-ID: <20201028000518.GK59267@breton.holly.idiocy.org> (raw)
In-Reply-To: <17FF276F-1E4B-4955-9781-29242C1D0CE4@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 553 bytes --]

On Tue, Oct 27, 2020 at 07:09:02PM -0400, Yuan Fu wrote:
> 
> How should the variable be named? There is already a variable named
> image-scale-factor. I suggest something like ns-pixel-scale-factor.

I went with ns-frame-scale-factor as that matched some other frame
related functions.

> > Anyway, even if not it will always display something, just not
> > necessarily the optimal image.
> > 
> > Do you want me to write the C code to expose the scale factor?
> 
> That’s marvelous!

Attached. It appears to work on my retina laptop.
-- 
Alan Third

[-- Attachment #2: 0001-Expose-NS-frames-scale-factor-to-lisp.patch --]
[-- Type: text/plain, Size: 1572 bytes --]

From 094cbd60523ba9282b653d71c288776713812b2b Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Tue, 27 Oct 2020 23:53:13 +0000
Subject: [PATCH] Expose NS frames scale factor to lisp

* src/nsfns.m (Fns_frame_scale_factor): New function.
---
 src/nsfns.m | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/nsfns.m b/src/nsfns.m
index c7956497c4..7e367b0edb 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1503,6 +1503,23 @@ Frames are listed from topmost (first) to bottommost (last).  */)
     }
 }
 
+DEFUN ("ns-frame-scale-factor", Fns_frame_scale_factor, Sns_frame_scale_factor,
+       0, 1, 0,
+       doc: /* Get the scale factor for FRAME.  */)
+  (Lisp_Object frame)
+{
+  struct frame *f = decode_window_system_frame (frame);
+
+#if defined NS_IMPL_COCOA && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
+  NSWindow *w = [FRAME_NS_VIEW (f) window];
+# if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
+  if ([w respondsToSelector:@selector(backingScaleFactor)])
+# endif
+    return make_float ([w backingScaleFactor]);
+#endif
+  return make_float (1);
+}
+
 DEFUN ("ns-popup-font-panel", Fns_popup_font_panel, Sns_popup_font_panel,
        0, 1, "",
        doc: /* Pop up the font panel.  */)
@@ -3133,6 +3150,7 @@ - (Lisp_Object)lispString
   defsubr (&Sns_frame_edges);
   defsubr (&Sns_frame_list_z_order);
   defsubr (&Sns_frame_restack);
+  defsubr (&Sns_frame_scale_factor);
   defsubr (&Sns_set_mouse_absolute_pixel_position);
   defsubr (&Sns_mouse_absolute_pixel_position);
   defsubr (&Sns_show_character_palette);
-- 
2.26.1


  reply	other threads:[~2020-10-28  0:05 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-21 19:47 High-res Customize icons Yuan Fu
2020-04-22  2:23 ` Eli Zaretskii
2020-04-22  2:37   ` Clément Pit-Claudel
2020-04-22  5:47     ` chad
2020-04-22 12:24       ` Yuan Fu
2020-04-22 12:41         ` Yuri Khan
2020-04-22 13:54           ` Yuan Fu
2020-04-22 21:12             ` Juri Linkov
2020-04-22 22:20               ` Yuan Fu
2020-04-23  4:11               ` Werner LEMBERG
2020-04-23 14:52                 ` Eli Zaretskii
2020-04-23 15:07                   ` Clément Pit-Claudel
2020-04-23 17:49                   ` Werner LEMBERG
2020-04-23 19:27                     ` Eli Zaretskii
2020-04-23 19:35                       ` Yuan Fu
2020-04-23 19:40                         ` Eli Zaretskii
2020-04-23 19:59                           ` Yuan Fu
2020-04-23 23:02                             ` chad
2020-04-24  6:30                             ` Eli Zaretskii
2020-04-24 11:00                               ` Dmitry Gutov
2020-04-23 23:23                       ` chad
2020-04-24  7:18                         ` Eli Zaretskii
2020-04-25  3:30                       ` Richard Stallman
2020-04-25  7:02                         ` Eli Zaretskii
2020-04-25 12:37                           ` Clément Pit-Claudel
2020-04-25 13:56                             ` Eli Zaretskii
2020-04-22 13:35       ` Eli Zaretskii
2020-04-22 17:09         ` chad
2020-04-22 17:36           ` Eli Zaretskii
2020-04-22 18:28             ` chad
2020-04-22 18:38               ` Eli Zaretskii
2020-04-22 19:19                 ` Yuan Fu
2020-04-22 19:28                   ` Eli Zaretskii
2020-04-22 20:38                     ` Yuan Fu
2020-05-01 13:46                       ` Eli Zaretskii
2020-10-22 15:33                         ` Yuan Fu
2020-10-23 16:39                         ` Yuan Fu
2020-10-23 18:08                           ` Eli Zaretskii
2020-10-27 19:17                             ` Yuan Fu
2020-10-27 19:27                               ` Eli Zaretskii
2020-10-27 22:26                               ` Alan Third
2020-10-27 23:09                                 ` Yuan Fu
2020-10-28  0:05                                   ` Alan Third [this message]
2020-10-28  1:22                               ` YAMAMOTO Mitsuharu
2020-10-29  5:31                                 ` Yuan Fu
  -- strict thread matches above, loose matches on Subject: below --
2020-04-23  7:14 ndame
2020-04-23  7:25 ` ndame
2020-04-23 10:06 ` Stefan Kangas
2020-04-23 14:07   ` Stefan Kangas
2020-04-23 14:11     ` Stefan Kangas
2020-04-23 14:39       ` Clément Pit-Claudel
2020-04-23 14:46       ` Lars Ingebrigtsen
2020-04-23 15:00         ` Clément Pit-Claudel
2020-04-23 15:44           ` Stefan Monnier
2020-04-23 19:14             ` Eli Zaretskii
2020-04-23 20:33               ` Stefan Monnier
2020-04-24  6:51                 ` Eli Zaretskii
2020-04-24 13:06                   ` Stefan Monnier
2020-04-24 13:36                     ` Eli Zaretskii
2020-04-24 15:13                       ` Stefan Monnier
2020-04-24 15:46                         ` Eli Zaretskii
2020-04-23 15:15         ` Eli Zaretskii
2020-04-23 15:17           ` Lars Ingebrigtsen
2020-04-23 16:40             ` Yuan Fu
2020-04-23 15:09       ` Eli Zaretskii
2020-04-23 16:19         ` Stefan Kangas
2020-04-23 16:35           ` Stefan Kangas
2020-04-23 15:08     ` Eli Zaretskii
2020-04-23 15:49       ` Clément Pit-Claudel
2020-04-23 16:34         ` Stefan Kangas
2020-04-23 19:56           ` Clément Pit-Claudel
2020-04-23 19:12         ` Eli Zaretskii
2020-04-25  2:55           ` Clément Pit-Claudel
2020-04-25  7:03             ` Eli Zaretskii
2020-04-25 13:12               ` Clément Pit-Claudel
2020-04-25 13:18                 ` Stefan Kangas
2020-04-24 12:05 ` Eli Zaretskii
2020-04-24 15:11   ` ndame
2020-04-24 15:45     ` Eli Zaretskii
2020-04-24 16:07       ` Stefan Monnier
2020-04-24 16:29         ` Eli Zaretskii
2020-04-25  3:38       ` Richard Stallman
2020-04-28 13:55         ` Robert Pluim
2020-04-28 14:38           ` Eli Zaretskii
2020-04-29 12:30             ` Robert Pluim
2020-04-29 14:00               ` Eli Zaretskii
2020-04-25  3:34   ` Richard Stallman
2020-04-25  6:39     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201028000518.GK59267@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=casouri@gmail.com \
    --cc=cpitclaudel@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=yandros@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.