Re: Screen Saver

From: Azedia of DOLFINA <dolfina_at_dolfina.org>
Date: Fri, 5 Jul 2002 14:44:13 -0700

BTW:

I have been comparing the Screensaver.f to a Delphi sample screensaver.pas.
There are the basic three elements of a
Windows API in both: Timer, Windows, and Winodows Messages but it seems that
the SF saver.f has several words
that correlate to the Windows Constants to end, close, destroy the Window. I
tried following the logic, but I am not
sure that the Screensaver.f is using the WindowsScreenSaverClass;
ScreenSaverProc, DefScreenSaverProc, and
ScreenSaverConfigurationDialog. Is the Screensaver.f using regular Window
and then checking for Mouse and key
movement?

{ --------------------------------------------------------------------
-------------------------------------------------------------------- }

: MOVED ( -- flag )
   THISPOS GetCursorPos DROP
   THISPOS 2@ INITPOS 2@ ( x y x y) ROT - ABS -ROT - ABS
   MAX NOTICABLE > ;

: SS-CREATE ( -- res )
   SAVERRATE ?DUP IF REG@ 1 MAX 10000 MIN ELSE 50 THEN RATE !
   INITPOS GetCursorPos DROP RATE @ /TIMER 0 DEFWINPROC ;

: SS-TIMER ( -- res )
   TICKS 1+ TO TICKS HWND DOSAVER 0 ;

: SS-END ( -- res )
   SCRMODE SMSAVER = IF
      HWND WM_CLOSE 0 0 PostMessage DROP
   THEN 0 DEFWINPROC ;

: SS-MOVED ( -- res )
   SCRMODE SMSAVER = IF
      MOVED IF
         HWND WM_CLOSE 0 0 PostMessage DROP
      THEN
   THEN 0 DEFWINPROC ;

: SS-DEACTIVATE ( -- res )
   SCRMODE SMSAVER =
   DEBUGGING 0= AND
   WPARAM LOWORD WA_INACTIVE = AND IF
      HWND WM_CLOSE 0 0 PostMessage DROP
   THEN 0 DEFWINPROC ;

: SS-SYSCOMMAND ( -- res )
   SCRMODE SMSAVER = IF
      WPARAM SC_SCREENSAVE = IF
         0 EXIT THEN
      WPARAM SC_CLOSE = DEBUGGING 0= AND IF
         0 EXIT THEN
   THEN
   0 DEFWINPROC ;

: SS-CLOSE ( -- res )
   SCRMODE SMSAVER = IF
      HWND DestroyWindow DROP 0 EXIT
   THEN 0 DEFWINPROC ;

: SS-DESTROY ( -- res )
   TIMER/ DEBUGGING ?EXIT
   0 PostQuitMessage DROP 0 DEFWINPROC ;

: SS-CURSOR ( -- res )
   SCRMODE SMSAVER = IF
      DEBUGGING 0= IF
         0 SetCursor DROP 0 EXIT
      THEN
   THEN
   0 IDC_ARROW LoadCursor SetCursor DROP
   0 DEFWINPROC ;

[SWITCH SAVER-MESSAGES DEFWINPROC ( msg -- res )
   WM_DESTROY RUNS SS-DESTROY
   WM_CLOSE RUNS SS-CLOSE
   WM_SETCURSOR RUNS SS-CURSOR
   WM_KEYDOWN RUNS SS-END
   WM_SYSKEYDOWN RUNS SS-END
   WM_LBUTTONDOWN RUNS SS-END
   WM_RBUTTONDOWN RUNS SS-END
   WM_MBUTTONDOWN RUNS SS-END
   WM_MOUSEMOVE RUNS SS-MOVED
   WM_SYSCOMMAND RUNS SS-SYSCOMMAND
   WM_CREATE RUNS SS-CREATE
   WM_ACTIVATE RUNS SS-DEACTIVATE
   WM_ACTIVATEAPP RUNS SS-DEACTIVATE
   WM_NCACTIVATE RUNS SS-DEACTIVATE
   USER_TIMER RUNS SS-TIMER
SWITCH]

:NONAME
   MSG LOWORD SAVER-MESSAGES ; 4 CB: SAVER-WNDPROC

{ --------------------------------------------------------------------
-------------------------------------------------------------------- }

Jodell

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.368 / Virus Database: 204 - Release Date: 5/29/2002
----------------------------------------------------------------------
sftalk_at_forth.com      The SwiftForth programming discussion email list
To unsubscribe,  send subject "unsubscribe sftalk" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/sftalk -- check them out!
Search the archives!    Visit http://www.forth.com/search for details.
Received on Fri Jul 05 2002 - 14:44:50 PDT

Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 09-Feb-2012. Archive updated nightly.