28 |
* |
* |
29 |
* 1) If at any time an error occurs the data |
* 1) If at any time an error occurs the data |
30 |
* pointer is left untouched and XM_FAILURE |
* pointer is left untouched and XM_FAILURE |
31 |
* is returned. |
* is returned. |
32 |
* |
* |
33 |
* 2) When a selection request is received (i.e., |
* 2) When a selection request is received (i.e., |
34 |
* when the specified mouse event occurs) the |
* when the specified mouse event occurs) the |
42 |
* will be left untouched and XM_NO_SELECT will |
* will be left untouched and XM_NO_SELECT will |
43 |
* be returned. |
* be returned. |
44 |
* |
* |
45 |
* 4) If the selection that was current at the time |
* 4) If the selection that was current at the time |
46 |
* a selection request is made is not an active |
* a selection request is made is not an active |
47 |
* selection the data pointer will be left |
* selection the data pointer will be left |
48 |
* untouched and XM_IA_SELECT will be returned. |
* untouched and XM_IA_SELECT will be returned. |
131 |
|
|
132 |
XMEventQue *feq = NULL; /* Foreign event queue. */ |
XMEventQue *feq = NULL; /* Foreign event queue. */ |
133 |
XMEventQue *feq_tmp; /* Foreign event queue temporary. */ |
XMEventQue *feq_tmp; /* Foreign event queue temporary. */ |
134 |
|
|
135 |
/* |
/* |
136 |
* If there are no panes in the menu then return failure |
* If there are no panes in the menu then return failure |
137 |
* because the menu is not initialized. |
* because the menu is not initialized. |
162 |
* Compute origin of menu so that cursor is in |
* Compute origin of menu so that cursor is in |
163 |
* Correct pane and selection. |
* Correct pane and selection. |
164 |
*/ |
*/ |
165 |
_XMTransToOrigin(display, |
_XMTransToOrigin(display, |
166 |
menu, |
menu, |
167 |
cur_p, cur_s, |
cur_p, cur_s, |
168 |
x_pos, y_pos, |
x_pos, y_pos, |
169 |
&orig_x, &orig_y); |
&orig_x, &orig_y); |
170 |
menu->x_pos = orig_x; /* Store X and Y coords of menu. */ |
menu->x_pos = orig_x; /* Store X and Y coords of menu. */ |
171 |
menu->y_pos = orig_y; |
menu->y_pos = orig_y; |
172 |
|
|
173 |
if (XMenuRecompute(display, menu) == XM_FAILURE) { |
if (XMenuRecompute(display, menu) == XM_FAILURE) { |
174 |
return(XM_FAILURE); |
return(XM_FAILURE); |
175 |
} |
} |
212 |
* not provided an event handler. |
* not provided an event handler. |
213 |
*/ |
*/ |
214 |
XSync(display, 0); |
XSync(display, 0); |
215 |
|
|
216 |
/* |
/* |
217 |
* Grab the mouse for menu input. |
* Grab the mouse for menu input. |
218 |
*/ |
*/ |
219 |
|
|
220 |
status = XGrabPointer( |
status = XGrabPointer( |
221 |
display, |
display, |
222 |
menu->parent, |
menu->parent, |
239 |
if (status != Success) |
if (status != Success) |
240 |
XUngrabPointer(display, CurrentTime); |
XUngrabPointer(display, CurrentTime); |
241 |
} |
} |
242 |
|
|
243 |
if (status == _X_FAILURE) { |
if (status == _X_FAILURE) { |
244 |
_XMErrorCode = XME_GRAB_MOUSE; |
_XMErrorCode = XME_GRAB_MOUSE; |
245 |
return(XM_FAILURE); |
return(XM_FAILURE); |
250 |
*/ |
*/ |
251 |
XMapWindow(display, cur_p->window); |
XMapWindow(display, cur_p->window); |
252 |
for (p_ptr = menu->p_list->next; |
for (p_ptr = menu->p_list->next; |
253 |
p_ptr != cur_p; |
p_ptr != cur_p; |
254 |
p_ptr = p_ptr->next) |
p_ptr = p_ptr->next) |
255 |
XMapWindow(display, p_ptr->window); |
XMapWindow(display, p_ptr->window); |
256 |
for (p_ptr = cur_p->next; |
for (p_ptr = cur_p->next; |
260 |
|
|
261 |
XRaiseWindow(display, cur_p->window); /* Make sure current */ |
XRaiseWindow(display, cur_p->window); /* Make sure current */ |
262 |
/* pane is on top. */ |
/* pane is on top. */ |
263 |
|
|
264 |
cur_s = NULL; /* Clear current selection. */ |
cur_s = NULL; /* Clear current selection. */ |
265 |
|
|
266 |
/* |
/* |
271 |
switch (event.type) { /* Dispatch on the event type. */ |
switch (event.type) { /* Dispatch on the event type. */ |
272 |
case Expose: |
case Expose: |
273 |
event_xmp = (XMPane *)XLookUpAssoc(display, |
event_xmp = (XMPane *)XLookUpAssoc(display, |
274 |
menu->assoc_tab, |
menu->assoc_tab, |
275 |
event.xexpose.window); |
event.xexpose.window); |
276 |
if (event_xmp == NULL) { |
if (event_xmp == NULL) { |
277 |
/* |
/* |
292 |
} |
} |
293 |
if (event_xmp->activated) { |
if (event_xmp->activated) { |
294 |
XSetWindowBackground(display, |
XSetWindowBackground(display, |
295 |
event_xmp->window, |
event_xmp->window, |
296 |
menu->bkgnd_color); |
menu->bkgnd_color); |
297 |
} |
} |
298 |
else { |
else { |
303 |
_XMRefreshPane(display, menu, event_xmp); |
_XMRefreshPane(display, menu, event_xmp); |
304 |
break; |
break; |
305 |
case EnterNotify: |
case EnterNotify: |
306 |
/* |
/* |
307 |
* First wait a small period of time, and see |
* First wait a small period of time, and see |
308 |
* if another EnterNotify event follows hard on the |
* if another EnterNotify event follows hard on the |
309 |
* heels of this one. i.e., the user is simply |
* heels of this one. i.e., the user is simply |
310 |
* "passing through". If so, ignore this one. |
* "passing through". If so, ignore this one. |
311 |
*/ |
*/ |
312 |
|
|
313 |
event_xmw = (XMWindow *)XLookUpAssoc(display, |
event_xmw = (XMWindow *)XLookUpAssoc(display, |
314 |
menu->assoc_tab, |
menu->assoc_tab, |
315 |
event.xcrossing.window); |
event.xcrossing.window); |
324 |
if(peek_event.type == LeaveNotify) { |
if(peek_event.type == LeaveNotify) { |
325 |
break; |
break; |
326 |
} |
} |
327 |
} |
} |
328 |
cur_s = (XMSelect *)event_xmw; |
cur_s = (XMSelect *)event_xmw; |
329 |
help_callback (cur_s->help_string, |
help_callback (cur_s->help_string, |
330 |
cur_p->serial, cur_s->serial); |
cur_p->serial, cur_s->serial); |
331 |
|
|
332 |
/* |
/* |
333 |
* If the pane we are in is active and the |
* If the pane we are in is active and the |
334 |
* selection entered is active then activate |
* selection entered is active then activate |
385 |
* take it from here. -- caveh@eng.sun.com. |
* take it from here. -- caveh@eng.sun.com. |
386 |
*/ |
*/ |
387 |
XSetWindowBackground(display, |
XSetWindowBackground(display, |
388 |
event_xmp->window, |
event_xmp->window, |
389 |
menu->bkgnd_color); |
menu->bkgnd_color); |
390 |
_XMRefreshPane(display, menu, event_xmp); |
_XMRefreshPane(display, menu, event_xmp); |
391 |
#endif |
#endif |
400 |
); |
); |
401 |
if (event_xmw == NULL) break; |
if (event_xmw == NULL) break; |
402 |
if(cur_s == NULL) break; |
if(cur_s == NULL) break; |
403 |
|
|
404 |
/* |
/* |
405 |
* If the current selection was activated then |
* If the current selection was activated then |
406 |
* deactivate it. |
* deactivate it. |
411 |
} |
} |
412 |
cur_s = NULL; |
cur_s = NULL; |
413 |
break; |
break; |
414 |
|
|
415 |
case ButtonPress: |
case ButtonPress: |
416 |
case ButtonRelease: |
case ButtonRelease: |
417 |
*p_num = cur_p->serial; |
*p_num = cur_p->serial; |
471 |
*/ |
*/ |
472 |
for ( p_ptr = menu->p_list->next; |
for ( p_ptr = menu->p_list->next; |
473 |
p_ptr != menu->p_list; |
p_ptr != menu->p_list; |
474 |
p_ptr = p_ptr->next) |
p_ptr = p_ptr->next) |
475 |
{ |
{ |
476 |
XUnmapWindow(display, p_ptr->window); |
XUnmapWindow(display, p_ptr->window); |
477 |
} |
} |
482 |
XUngrabPointer(display, CurrentTime); |
XUngrabPointer(display, CurrentTime); |
483 |
XUngrabKeyboard(display, CurrentTime); |
XUngrabKeyboard(display, CurrentTime); |
484 |
|
|
485 |
/* |
/* |
486 |
* Restore bits under where the menu was if we managed |
* Restore bits under where the menu was if we managed |
487 |
* to save them and free the pixmap. |
* to save them and free the pixmap. |
488 |
*/ |
*/ |
502 |
* Synchronize the X buffers and the X event queue. |
* Synchronize the X buffers and the X event queue. |
503 |
*/ |
*/ |
504 |
XSync(display, 0); |
XSync(display, 0); |
505 |
|
|
506 |
/* |
/* |
507 |
* Dispatch any events remaining on the queue. |
* Dispatch any events remaining on the queue. |
508 |
*/ |
*/ |
557 |
feq = feq_tmp->next; |
feq = feq_tmp->next; |
558 |
free((char *)feq_tmp); |
free((char *)feq_tmp); |
559 |
} |
} |
560 |
|
|
561 |
/* |
/* |
562 |
* Return successfully. |
* Return successfully. |
563 |
*/ |
*/ |