Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use reversed inheritance (like we did for window class) for video-mod…

…e struct
  • Loading branch information...
commit 46a435f8a4b7f5ccc868fa02a1d194c26f961f39 1 parent f60212a
@patzy authored
View
4 src/osx/glop-osx.lisp
@@ -264,7 +264,7 @@
(glop-bridge:capture-all-displays)
(glop-bridge:set-display-mode
(glop-bridge:main-display-id)
- (osx-video-mode-mode fullscreen-mode)
+ (video-mode-mode fullscreen-mode)
(cffi:null-pointer))
(glop-bridge:ns-opengl-context-clear-drawable gl-context)
(glop-bridge:ns-opengl-context-set-full-screen gl-context)
@@ -274,7 +274,7 @@
(progn
(glop-bridge:set-display-mode
(glop-bridge:main-display-id)
- (osx-video-mode-mode *native-video-mode*)
+ (video-mode-mode *native-video-mode*)
(cffi:null-pointer))
(glop-bridge:ns-opengl-context-clear-drawable gl-context)
(glop-bridge:release-all-displays)
View
2  src/osx/quartz.lisp
@@ -11,7 +11,7 @@
(declaim (inline display-to-video-mode))
(defun translate-to-video-mode (mode)
- (glop::make-osx-video-mode
+ (glop::make-video-mode
:width (mode-width mode)
:height (mode-height mode)
:rate (mode-rate mode)
View
32 src/utils.lisp
@@ -1,6 +1,22 @@
(in-package #:glop)
-(defstruct video-mode
+#+(or win32 windows)
+(defstruct win32-video-mode
+ (rate 0 :type integer))
+
+#+(and unix (not darwin))
+(defstruct x11-video-mode
+ (rate 0 :type integer)
+ (index -1 :type integer))
+
+#+darwin
+(defstruct osx-video-mode
+ (rate 0 :type double-float)
+ mode)
+
+(defstruct (video-mode (:include #+(and unix (not darwin)) x11-video-mode
+ #+(and win32 windows) win32-video-mode
+ #+darwin osx-video-mode))
(width 0 :type integer)
(height 0 :type integer)
(depth 0 :type integer))
@@ -16,10 +32,6 @@
(dc :accessor win32-window-dc)
(id :accessor win32-window-id)))
-#+(or win32 windows)
-(defstruct (win32-video-mode (:include video-mode))
- (rate 0 :type integer))
-
#+(and unix (not darwin))
(defclass x11-window ()
((display :initarg :display :accessor x11-window-display)
@@ -29,11 +41,6 @@
(fb-config :accessor x11-window-fb-config)
(cursor :accessor x11-window-cursor)))
-#+(and unix (not darwin))
-(defstruct (x11-video-mode (:include video-mode))
- (rate 0 :type integer)
- (index -1 :type integer))
-
#+darwin
(defclass osx-window ()
((ns-window :initform nil
@@ -45,11 +52,6 @@
(invert-mouse-y :initform nil
:accessor invert-mouse-y)))
-#+darwin
-(defstruct (osx-video-mode (:include video-mode))
- (rate 0 :type double-float)
- mode)
-
;; base window structure
;; you may inherit your own window class from this
(defclass window (#+(and unix (not darwin)) x11-window
View
2  src/win32/glop-win32.lisp
@@ -9,7 +9,7 @@
(defmethod list-video-modes ()
(glop-win32::list-video-modes))
-(defmethod set-video-mode ((mode win32-video-mode))
+(defmethod set-video-mode ((mode video-mode))
(glop-win32::set-video-mode mode))
(defmethod current-video-mode ()
View
10 src/win32/win32.lisp
@@ -395,7 +395,7 @@
dmode devmode)
(setf size (foreign-type-size 'devmode))
(enum-display-settings (cffi:null-pointer) -1 dmode)
- (glop::make-win32-video-mode :width pels-width
+ (glop::make-video-mode :width pels-width
:height pels-height
:depth bits-per-pixel
:rate display-frequency))))
@@ -409,10 +409,10 @@
for res = (enum-display-settings (cffi:null-pointer) mode-index dmode)
do (incf mode-index)
until (zerop res)
- collect (glop::make-win32-video-mode :width pels-width
- :height pels-height
- :depth bits-per-pixel
- :rate display-frequency)))))
+ collect (glop::make-video-mode :width pels-width
+ :height pels-height
+ :depth bits-per-pixel
+ :rate display-frequency)))))
(defun set-video-mode (mode)
(let ((width (glop::video-mode-width mode))
View
18 src/x11/glop-x11.lisp
@@ -17,24 +17,24 @@
for rate = (third res)
for index = (fourth res)
do (loop for depth in depth-list
- do (push (make-x11-video-mode :width width
- :height height
- :depth depth
- :rate rate
- :index index)
+ do (push (make-video-mode :width width
+ :height height
+ :depth depth
+ :rate rate
+ :index index)
modes)))))
modes))
-(defmethod set-video-mode ((mode x11-video-mode))
+(defmethod set-video-mode ((mode video-mode))
(glop-xlib::with-current-display dpy
- (glop-xlib::set-mode dpy 0 (x11-video-mode-index mode)
- (x11-video-mode-rate mode))))
+ (glop-xlib::set-mode dpy 0 (video-mode-index mode)
+ (video-mode-rate mode))))
(defmethod current-video-mode ()
(glop-xlib::with-current-display dpy
(multiple-value-bind (width height depth rate index)
(glop-xlib::current-mode dpy 0)
- (make-x11-video-mode :width width :height height :depth depth
+ (make-video-mode :width width :height height :depth depth
:rate rate :index index))))
(defstruct glx-context
Please sign in to comment.
Something went wrong with that request. Please try again.