unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#48157: Emacs-28 on Mac: corrupted GUI when setting default-frame-alist
@ 2021-05-02 10:37 PEDRO ANDRES ARANDA GUTIERREZ
  2021-05-02 11:39 ` Alan Third
  2021-05-02 16:17 ` martin rudalics
  0 siblings, 2 replies; 6+ messages in thread
From: PEDRO ANDRES ARANDA GUTIERREZ @ 2021-05-02 10:37 UTC (permalink / raw)
  To: 48157

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




Hi 

Just tested compiling emacs con macOS Catalina.

My .emacs.d/init includes 

(setq default-frame-alist '((top . 32 ) (left . 32) (width . 128) (height . 37)))

The result is this:


With the mini-buffer line hidden. If I comment this line, the GUI is created correctly. The window rebuild correctly if I resize it with the mouse

Configured using:
 'configure PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
 LDFLAGS=-L/usr/local/lib CPPFLAGS=-I/usr/local/include CC=clang
 OBJC=clang 'CFLAGS=-g -O3'
 LIBXML2_CFLAGS=-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2
 LIBXML2_LIBS=-lxml2'

Configured features:
ACL GMP GNUTLS JPEG JSON LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER PNG
THREADS TIFF TOOLKIT_SCROLL_BARS ZLIB

Important settings:
  value of $LANG: es_ES.UTF-8
  locale-coding-system: utf-8

Major mode: Lisp Interaction

Minor modes in effect:
  global-tab-line-mode: t
  tab-line-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  shell-dirtrack-mode: t
  electric-pair-mode: t
  show-paren-mode: t
  override-global-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/Users/paag/.emacs.d/lisp/rst hides /Applications/Emacs.app/Contents/Resources/lisp/textmodes/rst

Features:
(shadow sort flyspell ispell mail-extr emacsbug message rmc puny dired
dired-loaddefs rfc822 mml mml-sec epa epg epg-config gnus-util rmail
rmail-loaddefs text-property-search mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils multiple-cursors
mc-hide-unmatched-lines-mode mc-separate-operations
rectangular-region-mode mc-mark-pop mc-mark-more thingatpt
mc-cycle-cursors mc-edit-lines multiple-cursors-core rect server
ob-python python tramp-sh ob-ditaa ox-odt rng-loc rng-uri rng-parse
rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok
nxml-util ox-latex ox-icalendar ox-html table ox-ascii ox-publish ox
org-element org ob ob-tangle ob-ref ob-lob ob-table org-macro
org-footnote org-src ob-comint org-pcomplete org-list org-faces
org-entities noutline outline org-version ob-emacs-lisp org-table
org-keys org-loaddefs find-func cal-menu calendar cal-loaddefs avl-tree
generator ol ob-exp ob-core org-compat advice ob-eval org-macs
silkworm-theme tab-line pcase indent-tools yafolding hydra lv
indent-tools-indentation-of synctex-mac texlog-mode derived texlog
yasnippet cl-extra help-mode tramp tramp-loaddefs trampver
tramp-integration files-x tramp-compat shell pcomplete comint ansi-color
ring parse-time iso8601 time-date ls-lisp format-spec hl-line elec-pair
track-change paren cus-edit pp cus-load wid-edit use-package
use-package-ensure use-package-delight use-package-diminish
use-package-bind-key bind-key easy-mmode use-package-core finder-inf
info edmacro kmacro package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq
byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib iso-transl
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar
mouse jit-lock font-lock syntax font-core term/tty-colors frame
minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite charscript charprop case-table epa-hook jka-cmpr-hook help
simple abbrev obarray cl-preloaded nadvice button loaddefs faces
cus-face macroexp files window text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote threads kqueue cocoa ns multi-tty make-network-process emacs)

Memory information:
((conses 16 212017 12721)
 (symbols 48 21953 7)
 (strings 32 76003 4845)
 (string-bytes 1 2495205)
 (vectors 16 36484)
 (vector-slots 8 403682 11441)
 (floats 8 124 105)
 (intervals 56 387 0)
 (buffers 992 12))

—
PEDRO ANDRES ARANDA GUTIERREZ
paranda@it.uc3m.es
Universidad Carlos III Madrid

Fragen sind nicht da um beantwortet zu werden…
Fragen sind da, um gestellt zu werden.
Georg Kreisler




[-- Attachment #2.1: Type: text/html, Size: 8330 bytes --]

[-- Attachment #2.2: Image.png --]
[-- Type: image/png, Size: 133249 bytes --]

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

* bug#48157: Emacs-28 on Mac: corrupted GUI when setting default-frame-alist
  2021-05-02 10:37 bug#48157: Emacs-28 on Mac: corrupted GUI when setting default-frame-alist PEDRO ANDRES ARANDA GUTIERREZ
@ 2021-05-02 11:39 ` Alan Third
  2021-05-02 16:17 ` martin rudalics
  1 sibling, 0 replies; 6+ messages in thread
From: Alan Third @ 2021-05-02 11:39 UTC (permalink / raw)
  To: PEDRO ANDRES ARANDA GUTIERREZ; +Cc: 48157

On Sun, May 02, 2021 at 12:37:29PM +0200, PEDRO ANDRES ARANDA GUTIERREZ wrote:
> Just tested compiling emacs con macOS Catalina.
> 
> My .emacs.d/init includes 
> 
> (setq default-frame-alist '((top . 32 ) (left . 32) (width . 128) (height . 37)))
> 
> The result is this:
> 
> 
> With the mini-buffer line hidden. If I comment this line, the GUI is
> created correctly. The window rebuild correctly if I resize it with
> the mouse

Can you please try pulling the latest changes down, there have been a
few modifications to frame resizing code just today, so hopefully they
might fix this. If not, can you work out roughly when this problem
started? For example, was it there before commit a190b4cfd8?
-- 
Alan Third





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

* bug#48157: Emacs-28 on Mac: corrupted GUI when setting default-frame-alist
  2021-05-02 10:37 bug#48157: Emacs-28 on Mac: corrupted GUI when setting default-frame-alist PEDRO ANDRES ARANDA GUTIERREZ
  2021-05-02 11:39 ` Alan Third
@ 2021-05-02 16:17 ` martin rudalics
  2021-05-03  6:49   ` PEDRO ANDRES ARANDA GUTIERREZ
  1 sibling, 1 reply; 6+ messages in thread
From: martin rudalics @ 2021-05-02 16:17 UTC (permalink / raw)
  To: PEDRO ANDRES ARANDA GUTIERREZ, 48157

 > Just tested compiling emacs con macOS Catalina.
 >
 > My .emacs.d/init includes
 >
 > (setq default-frame-alist '((top . 32 ) (left . 32) (width . 128) (height . 37)))
 >
 > The result is this:
 >
 >
 > With the mini-buffer line hidden. If I comment this line, the GUI is created correctly. The window rebuild correctly if I resize it with the mouse

Please try the patch below.

Thanks, martin


diff --git a/src/nsterm.m b/src/nsterm.m
index 6e7ab1266b..b089146e64 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7310,9 +7310,9 @@ - (void)viewDidResize:(NSNotification *)notification

    /* Don't want to do anything when the view size hasn't changed. */
    if ((oldh == newh && oldw == neww)
-      || (emacsframe->new_size_p
-          && newh == emacsframe->new_height
-          && neww == emacsframe->new_width))
+      && (!emacsframe->new_size_p
+          || (newh == emacsframe->new_height
+	      && neww == emacsframe->new_width)))
      {
        NSTRACE_MSG ("No change");
        return;





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

* bug#48157: Emacs-28 on Mac: corrupted GUI when setting default-frame-alist
  2021-05-02 16:17 ` martin rudalics
@ 2021-05-03  6:49   ` PEDRO ANDRES ARANDA GUTIERREZ
  2021-05-03  7:56     ` martin rudalics
  0 siblings, 1 reply; 6+ messages in thread
From: PEDRO ANDRES ARANDA GUTIERREZ @ 2021-05-03  6:49 UTC (permalink / raw)
  To: martin rudalics; +Cc: 48157

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

HI,

I retried a couple of minutes ago and it continues to startup weirdly on my
MacBook Air

Darwin paag-MacBookAir 19.6.0 Darwin Kernel Version 19.6.0: Tue Jan 12
22:13:05 PST 2021; root:xnu-6153.141.16~1/RELEASE_X86_64 x86_64

The same code compiled on my pre-2015 McBook Pro (macOS 10.13) works
perfectly on both systems.

Best, /PA

El dom, 2 may 2021 a las 18:17, martin rudalics (<rudalics@gmx.at>)
escribió:

>  > Just tested compiling emacs con macOS Catalina.
>  >
>  > My .emacs.d/init includes
>  >
>  > (setq default-frame-alist '((top . 32 ) (left . 32) (width . 128)
> (height . 37)))
>  >
>  > The result is this:
>  >
>  >
>  > With the mini-buffer line hidden. If I comment this line, the GUI is
> created correctly. The window rebuild correctly if I resize it with the
> mouse
>
> Please try the patch below.
>
> Thanks, martin
>
>
> diff --git a/src/nsterm.m b/src/nsterm.m
> index 6e7ab1266b..b089146e64 100644
> --- a/src/nsterm.m
> +++ b/src/nsterm.m
> @@ -7310,9 +7310,9 @@ - (void)viewDidResize:(NSNotification *)notification
>
>     /* Don't want to do anything when the view size hasn't changed. */
>     if ((oldh == newh && oldw == neww)
> -      || (emacsframe->new_size_p
> -          && newh == emacsframe->new_height
> -          && neww == emacsframe->new_width))
> +      && (!emacsframe->new_size_p
> +          || (newh == emacsframe->new_height
> +             && neww == emacsframe->new_width)))
>       {
>         NSTRACE_MSG ("No change");
>         return;
>


-- 
---
PEDRO ANDRES ARANDA GUTIERREZ
Universidad Carlos III de Madrid

"Fragen sind nicht da um beantwortet zu werden.
Fragen sind da, um gestellt zu werden" Georg Kreisler

[-- Attachment #2: Type: text/html, Size: 2537 bytes --]

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

* bug#48157: Emacs-28 on Mac: corrupted GUI when setting default-frame-alist
  2021-05-03  6:49   ` PEDRO ANDRES ARANDA GUTIERREZ
@ 2021-05-03  7:56     ` martin rudalics
       [not found]       ` <CAPoMwp0xhMSa9KUaTmmYsQZBJjtLpY-2Kz5qvuLZLVpxN5Dzsw@mail.gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: martin rudalics @ 2021-05-03  7:56 UTC (permalink / raw)
  To: PEDRO ANDRES ARANDA GUTIERREZ; +Cc: 48157

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

 > I retried a couple of minutes ago and it continues to startup weirdly on my
 > MacBook Air

Did you try Alan's latest fixes (I attach them here)?

martin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-incorrect-resizing-behaviour-on-macOS-bug-48157-.patch --]
[-- Type: text/x-patch; name="0001-Fix-incorrect-resizing-behaviour-on-macOS-bug-48157-.patch", Size: 2437 bytes --]

>From c4048b3cd6841a7f2ccdfb3f6c880c9ee176390a Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Sun, 2 May 2021 22:38:13 +0100
Subject: [PATCH] Fix incorrect resizing behaviour on macOS (bug#48157,
 bug#48162)

* src/nsterm.m ([EmacsView viewDidResize:]): The drawing buffer can be
resized independently of Emacs's idea of the frame size.

Co-authored-by: martin rudalics <rudalics@gmx.at>
---
 src/nsterm.m | 36 ++++++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index 6e7ab1266b..bb20886ab1 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7303,16 +7303,34 @@ - (void)viewDidResize:(NSNotification *)notification

   NSTRACE ("[EmacsView viewDidResize]");

+#ifdef NS_DRAW_TO_BUFFER
+  /* If the buffer size doesn't match the view's backing size, destroy
+     the buffer and let it be recreated at the correct size later.  */
+  if ([self wantsUpdateLayer] && surface)
+    {
+      NSRect surfaceRect = {{0, 0}, [surface getSize]};
+      NSRect frameRect = [[self window] convertRectToBacking:frame];
+
+      if (!NSEqualRects (frameRect, surfaceRect))
+        {
+          [surface release];
+          surface = nil;
+
+          [self setNeedsDisplay:YES];
+        }
+    }
+#endif
+
   neww = (int)NSWidth (frame);
   newh = (int)NSHeight (frame);
   oldw = FRAME_PIXEL_WIDTH (emacsframe);
   oldh = FRAME_PIXEL_HEIGHT (emacsframe);

   /* Don't want to do anything when the view size hasn't changed. */
-  if ((oldh == newh && oldw == neww)
-      || (emacsframe->new_size_p
-          && newh == emacsframe->new_height
-          && neww == emacsframe->new_width))
+  if (emacsframe->new_size_p
+      ? (newh == emacsframe->new_height
+         && neww == emacsframe->new_width)
+      : (oldh == newh && oldw == neww))
     {
       NSTRACE_MSG ("No change");
       return;
@@ -7321,16 +7339,6 @@ - (void)viewDidResize:(NSNotification *)notification
   NSTRACE_SIZE ("New size", NSMakeSize (neww, newh));
   NSTRACE_SIZE ("Original size", NSMakeSize (oldw, oldh));

-#ifdef NS_DRAW_TO_BUFFER
-  if ([self wantsUpdateLayer])
-    {
-      [surface release];
-      surface = nil;
-
-      [self setNeedsDisplay:YES];
-    }
-#endif
-
   change_frame_size (emacsframe, neww, newh, false, YES, false);

   SET_FRAME_GARBAGED (emacsframe);
--
2.30.2


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

* bug#48157: Emacs-28 on Mac: corrupted GUI when setting default-frame-alist
       [not found]             ` <7B3D9FF8-ED16-4D1F-84FF-3F900FD8DB0F@it.uc3m.es>
@ 2021-05-03 17:49               ` Alan Third
  0 siblings, 0 replies; 6+ messages in thread
From: Alan Third @ 2021-05-03 17:49 UTC (permalink / raw)
  To: PEDRO ANDRES ARANDA GUTIERREZ; +Cc: 48157-done

Thanks!

On Mon, May 03, 2021 at 06:52:36PM +0200, PEDRO ANDRES ARANDA GUTIERREZ wrote:
> Confirmed that the currect version with the patch applied works in High Sierra and Catalina :-)
> 
> Best, /PA
> 
> > El 3 may 2021, a las 13:19, Alan Third <alan@idiocy.org> escribió:
> > 
> > On Mon, May 03, 2021 at 11:49:54AM +0200, PEDRO ANDRES ARANDA GUTIERREZ wrote:
> >> So... I have just compiled and tested on the Catalina Air and it draws the
> >> screen correctly :-)
> >> 
> >> Do you need me to check on the 10.13 MacBook pro too?
> > 
> > If you could it would be helpful, as 10.13 and below use a slightly
> > different mechanism, although given it works in GNUstep, it should
> > work in 10.13.
> > 
> > Thanks!
> 
> —
> PEDRO ANDRES ARANDA GUTIERREZ
> paranda@it.uc3m.es
> Universidad Carlos III Madrid
> 
> Fragen sind nicht da um beantwortet zu werden…
> Fragen sind da, um gestellt zu werden.
> Georg Kreisler
> 

-- 
Alan Third





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

end of thread, other threads:[~2021-05-03 17:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-02 10:37 bug#48157: Emacs-28 on Mac: corrupted GUI when setting default-frame-alist PEDRO ANDRES ARANDA GUTIERREZ
2021-05-02 11:39 ` Alan Third
2021-05-02 16:17 ` martin rudalics
2021-05-03  6:49   ` PEDRO ANDRES ARANDA GUTIERREZ
2021-05-03  7:56     ` martin rudalics
     [not found]       ` <CAPoMwp0xhMSa9KUaTmmYsQZBJjtLpY-2Kz5qvuLZLVpxN5Dzsw@mail.gmail.com>
     [not found]         ` <CAPoMwp2X66+512Yj8aWna5WzYj=Luqa8r7c+JZjhiOmhMWuZ7g@mail.gmail.com>
     [not found]           ` <YI/cJ6q7Zgw9fCHr@idiocy.org>
     [not found]             ` <7B3D9FF8-ED16-4D1F-84FF-3F900FD8DB0F@it.uc3m.es>
2021-05-03 17:49               ` Alan Third

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