emacs-application-framework icon indicating copy to clipboard operation
emacs-application-framework copied to clipboard

macOS: mode-line disappear in EAF browser when Emacs is open in full-screen mode

Open taquangtrung opened this issue 2 years ago • 7 comments

Hi,

Describe the bug When I run Emacs in full-screen mode and open a webpage by EAF browser, the mode-line disappear

To Reproduce

Run Emacs on macOS, press F11 to go to full-screen mode. Then open a webpage by eaf-search-it and type "testing"

Here is the screenshot showing that the mode-line disappear:

Screenshot 2021-08-27 at 9 04 03 AM

Expected behavior

If I don't use the full-screen mode, then the mode-line can be displayed correctly.

Screenshot 2021-08-27 at 9 03 52 AM

Versions (please complete the following info):

  • Distro and DE/WM: macOS Big Sur 11.3
  • Versions of Dependencies: eaf-20210826.100
  • M-x emacs-version: 27.2

taquangtrung avatar Aug 27 '21 01:08 taquangtrung

Which Emacs version do you use, emacs-mac or emacs-plus? I guess this is because of the height of the title bar. Currently, we don't handle the event of showing and hiding the title bar.

lhpfvs avatar Aug 27 '21 11:08 lhpfvs

@lhpfvs: I tested on both Emacs Mac Port and Emacs for Mac OS X, the problem still occurs on full-screen mode (F11)\

Notice that there is a blank line on top of EAF browser (in the first attached image). I think might be due to that line, the webpage is pushed lower and cover the mode-line.

taquangtrung avatar Aug 27 '21 14:08 taquangtrung

The missing height at the top is exactly the macOS menu bar height.

With this patched defun, at least the mode-line is still visible for me in macOS 10.14.6 but it hardcodes the menu bar height and I think it changes slightly across macOS versions.

(defun eaf-get-window-allocation (&optional window)
  "Get WINDOW allocation.

Patches:
- subtract 23px from the height which is the macOS 10.14.6 menu bar height"
  (let* ((window-edges (window-pixel-edges window))
         (x (nth 0 window-edges))
         (y (+ (nth 1 window-edges)
               (if (version< emacs-version "27.0")
                   (window-header-line-height window)
                 (window-tab-line-height window))))
         (w (- (nth 2 window-edges) x))
         (h (- (nth 3 window-edges) (window-mode-line-height window) y
               (if (and (eq system-type 'darwin)
                        (equal (frame-parameter nil 'fullscreen) 'fullboth))
                   23
                 0))))
    (list x y w h)))

It still has the 23px margin at the top though:

Fullscreen

image

Maximized

image

Dima-369 avatar Dec 18 '21 11:12 Dima-369

I also tried to hardcode a 0 for y in (eaf-get-window-allocation) but it does not change anything. There is still this menu bar gap at the top.

I think the problem is that Emacs kind of emulates full-screen behavior without really being in native macOS full-screen which is nice because there is no annoying window switch animation in macOS.

But the EAF Python windows do not (I am not even sure if they can) behave this way and are thus forced below the macOS menu bar.

Dima-369 avatar Dec 18 '21 12:12 Dima-369

I noticed that when you check Automatically hide and show the menu bar in the General System Settings in macOS that the gap at the top disappears!

image

With the setting checked, the EAF Python windows then correctly take up all the height:

Personally, this is not an option for me as I have certain notifications in the macOS menu bar, but it might be a good solution for others!

image

Dima-369 avatar Dec 18 '21 12:12 Dima-369

any update on this issue?

altunkan avatar Aug 04 '22 09:08 altunkan

In newest version has function eaf--get-titlebar-height https://github.com/emacs-eaf/emacs-application-framework/blob/d493e14e3d209beee2247f916b4ecd8e41db76c1/eaf.el#L1190

Maybe some mac user can fix this issue by add mac branch in eaf--get-titlebar-height

manateelazycat avatar Oct 19 '22 16:10 manateelazycat