(require 'maxframe)
(when *is-cocoa-emacs*
  (fset 'maximize-frame 'x-maximize-frame)
  (fset 'restore-frame 'x-restore-frame))
(when *macbook-pro-support-enabled*
  (setq mf-max-width 1440)
  (setq mf-max-height 898)
  (setq mf-offset-x 0))

(defmacro with-selected-frame (frame &rest forms)
  (let ((prev-frame (gensym)))
    `(progn
       (let ((,prev-frame (selected-frame)))
         (select-frame (or ,frame (selected-frame)))
         (unwind-protect
             (progn ,@forms)
           (select-frame ,prev-frame))))))

(defun maybe-maximize-frame (&optional frame)
  (with-selected-frame frame
    (if window-system (maximize-frame))))

(add-hook 'after-make-frame-functions 'maybe-maximize-frame)
(add-hook 'after-init-hook 'maybe-maximize-frame)

(defun maximized-p (&optional frame)
  (or (not (with-selected-frame frame window-system))
      (and (<= (abs (- (mf-max-display-pixel-width) (frame-pixel-width frame))) (frame-char-width frame))
           (<= (abs (- (mf-max-display-pixel-height) (+ mf-display-padding-height (frame-pixel-height frame)))) (+ 5 (frame-char-height frame))))))


(provide 'init-maxframe)

(require 'maxframe)
(when *is-cocoa-emacs*
  (fset 'maximize-frame 'x-maximize-frame)
  (fset 'restore-frame 'x-restore-frame))
(when *macbook-pro-support-enabled*
  (setq mf-max-width 1440)
  (setq mf-max-height 890)
  (setq mf-offset-x 0))

(defmacro with-selected-frame (frame &rest forms)
  (let ((prev-frame (gensym)))
    `(progn
       (let ((,prev-frame (selected-frame)))
         (select-frame (or ,frame (selected-frame)))
         (unwind-protect
             (progn ,@forms)
           (select-frame ,prev-frame))))))

(defun maybe-maximize-frame (&optional frame)
  (with-selected-frame frame
    (if window-system (maximize-frame))))

(add-hook 'after-make-frame-functions 'maybe-maximize-frame)
(add-hook 'after-init-hook 'maybe-maximize-frame)

(defun maximized-p (&optional frame)
  (or (not (with-selected-frame frame window-system))
      (and (<= (abs (- (mf-max-display-pixel-width) (frame-pixel-width frame))) (frame-char-width frame))
           (<= (abs (- (mf-max-display-pixel-height) (+ mf-display-padding-height (frame-pixel-height frame)))) (+ 5 (frame-char-height frame))))))


(provide 'init-maxframe)

Fix macbook pro max screen height
Fix macbook pro max screen height

Werewolflsp/emacs.d,jkaessens/emacs.d,zuoshifan/emacs.d,zhuoyikang/emacs.d,atreeyang/emacs.d,zuoshifan/emacs.d,kindoblue/emacs.d,wenpincui/emacs.d,lromang/emacs.d,farzadbekran/emacs.d,boblannon/emacs.d,lust4life/emacs.d,carlosliu/emacs.d,farzadbekran/emacs.d,emuio/emacs.d,gsmlg/emacs.d,shafayetkhan/emacs.d,farzadbekran/emacs.d,pairyo/emacs.d,ruiyang/emacs.d,roxolan/emacs.d,zhaotai/.emacs.d,mmqmzk/emacs.d,whizzzkid/emacs.d,zuoshifan/emacs.d,LittleLmp/emacs.d,mpwang/emacs.d,krzysz00/emacs.d,LKI/emacs.d,Guoozz/emacs.d,YangXin/emacs.d,svenyurgensson/emacs.d,benkha/emacs.d,haodaivshen/emacs.d,zuoshifan/emacs.d,hophacker/emacs.d,modkzs/emcs.d,YangXin/emacs.d,lujianmei/emacs.d,zuoshifan/emacs.d,jthetzel/emacs.d,braveoyster/emacs.d,farzadbekran/emacs.d,dcorking/emacs.d,zuoshifan/emacs.d,jhpx/emacs.d,46do14/emacs.d,ernest-dzf/emacs.d,farzadbekran/emacs.d,me020523/emacs.d,Togal/emacs.d,exclamaforte/emacs.d,ilove0518/emacs.d,alant/emacs.d,DarkThrone/emacs.d,fengxl/emacs.d,bibaijin/emacs.d,zuoshifan/emacs.d,Jadecity/PurcellEmacs.d,jachinpy/emacs.d,danfengcao/emacs.d,renatoriccio/emacs.d,qinshulei/emacs.d,caoyuanqi/emacs.d,zuoshifan/emacs.d,jachinpy/emacs.d,cyjia/emacs.d,zenith-john/emacs.d,zuoshifan/emacs.d,scorpionis/emacs.d,Shanicky/emacs.d,purcell/emacs.d,blueseason/emacs.d,baohaojun/emacs.d,dongdonghu/.emacs.d,arthurl/emacs.d,hkcqr/emacs.d,kongfy/emacs.d,dhanunjaya/emacs.d,sgarciac/emacs.d,cjqw/emacs.d,blueabysm/emacs.d,Enzo-Liu/emacs.d,ruiyang/emacs.d,qianwan/emacs.d,wegatron/emacs.d