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.bugs Subject: bug#54623: No scroll bars on macOS builds Date: Thu, 31 Mar 2022 17:43:09 +0100 Message-ID: References: <542747779.525811.1648554603075@mail1.libero.it> <875ynxapxv.fsf@gnus.org> <232238068.1610928.1648723538459@mail1.libero.it> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="AC3/Je72P5+wH3hi" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7710"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 54623@debbugs.gnu.org, Lars Ingebrigtsen To: Angelo Graziosi Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 31 18:44:24 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1nZxuK-0001mw-6L for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 31 Mar 2022 18:44:24 +0200 Original-Received: from localhost ([::1]:52744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZxuI-00049C-04 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 31 Mar 2022 12:44:22 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:50006) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZxty-000460-9t for bug-gnu-emacs@gnu.org; Thu, 31 Mar 2022 12:44:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45741) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nZxty-0006Yp-1O for bug-gnu-emacs@gnu.org; Thu, 31 Mar 2022 12:44:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nZxtx-00034p-Ss for bug-gnu-emacs@gnu.org; Thu, 31 Mar 2022 12:44:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 31 Mar 2022 16:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54623 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 54623-submit@debbugs.gnu.org id=B54623.164874500311770 (code B ref 54623); Thu, 31 Mar 2022 16:44:01 +0000 Original-Received: (at 54623) by debbugs.gnu.org; 31 Mar 2022 16:43:23 +0000 Original-Received: from localhost ([127.0.0.1]:39638 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZxtK-00033m-M8 for submit@debbugs.gnu.org; Thu, 31 Mar 2022 12:43:23 -0400 Original-Received: from outbound.soverin.net ([116.202.126.228]:57023) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZxtH-00033T-C8 for 54623@debbugs.gnu.org; Thu, 31 Mar 2022 12:43:20 -0400 Original-Received: from smtp.soverin.net (unknown [10.10.3.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id 99982316; Thu, 31 Mar 2022 16:43:12 +0000 (UTC) Original-Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.100]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1648744992; bh=0YyUz+YD49sUYIuCjx8k2JTULlS0Vx+JPQy0/16UtkM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=l9ESr5o42MU/eble0StHEAOQ3et6o3VkXJFOw3XOXBlEhJ7lPuIEkFFyfMpEziREG 4Y5HDJoNZEONw9W8FXX8XhvhIYfSBXCyAylfcxOsm3VF25+92bpIxWLNYTqeFOtj9K cT7JVzqu2fo+Av0jrCxXC1tABlgPfPeMPrxqjJa1qwBo39gIwAt0I3GatJdGuUpCyL aRqVLWQQnz/Lp2/5tV8eZpMCUSKdQnJew28dcVTc4hs9/gs3WSLZnbB+a9lwES3OWP w15jkCtc+YFvINDt3uBO8xVKdxyhywICyPtLebCd3ZKQLppxBOLKw8jQ64785JD7oN XpfI55ru2uPjg== Original-Received: from alan by faroe.holly.idiocy.org with local (Exim 4.95) (envelope-from ) id 1nZxt7-000Dxa-KG; Thu, 31 Mar 2022 17:43:09 +0100 Mail-Followup-To: Alan Third , Angelo Graziosi , Lars Ingebrigtsen , 54623@debbugs.gnu.org Content-Disposition: inline In-Reply-To: <232238068.1610928.1648723538459@mail1.libero.it> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:229168 Archived-At: --AC3/Je72P5+wH3hi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Mar 31, 2022 at 12:45:38PM +0200, Angelo Graziosi wrote: > > Il 30/03/2022 23:52 Alan Third ha scritto: > > > > I can't reproduce it on 10.14 either. I suspect it's some subtle > > difference in layer handling between 10.13 and 10.14+. > > > > > > Maybe the attached will help. > > No.. I am afraid... > > I applied it to current master and it builds but crashes when I try to start it. > > Attached the report that the system produces (it is taken with 'Emacs -Q', but the same occurs when I start Emacs in normal way, i.e. cliking the icon on the Dock). Can you try the new version attached to this email, please? -- Alan Third --AC3/Je72P5+wH3hi Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0001-Fix-scrollbars-on-macOS-10.13-and-below-bug-54623.patch" >From ea124ec1849c4f800a8e0a81be41ed195853d0de Mon Sep 17 00:00:00 2001 From: Alan Third Date: Wed, 30 Mar 2022 22:40:03 +0100 Subject: [PATCH v2] Fix scrollbars on macOS 10.13 and below (bug#54623) * src/nsterm.h (NSAppKitVersionNumber10_14): Required for makeBackingLayer version check. * src/nsterm.m (USING_EMACSLAYER): Check whether we're using layers and whether the layer is an EmacsLayer class. ([EmacsView makeBackingLayer]): Only use EmacsLayer on macOS 10.14 and above. ([EmacsView lockFocus]): ([EmacsView unlockFocus]): ([EmacsView windowDidChangeBackingProperties:]): ([EmacsView copyRect:to:]): Replace check for wantsLayer with USING_EMACSLAYER. ([EmacsView unlockFocus]): Remove call to flushWindow. --- src/nsterm.h | 4 ++++ src/nsterm.m | 31 ++++++++++++++++++------------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/nsterm.h b/src/nsterm.h index f027646123..ea92d8e893 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -1239,6 +1239,10 @@ #define NSAppKitVersionNumber10_7 1138 #ifndef NSAppKitVersionNumber10_10 #define NSAppKitVersionNumber10_10 1343 #endif + +#ifndef NSAppKitVersionNumber10_14 +#define NSAppKitVersionNumber10_14 1671 +#endif #endif /* NS_IMPL_COCOA */ diff --git a/src/nsterm.m b/src/nsterm.m index fd56094c28..4b4ca44981 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -5954,6 +5954,9 @@ - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg @implementation EmacsView +#define USING_EMACSLAYER \ + ([self wantsLayer] && [[self layer] isKindOfClass:[EmacsLayer class]]) + /* Needed to inform when window closed from lisp. */ - (void) setWindowClosing: (BOOL)closing { @@ -7864,12 +7867,17 @@ - (instancetype)toggleToolbar: (id)sender #ifdef NS_IMPL_COCOA - (CALayer *)makeBackingLayer; { - EmacsLayer *l = [[EmacsLayer alloc] - initWithColorSpace:[[[self window] colorSpace] CGColorSpace]]; - [l setDelegate:(id)self]; - [l setContentsScale:[[self window] backingScaleFactor]]; + if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_14) + { + EmacsLayer *l = [[EmacsLayer alloc] + initWithColorSpace:[[[self window] colorSpace] CGColorSpace]]; + [l setDelegate:(id)self]; + [l setContentsScale:[[self window] backingScaleFactor]]; + + return l; + } - return l; + return [super makeBackingLayer]; } @@ -7877,7 +7885,7 @@ - (void)lockFocus { NSTRACE ("[EmacsView lockFocus]"); - if ([self wantsLayer]) + if (USING_EMACSLAYER) { CGContextRef context = [(EmacsLayer*)[self layer] getContext]; @@ -7897,17 +7905,14 @@ - (void)unlockFocus { NSTRACE ("[EmacsView unlockFocus]"); - if ([self wantsLayer]) + if (USING_EMACSLAYER) { [NSGraphicsContext setCurrentContext:nil]; [self setNeedsDisplay:YES]; } #if MAC_OS_X_VERSION_MIN_REQUIRED < 101400 else - { - [super unlockFocus]; - [super flushWindow]; - } + [super unlockFocus]; #endif } @@ -7917,7 +7922,7 @@ - (void)windowDidChangeBackingProperties:(NSNotification *)notification { NSTRACE ("EmacsView windowDidChangeBackingProperties:]"); - if ([self wantsLayer]) + if (USING_EMACSLAYER) { NSRect frame = [self frame]; EmacsLayer *layer = (EmacsLayer *)[self layer]; @@ -7942,7 +7947,7 @@ - (void)copyRect:(NSRect)srcRect to:(NSPoint)dest NSHeight (srcRect)); #ifdef NS_IMPL_COCOA - if ([self wantsLayer]) + if (USING_EMACSLAYER) { double scale = [[self window] backingScaleFactor]; CGContextRef context = [(EmacsLayer *)[self layer] getContext]; -- 2.35.1 --AC3/Je72P5+wH3hi--