1 | /* |
---|
2 | * (c) Copyright 1989, 1990, 1991, 1992 OPEN SOFTWARE FOUNDATION, INC. |
---|
3 | * ALL RIGHTS RESERVED |
---|
4 | */ |
---|
5 | /* |
---|
6 | * Motif Release 1.2.1 |
---|
7 | */ |
---|
8 | #ifdef REV_INFO |
---|
9 | #ifndef lint |
---|
10 | static char rcsid[] = "$RCSfile: WmMain.c,v $ $Revision: 1.1.1.1 $ $Date: 1997-03-25 09:12:21 $" |
---|
11 | #endif |
---|
12 | #endif |
---|
13 | /* |
---|
14 | * (c) Copyright 1987, 1988, 1989, 1990 HEWLETT-PACKARD COMPANY */ |
---|
15 | |
---|
16 | /* |
---|
17 | * Included Files: |
---|
18 | */ |
---|
19 | |
---|
20 | #include "WmGlobal.h" |
---|
21 | |
---|
22 | /* |
---|
23 | * include extern functions |
---|
24 | */ |
---|
25 | |
---|
26 | #include "WmCEvent.h" |
---|
27 | #include "WmEvent.h" |
---|
28 | #include "WmInitWs.h" |
---|
29 | |
---|
30 | |
---|
31 | /* |
---|
32 | * Function Declarations: |
---|
33 | */ |
---|
34 | |
---|
35 | |
---|
36 | #define ManagedRoot(w) (!XFindContext (DISPLAY, (w), wmGD.screenContextType, \ |
---|
37 | (caddr_t *)&pSD) ? (SetActiveScreen (pSD), True) : False) |
---|
38 | |
---|
39 | WmScreenData *pSD; |
---|
40 | |
---|
41 | /* |
---|
42 | * Global Variables: |
---|
43 | */ |
---|
44 | |
---|
45 | WmGlobalData wmGD; |
---|
46 | |
---|
47 | |
---|
48 | |
---|
49 | /*************************************<->************************************* |
---|
50 | * |
---|
51 | * main (argc, argv, environ) |
---|
52 | * |
---|
53 | * |
---|
54 | * Description: |
---|
55 | * ----------- |
---|
56 | * This is the main window manager function. It calls window manager |
---|
57 | * initializtion functions and has the main event processing loop. |
---|
58 | * |
---|
59 | * |
---|
60 | * Inputs: |
---|
61 | * ------ |
---|
62 | * argc = number of command line arguments (+1) |
---|
63 | * |
---|
64 | * argv = window manager command line arguments |
---|
65 | * |
---|
66 | * environ = window manager environment |
---|
67 | * |
---|
68 | *************************************<->***********************************/ |
---|
69 | |
---|
70 | #ifdef _NO_PROTO |
---|
71 | int |
---|
72 | main (argc, argv, environ) |
---|
73 | int argc; |
---|
74 | char *argv[]; |
---|
75 | char *environ[]; |
---|
76 | |
---|
77 | #else /* _NO_PROTO */ |
---|
78 | int |
---|
79 | main (int argc, char *argv [], char *environ []) |
---|
80 | #endif /* _NO_PROTO */ |
---|
81 | { |
---|
82 | XEvent event; |
---|
83 | Boolean dispatchEvent; |
---|
84 | |
---|
85 | #ifndef NO_MULTIBYTE |
---|
86 | XtSetLanguageProc (NULL, (XtLanguageProc)NULL, NULL); |
---|
87 | #endif |
---|
88 | |
---|
89 | /* |
---|
90 | * Initialize the workspace: |
---|
91 | */ |
---|
92 | |
---|
93 | InitWmGlobal (argc, argv, environ); |
---|
94 | |
---|
95 | /* |
---|
96 | * MAIN EVENT HANDLING LOOP: |
---|
97 | */ |
---|
98 | |
---|
99 | for (;;) |
---|
100 | { |
---|
101 | XtAppNextEvent (wmGD.mwmAppContext, &event); |
---|
102 | |
---|
103 | |
---|
104 | /* |
---|
105 | * Check for, and process non-widget events. The events may be |
---|
106 | * reported to the root window, to some client frame window, |
---|
107 | * to an icon window, or to a "special" window management window. |
---|
108 | * The lock modifier is "filtered" out for window manager processing. |
---|
109 | */ |
---|
110 | |
---|
111 | wmGD.attributesWindow = 0L; |
---|
112 | |
---|
113 | if ((event.type == ButtonPress) || (event.type == ButtonRelease) || |
---|
114 | (event.type == KeyPress) || (event.type == KeyRelease)) |
---|
115 | { |
---|
116 | wmGD.currentEventState = event.xbutton.state; |
---|
117 | if (wmGD.ignoreLockMod) |
---|
118 | { |
---|
119 | event.xbutton.state &= ~(LockMask); |
---|
120 | } |
---|
121 | } |
---|
122 | |
---|
123 | dispatchEvent = True; |
---|
124 | if (wmGD.menuActive) |
---|
125 | { |
---|
126 | /* |
---|
127 | * Do special menu event preprocessing. |
---|
128 | */ |
---|
129 | |
---|
130 | if (wmGD.checkHotspot || wmGD.menuUnpostKeySpec || |
---|
131 | wmGD.menuActive->accelKeySpecs) |
---|
132 | { |
---|
133 | dispatchEvent = WmDispatchMenuEvent ((XButtonEvent *) &event); |
---|
134 | } |
---|
135 | } |
---|
136 | |
---|
137 | if (dispatchEvent) |
---|
138 | { |
---|
139 | if (ManagedRoot(event.xany.window)) |
---|
140 | { |
---|
141 | dispatchEvent = WmDispatchWsEvent (&event); |
---|
142 | } |
---|
143 | else |
---|
144 | { |
---|
145 | dispatchEvent = WmDispatchClientEvent (&event); |
---|
146 | } |
---|
147 | |
---|
148 | if (dispatchEvent) |
---|
149 | { |
---|
150 | /* |
---|
151 | * Dispatch widget related event: |
---|
152 | */ |
---|
153 | |
---|
154 | XtDispatchEvent (&event); |
---|
155 | } |
---|
156 | } |
---|
157 | } |
---|
158 | |
---|
159 | } /* END OF FUNCTION main */ |
---|
160 | |
---|