mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 04:20:46 +00:00
- Modified butterflies screensaver registry key
- Updated scrnsave library reference name - started removing MSVC resource stuff - renamed scrnsave to blankscr to avoid name conflicts with scrnsave library - modified scrnsave (aka blankscr) to use scrnsave library . simplified the code a lot! - various other small changes svn path=/trunk/; revision=30753
This commit is contained in:
parent
1a755132e9
commit
2750f99b97
15 changed files with 75 additions and 236 deletions
|
@ -14,7 +14,7 @@ HINSTANCE hInstance; // Holds The Instance Of The Application
|
||||||
|
|
||||||
GLuint texture[3]; //stores texture objects and display list
|
GLuint texture[3]; //stores texture objects and display list
|
||||||
|
|
||||||
LPCTSTR registryPath = ("Software\\tHaPuTeRProductions\\Lesson38Saver");
|
LPCTSTR registryPath = ("Software\\Microsoft\\ScreenSavers\\Butterflies");
|
||||||
BOOL dRotate;
|
BOOL dRotate;
|
||||||
|
|
||||||
|
|
||||||
|
@ -299,25 +299,25 @@ BOOL WINAPI ScreenSaverConfigureDialog(HWND hDlg, UINT message,
|
||||||
{
|
{
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
ReadRegistry();
|
ReadRegistry();
|
||||||
CheckDlgButton(hDlg, ROTATE, dRotate);
|
CheckDlgButton(hDlg, ROTATE, dRotate);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch (LOWORD(wParam))
|
switch (LOWORD(wParam))
|
||||||
{
|
{
|
||||||
case IDOK:
|
case IDOK:
|
||||||
dRotate = (IsDlgButtonChecked(hDlg, ROTATE) == BST_CHECKED);
|
dRotate = (IsDlgButtonChecked(hDlg, ROTATE) == BST_CHECKED);
|
||||||
WriteRegistry();
|
WriteRegistry();
|
||||||
EndDialog(hDlg, TRUE);
|
EndDialog(hDlg, TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
EndDialog(hDlg, TRUE);
|
EndDialog(hDlg, TRUE);
|
||||||
break;
|
break;
|
||||||
case IDABOUT:
|
case IDABOUT:
|
||||||
DialogBox(hInstance, MAKEINTRESOURCE(IDD_DLG_ABOUT), hDlg, (DLGPROC)AboutProc);
|
DialogBox(hInstance, MAKEINTRESOURCE(IDD_DLG_ABOUT), hDlg, (DLGPROC)AboutProc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
NAME LESSON38SAVER.SCR
|
NAME butterflies.SCR
|
||||||
|
|
||||||
DESCRIPTION 'Lesson38Saver screen saver'
|
DESCRIPTION 'OpenGL Butterflies screen saver'
|
||||||
|
|
||||||
HEAPSIZE 1024
|
HEAPSIZE 1024
|
||||||
STACKSIZE 4096
|
STACKSIZE 4096
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<module name="butterflies" type="win32scr" installbase="system32" installname="butterflies.scr" allowwarnings="true">
|
<module name="butterflies" type="win32scr" installbase="system32" installname="butterflies.scr" allowwarnings="true">
|
||||||
<importlibrary definition="butterflies.def" />
|
<importlibrary definition="butterflies.def" />
|
||||||
<include base="butterflies">.</include>
|
<include base="butterflies">.</include>
|
||||||
<library>scrnsavelib</library>
|
<library>scrnsave</library>
|
||||||
<library>kernel32</library>
|
<library>kernel32</library>
|
||||||
<library>user32</library>
|
<library>user32</library>
|
||||||
<library>gdi32</library>
|
<library>gdi32</library>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
<library>advapi32</library>
|
<library>advapi32</library>
|
||||||
<library>shell32</library>
|
<library>shell32</library>
|
||||||
|
|
||||||
<metadata description = "Butterflies screensaver" />
|
<metadata description = "OpenGL Butterflies screensaver" />
|
||||||
|
|
||||||
<file>butterflies.c</file>
|
<file>butterflies.c</file>
|
||||||
<file>butterflies.rc</file>
|
<file>butterflies.rc</file>
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
//{{NO_DEPENDENCIES}}
|
|
||||||
// Microsoft Developer Studio generated include file.
|
|
||||||
// Used by Lesson38Saver.rc
|
|
||||||
//
|
|
||||||
#define IDS_STR_DESCRIP 1
|
#define IDS_STR_DESCRIP 1
|
||||||
#define IDABOUT 3
|
#define IDABOUT 3
|
||||||
#define IDI_ICON_SCREEN 100
|
#define IDI_ICON_SCREEN 100
|
||||||
|
@ -14,14 +11,3 @@
|
||||||
#define WEBPAGE1 1001
|
#define WEBPAGE1 1001
|
||||||
#define WEBPAGE2 1002
|
#define WEBPAGE2 1002
|
||||||
#define IDD_DLG_SCREEN 2003
|
#define IDD_DLG_SCREEN 2003
|
||||||
|
|
||||||
// Next default values for new objects
|
|
||||||
//
|
|
||||||
#ifdef APSTUDIO_INVOKED
|
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 108
|
|
||||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1003
|
|
||||||
#define _APS_NEXT_SYMED_VALUE 106
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_DESCRIPTION "Ïîäðàçáðàí åêðàíåí ïðåäïàçèòåë"
|
IDS_DESCRIPTION "Blank"
|
||||||
IDS_TITLE "Çà"
|
IDS_TITLE "Çà"
|
||||||
IDS_TEXT "Íÿìà âúçìîæíîñò çà íàñòðîéêè."
|
IDS_TEXT "Íÿìà âúçìîæíîñò çà íàñòðîéêè."
|
||||||
END
|
END
|
||||||
|
|
|
@ -2,7 +2,7 @@ LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_DESCRIPTION "Standard Bildschirmschoner"
|
IDS_DESCRIPTION "Blank"
|
||||||
IDS_TITLE "Über"
|
IDS_TITLE "Über"
|
||||||
IDS_TEXT "Keinerlei Einstellungen notwendig."
|
IDS_TEXT "Keinerlei Einstellungen notwendig."
|
||||||
END
|
END
|
||||||
|
|
|
@ -2,7 +2,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_DESCRIPTION "Default ScreenSaver"
|
IDS_DESCRIPTION "Blank"
|
||||||
IDS_TITLE "About"
|
IDS_TITLE "About"
|
||||||
IDS_TEXT "No options need to be set."
|
IDS_TEXT "No options need to be set."
|
||||||
END
|
END
|
||||||
|
|
|
@ -2,7 +2,7 @@ LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_DESCRIPTION "Écran de veille par défaut"
|
IDS_DESCRIPTION "Blank"
|
||||||
IDS_TITLE "À propos de"
|
IDS_TITLE "À propos de"
|
||||||
IDS_TEXT "Il n'y a aucune option à définir."
|
IDS_TEXT "Il n'y a aucune option à définir."
|
||||||
END
|
END
|
||||||
|
|
|
@ -11,7 +11,7 @@ LANGUAGE LANG_LITHUANIAN, SUBLANG_DEFAULT
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_DESCRIPTION "Standartinë ekrano uþsklanda"
|
IDS_DESCRIPTION "Blank"
|
||||||
IDS_TITLE "Apie"
|
IDS_TITLE "Apie"
|
||||||
IDS_TEXT "Nëra keièiamø parametrø."
|
IDS_TEXT "Nëra keièiamø parametrø."
|
||||||
END
|
END
|
||||||
|
|
|
@ -2,7 +2,7 @@ LANGUAGE LANG_DUTCH, SUBLANG_NEUTRAL
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_DESCRIPTION "Standaard Schermbeveiliging"
|
IDS_DESCRIPTION "Blank"
|
||||||
IDS_TITLE "Informatie"
|
IDS_TITLE "Informatie"
|
||||||
IDS_TEXT "Geen dingen om in te stellen."
|
IDS_TEXT "Geen dingen om in te stellen."
|
||||||
END
|
END
|
||||||
|
|
|
@ -6,7 +6,7 @@ LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_DESCRIPTION "Predvolený šetriè obrazovky"
|
IDS_DESCRIPTION "Blank"
|
||||||
IDS_TITLE "Čo je ..."
|
IDS_TITLE "Čo je ..."
|
||||||
IDS_TEXT "Nie sú potrebné žiadne nastavenia."
|
IDS_TEXT "Nie sú potrebné žiadne nastavenia."
|
||||||
END
|
END
|
||||||
|
|
|
@ -10,7 +10,7 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_DESCRIPTION "Çàñòàâêà çà çàìîâ÷óâàííÿì"
|
IDS_DESCRIPTION "Blank"
|
||||||
IDS_TITLE "Про"
|
IDS_TITLE "Про"
|
||||||
IDS_TEXT "Ця заставка не має налаштовуваних параметрів."
|
IDS_TEXT "Ця заставка не має налаштовуваних параметрів."
|
||||||
END
|
END
|
||||||
|
|
|
@ -17,199 +17,42 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <tchar.h>
|
#include <scrnsave.h>
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
#define APPNAME _T("Scrnsave")
|
LRESULT WINAPI ScreenSaverProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
static HDC hdc;
|
||||||
|
static RECT rc;
|
||||||
|
|
||||||
|
switch(message)
|
||||||
HINSTANCE hInstance;
|
{
|
||||||
|
case WM_CREATE:
|
||||||
BOOL fullscreen = FALSE;
|
break;
|
||||||
|
case WM_DESTROY:
|
||||||
|
PostQuitMessage(0);
|
||||||
LRESULT WINAPI WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
break;
|
||||||
{
|
case WM_ERASEBKGND:
|
||||||
static POINT ptLast;
|
hdc = GetDC(hwnd);
|
||||||
static POINT ptCursor;
|
GetClientRect (hwnd, &rc);
|
||||||
static BOOL fFirstTime = TRUE;
|
FillRect (hdc, &rc, GetStockObject(BLACK_BRUSH));
|
||||||
|
ReleaseDC(hwnd,hdc);
|
||||||
switch (msg)
|
break;
|
||||||
{
|
case WM_PAINT:
|
||||||
case WM_DESTROY:
|
break;
|
||||||
ShowCursor(TRUE);
|
default:
|
||||||
PostQuitMessage(0);
|
return DefScreenSaverProc(hwnd, message, wParam, lParam);
|
||||||
break;
|
}
|
||||||
|
return 0;
|
||||||
// break out of screen-saver if any keyboard activity
|
|
||||||
case WM_NOTIFY:
|
|
||||||
case WM_SYSKEYDOWN:
|
|
||||||
PostMessage(hwnd, WM_CLOSE, 0, 0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// break out of screen-saver if any mouse activity
|
|
||||||
case WM_LBUTTONDOWN:
|
|
||||||
case WM_LBUTTONUP:
|
|
||||||
case WM_RBUTTONDOWN:
|
|
||||||
case WM_RBUTTONUP:
|
|
||||||
case WM_MBUTTONDOWN:
|
|
||||||
case WM_MBUTTONUP:
|
|
||||||
case WM_MOUSEMOVE:
|
|
||||||
// If we've got a parent then we must be a preview
|
|
||||||
if(GetParent(hwnd) != 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if(fFirstTime)
|
|
||||||
{
|
|
||||||
GetCursorPos(&ptLast);
|
|
||||||
fFirstTime = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
GetCursorPos(&ptCursor);
|
|
||||||
|
|
||||||
// if the mouse has moved more than 3 pixels then exit
|
|
||||||
if(abs(ptCursor.x - ptLast.x) >= 3 || abs(ptCursor.y - ptLast.y) >= 3)
|
|
||||||
PostMessage(hwnd, WM_CLOSE, 0, 0);
|
|
||||||
|
|
||||||
ptLast = ptCursor;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitSaver(HWND hwndParent)
|
BOOL WINAPI ScreenSaverConfigureDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
WNDCLASS wc;
|
return FALSE;
|
||||||
ZeroMemory(&wc, sizeof(wc));
|
|
||||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
|
||||||
wc.lpfnWndProc = WndProc;
|
|
||||||
wc.lpszClassName = APPNAME;
|
|
||||||
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
|
|
||||||
RegisterClass(&wc);
|
|
||||||
|
|
||||||
if (hwndParent != 0)
|
|
||||||
{
|
|
||||||
RECT rect;
|
|
||||||
GetClientRect(hwndParent, &rect);
|
|
||||||
CreateWindow(APPNAME, APPNAME,
|
|
||||||
WS_VISIBLE | WS_CHILD,
|
|
||||||
0, 0,
|
|
||||||
rect.right,
|
|
||||||
rect.bottom,
|
|
||||||
hwndParent, 0,
|
|
||||||
hInstance, NULL);
|
|
||||||
fullscreen = FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
HWND hwnd;
|
|
||||||
hwnd = CreateWindowEx(WS_EX_TOPMOST,
|
|
||||||
APPNAME,
|
|
||||||
APPNAME,
|
|
||||||
WS_VISIBLE | WS_POPUP,
|
|
||||||
0, 0,
|
|
||||||
GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
|
|
||||||
HWND_DESKTOP, 0,
|
|
||||||
hInstance, NULL);
|
|
||||||
|
|
||||||
SetWindowPos(hwnd,
|
|
||||||
0, 0, 0, 0, 0,
|
|
||||||
SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE|SWP_SHOWWINDOW);
|
|
||||||
|
|
||||||
ShowCursor(FALSE);
|
|
||||||
fullscreen = TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID ParseCommandLine(LPWSTR szCmdLine, UCHAR *chOption, HWND *hwndParent)
|
BOOL WINAPI RegisterDialogClasses(HANDLE hInst)
|
||||||
{
|
{
|
||||||
UCHAR ch = *szCmdLine++;
|
return TRUE;
|
||||||
|
|
||||||
if(ch == '-' || ch == '/')
|
|
||||||
ch = *szCmdLine++;
|
|
||||||
|
|
||||||
if(ch >= 'A' && ch <= 'Z')
|
|
||||||
ch += 'a' - 'A'; //convert to lower case
|
|
||||||
|
|
||||||
*chOption = ch;
|
|
||||||
ch = *szCmdLine++;
|
|
||||||
|
|
||||||
if(ch == ':')
|
|
||||||
ch = *szCmdLine++;
|
|
||||||
|
|
||||||
while(ch == ' ' || ch == '\t')
|
|
||||||
ch = *szCmdLine++;
|
|
||||||
|
|
||||||
if(isdigit(ch))
|
|
||||||
{
|
|
||||||
unsigned int i = _wtoi(szCmdLine - 1);
|
|
||||||
*hwndParent = (HWND)i;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*hwndParent = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Configure(void)
|
|
||||||
{
|
|
||||||
TCHAR szTitle[256];
|
|
||||||
TCHAR szText[256];
|
|
||||||
|
|
||||||
LoadString(hInstance,
|
|
||||||
IDS_TITLE,
|
|
||||||
szTitle,
|
|
||||||
256);
|
|
||||||
|
|
||||||
LoadString(hInstance,
|
|
||||||
IDS_TEXT,
|
|
||||||
szText,
|
|
||||||
256);
|
|
||||||
|
|
||||||
MessageBox(0,
|
|
||||||
szText,
|
|
||||||
szTitle,
|
|
||||||
MB_OK | MB_ICONWARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int CALLBACK wWinMain (HINSTANCE hInst,
|
|
||||||
HINSTANCE hPrev,
|
|
||||||
LPWSTR lpCmdLine,
|
|
||||||
int iCmdShow)
|
|
||||||
{
|
|
||||||
HWND hwndParent;
|
|
||||||
UINT nPreviousState;
|
|
||||||
UCHAR chOption;
|
|
||||||
MSG Message;
|
|
||||||
|
|
||||||
hInstance = hInst;
|
|
||||||
|
|
||||||
ParseCommandLine(lpCmdLine, &chOption, &hwndParent);
|
|
||||||
|
|
||||||
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, &nPreviousState, 0);
|
|
||||||
|
|
||||||
switch (chOption)
|
|
||||||
{
|
|
||||||
case 's':
|
|
||||||
InitSaver(0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'p':
|
|
||||||
InitSaver(hwndParent);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'c':
|
|
||||||
default:
|
|
||||||
Configure();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (GetMessage(&Message, 0, 0, 0))
|
|
||||||
DispatchMessage(&Message);
|
|
||||||
|
|
||||||
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, FALSE, &nPreviousState, 0);
|
|
||||||
|
|
||||||
return Message.wParam;
|
|
||||||
}
|
}
|
||||||
|
|
7
rosapps/applications/screensavers/scrnsave/scrnsave.def
Normal file
7
rosapps/applications/screensavers/scrnsave/scrnsave.def
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
NAME blankscr.SCR
|
||||||
|
|
||||||
|
DESCRIPTION 'Blank screen saver'
|
||||||
|
|
||||||
|
EXPORTS
|
||||||
|
ScreenSaverProc
|
||||||
|
ScreenSaverConfigureDialog
|
|
@ -1,12 +1,15 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
|
<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
|
||||||
<module name="scrnsave" type="win32scr" installbase="system32" installname="scrnsave.scr" unicode="true">
|
<module name="blankscr" type="win32scr" installbase="system32" installname="scrnsave.scr">
|
||||||
|
<importlibrary definition="scrnsave.def" />
|
||||||
|
<library>scrnsave</library>
|
||||||
<library>kernel32</library>
|
<library>kernel32</library>
|
||||||
<library>user32</library>
|
<library>user32</library>
|
||||||
<library>gdi32</library>
|
<library>gdi32</library>
|
||||||
<library>opengl32</library>
|
<library>opengl32</library>
|
||||||
<library>glu32</library>
|
<library>glu32</library>
|
||||||
<library>winmm</library>
|
<library>advapi32</library>
|
||||||
|
<library>shell32</library>
|
||||||
|
|
||||||
<file>scrnsave.c</file>
|
<file>scrnsave.c</file>
|
||||||
<file>scrnsave.rc</file>
|
<file>scrnsave.rc</file>
|
||||||
|
|
Loading…
Reference in a new issue