From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.devel Subject: Re: High-res Customize icons Date: Wed, 28 Oct 2020 00:05:18 +0000 Message-ID: <20201028000518.GK59267@breton.holly.idiocy.org> References: <83a733e56k.fsf@gnu.org> <834ktbe2ve.fsf@gnu.org> <83zharvkcc.fsf@gnu.org> <17B57ACD-3249-463A-9F23-7EA9B3E0C9A1@gmail.com> <83sga4izmc.fsf@gnu.org> <5AEB1CE7-D76C-4EE4-97F3-CCB86AEB6382@gmail.com> <20201027222653.GJ59267@breton.holly.idiocy.org> <17FF276F-1E4B-4955-9781-29242C1D0CE4@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="hHWLQfXTYDoKhP50" Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6203"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , =?iso-8859-1?Q?Cl=E9ment?= Pit-Claudel , chad , emacs-devel@gnu.org To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Oct 28 01:06:26 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 1kXYyw-0001XU-Ki for ged-emacs-devel@m.gmane-mx.org; Wed, 28 Oct 2020 01:06:26 +0100 Original-Received: from localhost ([::1]:38962 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXYyv-0002sc-Ir for ged-emacs-devel@m.gmane-mx.org; Tue, 27 Oct 2020 20:06:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXYy5-0002Mm-N1 for emacs-devel@gnu.org; Tue, 27 Oct 2020 20:05:33 -0400 Original-Received: from wilbur.contactoffice.com ([212.3.242.68]:45670) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXYxx-0000kh-Qi; Tue, 27 Oct 2020 20:05:29 -0400 Original-Received: from smtpauth2.co-bxl (smtpauth2.co-bxl [10.2.0.24]) by wilbur.contactoffice.com (Postfix) with ESMTP id CE314F88; Wed, 28 Oct 2020 01:05:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1603843521; s=20200222-6h9o; d=idiocy.org; i=alan@idiocy.org; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To; l=2445; bh=jeyiYJs2Y7RhXm5Dd84evGn/1OquHr6zZGR7W/z5z/Q=; b=XJyUWOO6NlkUUsH1xMrWhoivxfl2V2Tuix7N1K7qmekeFVFL5OIhXQX/eL61TdAd WPkJL504L1cnbPXo9w1ucNI9JPEUG0c5EqSvYjI57Qzr3mtYmuOfRdCcqt+MnmQkeBF Eb22mJ0Hsw8tNRHp5H2E2xjR0IhhQIQ/2cC5J7hCizgNZufg6W+CkFqpn8/WeZPV8Fp 9sWY51/2Ti8XTA9X2TsV37h9KqZtf6ZbvVbr/WqdawPkqYia7Ahm9FsivTyOnnVdRqU v584EPker/oA6aTAR6ObP/fr3dxbKroy9GJ1rug/vsgNWixWTCHWiKybJHZD5yre8Zi 3Sj2cSnMlQ== Original-Received: by smtp.mailfence.com with ESMTPA ; Wed, 28 Oct 2020 01:05:19 +0100 (CET) Original-Received: by breton.holly.idiocy.org (Postfix, from userid 501) id 1B9852026455DA; Wed, 28 Oct 2020 00:05:18 +0000 (GMT) Mail-Followup-To: Alan Third , Yuan Fu , Eli Zaretskii , chad , =?iso-8859-1?Q?Cl=E9ment?= Pit-Claudel , emacs-devel@gnu.org Content-Disposition: inline In-Reply-To: <17FF276F-1E4B-4955-9781-29242C1D0CE4@gmail.com> X-ContactOffice-Account: com:241649512 Received-SPF: pass client-ip=212.3.242.68; envelope-from=alan@idiocy.org; helo=wilbur.contactoffice.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 20:05:22 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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:258524 Archived-At: --hHWLQfXTYDoKhP50 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 --hHWLQfXTYDoKhP50 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Expose-NS-frames-scale-factor-to-lisp.patch" >From 094cbd60523ba9282b653d71c288776713812b2b Mon Sep 17 00:00:00 2001 From: Alan Third 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 --hHWLQfXTYDoKhP50--