[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
> So I'm leaning towards the proposition to disable the screensaver in
> fullscreen mode and not to disable it in windowed mode.
The patch is attached. It implements this policy by default (on Windows only
for the time being, I haven't yet investigated on other OSes) but also makes
it possible to always or never disable.
Applied to mainline and branch.
--
Eric Botcazou
Index: allegro.cfg
===================================================================
RCS file: /cvsroot/alleg/allegro/allegro.cfg,v
retrieving revision 1.49
diff -u -p -r1.49 allegro.cfg
--- allegro.cfg 22 Oct 2003 13:49:20 -0000 1.49
+++ allegro.cfg 9 Jan 2004 05:30:44 -0000
@@ -74,6 +74,11 @@ language =
+# whether to disable the screensaver (0:never 1:fullscreen 2:always, default 1)
+disable_screensaver =
+
+
+
# how long to take for menus to auto-open (time in msecs or -1 to disable)
menu_opening_delay =
Index: docs/src/allegro._tx
===================================================================
RCS file: /cvsroot/alleg/allegro/docs/src/allegro._tx,v
retrieving revision 1.203
diff -u -p -r1.203 allegro._tx
--- docs/src/allegro._tx 18 Dec 2003 11:31:00 -0000 1.203
+++ docs/src/allegro._tx 9 Jan 2004 05:31:42 -0000
@@ -1784,6 +1784,10 @@ language = x<br>
in the location pointed to by the ALLEGRO environment variable. Look in the
`language.dat' file to see which mappings are currently available.
<li>
+disable_screensaver = x<br>
+ Specifies whether to disable the screensaver: 0 to never disable it, 1 to
+ disable it in fullscreen mode only and 2 to always disable it. Default is 1.
+<li>
menu_opening_delay = x<br>
Sets how long the menus take to auto-open. The time is given in
milliseconds (default is `300'). Specifying `-1' will disable the
Index: include/allegro/internal/aintern.h
===================================================================
RCS file: /cvsroot/alleg/allegro/include/allegro/internal/aintern.h,v
retrieving revision 1.16
diff -u -p -r1.16 aintern.h
--- include/allegro/internal/aintern.h 17 Sep 2003 13:12:25 -0000 1.16
+++ include/allegro/internal/aintern.h 9 Jan 2004 05:31:43 -0000
@@ -36,6 +36,16 @@
AL_VAR(int, _allegro_count);
+/* flag to decide whether to disable the screensaver */
+enum {
+ NEVER_DISABLED,
+ FULLSCREEN_DISABLED,
+ ALWAYS_DISABLED
+};
+
+AL_VAR(int, _screensaver_policy);
+
+
/* some Allegro functions need a block of scratch memory */
AL_VAR(void *, _scratch_mem);
AL_VAR(int, _scratch_mem_size);
Index: src/allegro.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/allegro.c,v
retrieving revision 1.43
diff -u -p -r1.43 allegro.c
--- src/allegro.c 12 Aug 2003 17:49:23 -0000 1.43
+++ src/allegro.c 9 Jan 2004 05:31:48 -0000
@@ -45,6 +45,10 @@ int *allegro_errno = NULL;
int _allegro_count = 0;
+/* flag to decide whether to disable the screensaver */
+int _screensaver_policy = FULLSCREEN_DISABLED;
+
+
/* the graphics driver currently in use */
GFX_DRIVER *gfx_driver = NULL;
@@ -52,9 +56,11 @@ GFX_DRIVER *gfx_driver = NULL;
/* abilities of the current graphics driver */
int gfx_capabilities = 0;
+
/* pointer to list of valid video modes */
GFX_MODE_LIST *gfx_mode_list = NULL;
+
/* a bitmap structure for accessing the physical screen */
BITMAP *screen = NULL;
@@ -349,6 +355,11 @@ int install_allegro(int system_id, int *
/* detect CPU type */
check_cpu();
+
+ /* set up screensaver policy */
+ _screensaver_policy = get_config_int(uconvert_ascii("system", tmp1),
+ uconvert_ascii("disable_screensaver", tmp2),
+ FULLSCREEN_DISABLED);
/* install shutdown handler */
if (_allegro_count == 0) {
Index: src/win/wwnd.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/win/wwnd.c,v
retrieving revision 1.76
diff -u -p -r1.76 wwnd.c
--- src/win/wwnd.c 27 Oct 2003 16:33:43 -0000 1.76
+++ src/win/wwnd.c 9 Jan 2004 05:31:51 -0000
@@ -303,6 +303,15 @@ static LRESULT CALLBACK directx_wnd_proc
return 0;
break;
+ case WM_SYSCOMMAND:
+ if (wparam == SC_MONITORPOWER || wparam == SC_SCREENSAVE) {
+ if (_screensaver_policy == ALWAYS_DISABLED
+ || (_screensaver_policy == FULLSCREEN_DISABLED
+ && gfx_driver && !gfx_driver->windowed))
+ return 0;
+ }
+ break;
+
case WM_INITMENUPOPUP:
wnd_sysmenu = TRUE;
mouse_set_sysmenu(TRUE);