1 | /* |
---|
2 | * (c) Copyright 1989, 1990, 1991, 1992 OPEN SOFTWARE FOUNDATION, INC. |
---|
3 | * ALL RIGHTS RESERVED |
---|
4 | */ |
---|
5 | /* |
---|
6 | * Motif Release 1.2 |
---|
7 | */ |
---|
8 | #ifdef REV_INFO |
---|
9 | #ifndef lint |
---|
10 | static char rcsid[] = "$RCSfile: WmSignal.c,v $ $Revision: 1.1.1.1 $ $Date: 1997-03-25 09:12:26 $" |
---|
11 | #endif |
---|
12 | #endif |
---|
13 | /* |
---|
14 | * (c) Copyright 1987, 1988, 1989, 1990 HEWLETT-PACKARD COMPANY */ |
---|
15 | |
---|
16 | /* |
---|
17 | * Included Files: |
---|
18 | */ |
---|
19 | |
---|
20 | #include <signal.h> |
---|
21 | #include "WmGlobal.h" |
---|
22 | |
---|
23 | /* |
---|
24 | * include extern functions |
---|
25 | */ |
---|
26 | |
---|
27 | #include "WmFeedback.h" |
---|
28 | #include "WmFunction.h" |
---|
29 | |
---|
30 | |
---|
31 | /* |
---|
32 | * Function Declarations: |
---|
33 | */ |
---|
34 | |
---|
35 | #ifdef _NO_PROTO |
---|
36 | void SetupWmSignalHandlers (); |
---|
37 | void QuitWmSignalHandler (); |
---|
38 | #else /* _NO_PROTO */ |
---|
39 | void SetupWmSignalHandlers (int); |
---|
40 | void QuitWmSignalHandler (int); |
---|
41 | #endif /* _NO_PROTO */ |
---|
42 | |
---|
43 | |
---|
44 | |
---|
45 | |
---|
46 | /* |
---|
47 | * Global Variables: |
---|
48 | */ |
---|
49 | |
---|
50 | |
---|
51 | |
---|
52 | /*************************************<->************************************* |
---|
53 | * |
---|
54 | * SetupWmSignalHandlers () |
---|
55 | * |
---|
56 | * |
---|
57 | * Description: |
---|
58 | * ----------- |
---|
59 | * This function sets up the signal handlers for the window manager. |
---|
60 | * |
---|
61 | *************************************<->***********************************/ |
---|
62 | |
---|
63 | #ifdef _NO_PROTO |
---|
64 | void SetupWmSignalHandlers (dummy) |
---|
65 | int dummy; |
---|
66 | #else /* _NO_PROTO */ |
---|
67 | void SetupWmSignalHandlers (int dummy) |
---|
68 | #endif /* _NO_PROTO */ |
---|
69 | { |
---|
70 | void (*signalHandler) (); |
---|
71 | |
---|
72 | |
---|
73 | signalHandler = (void (*)())signal (SIGINT, SIG_IGN); |
---|
74 | if (signalHandler != (void (*)())SIG_IGN) |
---|
75 | { |
---|
76 | signal (SIGINT, QuitWmSignalHandler); |
---|
77 | } |
---|
78 | |
---|
79 | signalHandler = (void (*)())signal (SIGHUP, SIG_IGN); |
---|
80 | if (signalHandler != (void (*)())SIG_IGN) |
---|
81 | { |
---|
82 | signal (SIGHUP, QuitWmSignalHandler); |
---|
83 | } |
---|
84 | |
---|
85 | signal (SIGQUIT, QuitWmSignalHandler); |
---|
86 | |
---|
87 | signal (SIGTERM, QuitWmSignalHandler); |
---|
88 | |
---|
89 | |
---|
90 | } /* END OF FUNCTION SetupWmSignalHandlers */ |
---|
91 | |
---|
92 | |
---|
93 | |
---|
94 | /*************************************<->************************************* |
---|
95 | * |
---|
96 | * QuitWmSignalHandler () |
---|
97 | * |
---|
98 | * |
---|
99 | * Description: |
---|
100 | * ----------- |
---|
101 | * This function is called on receipt of a signal that is to terminate the |
---|
102 | * window manager. |
---|
103 | * |
---|
104 | *************************************<->***********************************/ |
---|
105 | |
---|
106 | #ifdef _NO_PROTO |
---|
107 | void QuitWmSignalHandler (dummy) |
---|
108 | int dummy; |
---|
109 | #else /* _NO_PROTO */ |
---|
110 | void QuitWmSignalHandler (int dummy) |
---|
111 | #endif /* _NO_PROTO */ |
---|
112 | { |
---|
113 | if (wmGD.showFeedback & WM_SHOW_FB_KILL) |
---|
114 | { |
---|
115 | ConfirmAction (ACTIVE_PSD, QUIT_MWM_ACTION); |
---|
116 | XFlush(DISPLAY); |
---|
117 | SetupWmSignalHandlers(0); /* dummy paramater */ |
---|
118 | } |
---|
119 | else |
---|
120 | { |
---|
121 | Do_Quit_Mwm(False); |
---|
122 | } |
---|
123 | |
---|
124 | } /* END OF FUNCTION QuitWmSignalHandler */ |
---|