This seems to work pretty well for me.
If you use the restore/maximize buttons or double click the
title bar (etc) my-frame-state could get out of sync but it
re-syncs every time my-frame-maximize or my-frame-restore
are called.

(make-variable-frame-local 'my-frame-state)
>
> (defun my-frame-maximize () "Maximize Emacs window in win32"
> (interactive)
  (modify-frame-parameters nil '((my-frame-state . t)))
> (w32-send-sys-command ?\xf030))
>
> (defun my-frame-restore () "Restore Emacs window in win32"
> (interactive)
  (modify-frame-parameters nil '((my-frame-state . nil)))
> (w32-send-sys-command ?\xF120))
>
(defun my-frame-toggle ()
  "Maximize/Restore Emacs frame based on `my-frame-state'"
  (interactive)
  (if my-frame-state
       (my-frame-restore)
     (my-frame-maximize)))
> --- keys
> 
(global-set-key [f2] 'my-frame-toggle) 
>

_______________________________________________
Help-gnu-emacs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

Reply via email to