1set_display_switch_mode(3)      Allegro manual      set_display_switch_mode(3)
2
3
4

NAME

6       set_display_switch_mode  -  Tells Allegro how the program handles back‐
7       ground switching.
8

SYNOPSIS

10       #include <allegro.h>
11
12
13       int set_display_switch_mode(int mode);
14

DESCRIPTION

16       Sets how the program should handle being switched into the  background,
17       if  the  user  tabs away from it. Not all of the possible modes will be
18       supported by every graphics driver on  every  platform.  The  available
19       modes are:
20
21       SWITCH_NONE
22
23       Disables  switching. This is the default in single-tasking systems like
24       DOS. It may be supported on other platforms, but you should use it with
25       caution,  because  your users won't be impressed if they want to switch
26       away from your program, but you don't let them!
27
28       SWITCH_PAUSE
29
30       Pauses the program whenever it is in the background. Execution will  be
31       resumed as soon as the user switches back to it. This is the default in
32       most fullscreen multitasking environments, for example the  Linux  con‐
33       sole, but not under Windows.
34
35       SWITCH_AMNESIA
36
37       Like  SWITCH_PAUSE,  but  this mode doesn't bother to remember the con‐
38       tents of video memory, so the screen, and any video  bitmaps  that  you
39       have created, will be erased after the user switches away and then back
40       to your program. This is not a terribly useful mode to have, but it  is
41       the default for the fullscreen drivers under Windows because DirectDraw
42       is too dumb to implement anything better.
43
44       SWITCH_BACKGROUND
45
46       The program will carry on running in the background,  with  the  screen
47       bitmap  temporarily being pointed at a memory buffer for the fullscreen
48       drivers. You must take special care when using this mode,  because  bad
49       things  will  happen if the screen bitmap gets changed around when your
50       program isn't expecting it (see below).
51
52       SWITCH_BACKAMNESIA
53
54       Like SWITCH_BACKGROUND, but this mode doesn't bother  to  remember  the
55       contents  of  video  memory  (see SWITCH_AMNESIA). It is again the only
56       mode supported by the fullscreen drivers under Windows  that  lets  the
57       program keep running in the background.
58
59       Note  that  you should be very careful when you are using graphics rou‐
60       tines in the switching context: you must always  call  acquire_screen()
61       before the start of any drawing code onto the screen and not release it
62       until you are completely finished, because the automatic locking mecha‐
63       nism  may not be good enough to work when the program runs in the back‐
64       ground or has just been raised in the foreground.
65

RETURN VALUE

67       Returns zero on success, invalidating at the same  time  all  callbacks
68       previously registered with set_display_switch_callback(). Returns -1 if
69       the requested mode is not currently possible.
70
71

SEE ALSO

73       set_display_switch_callback(3), get_display_switch_mode(3),  exmidi(3),
74       exswitch(3)
75
76
77
78Allegro                          version 4.2.3      set_display_switch_mode(3)
Impressum