comparison lwlib/lwlib-Xm.c @ 109173:33021b778d4d

Change function definition from K&R to prototype. Fix prototype warnings. * lwlib-Xaw.c (xaw_generic_callback, command_reset) (xaw_update_one_value): Reformat. (xaw_update_one_widget): Reformat and remove dead code. (xaw_scrollbar_scroll, xaw_scrollbar_jump, xaw_create_scrollbar) (xaw_update_scrollbar): Remove (not used). (make_dialog): Change from K&R to prototype. Remove dead code. (xaw_creation_table): Remove scrollbar entry. * lwlib-Xlw.c (x_print_complete_resource_name): Change from K&R to prototype. (xlw_update_one_value): Reformat. * lwlib-Xm.c (x_print_complete_resource_name) (make_destroyed_instance, free_destroyed_instance, first_child) (lw_motif_widget_p, resource_motif_string, destroy_all_children) (xm_arm_callback, xm_update_label, xm_update_list) (xm_update_pushbutton, xm_update_cascadebutton) (xm_update_toggle, xm_update_radiobox, make_menu_in_widget) (update_one_menu_entry, xm_update_menu, xm_update_text) (xm_update_text_field, xm_update_one_widget) (xm_update_one_value, activate_button, dialog_key_cb) (make_dialog, mark_dead_instance_destroyed) (find_matching_instance, recenter_widget, recycle_instance) (xm_create_dialog, make_menubar, remove_grabs, make_popup_menu) (make_main, xm_destroy_instance, xm_popup_menu) (set_min_dialog_size, xm_pop_instance, do_call) (xm_internal_update_other_instances, xm_generic_callback) (xm_nosel_callback, xm_pull_down_callback, xm_pop_down_callback) (xm_set_keyboard_focus, xm_set_main_areas, xm_manage_resizing): Change from K&R to prototype. * lwlib-int.h (widget_creation_function): Fix prototype. * lwlib.c (allocate_widget_info, lw_register_widget): Change from K&R to prototype. (lw_internal_update_other_instances, merge_widget_value): Reformat. * xlwmenu.c (size_menu_item): Change from K&R to prototype. Change label_width and height to int. (draw_arrow, draw_shadow_rectangle, draw_shadow_rhombus) (draw_separator, display_menu, fit_to_screen, motion_event_is_in_menu) (map_event_to_widget_value): Reformat. (display_menu_item): Change from K&R to prototype.
author Jan D <jan.h.d@swipnet.se>
date Thu, 08 Jul 2010 12:29:51 +0200
parents d8a16c4fa9b1
children 417b1e4d63cd
comparison
equal deleted inserted replaced
109172:834e32d50d35 109173:33021b778d4d
143 143
144 /* Print the complete X resource name of widget WIDGET to stderr. 144 /* Print the complete X resource name of widget WIDGET to stderr.
145 This is sometimes handy to have available. */ 145 This is sometimes handy to have available. */
146 146
147 void 147 void
148 x_print_complete_resource_name (widget) 148 x_print_complete_resource_name (Widget widget)
149 Widget widget;
150 { 149 {
151 int i; 150 int i;
152 String names[100]; 151 String names[100];
153 152
154 for (i = 0; i < 100 && widget != NULL; ++i) 153 for (i = 0; i < 100 && widget != NULL; ++i)
166 165
167 166
168 static destroyed_instance *all_destroyed_instances = NULL; 167 static destroyed_instance *all_destroyed_instances = NULL;
169 168
170 static destroyed_instance* 169 static destroyed_instance*
171 make_destroyed_instance (name, type, widget, parent, pop_up_p) 170 make_destroyed_instance (char* name,
172 char* name; 171 char* type,
173 char* type; 172 Widget widget,
174 Widget widget; 173 Widget parent,
175 Widget parent; 174 Boolean pop_up_p)
176 Boolean pop_up_p;
177 { 175 {
178 destroyed_instance* instance = 176 destroyed_instance* instance =
179 (destroyed_instance*)malloc (sizeof (destroyed_instance)); 177 (destroyed_instance*)malloc (sizeof (destroyed_instance));
180 instance->name = safe_strdup (name); 178 instance->name = safe_strdup (name);
181 instance->type = safe_strdup (type); 179 instance->type = safe_strdup (type);
185 instance->next = NULL; 183 instance->next = NULL;
186 return instance; 184 return instance;
187 } 185 }
188 186
189 static void 187 static void
190 free_destroyed_instance (instance) 188 free_destroyed_instance (destroyed_instance* instance)
191 destroyed_instance* instance;
192 { 189 {
193 free (instance->name); 190 free (instance->name);
194 free (instance->type); 191 free (instance->type);
195 free (instance); 192 free (instance);
196 } 193 }
197 194
198 /* motif utility functions */ 195 /* motif utility functions */
199 Widget 196 Widget
200 first_child (widget) 197 first_child (Widget widget)
201 Widget widget;
202 { 198 {
203 return ((CompositeWidget)widget)->composite.children [0]; 199 return ((CompositeWidget)widget)->composite.children [0];
204 } 200 }
205 201
206 Boolean 202 Boolean
207 lw_motif_widget_p (widget) 203 lw_motif_widget_p (Widget widget)
208 Widget widget;
209 { 204 {
210 return 205 return
211 XtClass (widget) == xmDialogShellWidgetClass 206 XtClass (widget) == xmDialogShellWidgetClass
212 || XmIsPrimitive (widget) || XmIsManager (widget) || XmIsGadget (widget); 207 || XmIsPrimitive (widget) || XmIsManager (widget) || XmIsGadget (widget);
213 } 208 }
214 209
215 static XmString 210 static XmString
216 resource_motif_string (widget, name) 211 resource_motif_string (Widget widget,
217 Widget widget; 212 char* name)
218 char* name;
219 { 213 {
220 XtResource resource; 214 XtResource resource;
221 XmString result = 0; 215 XmString result = 0;
222 216
223 resource.resource_name = name; 217 resource.resource_name = name;
235 229
236 /* Destroy all of the children of WIDGET 230 /* Destroy all of the children of WIDGET
237 starting with number FIRST_CHILD_TO_DESTROY. */ 231 starting with number FIRST_CHILD_TO_DESTROY. */
238 232
239 static void 233 static void
240 destroy_all_children (widget, first_child_to_destroy) 234 destroy_all_children (Widget widget,
241 Widget widget; 235 int first_child_to_destroy)
242 int first_child_to_destroy;
243 { 236 {
244 Widget* children; 237 Widget* children;
245 unsigned int number; 238 unsigned int number;
246 int i; 239 int i;
247 240
283 corresponding to widget W. CALL_DATA contains a 276 corresponding to widget W. CALL_DATA contains a
284 XmPushButtonCallbackStruct containing the reason why the callback 277 XmPushButtonCallbackStruct containing the reason why the callback
285 is called. */ 278 is called. */
286 279
287 static void 280 static void
288 xm_arm_callback (w, client_data, call_data) 281 xm_arm_callback (Widget w, XtPointer client_data, XtPointer call_data)
289 Widget w;
290 XtPointer client_data, call_data;
291 { 282 {
292 XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct *) call_data; 283 XmPushButtonCallbackStruct *cbs = (XmPushButtonCallbackStruct *) call_data;
293 widget_value *wv = (widget_value *) client_data; 284 widget_value *wv = (widget_value *) client_data;
294 widget_instance *instance; 285 widget_instance *instance;
295 286
337 328
338 VAL->name is again set to the resource name, but VAL->value is 329 VAL->name is again set to the resource name, but VAL->value is
339 not null, and contains the label string to display. */ 330 not null, and contains the label string to display. */
340 331
341 static void 332 static void
342 xm_update_label (instance, widget, val) 333 xm_update_label (widget_instance* instance,
343 widget_instance* instance; 334 Widget widget,
344 Widget widget; 335 widget_value* val)
345 widget_value* val;
346 { 336 {
347 XmString res_string = 0; 337 XmString res_string = 0;
348 XmString built_string = 0; 338 XmString built_string = 0;
349 XmString key_string = 0; 339 XmString key_string = 0;
350 Arg al [256]; 340 Arg al [256];
388 XmStringFree (key_string); 378 XmStringFree (key_string);
389 } 379 }
390 380
391 /* update of list */ 381 /* update of list */
392 static void 382 static void
393 xm_update_list (instance, widget, val) 383 xm_update_list (widget_instance* instance,
394 widget_instance* instance; 384 Widget widget,
395 Widget widget; 385 widget_value* val)
396 widget_value* val;
397 { 386 {
398 widget_value* cur; 387 widget_value* cur;
399 int i; 388 int i;
400 XtRemoveAllCallbacks (widget, XmNsingleSelectionCallback); 389 XtRemoveAllCallbacks (widget, XmNsingleSelectionCallback);
401 XtAddCallback (widget, XmNsingleSelectionCallback, xm_generic_callback, 390 XtAddCallback (widget, XmNsingleSelectionCallback, xm_generic_callback,
412 } 401 }
413 } 402 }
414 403
415 /* update of buttons */ 404 /* update of buttons */
416 static void 405 static void
417 xm_update_pushbutton (instance, widget, val) 406 xm_update_pushbutton (widget_instance* instance,
418 widget_instance* instance; 407 Widget widget,
419 Widget widget; 408 widget_value* val)
420 widget_value* val;
421 { 409 {
422 XtVaSetValues (widget, XmNalignment, XmALIGNMENT_CENTER, NULL); 410 XtVaSetValues (widget, XmNalignment, XmALIGNMENT_CENTER, NULL);
423 XtRemoveAllCallbacks (widget, XmNactivateCallback); 411 XtRemoveAllCallbacks (widget, XmNactivateCallback);
424 XtAddCallback (widget, XmNactivateCallback, xm_generic_callback, instance); 412 XtAddCallback (widget, XmNactivateCallback, xm_generic_callback, instance);
425 } 413 }
426 414
427 static void 415 static void
428 xm_update_cascadebutton (instance, widget, val) 416 xm_update_cascadebutton (widget_instance* instance,
429 widget_instance* instance; 417 Widget widget,
430 Widget widget; 418 widget_value* val)
431 widget_value* val;
432 { 419 {
433 /* Should also rebuild the menu by calling ...update_menu... */ 420 /* Should also rebuild the menu by calling ...update_menu... */
434 XtRemoveAllCallbacks (widget, XmNcascadingCallback); 421 XtRemoveAllCallbacks (widget, XmNcascadingCallback);
435 XtAddCallback (widget, XmNcascadingCallback, xm_pull_down_callback, 422 XtAddCallback (widget, XmNcascadingCallback, xm_pull_down_callback,
436 instance); 423 instance);
437 } 424 }
438 425
439 /* update toggle and radiobox */ 426 /* update toggle and radiobox */
440 static void 427 static void
441 xm_update_toggle (instance, widget, val) 428 xm_update_toggle (widget_instance* instance,
442 widget_instance* instance; 429 Widget widget,
443 Widget widget; 430 widget_value* val)
444 widget_value* val;
445 { 431 {
446 XtRemoveAllCallbacks (widget, XmNvalueChangedCallback); 432 XtRemoveAllCallbacks (widget, XmNvalueChangedCallback);
447 XtAddCallback (widget, XmNvalueChangedCallback, 433 XtAddCallback (widget, XmNvalueChangedCallback,
448 xm_generic_callback, instance); 434 xm_generic_callback, instance);
449 XtVaSetValues (widget, XmNset, val->selected, 435 XtVaSetValues (widget, XmNset, val->selected,
450 XmNalignment, XmALIGNMENT_BEGINNING, NULL); 436 XmNalignment, XmALIGNMENT_BEGINNING, NULL);
451 } 437 }
452 438
453 static void 439 static void
454 xm_update_radiobox (instance, widget, val) 440 xm_update_radiobox (widget_instance* instance,
455 widget_instance* instance; 441 Widget widget,
456 Widget widget; 442 widget_value* val)
457 widget_value* val;
458 443
459 { 444 {
460 Widget toggle; 445 Widget toggle;
461 widget_value* cur; 446 widget_value* cur;
462 447
496 /* update a popup menu, pulldown menu or a menubar */ 481 /* update a popup menu, pulldown menu or a menubar */
497 482
498 /* KEEP_FIRST_CHILDREN gives the number of initial children to keep. */ 483 /* KEEP_FIRST_CHILDREN gives the number of initial children to keep. */
499 484
500 static void 485 static void
501 make_menu_in_widget (instance, widget, val, keep_first_children) 486 make_menu_in_widget (widget_instance* instance,
502 widget_instance* instance; 487 Widget widget,
503 Widget widget; 488 widget_value* val,
504 widget_value* val; 489 int keep_first_children)
505 int keep_first_children;
506 { 490 {
507 Widget* children = 0; 491 Widget* children = 0;
508 int num_children; 492 int num_children;
509 int child_index; 493 int child_index;
510 widget_value* cur; 494 widget_value* cur;
653 if (old_children) 637 if (old_children)
654 XtFree ((char *) old_children); 638 XtFree ((char *) old_children);
655 } 639 }
656 640
657 static void 641 static void
658 update_one_menu_entry (instance, widget, val, deep_p) 642 update_one_menu_entry (widget_instance* instance,
659 widget_instance* instance; 643 Widget widget,
660 Widget widget; 644 widget_value* val,
661 widget_value* val; 645 Boolean deep_p)
662 Boolean deep_p;
663 { 646 {
664 Arg al [256]; 647 Arg al [256];
665 int ac; 648 int ac;
666 Widget menu; 649 Widget menu;
667 widget_value* contents; 650 widget_value* contents;
755 else if (deep_p && contents->change != NO_CHANGE) 738 else if (deep_p && contents->change != NO_CHANGE)
756 xm_update_menu (instance, menu, val, 1); 739 xm_update_menu (instance, menu, val, 1);
757 } 740 }
758 741
759 static void 742 static void
760 xm_update_menu (instance, widget, val, deep_p) 743 xm_update_menu (widget_instance* instance,
761 widget_instance* instance; 744 Widget widget,
762 Widget widget; 745 widget_value* val,
763 widget_value* val; 746 Boolean deep_p)
764 Boolean deep_p;
765 { 747 {
766 Widget* children; 748 Widget* children;
767 unsigned int num_children; 749 unsigned int num_children;
768 int num_children_to_keep = 0; 750 int num_children_to_keep = 0;
769 int i; 751 int i;
830 812
831 813
832 /* update text widgets */ 814 /* update text widgets */
833 815
834 static void 816 static void
835 xm_update_text (instance, widget, val) 817 xm_update_text (widget_instance* instance,
836 widget_instance* instance; 818 Widget widget,
837 Widget widget; 819 widget_value* val)
838 widget_value* val;
839 { 820 {
840 XmTextSetString (widget, val->value ? val->value : ""); 821 XmTextSetString (widget, val->value ? val->value : "");
841 XtRemoveAllCallbacks (widget, XmNactivateCallback); 822 XtRemoveAllCallbacks (widget, XmNactivateCallback);
842 XtAddCallback (widget, XmNactivateCallback, xm_generic_callback, instance); 823 XtAddCallback (widget, XmNactivateCallback, xm_generic_callback, instance);
843 XtRemoveAllCallbacks (widget, XmNvalueChangedCallback); 824 XtRemoveAllCallbacks (widget, XmNvalueChangedCallback);
844 XtAddCallback (widget, XmNvalueChangedCallback, 825 XtAddCallback (widget, XmNvalueChangedCallback,
845 xm_internal_update_other_instances, instance); 826 xm_internal_update_other_instances, instance);
846 } 827 }
847 828
848 static void 829 static void
849 xm_update_text_field (instance, widget, val) 830 xm_update_text_field (widget_instance* instance,
850 widget_instance* instance; 831 Widget widget,
851 Widget widget; 832 widget_value* val)
852 widget_value* val;
853 { 833 {
854 XmTextFieldSetString (widget, val->value ? val->value : ""); 834 XmTextFieldSetString (widget, val->value ? val->value : "");
855 XtRemoveAllCallbacks (widget, XmNactivateCallback); 835 XtRemoveAllCallbacks (widget, XmNactivateCallback);
856 XtAddCallback (widget, XmNactivateCallback, xm_generic_callback, instance); 836 XtAddCallback (widget, XmNactivateCallback, xm_generic_callback, instance);
857 XtRemoveAllCallbacks (widget, XmNvalueChangedCallback); 837 XtRemoveAllCallbacks (widget, XmNvalueChangedCallback);
861 841
862 842
863 /* update a motif widget */ 843 /* update a motif widget */
864 844
865 void 845 void
866 xm_update_one_widget (instance, widget, val, deep_p) 846 xm_update_one_widget (widget_instance* instance,
867 widget_instance* instance; 847 Widget widget,
868 Widget widget; 848 widget_value* val,
869 widget_value* val; 849 Boolean deep_p)
870 Boolean deep_p;
871 { 850 {
872 WidgetClass class; 851 WidgetClass class;
873 852
874 /* Mark as not edited */ 853 /* Mark as not edited */
875 val->edited = False; 854 val->edited = False;
926 } 905 }
927 } 906 }
928 907
929 /* getting the value back */ 908 /* getting the value back */
930 void 909 void
931 xm_update_one_value (instance, widget, val) 910 xm_update_one_value (widget_instance* instance,
932 widget_instance* instance; 911 Widget widget,
933 Widget widget; 912 widget_value* val)
934 widget_value* val;
935 { 913 {
936 WidgetClass class = XtClass (widget); 914 WidgetClass class = XtClass (widget);
937 widget_value *old_wv; 915 widget_value *old_wv;
938 916
939 /* copy the call_data slot into the "return" widget_value */ 917 /* copy the call_data slot into the "return" widget_value */
1022 This is used from the XmNdefaultAction callback of the List widgets to 1000 This is used from the XmNdefaultAction callback of the List widgets to
1023 have a double-click put down a dialog box like the button would do. 1001 have a double-click put down a dialog box like the button would do.
1024 I could not find a way to do that with accelerators. 1002 I could not find a way to do that with accelerators.
1025 */ 1003 */
1026 static void 1004 static void
1027 activate_button (widget, closure, call_data) 1005 activate_button (Widget widget,
1028 Widget widget; 1006 XtPointer closure,
1029 XtPointer closure; 1007 XtPointer call_data)
1030 XtPointer call_data;
1031 { 1008 {
1032 Widget button = (Widget)closure; 1009 Widget button = (Widget)closure;
1033 XtCallCallbacks (button, XmNactivateCallback, NULL); 1010 XtCallCallbacks (button, XmNactivateCallback, NULL);
1034 } 1011 }
1035 1012
1036 /* creation functions */ 1013 /* creation functions */
1037 1014
1038 /* Called for key press in dialogs. Used to pop down dialog on ESC. */ 1015 /* Called for key press in dialogs. Used to pop down dialog on ESC. */
1039 static void 1016 static void
1040 dialog_key_cb (widget, closure, event, continue_to_dispatch) 1017 dialog_key_cb (Widget widget,
1041 Widget widget; 1018 XtPointer closure,
1042 XtPointer closure; 1019 XEvent *event,
1043 XEvent *event; 1020 Boolean *continue_to_dispatch)
1044 Boolean *continue_to_dispatch;
1045 { 1021 {
1046 KeySym sym = 0; 1022 KeySym sym = 0;
1047 Modifiers modif_ret; 1023 Modifiers modif_ret;
1048 1024
1049 XtTranslateKeycode (event->xkey.display, event->xkey.keycode, 0, 1025 XtTranslateKeycode (event->xkey.display, event->xkey.keycode, 0,
1062 *continue_to_dispatch = TRUE; 1038 *continue_to_dispatch = TRUE;
1063 } 1039 }
1064 1040
1065 /* dialogs */ 1041 /* dialogs */
1066 static Widget 1042 static Widget
1067 make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot, 1043 make_dialog (char* name,
1068 radio_box, list, left_buttons, right_buttons) 1044 Widget parent,
1069 char* name; 1045 Boolean pop_up_p,
1070 Widget parent; 1046 char* shell_title,
1071 Boolean pop_up_p; 1047 char* icon_name,
1072 char* shell_title; 1048 Boolean text_input_slot,
1073 char* icon_name; 1049 Boolean radio_box,
1074 Boolean text_input_slot; 1050 Boolean list,
1075 Boolean radio_box; 1051 int left_buttons,
1076 Boolean list; 1052 int right_buttons)
1077 int left_buttons;
1078 int right_buttons;
1079 { 1053 {
1080 Widget result; 1054 Widget result;
1081 Widget form; 1055 Widget form;
1082 Widget row; 1056 Widget row;
1083 Widget icon; 1057 Widget icon;
1326 1300
1327 return result; 1301 return result;
1328 } 1302 }
1329 1303
1330 static destroyed_instance* 1304 static destroyed_instance*
1331 find_matching_instance (instance) 1305 find_matching_instance (widget_instance* instance)
1332 widget_instance* instance;
1333 { 1306 {
1334 destroyed_instance* cur; 1307 destroyed_instance* cur;
1335 destroyed_instance* prev; 1308 destroyed_instance* prev;
1336 char* type = instance->info->type; 1309 char* type = instance->info->type;
1337 char* name = instance->info->name; 1310 char* name = instance->info->name;
1364 } 1337 }
1365 return NULL; 1338 return NULL;
1366 } 1339 }
1367 1340
1368 static void 1341 static void
1369 mark_dead_instance_destroyed (widget, closure, call_data) 1342 mark_dead_instance_destroyed (Widget widget,
1370 Widget widget; 1343 XtPointer closure,
1371 XtPointer closure; 1344 XtPointer call_data)
1372 XtPointer call_data;
1373 { 1345 {
1374 destroyed_instance* instance = (destroyed_instance*)closure; 1346 destroyed_instance* instance = (destroyed_instance*)closure;
1375 instance->widget = NULL; 1347 instance->widget = NULL;
1376 } 1348 }
1377 1349
1378 static void 1350 static void
1379 recenter_widget (widget) 1351 recenter_widget (Widget widget)
1380 Widget widget;
1381 { 1352 {
1382 Widget parent = XtParent (widget); 1353 Widget parent = XtParent (widget);
1383 Screen* screen = XtScreen (widget); 1354 Screen* screen = XtScreen (widget);
1384 Dimension screen_width = WidthOfScreen (screen); 1355 Dimension screen_width = WidthOfScreen (screen);
1385 Dimension screen_height = HeightOfScreen (screen); 1356 Dimension screen_height = HeightOfScreen (screen);
1411 1382
1412 XtVaSetValues (widget, XtNx, x, XtNy, y, NULL); 1383 XtVaSetValues (widget, XtNx, x, XtNy, y, NULL);
1413 } 1384 }
1414 1385
1415 static Widget 1386 static Widget
1416 recycle_instance (instance) 1387 recycle_instance (destroyed_instance* instance)
1417 destroyed_instance* instance;
1418 { 1388 {
1419 Widget widget = instance->widget; 1389 Widget widget = instance->widget;
1420 1390
1421 /* widget is NULL if the parent was destroyed. */ 1391 /* widget is NULL if the parent was destroyed. */
1422 if (widget) 1392 if (widget)
1448 free_destroyed_instance (instance); 1418 free_destroyed_instance (instance);
1449 return widget; 1419 return widget;
1450 } 1420 }
1451 1421
1452 Widget 1422 Widget
1453 xm_create_dialog (instance) 1423 xm_create_dialog (widget_instance* instance)
1454 widget_instance* instance;
1455 { 1424 {
1456 char* name = instance->info->type; 1425 char* name = instance->info->type;
1457 Widget parent = instance->parent; 1426 Widget parent = instance->parent;
1458 Widget widget; 1427 Widget widget;
1459 Boolean pop_up_p = instance->pop_up_p; 1428 Boolean pop_up_p = instance->pop_up_p;
1529 1498
1530 /* Create a menu bar. We turn off the f10 key 1499 /* Create a menu bar. We turn off the f10 key
1531 because we have not yet managed to make it work right in Motif. */ 1500 because we have not yet managed to make it work right in Motif. */
1532 1501
1533 static Widget 1502 static Widget
1534 make_menubar (instance) 1503 make_menubar (widget_instance* instance)
1535 widget_instance* instance;
1536 { 1504 {
1537 Arg al[3]; 1505 Arg al[3];
1538 int ac; 1506 int ac;
1539 1507
1540 ac = 0; 1508 ac = 0;
1541 XtSetArg(al[ac], XmNmenuAccelerator, 0); ++ac; 1509 XtSetArg(al[ac], XmNmenuAccelerator, 0); ++ac;
1542 return XmCreateMenuBar (instance->parent, instance->info->name, al, ac); 1510 return XmCreateMenuBar (instance->parent, instance->info->name, al, ac);
1543 } 1511 }
1544 1512
1545 static void 1513 static void
1546 remove_grabs (shell, closure, call_data) 1514 remove_grabs (Widget shell,
1547 Widget shell; 1515 XtPointer closure,
1548 XtPointer closure; 1516 XtPointer call_data)
1549 XtPointer call_data;
1550 { 1517 {
1551 Widget menu = (Widget) closure; 1518 Widget menu = (Widget) closure;
1552 XmRemoveFromPostFromList (menu, XtParent (XtParent (menu))); 1519 XmRemoveFromPostFromList (menu, XtParent (XtParent (menu)));
1553 } 1520 }
1554 1521
1555 static Widget 1522 static Widget
1556 make_popup_menu (instance) 1523 make_popup_menu (widget_instance* instance)
1557 widget_instance* instance;
1558 { 1524 {
1559 Widget parent = instance->parent; 1525 Widget parent = instance->parent;
1560 Window parent_window = parent->core.window; 1526 Window parent_window = parent->core.window;
1561 Widget result; 1527 Widget result;
1562 1528
1568 parent->core.window = parent_window; 1534 parent->core.window = parent_window;
1569 return result; 1535 return result;
1570 } 1536 }
1571 1537
1572 static Widget 1538 static Widget
1573 make_main (instance) 1539 make_main (widget_instance* instance)
1574 widget_instance* instance;
1575 { 1540 {
1576 Widget parent = instance->parent; 1541 Widget parent = instance->parent;
1577 Widget result; 1542 Widget result;
1578 Arg al[2]; 1543 Arg al[2];
1579 int ac; 1544 int ac;
1708 {NULL, NULL} 1673 {NULL, NULL}
1709 }; 1674 };
1710 1675
1711 /* Destruction of instances */ 1676 /* Destruction of instances */
1712 void 1677 void
1713 xm_destroy_instance (instance) 1678 xm_destroy_instance ( widget_instance* instance)
1714 widget_instance* instance;
1715 { 1679 {
1716 Widget widget = instance->widget; 1680 Widget widget = instance->widget;
1717 /* recycle the dialog boxes */ 1681 /* recycle the dialog boxes */
1718 /* Disable the recycling until we can find a way to have the dialog box 1682 /* Disable the recycling until we can find a way to have the dialog box
1719 get reasonable layout after we modify its contents. */ 1683 get reasonable layout after we modify its contents. */
1743 } 1707 }
1744 } 1708 }
1745 1709
1746 /* popup utility */ 1710 /* popup utility */
1747 void 1711 void
1748 xm_popup_menu (widget, event) 1712 xm_popup_menu (Widget widget, XEvent *event)
1749 Widget widget;
1750 XEvent *event;
1751 { 1713 {
1752 XButtonPressedEvent dummy; 1714 XButtonPressedEvent dummy;
1753 1715
1754 if (event == 0) 1716 if (event == 0)
1755 { 1717 {
1793 1755
1794 XtManageChild (widget); 1756 XtManageChild (widget);
1795 } 1757 }
1796 1758
1797 static void 1759 static void
1798 set_min_dialog_size (w) 1760 set_min_dialog_size (Widget w)
1799 Widget w;
1800 { 1761 {
1801 short width; 1762 short width;
1802 short height; 1763 short height;
1803 XtVaGetValues (w, XmNwidth, &width, XmNheight, &height, NULL); 1764 XtVaGetValues (w, XmNwidth, &width, XmNheight, &height, NULL);
1804 XtVaSetValues (w, XmNminWidth, width, XmNminHeight, height, NULL); 1765 XtVaSetValues (w, XmNminWidth, width, XmNminHeight, height, NULL);
1805 } 1766 }
1806 1767
1807 void 1768 void
1808 xm_pop_instance (instance, up) 1769 xm_pop_instance (widget_instance* instance, Boolean up)
1809 widget_instance* instance;
1810 Boolean up;
1811 { 1770 {
1812 Widget widget = instance->widget; 1771 Widget widget = instance->widget;
1813 1772
1814 if (XtClass (widget) == xmDialogShellWidgetClass) 1773 if (XtClass (widget) == xmDialogShellWidgetClass)
1815 { 1774 {
1834 1793
1835 1794
1836 /* motif callback */ 1795 /* motif callback */
1837 1796
1838 static void 1797 static void
1839 do_call (widget, closure, type) 1798 do_call (Widget widget,
1840 Widget widget; 1799 XtPointer closure,
1841 XtPointer closure; 1800 enum do_call_type type)
1842 enum do_call_type type;
1843 { 1801 {
1844 Arg al [256]; 1802 Arg al [256];
1845 int ac; 1803 int ac;
1846 XtPointer user_data; 1804 XtPointer user_data;
1847 widget_instance* instance = (widget_instance*)closure; 1805 widget_instance* instance = (widget_instance*)closure;
1894 anything if its shell parent is not managed. This is to protect 1852 anything if its shell parent is not managed. This is to protect
1895 lw_internal_update_other_instances to dereference freed memory 1853 lw_internal_update_other_instances to dereference freed memory
1896 if the widget was ``destroyed'' by caching it in the all_destroyed_instances 1854 if the widget was ``destroyed'' by caching it in the all_destroyed_instances
1897 list */ 1855 list */
1898 static void 1856 static void
1899 xm_internal_update_other_instances (widget, closure, call_data) 1857 xm_internal_update_other_instances (Widget widget,
1900 Widget widget; 1858 XtPointer closure,
1901 XtPointer closure; 1859 XtPointer call_data)
1902 XtPointer call_data;
1903 { 1860 {
1904 Widget parent; 1861 Widget parent;
1905 for (parent = widget; parent; parent = XtParent (parent)) 1862 for (parent = widget; parent; parent = XtParent (parent))
1906 if (XtIsShell (parent)) 1863 if (XtIsShell (parent))
1907 break; 1864 break;
1909 return; 1866 return;
1910 lw_internal_update_other_instances (widget, closure, call_data); 1867 lw_internal_update_other_instances (widget, closure, call_data);
1911 } 1868 }
1912 1869
1913 static void 1870 static void
1914 xm_generic_callback (widget, closure, call_data) 1871 xm_generic_callback (Widget widget,
1915 Widget widget; 1872 XtPointer closure,
1916 XtPointer closure; 1873 XtPointer call_data)
1917 XtPointer call_data;
1918 { 1874 {
1919 lw_internal_update_other_instances (widget, closure, call_data); 1875 lw_internal_update_other_instances (widget, closure, call_data);
1920 do_call (widget, closure, selection); 1876 do_call (widget, closure, selection);
1921 } 1877 }
1922 1878
1923 static void 1879 static void
1924 xm_nosel_callback (widget, closure, call_data) 1880 xm_nosel_callback (Widget widget,
1925 Widget widget; 1881 XtPointer closure,
1926 XtPointer closure; 1882 XtPointer call_data)
1927 XtPointer call_data;
1928 { 1883 {
1929 /* This callback is only called when a dialog box is dismissed with 1884 /* This callback is only called when a dialog box is dismissed with
1930 the wm's destroy button (WM_DELETE_WINDOW.) We want the dialog 1885 the wm's destroy button (WM_DELETE_WINDOW.) We want the dialog
1931 box to be destroyed in that case, not just unmapped, so that it 1886 box to be destroyed in that case, not just unmapped, so that it
1932 releases its keyboard grabs. But there are problems with running 1887 releases its keyboard grabs. But there are problems with running
1937 do_call (widget, closure, no_selection); 1892 do_call (widget, closure, no_selection);
1938 XtDestroyWidget (widget); 1893 XtDestroyWidget (widget);
1939 } 1894 }
1940 1895
1941 static void 1896 static void
1942 xm_pull_down_callback (widget, closure, call_data) 1897 xm_pull_down_callback (Widget widget,
1943 Widget widget; 1898 XtPointer closure,
1944 XtPointer closure; 1899 XtPointer call_data)
1945 XtPointer call_data;
1946 { 1900 {
1947 Widget parent = XtParent (widget); 1901 Widget parent = XtParent (widget);
1948 1902
1949 if (XmIsRowColumn (parent)) 1903 if (XmIsRowColumn (parent))
1950 { 1904 {
1961 1915
1962 Note that this callback is called for each cascade button in a 1916 Note that this callback is called for each cascade button in a
1963 menu, whether or not its submenu is visible. */ 1917 menu, whether or not its submenu is visible. */
1964 1918
1965 static void 1919 static void
1966 xm_pop_down_callback (widget, closure, call_data) 1920 xm_pop_down_callback (Widget widget,
1967 Widget widget; 1921 XtPointer closure,
1968 XtPointer closure; 1922 XtPointer call_data)
1969 XtPointer call_data;
1970 { 1923 {
1971 widget_instance *instance = (widget_instance *) closure; 1924 widget_instance *instance = (widget_instance *) closure;
1972 1925
1973 if ((!instance->pop_up_p && XtParent (widget) == instance->widget) 1926 if ((!instance->pop_up_p && XtParent (widget) == instance->widget)
1974 || XtParent (widget) == instance->parent) 1927 || XtParent (widget) == instance->parent)
1976 } 1929 }
1977 1930
1978 1931
1979 /* set the keyboard focus */ 1932 /* set the keyboard focus */
1980 void 1933 void
1981 xm_set_keyboard_focus (parent, w) 1934 xm_set_keyboard_focus (Widget parent, Widget w)
1982 Widget parent;
1983 Widget w;
1984 { 1935 {
1985 XmProcessTraversal (w, 0); 1936 XmProcessTraversal (w, 0);
1986 XtSetKeyboardFocus (parent, w); 1937 XtSetKeyboardFocus (parent, w);
1987 } 1938 }
1988 1939
1989 /* Motif hack to set the main window areas. */ 1940 /* Motif hack to set the main window areas. */
1990 void 1941 void
1991 xm_set_main_areas (parent, menubar, work_area) 1942 xm_set_main_areas (Widget parent,
1992 Widget parent; 1943 Widget menubar,
1993 Widget menubar; 1944 Widget work_area)
1994 Widget work_area;
1995 { 1945 {
1996 XmMainWindowSetAreas (parent, 1946 XmMainWindowSetAreas (parent,
1997 menubar, /* menubar (maybe 0) */ 1947 menubar, /* menubar (maybe 0) */
1998 0, /* command area (psheets) */ 1948 0, /* command area (psheets) */
1999 0, /* horizontal scroll */ 1949 0, /* horizontal scroll */
2001 work_area); /* work area */ 1951 work_area); /* work area */
2002 } 1952 }
2003 1953
2004 /* Motif hack to control resizing on the menubar. */ 1954 /* Motif hack to control resizing on the menubar. */
2005 void 1955 void
2006 xm_manage_resizing (w, flag) 1956 xm_manage_resizing (Widget w, Boolean flag)
2007 Widget w;
2008 Boolean flag;
2009 { 1957 {
2010 XtVaSetValues (w, XtNallowShellResize, flag, NULL); 1958 XtVaSetValues (w, XtNallowShellResize, flag, NULL);
2011 } 1959 }
2012 1960
2013 /* arch-tag: 73976f64-73b2-4600-aa13-d9ede20ee965 1961 /* arch-tag: 73976f64-73b2-4600-aa13-d9ede20ee965