unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Menu-bar flickering on Win10
@ 2022-11-02 12:08 Arash Esbati
  2022-11-02 12:14 ` Po Lu
  2022-11-02 13:17 ` Eli Zaretskii
  0 siblings, 2 replies; 13+ messages in thread
From: Arash Esbati @ 2022-11-02 12:08 UTC (permalink / raw)
  To: emacs-devel

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

Hi all,

I had a minute and gave Eglot for a LaTeX file a roll.  Digestif as
server doesn't work on Win10, so I installed texlab which works.  For
the good news, I added one entry to `eglot-server-programs' and 'M-x
eglot RET' just worked.

For the bad news, I observed a random flickering in the menu-bar when
completion happens which looks like this:

[-- Attachment #2: emacs-flickering.gif --]
[-- Type: image/gif, Size: 33527 bytes --]

[-- Attachment #3: Type: text/plain, Size: 162 bytes --]


This is with 'emacs -Q' and 'Corfu' providing the pop-ups.  Is this a
known issue with child frames?  I'm asking if it's worth filing a bug
report.

Best, Arash

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

* Re: Menu-bar flickering on Win10
  2022-11-02 12:08 Arash Esbati
@ 2022-11-02 12:14 ` Po Lu
  2022-11-02 13:17 ` Eli Zaretskii
  1 sibling, 0 replies; 13+ messages in thread
From: Po Lu @ 2022-11-02 12:14 UTC (permalink / raw)
  To: Arash Esbati; +Cc: emacs-devel

Arash Esbati <arash@gnu.org> writes:

> Hi all,
>
> I had a minute and gave Eglot for a LaTeX file a roll.  Digestif as
> server doesn't work on Win10, so I installed texlab which works.  For
> the good news, I added one entry to `eglot-server-programs' and 'M-x
> eglot RET' just worked.
>
> For the bad news, I observed a random flickering in the menu-bar when
> completion happens which looks like this:
>
>  
>
>
> This is with 'emacs -Q' and 'Corfu' providing the pop-ups.  Is this a
> known issue with child frames?  I'm asking if it's worth filing a bug
> report.
>
> Best, Arash

I think menu bar updates are not double buffered on MS Windows, and as a
consequence flickers as Emacs removes the items to update them.



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

* Re: Menu-bar flickering on Win10
  2022-11-02 12:08 Arash Esbati
  2022-11-02 12:14 ` Po Lu
@ 2022-11-02 13:17 ` Eli Zaretskii
  2022-11-02 13:35   ` Arash Esbati
  1 sibling, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2022-11-02 13:17 UTC (permalink / raw)
  To: Arash Esbati; +Cc: emacs-devel

> From: Arash Esbati <arash@gnu.org>
> Date: Wed, 02 Nov 2022 13:08:51 +0100
> 
> This is with 'emacs -Q' and 'Corfu' providing the pop-ups.  Is this a
> known issue with child frames?  I'm asking if it's worth filing a bug
> report.

Does the code involved in the display of completion temporarily
switches to a different window, or changes the major mode?

IOW, I suggest to step through the code which is involved, and see
which part of it actually causes the flickering.  There's too many
unknowns in what you described.



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

* Re: Menu-bar flickering on Win10
  2022-11-02 13:17 ` Eli Zaretskii
@ 2022-11-02 13:35   ` Arash Esbati
  2022-11-02 13:53     ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Arash Esbati @ 2022-11-02 13:35 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> Does the code involved in the display of completion temporarily
> switches to a different window, or changes the major mode?

No, it is in a single window and the only buffer I used.

> IOW, I suggest to step through the code which is involved, and see
> which part of it actually causes the flickering.  There's too many
> unknowns in what you described.

I did only this:

 • emacs -Q

 • Opened a trivial and small .tex file like this:

     \documentclass{article}

     \usepackage{cleveref}

     \begin{document}

     \section{This is my first section}
     \label{sec:firstsec}

     \begin{equation}
       \label{eq:1}
       a+b=c
     \end{equation}

     \ref{eq:1}; \cref{sec:firstsec}

     \end{document}

     %%% Local Variables:
     %%% mode: latex
     %%% TeX-master: t
     %%% End:

 • Eval'ed the following lines to setup the buffer:

    (setq tab-always-indent 'complete)
    (tool-bar-mode -1)

    (add-to-list 'load-path
                 (directory-file-name "~/.emacs.d/elpa/corfu-0.28/")
                 t)

    (require 'corfu)
    (corfu-mode 1)

    (require 'eglot)
    (add-to-list 'eglot-server-programs
                 '((tex-mode context-mode texinfo-mode bibtex-mode) .
                   ("texlab")))

  • M-x eglot RET

  • Started playing with the file by hitting \usep<TAB> to see what
    happens.

My first reaction was if corfu is probably the problem since it uses
child frames and not overlays, hence my question.

Best, Arash



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

* Re: Menu-bar flickering on Win10
  2022-11-02 13:35   ` Arash Esbati
@ 2022-11-02 13:53     ` Eli Zaretskii
  2022-11-02 14:07       ` Arash Esbati
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2022-11-02 13:53 UTC (permalink / raw)
  To: Arash Esbati; +Cc: emacs-devel

> From: Arash Esbati <arash@gnu.org>
> Cc: emacs-devel@gnu.org
> Date: Wed, 02 Nov 2022 14:35:19 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Does the code involved in the display of completion temporarily
> > switches to a different window, or changes the major mode?
> 
> No, it is in a single window and the only buffer I used.

Didn't you say child frames are involved?  If so, there are at least 2
frames, and each frame has at least one window.  Right?

> > IOW, I suggest to step through the code which is involved, and see
> > which part of it actually causes the flickering.  There's too many
> > unknowns in what you described.
> 
> I did only this:

I didn't mean to say you are responsible in some way.  I meant to say
that we need to understand better what code causes the flickering.
And the only way I could think of was to step through the code which
displays the completion candidates, because that's where the
flickering happens.

> My first reaction was if corfu is probably the problem since it uses
> child frames and not overlays, hence my question.

Could be.  I simply don't know yet.  Which is why I suggested to step
through the code.



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

* Re: Menu-bar flickering on Win10
  2022-11-02 13:53     ` Eli Zaretskii
@ 2022-11-02 14:07       ` Arash Esbati
  2022-11-02 15:11         ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Arash Esbati @ 2022-11-02 14:07 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> Didn't you say child frames are involved?

Yes, corfu uses child frames for completion pop-ups.

> If so, there are at least 2 frames, and each frame has at least one
> window.  Right?

I meant that *I* didn't open multiple frames/windows with 'C-x 5 2'
and/or 'C-x 2' etc.

> I didn't mean to say you are responsible in some way.

Thanks, I also didn't get it like that.

> Could be.  I simply don't know yet.  Which is why I suggested to step
> through the code.

Is there anything else I can provide?  Should I open a bug report for
this?

Best, Arash



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

* Re: Menu-bar flickering on Win10
  2022-11-02 14:07       ` Arash Esbati
@ 2022-11-02 15:11         ` Eli Zaretskii
  2022-11-03 10:46           ` Arash Esbati
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2022-11-02 15:11 UTC (permalink / raw)
  To: Arash Esbati; +Cc: emacs-devel

> From: Arash Esbati <arash@gnu.org>
> Cc: emacs-devel@gnu.org
> Date: Wed, 02 Nov 2022 15:07:20 +0100
> 
> Is there anything else I can provide?

I hoped you would be able to actually step through the code (in
Edebug) and tell which part causes the flickering...

> Should I open a bug report for this?

Feel free, it cannot do any harm.



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

* Re: Menu-bar flickering on Win10
  2022-11-02 15:11         ` Eli Zaretskii
@ 2022-11-03 10:46           ` Arash Esbati
  2022-11-03 11:26             ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Arash Esbati @ 2022-11-03 10:46 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> I hoped you would be able to actually step through the code (in
> Edebug) and tell which part causes the flickering...

I started doing it and then it occurred to me that corfu is not needed
to trigger the issue.  It is enough to do 'emacs -Q', 'C-x 5 2' and
switch between the frames, I did it by clicking with the mouse pointer.

I'm not familiar with Emacs internals, but does this observation fit to
Po Lu's message where he said:

  I think menu bar updates are not double buffered on MS Windows, and as
  a consequence flickers as Emacs removes the items to update them.

?  I'll file a bug report.

Best, Arash



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

* Re: Menu-bar flickering on Win10
  2022-11-03 10:46           ` Arash Esbati
@ 2022-11-03 11:26             ` Eli Zaretskii
  2022-11-03 11:51               ` Po Lu
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2022-11-03 11:26 UTC (permalink / raw)
  To: Arash Esbati; +Cc: emacs-devel

> From: Arash Esbati <arash@gnu.org>
> Cc: emacs-devel@gnu.org
> Date: Thu, 03 Nov 2022 11:46:21 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > I hoped you would be able to actually step through the code (in
> > Edebug) and tell which part causes the flickering...
> 
> I started doing it and then it occurred to me that corfu is not needed
> to trigger the issue.  It is enough to do 'emacs -Q', 'C-x 5 2' and
> switch between the frames, I did it by clicking with the mouse pointer.

Then I simply cannot reproduce this on my system.

> I'm not familiar with Emacs internals, but does this observation fit to
> Po Lu's message where he said:
> 
>   I think menu bar updates are not double buffered on MS Windows, and as
>   a consequence flickers as Emacs removes the items to update them.
> 
> ?

No.



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

* Re: Menu-bar flickering on Win10
  2022-11-03 11:26             ` Eli Zaretskii
@ 2022-11-03 11:51               ` Po Lu
  2022-11-03 13:55                 ` Arash Esbati
  0 siblings, 1 reply; 13+ messages in thread
From: Po Lu @ 2022-11-03 11:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Arash Esbati, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> Then I simply cannot reproduce this on my system.

Maybe the graphics driver is at play here?

Arash, what happens if you go to the "Graphics" control panel, drag the
"Hardware Acceleration" to the leftmost position, and reboot?  I had to
do that to make Emacs work at all on some Windows hardware.

Here are some instructions I found on the net:

1. 	Click Start, point to Settings, and then click Control Panel.
2. 	Double-click System.
3. 	On the Performance tab, click Graphics.
4. 	Move the Hardware Acceleration slider until it is one notch to the right of None, the Basic acceleration setting.
5. 	Click OK, and then click Close.
6. 	When you are prompted to restart your computer, click Yes.



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

* Re: Menu-bar flickering on Win10
  2022-11-03 11:51               ` Po Lu
@ 2022-11-03 13:55                 ` Arash Esbati
  0 siblings, 0 replies; 13+ messages in thread
From: Arash Esbati @ 2022-11-03 13:55 UTC (permalink / raw)
  To: Po Lu; +Cc: Eli Zaretskii, emacs-devel

Po Lu <luangruo@yahoo.com> writes:

> Maybe the graphics driver is at play here?
>
> Arash, what happens if you go to the "Graphics" control panel, drag the
> "Hardware Acceleration" to the leftmost position, and reboot?  I had to
> do that to make Emacs work at all on some Windows hardware.

Thanks for the hint.  I have a nvidia GeForce adapter here so I had to
go to the nvidia control panel; I tried the latest driver version with
different settings but no avail.  I will play more with it to see if it
helps.

Best, Arash



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

* Re: Menu-bar flickering on Win10
@ 2022-11-04 12:51 Johan Myréen
  2022-11-04 13:54 ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Johan Myréen @ 2022-11-04 12:51 UTC (permalink / raw)
  To: emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 639 bytes --]

The menu bar flickers for me on Windows, too. It is not as disturbing as
for Arash, though.

I have attached a picture composed of four consecutive (partial) frames
from a screen recording. In the uppermost frame the Emacs window is just
about to lose focus, and in the three lower frames the menu bar is being
redrawn after losing focus. In the second frame only the word "File" is
displayed, in the third frame the words "File Edit Options Buffers" and
only the fourth frame shows all seven menu headers.

This result was obtained the way Arash described: I started Emacs with
emacs -Q, C-x 5 2 and then switched between the two frames.

[-- Attachment #1.2: Type: text/html, Size: 759 bytes --]

[-- Attachment #2: Flicker.png --]
[-- Type: image/png, Size: 315848 bytes --]

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

* Re: Menu-bar flickering on Win10
  2022-11-04 12:51 Menu-bar flickering on Win10 Johan Myréen
@ 2022-11-04 13:54 ` Eli Zaretskii
  0 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2022-11-04 13:54 UTC (permalink / raw)
  To: Johan Myréen; +Cc: emacs-devel

> From: Johan Myréen <johan.myreen@gmail.com>
> Date: Fri, 4 Nov 2022 14:51:48 +0200
> 
> The menu bar flickers for me on Windows, too. It is not as disturbing as for Arash, though.
> 
> I have attached a picture composed of four consecutive (partial) frames from a screen recording. In the
> uppermost frame the Emacs window is just about to lose focus, and in the three lower frames the menu bar
> is being redrawn after losing focus. In the second frame only the word "File" is displayed, in the third frame the
> words "File Edit Options Buffers" and only the fourth frame shows all seven menu headers.
> 
> This result was obtained the way Arash described: I started Emacs with emacs -Q, C-x 5 2 and then switched
> between the two frames.

This is purely a Windows display issue.  Emacs refreshes the menu bar
when another frame gets focus, because that means a different window
becomes the selected window, and when a window becomes selected, it
should be redisplayed.  As a side effect of redisplaying a window, we
recompute the frame's top-level menu items and call the Windows API
that draws the menu.  The expectation from Windows is that it doesn't
actually redraw the menu bar when its contents didn't change, but
evidently in your case that doesn't happen.

Unless someone can point out how to call the Windows APIs in a way
that avoids this, I don't see what we can do with this issue.



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

end of thread, other threads:[~2022-11-04 13:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04 12:51 Menu-bar flickering on Win10 Johan Myréen
2022-11-04 13:54 ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2022-11-02 12:08 Arash Esbati
2022-11-02 12:14 ` Po Lu
2022-11-02 13:17 ` Eli Zaretskii
2022-11-02 13:35   ` Arash Esbati
2022-11-02 13:53     ` Eli Zaretskii
2022-11-02 14:07       ` Arash Esbati
2022-11-02 15:11         ` Eli Zaretskii
2022-11-03 10:46           ` Arash Esbati
2022-11-03 11:26             ` Eli Zaretskii
2022-11-03 11:51               ` Po Lu
2022-11-03 13:55                 ` Arash Esbati

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