From: Alan Third <alan@idiocy.org>
To: Aaron Jensen <aaronjensen@gmail.com>, 46155@debbugs.gnu.org
Subject: bug#46155: 28.0.50; Regression: buffer contents flicker on macOS frames when
Date: Sun, 31 Jan 2021 20:28:21 +0000 [thread overview]
Message-ID: <YBcS5atJcCP8rz65@breton.holly.idiocy.org> (raw)
In-Reply-To: <YBLo1bZqPL4YaRDS@breton.holly.idiocy.org>
[-- Attachment #1: Type: text/plain, Size: 987 bytes --]
On Thu, Jan 28, 2021 at 04:39:49PM +0000, Alan Third wrote:
> On Thu, Jan 28, 2021 at 09:48:25AM -0600, Aaron Jensen wrote:
> > From emacs -Q:
> >
> > (dotimes (n 10)
> > (set-frame-parameter nil 'width (+ 80 n))
> > (sit-for 0.1))
> >
> > This was previously fixed in bug#30699
> >
> > I don't know if it was reverted at some point and I didn't notice, or it
> > was started flickering again after Alan's recent (fantastic) performance
> > improvements.
> >
> > This reproduces on master (non-native-comp) as of ac102bb966 as well.
>
> Apple deprecated the functions we were using to block screen drawing.
>
> It's possible we can have a neater work-around now since we're drawing
> to an offscreen buffer and therefore have greater control over what's
> displayed. I'll have to look into it again.
Well... I tried something ridiculous and it appears to work...
I suspect forcing redisplay this way within the NS run loop is bad
form, but it appears to work.
--
Alan Third
[-- Attachment #2: 0001-Fix-flicker-when-resizing-NS-frame-programmatically-.patch --]
[-- Type: text/plain, Size: 1505 bytes --]
From ed901d4219b996a72e5944c6b959086ef2b8431d Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Sun, 31 Jan 2021 20:19:53 +0000
Subject: [PATCH] Fix flicker when resizing NS frame programmatically
(bug#46155)
; Incidentally fixes bug#21326.
* src/nsterm.m ([EmacsView viewWillDraw]): New function.
---
src/nsterm.m | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/src/nsterm.m b/src/nsterm.m
index 1b2328628e..8f2b61a165 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -8452,6 +8452,33 @@ - (void)copyRect:(NSRect)srcRect to:(NSRect)dstRect
}
+#ifdef NS_IMPL_COCOA
+/* 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
+ redisplay before drawing. */
+- (void)viewWillDraw
+{
+ if (FRAME_GARBAGED_P (emacsframe))
+ {
+ /* If there is IO going on when redisplay is run here Emacs
+ crashes. I think it's because this code will always be run
+ within the run loop and for whatever reason processing input
+ is dangerous. This technique was stolen wholesale from
+ nsmenu.m and seems to work. */
+ bool owfi = waiting_for_input;
+ waiting_for_input = 0;
+ block_input ();
+
+ redisplay();
+
+ unblock_input ();
+ waiting_for_input = owfi;
+ }
+}
+#endif
+
+
#ifdef NS_DRAW_TO_BUFFER
- (BOOL)wantsUpdateLayer
{
--
2.29.2
next prev parent reply other threads:[~2021-01-31 20:28 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-28 15:48 bug#46155: 28.0.50; Regression: buffer contents flicker on macOS frames when Aaron Jensen
2021-01-28 16:39 ` Alan Third
2021-01-31 20:28 ` Alan Third [this message]
2021-01-31 22:05 ` Aaron Jensen
2021-02-08 15:25 ` Aaron Jensen
2021-02-08 21:45 ` Aaron Jensen
2021-02-09 7:58 ` martin rudalics
2021-02-09 9:55 ` Andrii Kolomoiets
2021-02-09 10:49 ` martin rudalics
2021-02-09 11:04 ` martin rudalics
2021-02-09 11:30 ` Andrii Kolomoiets
2021-02-09 17:31 ` martin rudalics
2021-02-09 11:05 ` Alan Third
2021-02-09 14:44 ` Alan Third
2021-02-09 16:29 ` Andrii Kolomoiets
2021-02-09 20:08 ` Alan Third
2021-02-10 1:11 ` Aaron Jensen
2021-02-11 22:16 ` bug#46155: [PATCH v2] Fix flicker when resizing NS frame programmatically (bug#46155) Alan Third
2021-02-12 4:06 ` Aaron Jensen
2021-02-13 22:44 ` Alan Third
2021-02-13 22:45 ` Aaron Jensen
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=YBcS5atJcCP8rz65@breton.holly.idiocy.org \
--to=alan@idiocy.org \
--cc=46155@debbugs.gnu.org \
--cc=aaronjensen@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.