From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: HiDPI support for wave style underlines Date: Sat, 29 Jul 2017 10:13:07 +0300 Message-ID: <83wp6r3ed8.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1501312415 6024 195.159.176.226 (29 Jul 2017 07:13:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 29 Jul 2017 07:13:35 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stephen Pegoraro Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 29 09:13:32 2017 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 1dbLwD-000180-9R for ged-emacs-devel@m.gmane.org; Sat, 29 Jul 2017 09:13:25 +0200 Original-Received: from localhost ([::1]:51379 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dbLwJ-00074y-6c for ged-emacs-devel@m.gmane.org; Sat, 29 Jul 2017 03:13:31 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dbLwB-00074f-8L for emacs-devel@gnu.org; Sat, 29 Jul 2017 03:13:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dbLw8-0007wV-0p for emacs-devel@gnu.org; Sat, 29 Jul 2017 03:13:23 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:48732) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dbLw7-0007wM-Tm; Sat, 29 Jul 2017 03:13:19 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4131 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dbLw4-000155-VT; Sat, 29 Jul 2017 03:13:18 -0400 In-reply-to: (message from Stephen Pegoraro on Sat, 29 Jul 2017 11:29:43 +0800) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e 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:217120 Archived-At: > From: Stephen Pegoraro > Date: Sat, 29 Jul 2017 11:29:43 +0800 > > I have made an attempt at implementing scaled drawing of wave style > underlines for hidpi displays, X only for now. Thanks. But why do you say this is only for HiDPI displays? What aspects of the change are specific to that kind of display? > +static int x_get_scale_factor(Display *disp) > +{ > + struct x_display_info * dpyinfo = x_display_info_for_display (disp); > + if (!dpyinfo) > + emacs_abort (); > + > + return floor(dpyinfo->resy / 96); > +} The indentation here is not according to our conventions: we use the offset of 2, not 4. Also, why call emacs_abort here? I think it's better to return 1 instead. Think about this being called from a daemon, or during early stages of Emacs startup, when some of the stuff is not yet set up. And finally, why do you use only resy? Isn't it better to return 2 values, for X and Y separately, and use them accordingly in the calling function? > static void > x_draw_underwave (struct glyph_string *s) > { > - int wave_height = 3, wave_length = 2; > + /* Adjust for scale/HiDPI */ A comment should end with a period, and should have 2 spaces after the period. Like this: /* Adjust for scale/HiDPI. */ > + int scale = x_get_scale_factor (s->display); > + int wave_height = 3 * scale, wave_length = 2 * scale, thickness = scale; Same issue with indentation here. Thanks again for working on this.