Klaus Demo nginx / 8017a63
ngx_process_tray() Igor Sysoev 13 years ago
1 changed file(s) with 44 addition(s) and 38 deletion(s). Raw diff Collapse all Expand all
1010
1111
1212 static ngx_thread_value_t __stdcall ngx_worker_thread_cycle(void *data);
13 static void ngx_process_tray(ngx_cycle_t *cycle);
1314 static long __stdcall ngx_window_procedure(HWND window, u_int message,
1415 u_int wparam, long lparam);
1516
5657 void
5758 ngx_single_process_cycle(ngx_cycle_t *cycle)
5859 {
59 int rc;
6060 ngx_int_t i;
6161 ngx_err_t err;
6262 ngx_tid_t tid;
63 MSG message;
64 HWND window;
65 HMENU menu;
66 HICON icon,tray;
67 WNDCLASS wc;
68 HINSTANCE instance;
6963 ngx_core_conf_t *ccf;
7064
7165 ngx_init_temp_number();
7973 }
8074 }
8175
82
8376 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
8477
85 if (ngx_init_threads(ngx_threads_n,
86 ccf->thread_stack_size, cycle) == NGX_ERROR)
78 if (ngx_init_threads(ngx_threads_n, ccf->thread_stack_size, cycle)
79 != NGX_OK)
8780 {
8881 /* fatal */
8982 exit(2);
9790 exit(2);
9891 }
9992
93 if (ngx_create_thread(&tid, ngx_worker_thread_cycle, NULL, cycle->log)
94 != 0)
95 {
96 /* fatal */
97 exit(2);
98 }
99
100 ngx_process_tray(cycle);
101 }
102
103
104 static ngx_thread_value_t __stdcall
105 ngx_worker_thread_cycle(void *data)
106 {
107 ngx_cycle_t *cycle;
108
109 cycle = (ngx_cycle_t *) ngx_cycle;
110
111 while (!ngx_quit) {
112 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "worker cycle");
113
114 ngx_process_events_and_timers(cycle);
115 }
116
117 return 0;
118 }
119
120
121 static void
122 ngx_process_tray(ngx_cycle_t *cycle)
123 {
124 int rc;
125 MSG message;
126 HWND window;
127 HMENU menu;
128 HICON icon, tray;
129 WNDCLASS wc;
130 HINSTANCE instance;
100131
101132 instance = GetModuleHandle(NULL);
102133
151182 exit(2);
152183 }
153184
154
155185 window = CreateWindow("nginx", "nginx", WS_OVERLAPPEDWINDOW,
156186 CW_USEDEFAULT, CW_USEDEFAULT,
157187 CW_USEDEFAULT, CW_USEDEFAULT,
174204 exit(2);
175205 }
176206
177
178 if (ngx_create_thread(&tid, ngx_worker_thread_cycle, NULL, cycle->log) != 0)
179 {
180 /* fatal */
181 exit(2);
182 }
183
184
185207 for ( ;; ) {
186208 rc = GetMessage(&message, NULL, 0, 0);
187209
201223 }
202224
203225
204 static ngx_thread_value_t __stdcall
205 ngx_worker_thread_cycle(void *data)
206 {
207 ngx_cycle_t *cycle;
208
209 cycle = (ngx_cycle_t *) ngx_cycle;
210
211 while (!ngx_quit) {
212 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "worker cycle");
213
214 ngx_process_events_and_timers(cycle);
215 }
216
217 return 0;
218 }
219
220
221226 static long __stdcall
222227 ngx_window_procedure(HWND window, u_int message, u_int wparam, long lparam)
223228 {
240245 }
241246
242247 if (TrackPopupMenu(ngx_menu, TPM_RIGHTBUTTON,
243 mouse.x, mouse.y, 0, window, NULL) == 0)
248 mouse.x, mouse.y, 0, window, NULL)
249 == 0)
244250 {
245251 ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, ngx_errno,
246252 "TrackPopupMenu() failed");
253259 case WM_COMMAND:
254260 if (wparam == NGX_WM_ABOUT) {
255261 ngx_message_box("nginx", MB_OK, 0,
256 NGINX_VER CRLF "(C) 2002-2005 Igor Sysoev");
262 NGINX_VER CRLF "(C) 2002-2009 Igor Sysoev");
257263 return 0;
258264 }
259265