[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: screensaver question



This total hack will only blank the main screen.

blank-screen blanks the screen and unblank-screen unblanks it.

Blaine.

--------------------------------------------------------------------
(require 'quickdraw)

;;; Blank the screen by drawing into the Window Manager Port with black.
(defun blank-screen ()
  (rlet ((old-port :pointer)
         (screen-port :pointer)
         (old-back-color :pointer))
    (#_GetPort old-port)
    (#_GetCWMgrPort screen-port)
    (#_SetPort (%get-ptr screen-port))
    (#_GetBackColor old-back-color)
    (#_RGBBackColor *black-rgb*)
    (ccl::with-rectangle-arg (r 0 0 *screen-width* *screen-height*)
      (#_ClipRect r)
      (#_EraseRect r))
    (#_RGBBackColor old-back-color)
    (#_SetPort (%get-ptr old-port))))


;;; TOTAL HACK STARTS HERE.
;;; Keep a big black window around and fool the OS into redrawing
;;; the screen by momentarily obscuring everything.
;;;
(defvar *cover-window* (make-instance 'window 
                         :window-show nil
                         :view-size (make-point *screen-width*
                                                *screen-height*)
                         :view-position (make-point 0 0)))
(set-back-color *cover-window* *black-color*)

(defun unblank-screen ()
  (window-select *cover-window*)
  (window-hide *cover-window*)
  (#_drawmenubar))