unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#29986: Add frame arg to toggle-frame-maximized
@ 2018-01-04 21:42 Juri Linkov
  2018-01-07 16:08 ` martin rudalics
  2018-01-11 22:14 ` Juri Linkov
  0 siblings, 2 replies; 4+ messages in thread
From: Juri Linkov @ 2018-01-04 21:42 UTC (permalink / raw)
  To: 29986

I propose to add a standard optional arg ‘frame’ to
‘toggle-frame-maximized’ and ‘toggle-frame-fullscreen’,
so it would be easier to add to ~/.emacs such customizations
as e.g.

  (add-to-list 'after-make-frame-functions
               'toggle-frame-maximized)

diff --git a/lisp/frame.el b/lisp/frame.el
index a28baf7..7ed2f9f 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -2388,8 +2388,8 @@ blink-cursor-mode
 \f
 ;; Frame maximization/fullscreen
 
-(defun toggle-frame-maximized ()
-  "Toggle maximization state of selected frame.
+(defun toggle-frame-maximized (&optional frame)
+  "Toggle maximization state of FRAME.
 Maximize selected frame or un-maximize if it is already maximized.
 
 If the frame is in fullscreen state, don't change its state, but
@@ -2404,19 +2404,19 @@ toggle-frame-maximized
 
 See also `toggle-frame-fullscreen'."
   (interactive)
-  (let ((fullscreen (frame-parameter nil 'fullscreen)))
+  (let ((fullscreen (frame-parameter frame 'fullscreen)))
     (cond
      ((memq fullscreen '(fullscreen fullboth))
-      (set-frame-parameter nil 'fullscreen-restore 'maximized))
+      (set-frame-parameter frame 'fullscreen-restore 'maximized))
      ((eq fullscreen 'maximized)
-      (set-frame-parameter nil 'fullscreen nil))
+      (set-frame-parameter frame 'fullscreen nil))
      (t
-      (set-frame-parameter nil 'fullscreen 'maximized)))))
+      (set-frame-parameter frame 'fullscreen 'maximized)))))
 
-(defun toggle-frame-fullscreen ()
-  "Toggle fullscreen state of selected frame.
-Make selected frame fullscreen or restore its previous size if it
-is already fullscreen.
+(defun toggle-frame-fullscreen (&optional frame)
+  "Toggle fullscreen state of FRAME.
+Make selected frame fullscreen or restore its previous size
+if it is already fullscreen.
 
 Before making the frame fullscreen remember the current value of
 the frame's `fullscreen' parameter in the `fullscreen-restore'
@@ -2431,14 +2431,14 @@ toggle-frame-fullscreen
 
 See also `toggle-frame-maximized'."
   (interactive)
-  (let ((fullscreen (frame-parameter nil 'fullscreen)))
+  (let ((fullscreen (frame-parameter frame 'fullscreen)))
     (if (memq fullscreen '(fullscreen fullboth))
-	(let ((fullscreen-restore (frame-parameter nil 'fullscreen-restore)))
+	(let ((fullscreen-restore (frame-parameter frame 'fullscreen-restore)))
 	  (if (memq fullscreen-restore '(maximized fullheight fullwidth))
-	      (set-frame-parameter nil 'fullscreen fullscreen-restore)
-	    (set-frame-parameter nil 'fullscreen nil)))
+	      (set-frame-parameter frame 'fullscreen fullscreen-restore)
+	    (set-frame-parameter frame 'fullscreen nil)))
       (modify-frame-parameters
-       nil `((fullscreen . fullboth) (fullscreen-restore . ,fullscreen))))
+       frame `((fullscreen . fullboth) (fullscreen-restore . ,fullscreen))))
     ;; Manipulating a frame without waiting for the fullscreen
     ;; animation to complete can cause a crash, or other unexpected
     ;; behaviour, on macOS (bug#28496).





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

* bug#29986: Add frame arg to toggle-frame-maximized
  2018-01-04 21:42 bug#29986: Add frame arg to toggle-frame-maximized Juri Linkov
@ 2018-01-07 16:08 ` martin rudalics
  2018-01-07 21:30   ` Juri Linkov
  2018-01-11 22:14 ` Juri Linkov
  1 sibling, 1 reply; 4+ messages in thread
From: martin rudalics @ 2018-01-07 16:08 UTC (permalink / raw)
  To: Juri Linkov, 29986

 >    (add-to-list 'after-make-frame-functions
 >                 'toggle-frame-maximized)

How would this behave when the frame is maximized initially by the
windowing system/manager?  Would it then set the frame to its normal
size?

martin





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

* bug#29986: Add frame arg to toggle-frame-maximized
  2018-01-07 16:08 ` martin rudalics
@ 2018-01-07 21:30   ` Juri Linkov
  0 siblings, 0 replies; 4+ messages in thread
From: Juri Linkov @ 2018-01-07 21:30 UTC (permalink / raw)
  To: martin rudalics; +Cc: 29986

>>    (add-to-list 'after-make-frame-functions
>>                 'toggle-frame-maximized)
>
> How would this behave when the frame is maximized initially by the
> windowing system/manager?  Would it then set the frame to its normal
> size?

Exactly.  But as long as the frame is not maximized initially
by the window manager, this should work fine.





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

* bug#29986: Add frame arg to toggle-frame-maximized
  2018-01-04 21:42 bug#29986: Add frame arg to toggle-frame-maximized Juri Linkov
  2018-01-07 16:08 ` martin rudalics
@ 2018-01-11 22:14 ` Juri Linkov
  1 sibling, 0 replies; 4+ messages in thread
From: Juri Linkov @ 2018-01-11 22:14 UTC (permalink / raw)
  To: 29986-done

> I propose to add a standard optional arg ‘frame’ to
> ‘toggle-frame-maximized’ and ‘toggle-frame-fullscreen’,
> so it would be easier to add to ~/.emacs such customizations
> as e.g.
>
>   (add-to-list 'after-make-frame-functions
>                'toggle-frame-maximized)

Done.





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

end of thread, other threads:[~2018-01-11 22:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-04 21:42 bug#29986: Add frame arg to toggle-frame-maximized Juri Linkov
2018-01-07 16:08 ` martin rudalics
2018-01-07 21:30   ` Juri Linkov
2018-01-11 22:14 ` Juri Linkov

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