Browse files

Make toggle-fullscreen check for previous-video-mode before doing any…


This should remove some weird behavior when mixing toggle-fullscreen and set-fullscreen.
Those shouldn't be mixed anyway but now at least video mode change only occurs when it should.
  • Loading branch information...
1 parent 46a435f commit a1d424ee6e27dfee27126ff5bc197e8a91697d77 @patzy patzy committed Feb 26, 2012
Showing with 10 additions and 6 deletions.
  1. +8 −5 src/glop.lisp
  2. +2 −1 src/utils.lisp
@@ -156,15 +156,18 @@ Returns NIL if no match is found."
(defun toggle-fullscreen (window)
"Attempt to change display mode to the mode closest to geometry and
set window fullscreen state."
- (if (window-fullscreen window)
- (progn (set-fullscreen window nil)
- (set-video-mode (window-previous-video-mode window)))
- (progn (setf (window-previous-video-mode window) (current-video-mode))
+ (cond
+ ((and (window-previous-video-mode window) (window-fullscreen window))
+ (progn (set-fullscreen window nil)
+ (set-video-mode (window-previous-video-mode window))
+ (setf (window-previous-video-mode window) nil)))
+ ((not (window-fullscreen window))
+ (progn (setf (window-previous-video-mode window) (current-video-mode))
(set-video-mode (closest-video-mode (current-video-mode)
(window-width window)
(window-height window)))
- (set-fullscreen window t))))
+ (set-fullscreen window t)))))
(defgeneric set-geometry (window x y width height)
@@ -65,7 +65,8 @@
(gl-context :accessor window-gl-context)
(pushed-event :initform nil :accessor window-pushed-event)
(fullscreen :initform nil :accessor window-fullscreen)
- (previous-video-mode :accessor window-previous-video-mode)))
+ (previous-video-mode :accessor window-previous-video-mode
+ :initform nil)))
(defun %update-geometry (win x y width height)
(setf (slot-value win 'x) x

0 comments on commit a1d424e

Please sign in to comment.