unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#54623: No scroll bars on macOS builds
@ 2022-03-29 11:50 Angelo Graziosi
  2022-03-29 12:44 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 21+ messages in thread
From: Angelo Graziosi @ 2022-03-29 11:50 UTC (permalink / raw)
  To: 54623

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

Emacs builds on macOS 10.13.6 do not show scroll bars even if both vertical and horizontal ones are enabled. The attached screenshot refers to 'Emacs -Q'. 

It seems that the "places" where scroll bars should appear are drawn but not the scroll bars. Clicking there looks as if the scroll bars are hidden.

Rebuilding an old master,

1)
commit: d2d3fc39295953b4db5bdd7a21d513a87d3d00f0
Alan Third 2021-07-26 23:12:31 +0100
Convert fringe bitmaps to vectors on NS port

produce an Emacs which DOES HAVE scroll bars!

The first build in which scroll bars are gone or hidden looks

2)
commit: a4d2c88cdee90a3e4863a62c4ff69896d0c1a347
Alan Third 2021-07-31 11:13:05 +0100
Simplify macOS drawing code

So, something changed between 2021-07-26 and 2021-07-31 seems to have broken this features.

I already flagged this on emacs-devel (https://lists.gnu.org/archive/html/emacs-devel/2021-12/msg03194.html) and re-flagged here to have memory of this issue.

Ciao,
  Angelo.

[-- Attachment #2: no-scrollbars-macOS.png --]
[-- Type: image/png, Size: 46506 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#54623: No scroll bars on macOS builds
  2022-03-29 11:50 bug#54623: No scroll bars on macOS builds Angelo Graziosi
@ 2022-03-29 12:44 ` Lars Ingebrigtsen
  2022-03-29 19:53   ` Angelo Graziosi
  2022-03-30 21:52   ` Alan Third
  0 siblings, 2 replies; 21+ messages in thread
From: Lars Ingebrigtsen @ 2022-03-29 12:44 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: 54623, Alan Third

Angelo Graziosi <angelo.g0@libero.it> writes:

> Emacs builds on macOS 10.13.6 do not show scroll bars even if both
> vertical and horizontal ones are enabled. The attached screenshot
> refers to 'Emacs -Q'.

I can't reproduce this on Macos 12.1.

> The first build in which scroll bars are gone or hidden looks
>
> 2)
> commit: a4d2c88cdee90a3e4863a62c4ff69896d0c1a347
> Alan Third 2021-07-31 11:13:05 +0100
> Simplify macOS drawing code

Perhaps Alan has some comments; added to the CCs.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#54623: No scroll bars on macOS builds
  2022-03-29 12:44 ` Lars Ingebrigtsen
@ 2022-03-29 19:53   ` Angelo Graziosi
  2022-03-30  0:39     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-03-31 11:56     ` Lars Ingebrigtsen
  2022-03-30 21:52   ` Alan Third
  1 sibling, 2 replies; 21+ messages in thread
From: Angelo Graziosi @ 2022-03-29 19:53 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 54623, Alan Third

> Il 29/03/2022 14:44 Lars Ingebrigtsen ha scritto:
> 
>  
> Angelo Graziosi writes:
> 
> > Emacs builds on macOS 10.13.6 do not show scroll bars even if both
> > vertical and horizontal ones are enabled. The attached screenshot
> > refers to 'Emacs -Q'.
> 
> I can't reproduce this on Macos 12.1.

Which build? Nextstep (--with-ns) or Mac (--with-mac)?

Just for the record.. the Mac build (source from https://bitbucket.org/mituharu/emacs-mac/src/work, about March 14) DOES HAVE the scrollbars! It is 28.0.92 Mac-patched source.

The nextstep build (source from 28 branch, about March 27) DOES NOT HAVE the scroll bars.

I didn't test master because I don't know how to build using '--with-mac' (bitbucket repo does not seem to have master source Mac-patched).

(Trying to build the bitbucket source '--with-ns' fails...)





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#54623: No scroll bars on macOS builds
  2022-03-29 19:53   ` Angelo Graziosi
@ 2022-03-30  0:39     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-03-31 11:56     ` Lars Ingebrigtsen
  1 sibling, 0 replies; 21+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-03-30  0:39 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: 54623, Lars Ingebrigtsen, Alan Third

Angelo Graziosi <angelo.g0@libero.it> writes:

> Which build? Nextstep (--with-ns) or Mac (--with-mac)?
>
> Just for the record.. the Mac build (source from
> https://bitbucket.org/mituharu/emacs-mac/src/work, about March 14)
> DOES HAVE the scrollbars! It is 28.0.92 Mac-patched source.

Unfortunately that doesn't help much, since the Carbon ("Mac") port has
been maintained externally by its original developer since its removal
in Emacs 23.  I vaguely recall some drama regarding multi-tty changes...

It descends from the port to Mac OS 8 or 9 that was at least part of
Emacs 21.

> The nextstep build (source from 28 branch, about March 27) DOES NOT
> HAVE the scroll bars.

What happens if you remove the #ifdefs from ns_update_window_end and its
corresponding entry in ns_redisplay_interface?





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#54623: No scroll bars on macOS builds
  2022-03-29 12:44 ` Lars Ingebrigtsen
  2022-03-29 19:53   ` Angelo Graziosi
@ 2022-03-30 21:52   ` Alan Third
  2022-03-31 10:45     ` Angelo Graziosi
  1 sibling, 1 reply; 21+ messages in thread
From: Alan Third @ 2022-03-30 21:52 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 54623, Angelo Graziosi

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

On Tue, Mar 29, 2022 at 02:44:28PM +0200, Lars Ingebrigtsen wrote:
> Angelo Graziosi <angelo.g0@libero.it> writes:
> 
> > Emacs builds on macOS 10.13.6 do not show scroll bars even if both
> > vertical and horizontal ones are enabled. The attached screenshot
> > refers to 'Emacs -Q'.
> 
> I can't reproduce this on Macos 12.1.

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+.

> > The first build in which scroll bars are gone or hidden looks
> >
> > 2)
> > commit: a4d2c88cdee90a3e4863a62c4ff69896d0c1a347
> > Alan Third 2021-07-31 11:13:05 +0100
> > Simplify macOS drawing code
> 
> Perhaps Alan has some comments; added to the CCs.

Maybe the attached will help.
-- 
Alan Third

[-- Attachment #2: 0001-Fix-scrollbars-on-macOS-10.13-and-below-bug-54623.patch --]
[-- Type: text/x-diff, Size: 3436 bytes --]

From aef95a32f2260fdadbbd0903b5d3bb0b1220a9db Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Wed, 30 Mar 2022 22:40:03 +0100
Subject: [PATCH] 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.
---
 src/nsterm.h |  4 ++++
 src/nsterm.m | 26 +++++++++++++++++---------
 2 files changed, 21 insertions(+), 9 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..b9ae512011 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,7 +7905,7 @@ - (void)unlockFocus
 {
   NSTRACE ("[EmacsView unlockFocus]");
 
-  if ([self wantsLayer])
+  if (USING_EMACSLAYER)
     {
       [NSGraphicsContext setCurrentContext:nil];
       [self setNeedsDisplay:YES];
@@ -7917,7 +7925,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 +7950,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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* bug#54623: No scroll bars on macOS builds
  2022-03-30 21:52   ` Alan Third
@ 2022-03-31 10:45     ` Angelo Graziosi
  2022-03-31 16:43       ` Alan Third
  0 siblings, 1 reply; 21+ messages in thread
From: Angelo Graziosi @ 2022-03-31 10:45 UTC (permalink / raw)
  To: Alan Third, Lars Ingebrigtsen; +Cc: 54623

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

> 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).

[-- Attachment #2: emacs-macOS-chrash-report.log.bz2 --]
[-- Type: application/x-bzip2, Size: 17442 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#54623: No scroll bars on macOS builds
  2022-03-29 19:53   ` Angelo Graziosi
  2022-03-30  0:39     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-03-31 11:56     ` Lars Ingebrigtsen
  2022-03-31 20:06       ` Alan Third
  1 sibling, 1 reply; 21+ messages in thread
From: Lars Ingebrigtsen @ 2022-03-31 11:56 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: 54623, Alan Third

Angelo Graziosi <angelo.g0@libero.it> writes:

> Which build? Nextstep (--with-ns) or Mac (--with-mac)?

I can never remember which is which.  I don't say either, but I end up
with:

In GNU Emacs 29.0.50 (build 2, aarch64-apple-darwin21.2.0, NS appkit-2113.20 Ve\
rsion 12.1 (Build 21C52))

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#54623: No scroll bars on macOS builds
  2022-03-31 10:45     ` Angelo Graziosi
@ 2022-03-31 16:43       ` Alan Third
  2022-03-31 22:27         ` Angelo Graziosi
  0 siblings, 1 reply; 21+ messages in thread
From: Alan Third @ 2022-03-31 16:43 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: 54623, Lars Ingebrigtsen

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

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

[-- Attachment #2: v2-0001-Fix-scrollbars-on-macOS-10.13-and-below-bug-54623.patch --]
[-- Type: text/x-diff, Size: 3670 bytes --]

From ea124ec1849c4f800a8e0a81be41ed195853d0de Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* bug#54623: No scroll bars on macOS builds
  2022-03-31 11:56     ` Lars Ingebrigtsen
@ 2022-03-31 20:06       ` Alan Third
  2022-03-31 22:31         ` Angelo Graziosi
  0 siblings, 1 reply; 21+ messages in thread
From: Alan Third @ 2022-03-31 20:06 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 54623, Angelo Graziosi

On Thu, Mar 31, 2022 at 01:56:05PM +0200, Lars Ingebrigtsen wrote:
> Angelo Graziosi <angelo.g0@libero.it> writes:
> 
> > Which build? Nextstep (--with-ns) or Mac (--with-mac)?
> 
> I can never remember which is which.  I don't say either, but I end up
> with:
> 
> In GNU Emacs 29.0.50 (build 2, aarch64-apple-darwin21.2.0, NS appkit-2113.20 Ve\
> rsion 12.1 (Build 21C52))

You're using the NS port. You have to go out of your way to get the
Mac port, it's the one Mitsuharu Yamamoto maintains.

-- 
Alan Third





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#54623: No scroll bars on macOS builds
  2022-03-31 16:43       ` Alan Third
@ 2022-03-31 22:27         ` Angelo Graziosi
  2022-04-01 20:59           ` Alan Third
  0 siblings, 1 reply; 21+ messages in thread
From: Angelo Graziosi @ 2022-03-31 22:27 UTC (permalink / raw)
  To: Alan Third; +Cc: 54623, Lars Ingebrigtsen


> Il 31/03/2022 18:43 Alan Third ha scritto:
> 
> 
> Can you try the new version attached to this email, please?
> 

Now Emacs builds and does not crash but DOES NOT work and still NO scroll bars:

- when scrolling the text moving the mouse wheel the bottom lines remain fixed and then after a while the window contains garbage.

- trying to use C-x C-f, M-x ... does not work, no minibuffer opens: it continues to display the text "For information about..."

- trying to select text with the mouse (mouse-1 and dragging) does not work...





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#54623: No scroll bars on macOS builds
  2022-03-31 20:06       ` Alan Third
@ 2022-03-31 22:31         ` Angelo Graziosi
  0 siblings, 0 replies; 21+ messages in thread
From: Angelo Graziosi @ 2022-03-31 22:31 UTC (permalink / raw)
  To: Alan Third, Lars Ingebrigtsen; +Cc: 54623

> Il 31/03/2022 22:06 Alan Third ha scritto:
> 
>  
> On Thu, Mar 31, 2022 at 01:56:05PM +0200, Lars Ingebrigtsen wrote:
> > Angelo Graziosi writes:
> > 
> > > Which build? Nextstep (--with-ns) or Mac (--with-mac)?
> > 
> > I can never remember which is which.  I don't say either, but I end up
> > with:
> > 
> > In GNU Emacs 29.0.50 (build 2, aarch64-apple-darwin21.2.0, NS appkit-2113.20 Ve\
> > rsion 12.1 (Build 21C52))
> 
> You're using the NS port. You have to go out of your way to get the
> Mac port, it's the one Mitsuharu Yamamoto maintains.

BTW, how to build Emacs master using Mac Port? It seems that for Mac port "master" means "emacs-27", "work" means "emacs-28"...





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#54623: No scroll bars on macOS builds
  2022-03-31 22:27         ` Angelo Graziosi
@ 2022-04-01 20:59           ` Alan Third
  2022-04-01 22:37             ` Angelo Graziosi
  0 siblings, 1 reply; 21+ messages in thread
From: Alan Third @ 2022-04-01 20:59 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: 54623, Lars Ingebrigtsen

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

On Fri, Apr 01, 2022 at 12:27:25AM +0200, Angelo Graziosi wrote:
> 
> > Il 31/03/2022 18:43 Alan Third ha scritto:
> > 
> > 
> > Can you try the new version attached to this email, please?
> > 
> 
> Now Emacs builds and does not crash but DOES NOT work and still NO scroll bars:
> 
> - when scrolling the text moving the mouse wheel the bottom lines remain fixed and then after a while the window contains garbage.
> 
> - trying to use C-x C-f, M-x ... does not work, no minibuffer opens: it continues to display the text "For information about..."
> 
> - trying to select text with the mouse (mouse-1 and dragging) does not work...

What about the attached?

-- 
Alan Third

[-- Attachment #2: v3-0001-Fix-scrollbars-on-macOS-10.13-and-below-bug-54623.patch --]
[-- Type: text/x-diff, Size: 8073 bytes --]

From be1e1165c94533ac47584639b544fd24acec284a Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Wed, 30 Mar 2022 22:40:03 +0100
Subject: [PATCH v3] Fix scrollbars on macOS 10.13 and below (bug#54623)

Make any build on macOS 10.13 and below follow the same drawing path
as the GNUstep port.  macOS 10.14 and above will use EmacsLayer.

* src/nsterm.h (EmacsLayer):
* src/nsterm.m ([EmacsView makeBackingLayer]):
([EmacsView unlockFocus]):
([EmacsView windowDidChangeBackingProperties:]):
([EmacsView copyRect:to:]): Remove any code required for macOS 10.13
and below, and fix the #if's to enforce strict separation of the
drawing paths.
---
 src/nsterm.h |   2 +-
 src/nsterm.m | 124 +++++++++++++++++++--------------------------------
 2 files changed, 47 insertions(+), 79 deletions(-)

diff --git a/src/nsterm.h b/src/nsterm.h
index f027646123..8452f3b3fa 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -698,7 +698,7 @@ #define NSTRACE_UNSILENCE()
 + (CGFloat)scrollerWidth;
 @end
 
-#ifdef NS_IMPL_COCOA
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
 @interface EmacsLayer : CALayer
 {
   NSMutableArray *cache;
diff --git a/src/nsterm.m b/src/nsterm.m
index fd56094c28..2b98fb9489 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7197,7 +7197,7 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f
 
   [[EmacsWindow alloc] initWithEmacsFrame:f];
 
-#ifdef NS_IMPL_COCOA
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
   /* These settings mean AppKit will retain the contents of the frame
      on resize.  Unfortunately it also means the frame will not be
      automatically marked for display, but we can do that ourselves in
@@ -7861,7 +7861,7 @@ - (instancetype)toggleToolbar: (id)sender
 }
 
 
-#ifdef NS_IMPL_COCOA
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 10140
 - (CALayer *)makeBackingLayer;
 {
   EmacsLayer *l = [[EmacsLayer alloc]
@@ -7877,19 +7877,12 @@ - (void)lockFocus
 {
   NSTRACE ("[EmacsView lockFocus]");
 
-  if ([self wantsLayer])
-    {
-      CGContextRef context = [(EmacsLayer*)[self layer] getContext];
+  CGContextRef context = [(EmacsLayer*)[self layer] getContext];
 
-      [NSGraphicsContext
+  [NSGraphicsContext
         setCurrentContext:[NSGraphicsContext
                             graphicsContextWithCGContext:context
                                                  flipped:YES]];
-    }
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
-  else
-    [super lockFocus];
-#endif
 }
 
 
@@ -7897,18 +7890,8 @@ - (void)unlockFocus
 {
   NSTRACE ("[EmacsView unlockFocus]");
 
-  if ([self wantsLayer])
-    {
-      [NSGraphicsContext setCurrentContext:nil];
-      [self setNeedsDisplay:YES];
-    }
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
-  else
-    {
-      [super unlockFocus];
-      [super flushWindow];
-    }
-#endif
+  [NSGraphicsContext setCurrentContext:nil];
+  [self setNeedsDisplay:YES];
 }
 
 
@@ -7917,19 +7900,16 @@ - (void)windowDidChangeBackingProperties:(NSNotification *)notification
 {
   NSTRACE ("EmacsView windowDidChangeBackingProperties:]");
 
-  if ([self wantsLayer])
-    {
-      NSRect frame = [self frame];
-      EmacsLayer *layer = (EmacsLayer *)[self layer];
+  NSRect frame = [self frame];
+  EmacsLayer *layer = (EmacsLayer *)[self layer];
 
-      [layer setContentsScale:[[notification object] backingScaleFactor]];
-      [layer setColorSpace:[[[notification object] colorSpace] CGColorSpace]];
+  [layer setContentsScale:[[notification object] backingScaleFactor]];
+  [layer setColorSpace:[[[notification object] colorSpace] CGColorSpace]];
 
-      ns_clear_frame (emacsframe);
-      expose_frame (emacsframe, 0, 0, NSWidth (frame), NSHeight (frame));
-    }
+  ns_clear_frame (emacsframe);
+  expose_frame (emacsframe, 0, 0, NSWidth (frame), NSHeight (frame));
 }
-#endif /* NS_IMPL_COCOA */
+#endif
 
 
 - (void)copyRect:(NSRect)srcRect to:(NSPoint)dest
@@ -7941,57 +7921,45 @@ - (void)copyRect:(NSRect)srcRect to:(NSPoint)dest
   NSRect dstRect = NSMakeRect (dest.x, dest.y, NSWidth (srcRect),
                                NSHeight (srcRect));
 
-#ifdef NS_IMPL_COCOA
-  if ([self wantsLayer])
-    {
-      double scale = [[self window] backingScaleFactor];
-      CGContextRef context = [(EmacsLayer *)[self layer] getContext];
-      int bpp = CGBitmapContextGetBitsPerPixel (context) / 8;
-      void *pixels = CGBitmapContextGetData (context);
-      int rowSize = CGBitmapContextGetBytesPerRow (context);
-      int srcRowSize = NSWidth (srcRect) * scale * bpp;
-      void *srcPixels = (char *) pixels
-                        + (int) (NSMinY (srcRect) * scale * rowSize
-                                 + NSMinX (srcRect) * scale * bpp);
-      void *dstPixels = (char *) pixels
-                        + (int) (dest.y * scale * rowSize
-                                 + dest.x * scale * bpp);
-
-      if (NSIntersectsRect (srcRect, dstRect)
-          && NSMinY (srcRect) < NSMinY (dstRect))
-        for (int y = NSHeight (srcRect) * scale - 1 ; y >= 0 ; y--)
-          memmove ((char *) dstPixels + y * rowSize,
-                   (char *) srcPixels + y * rowSize,
-                   srcRowSize);
-      else
-        for (int y = 0 ; y < NSHeight (srcRect) * scale ; y++)
-          memmove ((char *) dstPixels + y * rowSize,
-                   (char *) srcPixels + y * rowSize,
-                   srcRowSize);
-
-    }
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+  double scale = [[self window] backingScaleFactor];
+  CGContextRef context = [(EmacsLayer *)[self layer] getContext];
+  int bpp = CGBitmapContextGetBitsPerPixel (context) / 8;
+  void *pixels = CGBitmapContextGetData (context);
+  int rowSize = CGBitmapContextGetBytesPerRow (context);
+  int srcRowSize = NSWidth (srcRect) * scale * bpp;
+  void *srcPixels = (char *) pixels
+    + (int) (NSMinY (srcRect) * scale * rowSize
+             + NSMinX (srcRect) * scale * bpp);
+  void *dstPixels = (char *) pixels
+    + (int) (dest.y * scale * rowSize
+             + dest.x * scale * bpp);
+
+  if (NSIntersectsRect (srcRect, dstRect)
+      && NSMinY (srcRect) < NSMinY (dstRect))
+    for (int y = NSHeight (srcRect) * scale - 1 ; y >= 0 ; y--)
+      memmove ((char *) dstPixels + y * rowSize,
+               (char *) srcPixels + y * rowSize,
+               srcRowSize);
   else
-    {
-#endif
-#endif /* NS_IMPL_COCOA */
+    for (int y = 0 ; y < NSHeight (srcRect) * scale ; y++)
+      memmove ((char *) dstPixels + y * rowSize,
+               (char *) srcPixels + y * rowSize,
+               srcRowSize);
 
-#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MIN_REQUIRED < 101400
-      hide_bell();              // Ensure the bell image isn't scrolled.
+#else
+  hide_bell();              // Ensure the bell image isn't scrolled.
 
-      ns_focus (emacsframe, &dstRect, 1);
-      [self scrollRect: srcRect
-                    by: NSMakeSize (dstRect.origin.x - srcRect.origin.x,
-                                    dstRect.origin.y - srcRect.origin.y)];
-      ns_unfocus (emacsframe);
-#endif
-#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED < 101400
-    }
+  ns_focus (emacsframe, &dstRect, 1);
+  [self scrollRect: srcRect
+                by: NSMakeSize (dstRect.origin.x - srcRect.origin.x,
+                                dstRect.origin.y - srcRect.origin.y)];
+  ns_unfocus (emacsframe);
 #endif
 }
 
 
-#ifdef NS_IMPL_COCOA
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
 /* If the frame has been garbaged but the toolkit wants to draw, for
    example when resizing the frame, we end up with a blank screen.
    Sometimes this results in an unpleasant flicker, so try to
@@ -9435,7 +9403,7 @@ - (void) scrollWheel: (NSEvent *)theEvent
 @end  /* EmacsScroller */
 
 
-#ifdef NS_IMPL_COCOA
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
 
 /* ==========================================================================
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* bug#54623: No scroll bars on macOS builds
  2022-04-01 20:59           ` Alan Third
@ 2022-04-01 22:37             ` Angelo Graziosi
  2022-04-02  8:07               ` Alan Third
  0 siblings, 1 reply; 21+ messages in thread
From: Angelo Graziosi @ 2022-04-01 22:37 UTC (permalink / raw)
  To: Alan Third; +Cc: 54623, Lars Ingebrigtsen


> Il 01/04/2022 22:59 Alan Third  ha scritto:
> 
>  
> On Fri, Apr 01, 2022 at 12:27:25AM +0200, Angelo Graziosi wrote:
> > 
> > > Il 31/03/2022 18:43 Alan Third ha scritto:
> > > 
> > > 
> > > Can you try the new version attached to this email, please?
> > > 
> > 
> > Now Emacs builds and does not crash but DOES NOT work and still NO scroll bars:
> > 
> > - when scrolling the text moving the mouse wheel the bottom lines remain fixed and then after a while the window contains garbage.
> > 
> > - trying to use C-x C-f, M-x ... does not work, no minibuffer opens: it continues to display the text "For information about..."
> > 
> > - trying to select text with the mouse (mouse-1 and dragging) does not work...
> 
> What about the attached?

WITHOUT it Emacs builds. 

WITH it Emacs fails to build:

[...]
GEN      ../../etc/charsets/MULE-uviscii.map
  GEN      ../../lisp/international/cp51932.el
  GEN      ../../lisp/international/eucjp-ms.el
  GEN      charsets.stamp
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C ../admin/unidata charscript.el
  GEN      ../../lisp/international/charscript.el
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C ../admin/unidata emoji-zwj.el
  GEN      ../../lisp/international/emoji-zwj.el
  CCLD     temacs
ld: warning: text-based stub file /System/Library/Frameworks//AppKit.framework/AppKit.tbd and library file /System/Library/Frameworks//AppKit.framework/AppKit are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//IOKit.framework/IOKit.tbd and library file /System/Library/Frameworks//IOKit.framework/IOKit are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//IOSurface.framework/IOSurface.tbd and library file /System/Library/Frameworks//IOSurface.framework/IOSurface are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//QuartzCore.framework/QuartzCore.tbd and library file /System/Library/Frameworks//QuartzCore.framework/QuartzCore are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/PrivateFrameworks/UIFoundation.framework/Versions/A/UIFoundation.tbd and library file /System/Library/PrivateFrameworks/UIFoundation.framework/Versions/A/UIFoundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//ApplicationServices.framework/Versions/A/ApplicationServices.tbd and library file /System/Library/Frameworks//ApplicationServices.framework/Versions/A/ApplicationServices are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//Foundation.framework/Versions/C/Foundation.tbd and library file /System/Library/Frameworks//Foundation.framework/Versions/C/Foundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/CommonPanels.framework/Versions/A/CommonPanels.tbd and library file /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/CommonPanels.framework/Versions/A/CommonPanels are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox.tbd and library file /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Help.framework/Versions/A/Help.tbd and library file /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Help.framework/Versions/A/Help are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/ImageCapture.framework/Versions/A/ImageCapture.tbd and library file /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/ImageCapture.framework/Versions/A/ImageCapture are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Ink.framework/Versions/A/Ink.tbd and library file /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Ink.framework/Versions/A/Ink are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/OpenScripting.framework/Versions/A/OpenScripting.tbd and library file /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/OpenScripting.framework/Versions/A/OpenScripting are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Print.framework/Versions/A/Print.tbd and library file /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Print.framework/Versions/A/Print are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/SecurityHI.framework/Versions/A/SecurityHI.tbd and library file /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/SecurityHI.framework/Versions/A/SecurityHI are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/SpeechRecognition.framework/Versions/A/SpeechRecognition.tbd and library file /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/SpeechRecognition.framework/Versions/A/SpeechRecognition are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreImage.framework/Versions/A/CoreImage.tbd and library file /System/Library/Frameworks//CoreImage.framework/Versions/A/CoreImage are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreVideo.framework/Versions/A/CoreVideo.tbd and library file /System/Library/Frameworks//CoreVideo.framework/Versions/A/CoreVideo are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/Versions/A/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/Versions/A/CoreFoundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreGraphics.framework/Versions/A/CoreGraphics.tbd and library file /System/Library/Frameworks//CoreGraphics.framework/Versions/A/CoreGraphics are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreText.framework/Versions/A/CoreText.tbd and library file /System/Library/Frameworks//CoreText.framework/Versions/A/CoreText are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//ImageIO.framework/Versions/A/ImageIO.tbd and library file /System/Library/Frameworks//ImageIO.framework/Versions/A/ImageIO are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//ColorSync.framework/Versions/A/ColorSync.tbd and library file /System/Library/Frameworks//ColorSync.framework/Versions/A/ColorSync are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/ATS.tbd and library file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/ATS are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ColorSyncLegacy.framework/Versions/A/ColorSyncLegacy.tbd and library file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ColorSyncLegacy.framework/Versions/A/ColorSyncLegacy are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreServices.framework/Versions/A/CoreServices.tbd and library file /System/Library/Frameworks//CoreServices.framework/Versions/A/CoreServices are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices.tbd and library file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LangAnalysis.framework/Versions/A/LangAnalysis.tbd and library file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LangAnalysis.framework/Versions/A/LangAnalysis are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/PrintCore.tbd and library file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/PrintCore are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/QD.framework/Versions/A/QD.tbd and library file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/QD.framework/Versions/A/QD are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/SpeechSynthesis.tbd and library file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/SpeechSynthesis are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CFNetwork.framework/Versions/A/CFNetwork.tbd and library file /System/Library/Frameworks//CFNetwork.framework/Versions/A/CFNetwork are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/FSEvents.framework/Versions/A/FSEvents.tbd and library file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/FSEvents.framework/Versions/A/FSEvents are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore.tbd and library file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata.tbd and library file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices.tbd and library file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit.tbd and library file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE.tbd and library file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices.tbd and library file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/DictionaryServices.tbd and library file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/DictionaryServices are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SharedFileList.framework/Versions/A/SharedFileList.tbd and library file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SharedFileList.framework/Versions/A/SharedFileList are out of sync. Falling back to library file for linking.
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_EmacsLayer", referenced from:
      objc-class-ref in nsterm.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [temacs] Error 1
make: *** [src] Error 2
Error: Failure running MAKE





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#54623: No scroll bars on macOS builds
  2022-04-01 22:37             ` Angelo Graziosi
@ 2022-04-02  8:07               ` Alan Third
  2022-04-02  9:42                 ` Angelo Graziosi
  0 siblings, 1 reply; 21+ messages in thread
From: Alan Third @ 2022-04-02  8:07 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: 54623, Lars Ingebrigtsen

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

On Sat, Apr 02, 2022 at 12:37:33AM +0200, Angelo Graziosi wrote:
> Undefined symbols for architecture x86_64:
>   "_OBJC_CLASS_$_EmacsLayer", referenced from:
>       objc-class-ref in nsterm.o
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
> make[1]: *** [temacs] Error 1
> make: *** [src] Error 2
> Error: Failure running MAKE

*sigh* missed a zero in the version number in one of the #if things.

Please try the attached.
-- 
Alan Third

[-- Attachment #2: v4-0001-Fix-scrollbars-on-macOS-10.13-and-below-bug-54623.patch --]
[-- Type: text/x-diff, Size: 8301 bytes --]

From a2b78c8b93b7c52fce1c3d1c6b6c478d86419a0d Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Wed, 30 Mar 2022 22:40:03 +0100
Subject: [PATCH v4] Fix scrollbars on macOS 10.13 and below (bug#54623)

Make any build on macOS 10.13 and below follow the same drawing path
as the GNUstep port.  macOS 10.14 and above will use EmacsLayer.

* src/nsterm.h (EmacsLayer):
* src/nsterm.m ([EmacsView makeBackingLayer]):
([EmacsView unlockFocus]):
([EmacsView windowDidChangeBackingProperties:]):
([EmacsView copyRect:to:]): Remove any code required for macOS 10.13
and below, and fix the #if's to enforce strict separation of the
drawing paths.
---
 src/nsterm.h |   4 +-
 src/nsterm.m | 124 +++++++++++++++++++--------------------------------
 2 files changed, 48 insertions(+), 80 deletions(-)

diff --git a/src/nsterm.h b/src/nsterm.h
index f027646123..4cba5c0be8 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -487,7 +487,7 @@ #define NSTRACE_UNSILENCE()
 #endif
 - (int)fullscreenState;
 
-#ifdef NS_IMPL_COCOA
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
 - (void)lockFocus;
 - (void)unlockFocus;
 #endif
@@ -698,7 +698,7 @@ #define NSTRACE_UNSILENCE()
 + (CGFloat)scrollerWidth;
 @end
 
-#ifdef NS_IMPL_COCOA
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
 @interface EmacsLayer : CALayer
 {
   NSMutableArray *cache;
diff --git a/src/nsterm.m b/src/nsterm.m
index fd56094c28..a093b6a67d 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7197,7 +7197,7 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f
 
   [[EmacsWindow alloc] initWithEmacsFrame:f];
 
-#ifdef NS_IMPL_COCOA
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
   /* These settings mean AppKit will retain the contents of the frame
      on resize.  Unfortunately it also means the frame will not be
      automatically marked for display, but we can do that ourselves in
@@ -7861,7 +7861,7 @@ - (instancetype)toggleToolbar: (id)sender
 }
 
 
-#ifdef NS_IMPL_COCOA
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
 - (CALayer *)makeBackingLayer;
 {
   EmacsLayer *l = [[EmacsLayer alloc]
@@ -7877,19 +7877,12 @@ - (void)lockFocus
 {
   NSTRACE ("[EmacsView lockFocus]");
 
-  if ([self wantsLayer])
-    {
-      CGContextRef context = [(EmacsLayer*)[self layer] getContext];
+  CGContextRef context = [(EmacsLayer*)[self layer] getContext];
 
-      [NSGraphicsContext
+  [NSGraphicsContext
         setCurrentContext:[NSGraphicsContext
                             graphicsContextWithCGContext:context
                                                  flipped:YES]];
-    }
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
-  else
-    [super lockFocus];
-#endif
 }
 
 
@@ -7897,18 +7890,8 @@ - (void)unlockFocus
 {
   NSTRACE ("[EmacsView unlockFocus]");
 
-  if ([self wantsLayer])
-    {
-      [NSGraphicsContext setCurrentContext:nil];
-      [self setNeedsDisplay:YES];
-    }
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
-  else
-    {
-      [super unlockFocus];
-      [super flushWindow];
-    }
-#endif
+  [NSGraphicsContext setCurrentContext:nil];
+  [self setNeedsDisplay:YES];
 }
 
 
@@ -7917,19 +7900,16 @@ - (void)windowDidChangeBackingProperties:(NSNotification *)notification
 {
   NSTRACE ("EmacsView windowDidChangeBackingProperties:]");
 
-  if ([self wantsLayer])
-    {
-      NSRect frame = [self frame];
-      EmacsLayer *layer = (EmacsLayer *)[self layer];
+  NSRect frame = [self frame];
+  EmacsLayer *layer = (EmacsLayer *)[self layer];
 
-      [layer setContentsScale:[[notification object] backingScaleFactor]];
-      [layer setColorSpace:[[[notification object] colorSpace] CGColorSpace]];
+  [layer setContentsScale:[[notification object] backingScaleFactor]];
+  [layer setColorSpace:[[[notification object] colorSpace] CGColorSpace]];
 
-      ns_clear_frame (emacsframe);
-      expose_frame (emacsframe, 0, 0, NSWidth (frame), NSHeight (frame));
-    }
+  ns_clear_frame (emacsframe);
+  expose_frame (emacsframe, 0, 0, NSWidth (frame), NSHeight (frame));
 }
-#endif /* NS_IMPL_COCOA */
+#endif
 
 
 - (void)copyRect:(NSRect)srcRect to:(NSPoint)dest
@@ -7941,57 +7921,45 @@ - (void)copyRect:(NSRect)srcRect to:(NSPoint)dest
   NSRect dstRect = NSMakeRect (dest.x, dest.y, NSWidth (srcRect),
                                NSHeight (srcRect));
 
-#ifdef NS_IMPL_COCOA
-  if ([self wantsLayer])
-    {
-      double scale = [[self window] backingScaleFactor];
-      CGContextRef context = [(EmacsLayer *)[self layer] getContext];
-      int bpp = CGBitmapContextGetBitsPerPixel (context) / 8;
-      void *pixels = CGBitmapContextGetData (context);
-      int rowSize = CGBitmapContextGetBytesPerRow (context);
-      int srcRowSize = NSWidth (srcRect) * scale * bpp;
-      void *srcPixels = (char *) pixels
-                        + (int) (NSMinY (srcRect) * scale * rowSize
-                                 + NSMinX (srcRect) * scale * bpp);
-      void *dstPixels = (char *) pixels
-                        + (int) (dest.y * scale * rowSize
-                                 + dest.x * scale * bpp);
-
-      if (NSIntersectsRect (srcRect, dstRect)
-          && NSMinY (srcRect) < NSMinY (dstRect))
-        for (int y = NSHeight (srcRect) * scale - 1 ; y >= 0 ; y--)
-          memmove ((char *) dstPixels + y * rowSize,
-                   (char *) srcPixels + y * rowSize,
-                   srcRowSize);
-      else
-        for (int y = 0 ; y < NSHeight (srcRect) * scale ; y++)
-          memmove ((char *) dstPixels + y * rowSize,
-                   (char *) srcPixels + y * rowSize,
-                   srcRowSize);
-
-    }
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+  double scale = [[self window] backingScaleFactor];
+  CGContextRef context = [(EmacsLayer *)[self layer] getContext];
+  int bpp = CGBitmapContextGetBitsPerPixel (context) / 8;
+  void *pixels = CGBitmapContextGetData (context);
+  int rowSize = CGBitmapContextGetBytesPerRow (context);
+  int srcRowSize = NSWidth (srcRect) * scale * bpp;
+  void *srcPixels = (char *) pixels
+    + (int) (NSMinY (srcRect) * scale * rowSize
+             + NSMinX (srcRect) * scale * bpp);
+  void *dstPixels = (char *) pixels
+    + (int) (dest.y * scale * rowSize
+             + dest.x * scale * bpp);
+
+  if (NSIntersectsRect (srcRect, dstRect)
+      && NSMinY (srcRect) < NSMinY (dstRect))
+    for (int y = NSHeight (srcRect) * scale - 1 ; y >= 0 ; y--)
+      memmove ((char *) dstPixels + y * rowSize,
+               (char *) srcPixels + y * rowSize,
+               srcRowSize);
   else
-    {
-#endif
-#endif /* NS_IMPL_COCOA */
+    for (int y = 0 ; y < NSHeight (srcRect) * scale ; y++)
+      memmove ((char *) dstPixels + y * rowSize,
+               (char *) srcPixels + y * rowSize,
+               srcRowSize);
 
-#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MIN_REQUIRED < 101400
-      hide_bell();              // Ensure the bell image isn't scrolled.
+#else
+  hide_bell();              // Ensure the bell image isn't scrolled.
 
-      ns_focus (emacsframe, &dstRect, 1);
-      [self scrollRect: srcRect
-                    by: NSMakeSize (dstRect.origin.x - srcRect.origin.x,
-                                    dstRect.origin.y - srcRect.origin.y)];
-      ns_unfocus (emacsframe);
-#endif
-#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED < 101400
-    }
+  ns_focus (emacsframe, &dstRect, 1);
+  [self scrollRect: srcRect
+                by: NSMakeSize (dstRect.origin.x - srcRect.origin.x,
+                                dstRect.origin.y - srcRect.origin.y)];
+  ns_unfocus (emacsframe);
 #endif
 }
 
 
-#ifdef NS_IMPL_COCOA
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
 /* If the frame has been garbaged but the toolkit wants to draw, for
    example when resizing the frame, we end up with a blank screen.
    Sometimes this results in an unpleasant flicker, so try to
@@ -9435,7 +9403,7 @@ - (void) scrollWheel: (NSEvent *)theEvent
 @end  /* EmacsScroller */
 
 
-#ifdef NS_IMPL_COCOA
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
 
 /* ==========================================================================
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* bug#54623: No scroll bars on macOS builds
  2022-04-02  8:07               ` Alan Third
@ 2022-04-02  9:42                 ` Angelo Graziosi
  2022-04-02 11:00                   ` Angelo Graziosi
  0 siblings, 1 reply; 21+ messages in thread
From: Angelo Graziosi @ 2022-04-02  9:42 UTC (permalink / raw)
  To: Alan Third; +Cc: 54623, Lars Ingebrigtsen


> Il 02/04/2022 10:07 Alan Third <alan@idiocy.org> ha scritto:
> 
>  
> On Sat, Apr 02, 2022 at 12:37:33AM +0200, Angelo Graziosi wrote:
> > Undefined symbols for architecture x86_64:
> >   "_OBJC_CLASS_$_EmacsLayer", referenced from:
> >       objc-class-ref in nsterm.o
> > ld: symbol(s) not found for architecture x86_64
> > clang: error: linker command failed with exit code 1 (use -v to see invocation)
> > make[1]: *** [temacs] Error 1
> > make: *** [src] Error 2
> > Error: Failure running MAKE
> 
> *sigh* missed a zero in the version number in one of the #if things.
> 
> Please try the attached.

Now it seems to work as expected!!!

Let's see how t work for few days..





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#54623: No scroll bars on macOS builds
  2022-04-02  9:42                 ` Angelo Graziosi
@ 2022-04-02 11:00                   ` Angelo Graziosi
  2022-04-03 13:36                     ` Alan Third
  0 siblings, 1 reply; 21+ messages in thread
From: Angelo Graziosi @ 2022-04-02 11:00 UTC (permalink / raw)
  To: Alan Third; +Cc: 54623, Lars Ingebrigtsen


> Il 02/04/2022 11:42 Angelo Graziosi <angelo.g0@libero.it> ha scritto:
> 
>  
> > Il 02/04/2022 10:07 Alan Third <alan@idiocy.org> ha scritto:
> > 
> >  
> > On Sat, Apr 02, 2022 at 12:37:33AM +0200, Angelo Graziosi wrote:
> > > Undefined symbols for architecture x86_64:
> > >   "_OBJC_CLASS_$_EmacsLayer", referenced from:
> > >       objc-class-ref in nsterm.o
> > > ld: symbol(s) not found for architecture x86_64
> > > clang: error: linker command failed with exit code 1 (use -v to see invocation)
> > > make[1]: *** [temacs] Error 1
> > > make: *** [src] Error 2
> > > Error: Failure running MAKE
> > 
> > *sigh* missed a zero in the version number in one of the #if things.
> > 
> > Please try the attached.
> 
> Now it seems to work as expected!!!
> 
> Let's see how t work for few days..

Spoken too soon!
=================

Now Emacs builds, does not crash, *does have* scroll bars, but..

- I cannot select text (mouse-1 and drag)

- minibuffer does not work: C-x C-f displays current directory but I cannot type anything there

- the same with M-x: only M-x is displayed but cannot type the command and cannot use history (UP/DOWN arrows)..





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#54623: No scroll bars on macOS builds
  2022-04-02 11:00                   ` Angelo Graziosi
@ 2022-04-03 13:36                     ` Alan Third
  2022-04-03 20:00                       ` Angelo Graziosi
  0 siblings, 1 reply; 21+ messages in thread
From: Alan Third @ 2022-04-03 13:36 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: 54623, Lars Ingebrigtsen

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

On Sat, Apr 02, 2022 at 01:00:13PM +0200, Angelo Graziosi wrote:
> 
> > Il 02/04/2022 11:42 Angelo Graziosi <angelo.g0@libero.it> ha scritto:
> > 
> >  
> > > Il 02/04/2022 10:07 Alan Third <alan@idiocy.org> ha scritto:
> > > 
> > >  
> > > On Sat, Apr 02, 2022 at 12:37:33AM +0200, Angelo Graziosi wrote:
> > > > Undefined symbols for architecture x86_64:
> > > >   "_OBJC_CLASS_$_EmacsLayer", referenced from:
> > > >       objc-class-ref in nsterm.o
> > > > ld: symbol(s) not found for architecture x86_64
> > > > clang: error: linker command failed with exit code 1 (use -v to see invocation)
> > > > make[1]: *** [temacs] Error 1
> > > > make: *** [src] Error 2
> > > > Error: Failure running MAKE
> > > 
> > > *sigh* missed a zero in the version number in one of the #if things.
> > > 
> > > Please try the attached.
> > 
> > Now it seems to work as expected!!!
> > 
> > Let's see how t work for few days..
> 
> Spoken too soon!
> =================
> 
> Now Emacs builds, does not crash, *does have* scroll bars, but..
> 
> - I cannot select text (mouse-1 and drag)
> 
> - minibuffer does not work: C-x C-f displays current directory but I cannot type anything there
> 
> - the same with M-x: only M-x is displayed but cannot type the command and cannot use history (UP/DOWN arrows)..

hopefully all we have to do is force an occasional redraw like on
GNUstep. Please try the attached.
-- 
Alan Third

[-- Attachment #2: v5-0001-Fix-scrollbars-on-macOS-10.13-and-below-bug-54623.patch --]
[-- Type: text/x-diff, Size: 9024 bytes --]

From 0ceb4141eaaac896cc1a16aa58cc11f037048906 Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Wed, 30 Mar 2022 22:40:03 +0100
Subject: [PATCH v5] Fix scrollbars on macOS 10.13 and below (bug#54623)

Make any build on macOS 10.13 and below follow the same drawing path
as the GNUstep port.  macOS 10.14 and above will use EmacsLayer.

* src/nsterm.h (EmacsLayer):
* src/nsterm.m ([EmacsView makeBackingLayer]):
([EmacsView unlockFocus]):
([EmacsView windowDidChangeBackingProperties:]):
([EmacsView copyRect:to:]): Remove any code required for macOS 10.13
and below, and fix the #if's to enforce strict separation of the
drawing paths.
(ns_update_end):
(ns_unfocus): Fix #ifs so that flushWindow is called on old macOS
versions as well as GNUstep.
---
 src/nsterm.h |   4 +-
 src/nsterm.m | 128 +++++++++++++++++++--------------------------------
 2 files changed, 50 insertions(+), 82 deletions(-)

diff --git a/src/nsterm.h b/src/nsterm.h
index f027646123..4cba5c0be8 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -487,7 +487,7 @@ #define NSTRACE_UNSILENCE()
 #endif
 - (int)fullscreenState;
 
-#ifdef NS_IMPL_COCOA
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
 - (void)lockFocus;
 - (void)unlockFocus;
 #endif
@@ -698,7 +698,7 @@ #define NSTRACE_UNSILENCE()
 + (CGFloat)scrollerWidth;
 @end
 
-#ifdef NS_IMPL_COCOA
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
 @interface EmacsLayer : CALayer
 {
   NSMutableArray *cache;
diff --git a/src/nsterm.m b/src/nsterm.m
index fd56094c28..0520d76b34 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1060,7 +1060,7 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
   block_input ();
 
   [view unlockFocus];
-#if defined (NS_IMPL_GNUSTEP)
+#if defined (NS_IMPL_GNUSTEP) || MAC_OS_X_VERSION_MIN_REQUIRED < 101400
   [[view window] flushWindow];
 #endif
 
@@ -1127,7 +1127,7 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
     {
       EmacsView *view = FRAME_NS_VIEW (f);
       [view unlockFocus];
-#if defined (NS_IMPL_GNUSTEP)
+#if defined (NS_IMPL_GNUSTEP) || MAC_OS_X_VERSION_MIN_REQUIRED < 101400
       [[view window] flushWindow];
 #endif
     }
@@ -7197,7 +7197,7 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f
 
   [[EmacsWindow alloc] initWithEmacsFrame:f];
 
-#ifdef NS_IMPL_COCOA
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
   /* These settings mean AppKit will retain the contents of the frame
      on resize.  Unfortunately it also means the frame will not be
      automatically marked for display, but we can do that ourselves in
@@ -7861,7 +7861,7 @@ - (instancetype)toggleToolbar: (id)sender
 }
 
 
-#ifdef NS_IMPL_COCOA
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
 - (CALayer *)makeBackingLayer;
 {
   EmacsLayer *l = [[EmacsLayer alloc]
@@ -7877,19 +7877,12 @@ - (void)lockFocus
 {
   NSTRACE ("[EmacsView lockFocus]");
 
-  if ([self wantsLayer])
-    {
-      CGContextRef context = [(EmacsLayer*)[self layer] getContext];
+  CGContextRef context = [(EmacsLayer*)[self layer] getContext];
 
-      [NSGraphicsContext
+  [NSGraphicsContext
         setCurrentContext:[NSGraphicsContext
                             graphicsContextWithCGContext:context
                                                  flipped:YES]];
-    }
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
-  else
-    [super lockFocus];
-#endif
 }
 
 
@@ -7897,18 +7890,8 @@ - (void)unlockFocus
 {
   NSTRACE ("[EmacsView unlockFocus]");
 
-  if ([self wantsLayer])
-    {
-      [NSGraphicsContext setCurrentContext:nil];
-      [self setNeedsDisplay:YES];
-    }
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
-  else
-    {
-      [super unlockFocus];
-      [super flushWindow];
-    }
-#endif
+  [NSGraphicsContext setCurrentContext:nil];
+  [self setNeedsDisplay:YES];
 }
 
 
@@ -7917,19 +7900,16 @@ - (void)windowDidChangeBackingProperties:(NSNotification *)notification
 {
   NSTRACE ("EmacsView windowDidChangeBackingProperties:]");
 
-  if ([self wantsLayer])
-    {
-      NSRect frame = [self frame];
-      EmacsLayer *layer = (EmacsLayer *)[self layer];
+  NSRect frame = [self frame];
+  EmacsLayer *layer = (EmacsLayer *)[self layer];
 
-      [layer setContentsScale:[[notification object] backingScaleFactor]];
-      [layer setColorSpace:[[[notification object] colorSpace] CGColorSpace]];
+  [layer setContentsScale:[[notification object] backingScaleFactor]];
+  [layer setColorSpace:[[[notification object] colorSpace] CGColorSpace]];
 
-      ns_clear_frame (emacsframe);
-      expose_frame (emacsframe, 0, 0, NSWidth (frame), NSHeight (frame));
-    }
+  ns_clear_frame (emacsframe);
+  expose_frame (emacsframe, 0, 0, NSWidth (frame), NSHeight (frame));
 }
-#endif /* NS_IMPL_COCOA */
+#endif
 
 
 - (void)copyRect:(NSRect)srcRect to:(NSPoint)dest
@@ -7941,57 +7921,45 @@ - (void)copyRect:(NSRect)srcRect to:(NSPoint)dest
   NSRect dstRect = NSMakeRect (dest.x, dest.y, NSWidth (srcRect),
                                NSHeight (srcRect));
 
-#ifdef NS_IMPL_COCOA
-  if ([self wantsLayer])
-    {
-      double scale = [[self window] backingScaleFactor];
-      CGContextRef context = [(EmacsLayer *)[self layer] getContext];
-      int bpp = CGBitmapContextGetBitsPerPixel (context) / 8;
-      void *pixels = CGBitmapContextGetData (context);
-      int rowSize = CGBitmapContextGetBytesPerRow (context);
-      int srcRowSize = NSWidth (srcRect) * scale * bpp;
-      void *srcPixels = (char *) pixels
-                        + (int) (NSMinY (srcRect) * scale * rowSize
-                                 + NSMinX (srcRect) * scale * bpp);
-      void *dstPixels = (char *) pixels
-                        + (int) (dest.y * scale * rowSize
-                                 + dest.x * scale * bpp);
-
-      if (NSIntersectsRect (srcRect, dstRect)
-          && NSMinY (srcRect) < NSMinY (dstRect))
-        for (int y = NSHeight (srcRect) * scale - 1 ; y >= 0 ; y--)
-          memmove ((char *) dstPixels + y * rowSize,
-                   (char *) srcPixels + y * rowSize,
-                   srcRowSize);
-      else
-        for (int y = 0 ; y < NSHeight (srcRect) * scale ; y++)
-          memmove ((char *) dstPixels + y * rowSize,
-                   (char *) srcPixels + y * rowSize,
-                   srcRowSize);
-
-    }
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+  double scale = [[self window] backingScaleFactor];
+  CGContextRef context = [(EmacsLayer *)[self layer] getContext];
+  int bpp = CGBitmapContextGetBitsPerPixel (context) / 8;
+  void *pixels = CGBitmapContextGetData (context);
+  int rowSize = CGBitmapContextGetBytesPerRow (context);
+  int srcRowSize = NSWidth (srcRect) * scale * bpp;
+  void *srcPixels = (char *) pixels
+    + (int) (NSMinY (srcRect) * scale * rowSize
+             + NSMinX (srcRect) * scale * bpp);
+  void *dstPixels = (char *) pixels
+    + (int) (dest.y * scale * rowSize
+             + dest.x * scale * bpp);
+
+  if (NSIntersectsRect (srcRect, dstRect)
+      && NSMinY (srcRect) < NSMinY (dstRect))
+    for (int y = NSHeight (srcRect) * scale - 1 ; y >= 0 ; y--)
+      memmove ((char *) dstPixels + y * rowSize,
+               (char *) srcPixels + y * rowSize,
+               srcRowSize);
   else
-    {
-#endif
-#endif /* NS_IMPL_COCOA */
+    for (int y = 0 ; y < NSHeight (srcRect) * scale ; y++)
+      memmove ((char *) dstPixels + y * rowSize,
+               (char *) srcPixels + y * rowSize,
+               srcRowSize);
 
-#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MIN_REQUIRED < 101400
-      hide_bell();              // Ensure the bell image isn't scrolled.
+#else
+  hide_bell();              // Ensure the bell image isn't scrolled.
 
-      ns_focus (emacsframe, &dstRect, 1);
-      [self scrollRect: srcRect
-                    by: NSMakeSize (dstRect.origin.x - srcRect.origin.x,
-                                    dstRect.origin.y - srcRect.origin.y)];
-      ns_unfocus (emacsframe);
-#endif
-#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED < 101400
-    }
+  ns_focus (emacsframe, &dstRect, 1);
+  [self scrollRect: srcRect
+                by: NSMakeSize (dstRect.origin.x - srcRect.origin.x,
+                                dstRect.origin.y - srcRect.origin.y)];
+  ns_unfocus (emacsframe);
 #endif
 }
 
 
-#ifdef NS_IMPL_COCOA
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
 /* If the frame has been garbaged but the toolkit wants to draw, for
    example when resizing the frame, we end up with a blank screen.
    Sometimes this results in an unpleasant flicker, so try to
@@ -9435,7 +9403,7 @@ - (void) scrollWheel: (NSEvent *)theEvent
 @end  /* EmacsScroller */
 
 
-#ifdef NS_IMPL_COCOA
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
 
 /* ==========================================================================
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* bug#54623: No scroll bars on macOS builds
  2022-04-03 13:36                     ` Alan Third
@ 2022-04-03 20:00                       ` Angelo Graziosi
  2022-04-04 20:30                         ` Angelo Graziosi
  0 siblings, 1 reply; 21+ messages in thread
From: Angelo Graziosi @ 2022-04-03 20:00 UTC (permalink / raw)
  To: Alan Third; +Cc: 54623, Lars Ingebrigtsen

> Il 03/04/2022 15:36 Alan Third ha scritto:
> 
> 
> hopefully all we have to do is force an occasional redraw like on
> GNUstep. Please try the attached.

At the moment it seems to work.. Fingers crossed!





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#54623: No scroll bars on macOS builds
  2022-04-03 20:00                       ` Angelo Graziosi
@ 2022-04-04 20:30                         ` Angelo Graziosi
  2022-04-08 21:47                           ` Alan Third
  0 siblings, 1 reply; 21+ messages in thread
From: Angelo Graziosi @ 2022-04-04 20:30 UTC (permalink / raw)
  To: Alan Third; +Cc: 54623, Lars Ingebrigtsen


> Il 03/04/2022 22:00 Angelo Graziosi <angelo.g0@libero.it> ha scritto:
> 
>  
> > Il 03/04/2022 15:36 Alan Third ha scritto:
> > 
> > 
> > hopefully all we have to do is force an occasional redraw like on
> > GNUstep. Please try the attached.
> 
> At the moment it seems to work.. Fingers crossed!

It still works, so maybe you can commit this patch (v5) and close this issue..

Many thanks!





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#54623: No scroll bars on macOS builds
  2022-04-04 20:30                         ` Angelo Graziosi
@ 2022-04-08 21:47                           ` Alan Third
  2022-04-09 10:20                             ` Angelo Graziosi
  0 siblings, 1 reply; 21+ messages in thread
From: Alan Third @ 2022-04-08 21:47 UTC (permalink / raw)
  To: Angelo Graziosi; +Cc: Lars Ingebrigtsen, 54623-done

On Mon, Apr 04, 2022 at 10:30:57PM +0200, Angelo Graziosi wrote:
> 
> > Il 03/04/2022 22:00 Angelo Graziosi <angelo.g0@libero.it> ha scritto:
> > 
> >  
> > > Il 03/04/2022 15:36 Alan Third ha scritto:
> > > 
> > > 
> > > hopefully all we have to do is force an occasional redraw like on
> > > GNUstep. Please try the attached.
> > 
> > At the moment it seems to work.. Fingers crossed!
> 
> It still works, so maybe you can commit this patch (v5) and close this issue..

Thanks. I've pushed to master.
-- 
Alan Third





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#54623: No scroll bars on macOS builds
  2022-04-08 21:47                           ` Alan Third
@ 2022-04-09 10:20                             ` Angelo Graziosi
  0 siblings, 0 replies; 21+ messages in thread
From: Angelo Graziosi @ 2022-04-09 10:20 UTC (permalink / raw)
  To: Alan Third; +Cc: Lars Ingebrigtsen, 54623-done


> Il 08/04/2022 23:47 Alan Third ha scritto:
> 
>  
> On Mon, Apr 04, 2022 at 10:30:57PM +0200, Angelo Graziosi wrote:
> > 
> > > Il 03/04/2022 22:00 Angelo Graziosi ha scritto:
> > > 
> > >  
> > > > Il 03/04/2022 15:36 Alan Third ha scritto:
> > > > 
> > > > 
> > > > hopefully all we have to do is force an occasional redraw like on
> > > > GNUstep. Please try the attached.
> > > 
> > > At the moment it seems to work.. Fingers crossed!
> > 
> > It still works, so maybe you can commit this patch (v5) and close this issue..
> 
> Thanks. I've pushed to master.


Thanks. I have built the last master and things look ok!





^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2022-04-09 10:20 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-29 11:50 bug#54623: No scroll bars on macOS builds Angelo Graziosi
2022-03-29 12:44 ` Lars Ingebrigtsen
2022-03-29 19:53   ` Angelo Graziosi
2022-03-30  0:39     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-31 11:56     ` Lars Ingebrigtsen
2022-03-31 20:06       ` Alan Third
2022-03-31 22:31         ` Angelo Graziosi
2022-03-30 21:52   ` Alan Third
2022-03-31 10:45     ` Angelo Graziosi
2022-03-31 16:43       ` Alan Third
2022-03-31 22:27         ` Angelo Graziosi
2022-04-01 20:59           ` Alan Third
2022-04-01 22:37             ` Angelo Graziosi
2022-04-02  8:07               ` Alan Third
2022-04-02  9:42                 ` Angelo Graziosi
2022-04-02 11:00                   ` Angelo Graziosi
2022-04-03 13:36                     ` Alan Third
2022-04-03 20:00                       ` Angelo Graziosi
2022-04-04 20:30                         ` Angelo Graziosi
2022-04-08 21:47                           ` Alan Third
2022-04-09 10:20                             ` Angelo Graziosi

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).