comparison oldXMenu/Activate.c @ 58167:9351060ba546

* XMenu.h (XMenuActivateSetWaitFunction): New function. * Activate.c (XMenuActivateSetWaitFunction): New function. (XMenuActivate): Call wait_func if set, before XNextEvent.
author Jan Djärv <jan.h.d@swipnet.se>
date Fri, 12 Nov 2004 08:28:57 +0000
parents e8824c4f5f7e
children 8aef5660523e 3ec251523b3e b637c617432f
comparison
equal deleted inserted replaced
58166:e0ba1fe44b88 58167:9351060ba546
82 #include <config.h> 82 #include <config.h>
83 #include "XMenuInt.h" 83 #include "XMenuInt.h"
84 84
85 /* For debug, set this to 0 to not grab the keyboard on menu popup */ 85 /* For debug, set this to 0 to not grab the keyboard on menu popup */
86 int x_menu_grab_keyboard = 1; 86 int x_menu_grab_keyboard = 1;
87
88 typedef void (*Wait_func)();
89
90 static Wait_func wait_func;
91 static void* wait_data;
92
93 void
94 XMenuActivateSetWaitFunction (func, data)
95 Wait_func func;
96 void *data;
97 {
98 wait_func = func;
99 wait_data = data;
100 }
87 101
88 int 102 int
89 XMenuActivate(display, menu, p_num, s_num, x_pos, y_pos, event_mask, data, 103 XMenuActivate(display, menu, p_num, s_num, x_pos, y_pos, event_mask, data,
90 help_callback) 104 help_callback)
91 register Display *display; /* Display to put menu on. */ 105 register Display *display; /* Display to put menu on. */
264 278
265 /* 279 /*
266 * Begin event processing loop. 280 * Begin event processing loop.
267 */ 281 */
268 while (1) { 282 while (1) {
283 if (wait_func) (*wait_func) (wait_data);
269 XNextEvent(display, &event); /* Get next event. */ 284 XNextEvent(display, &event); /* Get next event. */
270 switch (event.type) { /* Dispatch on the event type. */ 285 switch (event.type) { /* Dispatch on the event type. */
271 case Expose: 286 case Expose:
272 event_xmp = (XMPane *)XLookUpAssoc(display, 287 event_xmp = (XMPane *)XLookUpAssoc(display,
273 menu->assoc_tab, 288 menu->assoc_tab,
555 XPutBackEvent(display, &feq_tmp->event); 570 XPutBackEvent(display, &feq_tmp->event);
556 feq = feq_tmp->next; 571 feq = feq_tmp->next;
557 free((char *)feq_tmp); 572 free((char *)feq_tmp);
558 } 573 }
559 574
575 wait_func = 0;
576
560 /* 577 /*
561 * Return successfully. 578 * Return successfully.
562 */ 579 */
563 _XMErrorCode = XME_NO_ERROR; 580 _XMErrorCode = XME_NO_ERROR;
564 return(ret_val); 581 return(ret_val);