Mercurial > sdl-ios-xcode
comparison src/events/SDL_quit.c @ 1668:4da1ee79c9af SDL-1.3
more tweaking indent options
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 29 May 2006 04:04:35 +0000 |
parents | 782fd950bd46 |
children | eef792d31de8 |
comparison
equal
deleted
inserted
replaced
1667:1fddae038bc8 | 1668:4da1ee79c9af |
---|---|
31 #include "SDL_events_c.h" | 31 #include "SDL_events_c.h" |
32 | 32 |
33 | 33 |
34 #ifdef HAVE_SIGNAL_H | 34 #ifdef HAVE_SIGNAL_H |
35 static void | 35 static void |
36 SDL_HandleSIG (int sig) | 36 SDL_HandleSIG(int sig) |
37 { | 37 { |
38 /* Reset the signal handler */ | 38 /* Reset the signal handler */ |
39 signal (sig, SDL_HandleSIG); | 39 signal(sig, SDL_HandleSIG); |
40 | 40 |
41 /* Signal a quit interrupt */ | 41 /* Signal a quit interrupt */ |
42 SDL_PrivateQuit (); | 42 SDL_PrivateQuit(); |
43 } | 43 } |
44 #endif /* HAVE_SIGNAL_H */ | 44 #endif /* HAVE_SIGNAL_H */ |
45 | 45 |
46 /* Public functions */ | 46 /* Public functions */ |
47 int | 47 int |
48 SDL_QuitInit (void) | 48 SDL_QuitInit(void) |
49 { | 49 { |
50 #ifdef HAVE_SIGNAL_H | 50 #ifdef HAVE_SIGNAL_H |
51 void (*ohandler) (int); | 51 void (*ohandler) (int); |
52 | 52 |
53 /* Both SIGINT and SIGTERM are translated into quit interrupts */ | 53 /* Both SIGINT and SIGTERM are translated into quit interrupts */ |
54 ohandler = signal (SIGINT, SDL_HandleSIG); | 54 ohandler = signal(SIGINT, SDL_HandleSIG); |
55 if (ohandler != SIG_DFL) | 55 if (ohandler != SIG_DFL) |
56 signal (SIGINT, ohandler); | 56 signal(SIGINT, ohandler); |
57 ohandler = signal (SIGTERM, SDL_HandleSIG); | 57 ohandler = signal(SIGTERM, SDL_HandleSIG); |
58 if (ohandler != SIG_DFL) | 58 if (ohandler != SIG_DFL) |
59 signal (SIGTERM, ohandler); | 59 signal(SIGTERM, ohandler); |
60 #endif /* HAVE_SIGNAL_H */ | 60 #endif /* HAVE_SIGNAL_H */ |
61 | 61 |
62 /* That's it! */ | 62 /* That's it! */ |
63 return (0); | 63 return (0); |
64 } | 64 } |
65 | 65 |
66 void | 66 void |
67 SDL_QuitQuit (void) | 67 SDL_QuitQuit(void) |
68 { | 68 { |
69 #ifdef HAVE_SIGNAL_H | 69 #ifdef HAVE_SIGNAL_H |
70 void (*ohandler) (int); | 70 void (*ohandler) (int); |
71 | 71 |
72 ohandler = signal (SIGINT, SIG_DFL); | 72 ohandler = signal(SIGINT, SIG_DFL); |
73 if (ohandler != SDL_HandleSIG) | 73 if (ohandler != SDL_HandleSIG) |
74 signal (SIGINT, ohandler); | 74 signal(SIGINT, ohandler); |
75 ohandler = signal (SIGTERM, SIG_DFL); | 75 ohandler = signal(SIGTERM, SIG_DFL); |
76 if (ohandler != SDL_HandleSIG) | 76 if (ohandler != SDL_HandleSIG) |
77 signal (SIGTERM, ohandler); | 77 signal(SIGTERM, ohandler); |
78 #endif /* HAVE_SIGNAL_H */ | 78 #endif /* HAVE_SIGNAL_H */ |
79 } | 79 } |
80 | 80 |
81 /* This function returns 1 if it's okay to close the application window */ | 81 /* This function returns 1 if it's okay to close the application window */ |
82 int | 82 int |
83 SDL_PrivateQuit (void) | 83 SDL_PrivateQuit(void) |
84 { | 84 { |
85 int posted; | 85 int posted; |
86 | 86 |
87 posted = 0; | 87 posted = 0; |
88 if (SDL_ProcessEvents[SDL_QUIT] == SDL_ENABLE) { | 88 if (SDL_ProcessEvents[SDL_QUIT] == SDL_ENABLE) { |
89 SDL_Event event; | 89 SDL_Event event; |
90 event.type = SDL_QUIT; | 90 event.type = SDL_QUIT; |
91 if ((SDL_EventOK == NULL) || (*SDL_EventOK) (&event)) { | 91 if ((SDL_EventOK == NULL) || (*SDL_EventOK) (&event)) { |
92 posted = 1; | 92 posted = 1; |
93 SDL_PushEvent (&event); | 93 SDL_PushEvent(&event); |
94 } | 94 } |
95 } | 95 } |
96 return (posted); | 96 return (posted); |
97 } | 97 } |
98 | 98 |