emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/native-comp 7438001 3/3: Merge remote-tracking branch 'savannah/


From: Andrea Corallo
Subject: feature/native-comp 7438001 3/3: Merge remote-tracking branch 'savannah/master' into HEAD
Date: Sat, 14 Mar 2020 11:15:40 -0400 (EDT)

branch: feature/native-comp
commit 7438001385889f6527ab5832c867392f3074c778
Merge: dab8dd8 1de9e0f
Author: Andrea Corallo <address@hidden>
Commit: Andrea Corallo <address@hidden>

    Merge remote-tracking branch 'savannah/master' into HEAD
---
 doc/emacs/frames.texi       |  13 ++++--
 doc/lispref/searching.texi  |   4 +-
 etc/NEWS.27                 |  10 ++++-
 lisp/emacs-lisp/cl-extra.el |   3 +-
 lisp/emacs-lisp/package.el  |   3 +-
 lisp/frame.el               |   6 +--
 lisp/gnus/mml.el            |   7 ++-
 lisp/mwheel.el              |  10 ++++-
 lisp/net/rcirc.el           |  16 ++++---
 lisp/net/tramp.el           |  19 ++++----
 lisp/progmodes/cc-defs.el   |   2 +-
 lisp/progmodes/gdb-mi.el    |   5 ++-
 lisp/subr.el                |   9 +++-
 lisp/tab-bar.el             |  26 ++++++++---
 lisp/w32-fns.el             |   7 +++
 src/.gdbinit                |   2 +-
 src/nsterm.h                |   4 ++
 src/nsterm.m                | 107 +++++++++++++++++++++++++++++++++++++++-----
 18 files changed, 195 insertions(+), 58 deletions(-)

diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi
index 002297c..7a583b9 100644
--- a/doc/emacs/frames.texi
+++ b/doc/emacs/frames.texi
@@ -217,10 +217,15 @@ default bound to scrolling with the @key{Ctrl} modifier.
 @vindex mouse-wheel-tilt-scroll
 @vindex mouse-wheel-flip-direction
 Emacs can also support horizontal scrolling if your mouse's wheel can
-be tilted.  This feature is off by default; the variable
-@code{mouse-wheel-tilt-scroll} turns it on.  If you'd like to reverse
-the direction of horizontal scrolling, customize the variable
-@code{mouse-wheel-flip-direction} to a non-@code{nil} value.
+be tilted, or if your touchpad supports it.  This feature is off by
+default; the variable @code{mouse-wheel-tilt-scroll} turns it on, if
+you customize it to a non-@code{nil} value.  By default, tilting the
+mouse wheel scrolls the window's view horizontally in the direction of
+the tilt: e.g., tilting to the right scrolls the window to the right,
+so that the text displayed in the window moves horizontally to the
+left.  If you'd like to reverse the direction of horizontal scrolling,
+customize the variable @code{mouse-wheel-flip-direction} to a
+non-@code{nil} value.
 
 When the mouse pointer is over an image, scrolling the mouse wheel
 with the @key{Ctrl} modifier scales the image under the mouse pointer.
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi
index 1a090eb..83c1549 100644
--- a/doc/lispref/searching.texi
+++ b/doc/lispref/searching.texi
@@ -1021,8 +1021,8 @@ or, using shorter synonyms and written more compactly,
 @example
 @group
 (rx "/*"
-    (* (| (not (any "*"))
-          (: "*" (not (any "/")))))
+    (* (| (not "*")
+          (: "*" (not "/"))))
     (+ "*") "/")
 @end group
 @end example
diff --git a/etc/NEWS.27 b/etc/NEWS.27
index 1eff926..6300319 100644
--- a/etc/NEWS.27
+++ b/etc/NEWS.27
@@ -360,6 +360,14 @@ its '--eval' command-line option), as well as in
 'lisp-interaction-mode' and 'ielm-mode', used in the "*scratch*" and
 "*ielm*" buffers.
 
+We envision that most Lisp code is already either written with
+lexical-binding in mind, or will work unchanged under
+lexical-binding.  If, for some reason, your code used in 'M-:' or
+'--eval' doesn't work as result of this change, either modify the code
+to work with lexical binding, or wrap it in an extra level of 'eval'.
+For example, --eval FORM becomes --eval "(eval 'FORM)" (note the extra
+quote in 'FORM).
+
 ---
 ** The new user option 'tooltip-resize-echo-area' avoids truncating
 tooltip text on GUI frames when tooltips are displayed in the echo
@@ -779,7 +787,7 @@ an offset to absolute line numbers.
 ** table
 
 +++
-*** 'table-generate-source' now supports wiki and mediawiki
+*** 'table-generate-source' now supports wiki and mediawiki.
 This command can now output wiki and mediawiki format tables.
 
 ** telnet-mode
diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index e9bfe8d..323bbbb 100644
--- a/lisp/emacs-lisp/cl-extra.el
+++ b/lisp/emacs-lisp/cl-extra.el
@@ -72,8 +72,7 @@ strings case-insensitively."
   (cond ((eq x y) t)
        ((stringp x)
         (and (stringp y) (= (length x) (length y))
-             (or (string-equal x y)
-                 (string-equal (downcase x) (downcase y))))) ;Lazy but simple!
+              (eq (compare-strings x nil nil y nil nil t) t)))
        ((numberp x)
         (and (numberp y) (= x y)))
        ((consp x)
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 43eb038..bce17a0 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2045,7 +2045,7 @@ Mark the installed package as selected by adding it to
 
 When called from Lisp and optional argument DONT-SELECT is
 non-nil, install the package but do not add it to
-`package-select-packages'.
+`package-selected-packages'.
 
 If PKG is a `package-desc' and it is already installed, don't try
 to install it but still mark it as selected."
@@ -3042,6 +3042,7 @@ column in the header line."
 
 (defun package-menu--generate (remember-pos &optional packages keywords)
   "Populate and display the Package Menu.
+If REMEMBER-POS is non-nil, keep point on the same entry.
 PACKAGES should be t, which means to display all known packages,
 or a list of package names (symbols) to display.
 
diff --git a/lisp/frame.el b/lisp/frame.el
index dc8dabc..6c2f774 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -2688,11 +2688,7 @@ See also `toggle-frame-maximized'."
              (set-frame-parameter frame 'fullscreen fullscreen-restore)
            (set-frame-parameter frame 'fullscreen nil)))
       (modify-frame-parameters
-       frame `((fullscreen . fullboth) (fullscreen-restore . ,fullscreen))))
-    ;; Manipulating a frame without waiting for the fullscreen
-    ;; animation to complete can cause a crash, or other unexpected
-    ;; behavior, on macOS (bug#28496).
-    (when (featurep 'cocoa) (sleep-for 0.5))))
+       frame `((fullscreen . fullboth) (fullscreen-restore . ,fullscreen))))))
 
 
 ;;;; Key bindings
diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el
index 3d86c5b..2006837 100644
--- a/lisp/gnus/mml.el
+++ b/lisp/gnus/mml.el
@@ -547,8 +547,7 @@ type detected."
                        new-parts))
                (setq cid (1+ cid)))))))
       ;; We have local images that we want to include.
-      (if (not new-parts)
-         (list cont)
+      (when new-parts
        (setcdr (assq 'contents cont) (buffer-string))
        (setq cont
              (nconc (list 'multipart (cons 'type "related"))
@@ -561,8 +560,8 @@ type detected."
                                       (nth 1 new-part)
                                       (nth 2 new-part))
                                    (id . ,(concat "<" (nth 0 new-part)
-                                                  ">")))))))
-       cont))))
+                                                  ">"))))))))
+      cont)))
 
 (autoload 'image-property "image")
 
diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index 56150c8..317f2cd 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -145,13 +145,19 @@ face height."
 ;;; For tilt-scroll
 ;;;
 (defcustom mouse-wheel-tilt-scroll nil
-  "Enable scroll using tilting mouse wheel."
+  "Enable horizontal scrolling by tilting mouse wheel or via touchpad.
+Also see `mouse-wheel-flip-direction'."
   :group 'mouse
   :type 'boolean
   :version "26.1")
 
 (defcustom mouse-wheel-flip-direction nil
-  "Swap direction of `wheel-right' and `wheel-left'."
+  "Swap direction of `wheel-right' and `wheel-left'.
+By default, `wheel-right' scrolls the text to the right,
+and `wheel-left' scrolls in the other direction.
+If this variable is non-nil, it inverts the direction of
+horizontal scrolling by tilting the mouse wheel.
+Also see `mouse-wheel-tilt-scroll'."
   :group 'mouse
   :type 'boolean
   :version "26.1")
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index a223416..1766e19 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -2626,12 +2626,16 @@ the only argument."
                (and ;; nickserv
                 (string= sender "NickServ")
                 (string= target rcirc-nick)
-                (member message
-                        (list
-                         (format "You are now identified for \C-b%s\C-b." 
rcirc-nick)
-                        (format "You are successfully identified as 
\C-b%s\C-b." rcirc-nick)
-                         "Password accepted - you are now recognized."
-                         )))
+                (cl-member
+                 message
+                 (list
+                  (format "You are now identified for \C-b%s\C-b." rcirc-nick)
+                  (format "You are successfully identified as \C-b%s\C-b."
+                          rcirc-nick)
+                  "Password accepted - you are now recognized.")
+                 ;; The nick may have a different case, so match
+                 ;; case-insensitively (Bug#39345).
+                 :test #'cl-equalp))
                (and ;; quakenet
                 (string= sender "Q")
                 (string= target rcirc-nick)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index c498f8c..3ce2225 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -4195,18 +4195,21 @@ performed successfully.  Any other value means an 
error."
 (defun tramp-accept-process-output (proc &optional timeout)
   "Like `accept-process-output' for Tramp processes.
 This is needed in order to hide `last-coding-system-used', which is set
-for process communication also."
+for process communication also.
+If the user quits via `C-g', it is propagated up to `tramp-file-name-handler'."
   (with-current-buffer (process-buffer proc)
     (let ((inhibit-read-only t)
          last-coding-system-used
          result)
-      ;; JUST-THIS-ONE is set due to Bug#12145.
-      (tramp-message
-       proc 10 "%s %s %s %s\n%s"
-       proc timeout (process-status proc)
-       (with-local-quit
-        (setq result (accept-process-output proc timeout nil t)))
-       (buffer-string))
+      ;; JUST-THIS-ONE is set due to Bug#12145.  `with-local-quit'
+      ;; returns t in order to report success.
+      (if (with-local-quit
+           (setq result (accept-process-output proc timeout nil t)) t)
+         (tramp-message
+          proc 10 "%s %s %s %s\n%s"
+          proc timeout (process-status proc) result (buffer-string))
+       ;; Propagate quit.
+       (keyboard-quit))
       result)))
 
 (defun tramp-search-regexp (regexp)
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index 12be09d..2624d9d 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -87,7 +87,7 @@
 
 ;;; Variables also used at compile time.
 
-(defconst c-version "5.34"
+(defconst c-version "5.34.2"
   "CC Mode version number.")
 
 (defconst c-version-sym (intern c-version))
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index da5a2a5..c262232 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -1046,7 +1046,10 @@ no input, and GDB is waiting for input."
 
 (declare-function tooltip-show "tooltip" (text &optional use-echo-area))
 
-(defconst gdb--string-regexp "\"\\(?:[^\\\"]\\|\\\\.\\)*\"")
+(defconst gdb--string-regexp (rx "\""
+                                 (* (or (seq "\\" nonl)
+                                        (not (any "\"\\"))))
+                                 "\""))
 
 (defun gdb-tooltip-print (expr)
   (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer)
diff --git a/lisp/subr.el b/lisp/subr.el
index 9c80c06..123557e 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2987,13 +2987,18 @@ This finishes the change group by reverting all of its 
changes."
        ;; the body of `atomic-change-group' all changes can be undone.
        (widen)
        (let ((old-car (car-safe elt))
-             (old-cdr (cdr-safe elt)))
+             (old-cdr (cdr-safe elt))
+             ;; Use `pending-undo-list' temporarily since `undo-more' needs
+             ;; it, but restore it afterwards so as not to mess with an
+             ;; ongoing sequence of `undo's.
+             (pending-undo-list
+              ;; Use `buffer-undo-list' unconditionally (bug#39680).
+              buffer-undo-list))
           (unwind-protect
               (progn
                 ;; Temporarily truncate the undo log at ELT.
                 (when (consp elt)
                   (setcar elt nil) (setcdr elt nil))
-                (unless (eq last-command 'undo) (undo-start))
                 ;; Make sure there's no confusion.
                 (when (and (consp elt) (not (eq elt (last pending-undo-list))))
                   (error "Undoing to some unrelated state"))
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 873f54a..30ed1a4 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -123,7 +123,8 @@ Possible modifiers are `control', `meta', `shift', `hyper', 
`super' and
                     (assq-delete-all 'tab-bar-lines
                                      default-frame-alist)))))
 
-  (when (and tab-bar-mode (not (get-text-property 0 'display 
tab-bar-new-button)))
+  (when (and tab-bar-mode tab-bar-new-button
+             (not (get-text-property 0 'display tab-bar-new-button)))
     ;; This file is pre-loaded so only here we can use the right 
data-directory:
     (add-text-properties 0 (length tab-bar-new-button)
                          `(display (image :type xpm
@@ -132,7 +133,8 @@ Possible modifiers are `control', `meta', `shift', `hyper', 
`super' and
                                           :ascent center))
                          tab-bar-new-button))
 
-  (when (and tab-bar-mode (not (get-text-property 0 'display 
tab-bar-close-button)))
+  (when (and tab-bar-mode tab-bar-close-button
+             (not (get-text-property 0 'display tab-bar-close-button)))
     ;; This file is pre-loaded so only here we can use the right 
data-directory:
     (add-text-properties 0 (length tab-bar-close-button)
                          `(display (image :type xpm
@@ -263,6 +265,17 @@ before calling the command that adds a new tab."
   :group 'tab-bar
   :version "27.1")
 
+(defcustom tab-bar-new-button-show t
+  "If non-nil, show the \"New tab\" button in the tab bar.
+When this is nil, you can create new tabs with \\[tab-new]."
+  :type 'boolean
+  :initialize 'custom-initialize-default
+  :set (lambda (sym val)
+         (set-default sym val)
+         (force-mode-line-update))
+  :group 'tab-bar
+  :version "27.1")
+
 (defvar tab-bar-new-button " + "
   "Button for creating a new tab.")
 
@@ -306,7 +319,8 @@ This helps to select the tab by its number using 
`tab-bar-select-tab'."
   :group 'tab-bar
   :version "27.1")
 
-(defvar tab-bar-separator nil)
+(defvar tab-bar-separator nil
+  "String that delimits tabs.")
 
 
 (defcustom tab-bar-tab-name-function #'tab-bar-tab-name-current
@@ -464,9 +478,9 @@ Return its existing value or a new value."
                  (interactive)
                  (tab-bar-close-tab ,i)))))))
       tabs)
-     (when tab-bar-new-button
-       `((sep-add-tab menu-item ,separator ignore)
-         (add-tab menu-item ,tab-bar-new-button tab-bar-new-tab
+     `((sep-add-tab menu-item ,separator ignore))
+     (when (and tab-bar-new-button-show tab-bar-new-button)
+       `((add-tab menu-item ,tab-bar-new-button tab-bar-new-tab
                   :help "New tab"))))))
 
 
diff --git a/lisp/w32-fns.el b/lisp/w32-fns.el
index 8a816da..c252c0b 100644
--- a/lisp/w32-fns.el
+++ b/lisp/w32-fns.el
@@ -238,14 +238,18 @@ bit output with no translation."
   ;; value from x-select-font etc, so list the most important charsets last.
   (w32-add-charset-info "iso8859-14" 'w32-charset-ansi  28604)
   (w32-add-charset-info "iso8859-15" 'w32-charset-ansi  28605)
+  (w32-add-charset-info "iso8859-16" 'w32-charset-ansi  28606)
   ;; The following two are included for pattern matching.
   (w32-add-charset-info "jisx0201" 'w32-charset-shiftjis 932)
   (w32-add-charset-info "jisx0208" 'w32-charset-shiftjis 932)
   (w32-add-charset-info "jisx0201-latin" 'w32-charset-shiftjis 932)
   (w32-add-charset-info "jisx0201-katakana" 'w32-charset-shiftjis 932)
+  (w32-add-charset-info "jisx0212" 'w32-charset-shiftjis 932)
   (w32-add-charset-info "ksc5601.1989" 'w32-charset-hangeul 949)
+  (w32-add-charset-info "ksx1001" 'w32-charset-hangeul 949)
   (w32-add-charset-info "big5" 'w32-charset-chinesebig5 950)
   (w32-add-charset-info "gb2312.1980" 'w32-charset-gb2312 936)
+  (w32-add-charset-info "gbk" 'w32-charset-gb2312 936)
   (w32-add-charset-info "ms-symbol" 'w32-charset-symbol nil)
   (w32-add-charset-info "ms-oem" 'w32-charset-oem 437)
   (w32-add-charset-info "ms-oemlatin" 'w32-charset-oem 850)
@@ -258,9 +262,12 @@ bit output with no translation."
   (w32-add-charset-info "iso8859-9" 'w32-charset-turkish 1254)
   (w32-add-charset-info "iso8859-13" 'w32-charset-baltic 1257)
   (w32-add-charset-info "koi8-r" 'w32-charset-russian 20866)
+  (w32-add-charset-info "microsoft-cp1251" 'w32-charset-russian 1251)
+  (w32-add-charset-info "windows-1251" 'w32-charset-russian 1251)
   (w32-add-charset-info "tis620-2533" 'w32-charset-russian 28595)
   (w32-add-charset-info "iso8859-11" 'w32-charset-thai 874)
   (w32-add-charset-info "windows-1258" 'w32-charset-vietnamese 1258)
+  (w32-add-charset-info "viscii" 'w32-charset-vietnamese 1258)
   (w32-add-charset-info "ksc5601.1992" 'w32-charset-johab 1361)
   (w32-add-charset-info "mac-roman" 'w32-charset-mac 10000)
   (w32-add-charset-info "iso10646-1" 'w32-charset-default t)
diff --git a/src/.gdbinit b/src/.gdbinit
index 5dd0133..30c7b05 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -72,7 +72,7 @@ end
 
 define xgetsym
   xgetptr $arg0
-  set $ptr = ((struct Lisp_Symbol *) ((char *)lispsym + $ptr))
+  set $ptr = ((struct Lisp_Symbol *) ((char *) &lispsym + $ptr))
 end
 
 # Access the name of a symbol
diff --git a/src/nsterm.h b/src/nsterm.h
index db966e1..8396a54 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -433,6 +433,7 @@ typedef id instancetype;
    int maximized_width, maximized_height;
    NSWindow *nonfs_window;
    BOOL fs_is_native;
+   BOOL in_fullscreen_transition;
 #ifdef NS_DRAW_TO_BUFFER
    CGContextRef drawingBuffer;
 #endif
@@ -467,6 +468,8 @@ typedef id instancetype;
 - (void) toggleFullScreen: (id) sender;
 - (BOOL) fsIsNative;
 - (BOOL) isFullscreen;
+- (BOOL) inFullScreenTransition;
+- (void) waitFullScreenTransition;
 #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
 - (void) updateCollectionBehavior;
 #endif
@@ -1286,6 +1289,7 @@ extern char gnustep_base_version[];  /* version tracking 
*/
 #if !defined (NS_IMPL_COCOA) || !defined (MAC_OS_X_VERSION_10_7)
 #define NSFullScreenWindowMask                      (1 << 14)
 #define NSWindowCollectionBehaviorFullScreenPrimary (1 << 7)
+#define NSWindowCollectionBehaviorFullScreenAuxiliary (1 << 8)
 #define NSApplicationPresentationFullScreen         (1 << 10)
 #define NSApplicationPresentationAutoHideToolbar    (1 << 11)
 #define NSAppKitVersionNumber10_7                   1138
diff --git a/src/nsterm.m b/src/nsterm.m
index 851a561..96a7fdc 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1571,9 +1571,12 @@ ns_make_frame_visible (struct frame *f)
 
       /* Making a new frame from a fullscreen frame will make the new frame
          fullscreen also.  So skip handleFS as this will print an error.  */
-      if ([view fsIsNative] && f->want_fullscreen == FULLSCREEN_BOTH
-          && [view isFullscreen])
-        return;
+      if ([view fsIsNative] && [view isFullscreen])
+        {
+          // maybe it is not necessary to wait
+          [view waitFullScreenTransition];
+          return;
+        }
 
       if (f->want_fullscreen != FULLSCREEN_NONE)
         {
@@ -1959,8 +1962,16 @@ ns_set_parent_frame (struct frame *f, Lisp_Object 
new_value, Lisp_Object old_val
       block_input ();
       child = [FRAME_NS_VIEW (f) window];
 
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
+      EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f);
+#endif
+
       if ([child parentWindow] != nil)
         {
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
+          parent = [child parentWindow];
+#endif
+
           [[child parentWindow] removeChildWindow:child];
 #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
 #if MAC_OS_X_VERSION_MIN_REQUIRED < 101000
@@ -1968,10 +1979,38 @@ ns_set_parent_frame (struct frame *f, Lisp_Object 
new_value, Lisp_Object old_val
 #endif
               [child 
setAccessibilitySubrole:NSAccessibilityStandardWindowSubrole];
 #endif
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
+          if (NILP (new_value))
+            {
+              NSTRACE ("child 
setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary");
+              [child 
setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
+              // if current parent in fullscreen and no new parent make child 
fullscreen
+              while (parent) {
+                if (([parent styleMask] & NSWindowStyleMaskFullScreen) != 0)
+                  {
+                    [view toggleFullScreen:child];
+                    break;
+                  }
+                // check all parents
+                parent = [parent parentWindow];
+              }
+            }
+#endif
         }
 
       if (!NILP (new_value))
         {
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
+          // child frame must not be in fullscreen
+          if ([view fsIsNative] && [view isFullscreen])
+            {
+              // in case child is going fullscreen
+              [view waitFullScreenTransition];
+              [view toggleFullScreen:child];
+            }
+          NSTRACE ("child 
setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary");
+          [child 
setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary];
+#endif
           parent = [FRAME_NS_VIEW (p) window];
 
           [parent addChildWindow: child
@@ -7398,6 +7437,7 @@ not_in_argv (NSString *arg)
 #endif
     fs_is_native = ns_use_native_fullscreen;
 #endif
+  in_fullscreen_transition = NO;
 
   maximized_width = maximized_height = -1;
   nonfs_window = nil;
@@ -7431,7 +7471,10 @@ not_in_argv (NSString *arg)
 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
   if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_7)
 #endif
-    [win setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
+    if (FRAME_PARENT_FRAME (f))
+      [win 
setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary];
+    else
+      [win setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
 #endif
 
   wr = [win frame];
@@ -7554,11 +7597,12 @@ not_in_argv (NSString *arg)
       emacsframe->top_pos =
         NS_PARENT_WINDOW_TOP_POS (emacsframe) - (r.origin.y + r.size.height);
 
-      if (emacs_event)
-        {
-          emacs_event->kind = MOVE_FRAME_EVENT;
-          EV_TRAILER ((id)nil);
-        }
+      // FIXME: after event part below didExitFullScreen is not received
+      // if (emacs_event)
+      //   {
+      //     emacs_event->kind = MOVE_FRAME_EVENT;
+      //     EV_TRAILER ((id)nil);
+      //   }
     }
 }
 
@@ -7758,6 +7802,7 @@ not_in_argv (NSString *arg)
 - (void)windowWillEnterFullScreen:(NSNotification *)notification
 {
   NSTRACE ("[EmacsView windowWillEnterFullScreen:]");
+  in_fullscreen_transition = YES;
   [self windowWillEnterFullScreen];
 }
 - (void)windowWillEnterFullScreen /* provided for direct calls */
@@ -7770,6 +7815,7 @@ not_in_argv (NSString *arg)
 {
   NSTRACE ("[EmacsView windowDidEnterFullScreen:]");
   [self windowDidEnterFullScreen];
+  in_fullscreen_transition = NO;
 }
 
 - (void)windowDidEnterFullScreen /* provided for direct calls */
@@ -7808,6 +7854,7 @@ not_in_argv (NSString *arg)
 - (void)windowWillExitFullScreen:(NSNotification *)notification
 {
   NSTRACE ("[EmacsView windowWillExitFullScreen:]");
+  in_fullscreen_transition = YES;
   [self windowWillExitFullScreen];
 }
 
@@ -7827,6 +7874,7 @@ not_in_argv (NSString *arg)
 {
   NSTRACE ("[EmacsView windowDidExitFullScreen:]");
   [self windowDidExitFullScreen];
+  in_fullscreen_transition = NO;
 }
 
 - (void)windowDidExitFullScreen /* provided for direct calls */
@@ -7856,6 +7904,22 @@ not_in_argv (NSString *arg)
     [[self window] performZoom:self];
 }
 
+- (BOOL)inFullScreenTransition
+{
+  return in_fullscreen_transition;
+}
+
+- (void)waitFullScreenTransition
+{
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
+  while ([self inFullScreenTransition])
+    {
+      NSTRACE ("wait for fullscreen");
+      wait_reading_process_output (0, 300000000, 0, 1, Qnil, NULL, 0);
+    }
+#endif
+}
+
 - (BOOL)fsIsNative
 {
   return fs_is_native;
@@ -7894,9 +7958,22 @@ not_in_argv (NSString *arg)
       NSWindow *win = [self window];
       NSWindowCollectionBehavior b = [win collectionBehavior];
       if (ns_use_native_fullscreen)
-        b |= NSWindowCollectionBehaviorFullScreenPrimary;
+        {
+          if ([win parentWindow])
+            {
+              b &= ~NSWindowCollectionBehaviorFullScreenPrimary;
+              b |= NSWindowCollectionBehaviorFullScreenAuxiliary;
+            }
+          else
+            {
+              b |= NSWindowCollectionBehaviorFullScreenPrimary;
+              b &= ~NSWindowCollectionBehaviorFullScreenAuxiliary;
+            }
+        }
       else
-        b &= ~NSWindowCollectionBehaviorFullScreenPrimary;
+        {
+          b &= ~NSWindowCollectionBehaviorFullScreenPrimary;
+        }
 
       [win setCollectionBehavior: b];
 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
@@ -7922,8 +7999,14 @@ not_in_argv (NSString *arg)
 #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
       if ([[self window] respondsToSelector: @selector(toggleFullScreen:)])
+        {
+#endif
+          [[self window] toggleFullScreen:sender];
+          // wait for fullscreen animation complete (bug#28496)
+          [self waitFullScreenTransition];
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
+        }
 #endif
-        [[self window] toggleFullScreen:sender];
 #endif
       return;
     }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]