Mercurial > hg > xemacs-beta
comparison lwlib/lwlib-Xm.c @ 165:5a88923fcbfe r20-3b9
Import from CVS: tag r20-3b9
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:44:42 +0200 |
parents | 0132846995bd |
children | 15872534500d |
comparison
equal
deleted
inserted
replaced
164:4e0740e5aab2 | 165:5a88923fcbfe |
---|---|
225 | 225 |
226 /* update the label of anything subclass of a label */ | 226 /* update the label of anything subclass of a label */ |
227 static void | 227 static void |
228 xm_update_label (widget_instance* instance, Widget widget, widget_value* val) | 228 xm_update_label (widget_instance* instance, Widget widget, widget_value* val) |
229 { | 229 { |
230 XmString built_string = 0; | 230 XmString built_string = NULL; |
231 XmString key_string = 0; | 231 XmString key_string = NULL; |
232 XmString val_string = 0; | 232 XmString val_string = NULL; |
233 XmString name_string = 0; | 233 XmString name_string = NULL; |
234 Arg al [256]; | 234 Arg al [20]; |
235 int ac; | 235 int ac = 0; |
236 | |
237 ac = 0; | |
238 | 236 |
239 if (val->value) | 237 if (val->value) |
240 { | 238 { |
241 #ifdef DIALOGS_MOTIF | 239 #ifdef DIALOGS_MOTIF |
242 /* | 240 /* |
256 | 254 |
257 built_string = | 255 built_string = |
258 XmStringCreateLtoR (value_name, XmSTRING_DEFAULT_CHARSET); | 256 XmStringCreateLtoR (value_name, XmSTRING_DEFAULT_CHARSET); |
259 } | 257 } |
260 else | 258 else |
261 #endif | 259 #endif /* DIALOGS_MOTIF */ |
262 { | 260 { |
263 char *value_name = NULL; | 261 char *value_name = NULL; |
264 char *res_name = NULL; | 262 char *res_name = NULL; |
265 | 263 |
266 res_name = resource_string (widget, val->name); | 264 res_name = resource_string (widget, val->name); |
333 /* update of buttons */ | 331 /* update of buttons */ |
334 static void | 332 static void |
335 xm_update_pushbutton (widget_instance* instance, Widget widget, | 333 xm_update_pushbutton (widget_instance* instance, Widget widget, |
336 widget_value* val) | 334 widget_value* val) |
337 { | 335 { |
338 XtVaSetValues (widget, XmNalignment, XmALIGNMENT_CENTER, NULL); | 336 Arg al [1]; |
337 XtSetArg (al [0], XmNalignment, XmALIGNMENT_CENTER); | |
338 XtSetValues (widget, al, 1); | |
339 XtRemoveAllCallbacks (widget, XmNactivateCallback); | 339 XtRemoveAllCallbacks (widget, XmNactivateCallback); |
340 XtAddCallback (widget, XmNactivateCallback, xm_generic_callback, instance); | 340 XtAddCallback (widget, XmNactivateCallback, xm_generic_callback, instance); |
341 } | 341 } |
342 | 342 |
343 #ifdef MENUBARS_MOTIF | 343 #ifdef MENUBARS_MOTIF |
372 | 372 |
373 /* update toggle and radiobox */ | 373 /* update toggle and radiobox */ |
374 static void | 374 static void |
375 xm_update_toggle (widget_instance* instance, Widget widget, widget_value* val) | 375 xm_update_toggle (widget_instance* instance, Widget widget, widget_value* val) |
376 { | 376 { |
377 Arg al [2]; | |
377 XtRemoveAllCallbacks (widget, XmNvalueChangedCallback); | 378 XtRemoveAllCallbacks (widget, XmNvalueChangedCallback); |
378 #ifndef ENERGIZE | 379 #ifndef ENERGIZE |
379 XtAddCallback (widget, XmNvalueChangedCallback, xm_generic_callback, | 380 XtAddCallback (widget, XmNvalueChangedCallback, xm_generic_callback, |
380 instance); | 381 instance); |
381 #else | 382 #else |
382 XtAddCallback (widget, XmNvalueChangedCallback, | 383 XtAddCallback (widget, XmNvalueChangedCallback, |
383 xm_internal_update_other_instances, instance); | 384 xm_internal_update_other_instances, instance); |
384 #endif | 385 #endif |
385 XtVaSetValues (widget, XmNset, val->selected, | 386 XtSetArg (al [0], XmNset, val->selected); |
386 XmNalignment, XmALIGNMENT_BEGINNING, NULL); | 387 XtSetArg (al [1], XmNalignment, XmALIGNMENT_BEGINNING); |
388 XtSetValues (widget, al, 2); | |
387 } | 389 } |
388 | 390 |
389 static void | 391 static void |
390 xm_update_radiobox (widget_instance* instance, Widget widget, | 392 xm_update_radiobox (widget_instance* instance, Widget widget, |
391 widget_value* val) | 393 widget_value* val) |
406 for (cur = val->contents; cur; cur = cur->next) | 408 for (cur = val->contents; cur; cur = cur->next) |
407 { | 409 { |
408 toggle = XtNameToWidget (widget, cur->value); | 410 toggle = XtNameToWidget (widget, cur->value); |
409 if (toggle) | 411 if (toggle) |
410 { | 412 { |
411 XtVaSetValues (toggle, XmNsensitive, cur->enabled, NULL); | 413 Arg al [2]; |
412 if (!val->value && cur->selected) | 414 XtSetArg (al [0], XmNsensitive, cur->enabled); |
413 XtVaSetValues (toggle, XmNset, cur->selected, NULL); | 415 XtSetArg (al [1], XmNset, (!val->value && cur->selected ? cur->selected : False)); |
414 if (val->value && strcmp (val->value, cur->value)) | 416 XtSetValues (toggle, al, 2); |
415 XtVaSetValues (toggle, XmNset, False, NULL); | |
416 } | 417 } |
417 } | 418 } |
418 | 419 |
419 /* The selected was specified by the value slot */ | 420 /* The selected was specified by the value slot */ |
420 if (val->value) | 421 if (val->value) |
421 { | 422 { |
422 toggle = XtNameToWidget (widget, val->value); | 423 toggle = XtNameToWidget (widget, val->value); |
423 if (toggle) | 424 if (toggle) |
424 XtVaSetValues (toggle, XmNset, True, NULL); | 425 { |
426 Arg al [1]; | |
427 XtSetArg (al [0], XmNset, True); | |
428 XtSetValues (toggle, al, 1); | |
429 } | |
425 } | 430 } |
426 } | 431 } |
427 | 432 |
428 #ifdef MENUBARS_MOTIF | 433 #ifdef MENUBARS_MOTIF |
429 | 434 |
438 widget_value* cur; | 443 widget_value* cur; |
439 Widget button = 0; | 444 Widget button = 0; |
440 Widget menu; | 445 Widget menu; |
441 Arg al [256]; | 446 Arg al [256]; |
442 int ac; | 447 int ac; |
443 Boolean menubar_p; | 448 Boolean menubar_p = False; |
444 | 449 |
445 /* Allocate the children array */ | 450 /* Allocate the children array */ |
446 for (num_children = 0, cur = val; cur; num_children++, cur = cur->next); | 451 for (num_children = 0, cur = val; cur; num_children++, cur = cur->next); |
447 children = (Widget*)XtMalloc (num_children * sizeof (Widget)); | 452 children = (Widget*)XtMalloc (num_children * sizeof (Widget)); |
448 | 453 |
449 /* tricky way to know if this RowColumn is a menubar or a pulldown... */ | 454 /* tricky way to know if this RowColumn is a menubar or a pulldown... */ |
450 menubar_p = False; | 455 XtSetArg (al [0], XmNisHomogeneous, &menubar_p); |
451 XtVaGetValues (widget, XmNisHomogeneous, &menubar_p, NULL); | 456 XtGetValues (widget, al, 1); |
452 | 457 |
453 /* add the unmap callback for popups and pulldowns */ | 458 /* add the unmap callback for popups and pulldowns */ |
454 /*** this sounds bogus ***/ | 459 /*** this sounds bogus ***/ |
455 /* probably because it is -- cet */ | 460 /* probably because it is -- cet */ |
456 /* | 461 /* |
501 button = XmCreateCascadeButton (widget, cur->name, al, ac); | 506 button = XmCreateCascadeButton (widget, cur->name, al, ac); |
502 else if (!cur->call_data) | 507 else if (!cur->call_data) |
503 button = XmCreateLabel (widget, cur->name, al, ac); | 508 button = XmCreateLabel (widget, cur->name, al, ac); |
504 else if (cur->type == TOGGLE_TYPE || cur->type == RADIO_TYPE) | 509 else if (cur->type == TOGGLE_TYPE || cur->type == RADIO_TYPE) |
505 { | 510 { |
506 if (cur->type == TOGGLE_TYPE) | 511 XtSetArg (al [ac], XmNindicatorType, |
507 { | 512 (cur->type == TOGGLE_TYPE ? |
508 XtSetArg (al [ac], XmNindicatorType, XmN_OF_MANY); ac++; | 513 XmN_OF_MANY : XmONE_OF_MANY)); ac++; |
509 } | |
510 else | |
511 { | |
512 XtSetArg (al [ac], XmNindicatorType, XmONE_OF_MANY); ac++; | |
513 } | |
514 | |
515 XtSetArg (al [ac], XmNvisibleWhenOff, True); ac++; | 514 XtSetArg (al [ac], XmNvisibleWhenOff, True); ac++; |
516 button = XmCreateToggleButtonGadget (widget, cur->name, al, ac); | 515 button = XmCreateToggleButtonGadget (widget, cur->name, al, ac); |
517 } | 516 } |
518 else | 517 else |
519 button = XmCreatePushButtonGadget (widget, cur->name, al, ac); | 518 button = XmCreatePushButtonGadget (widget, cur->name, al, ac); |
553 | 552 |
554 static void | 553 static void |
555 update_one_menu_entry (widget_instance* instance, Widget widget, | 554 update_one_menu_entry (widget_instance* instance, Widget widget, |
556 widget_value* val, Boolean deep_p) | 555 widget_value* val, Boolean deep_p) |
557 { | 556 { |
558 Arg al [256]; | 557 Arg al [2]; |
559 int ac; | |
560 Widget menu; | 558 Widget menu; |
561 widget_value* contents; | 559 widget_value* contents; |
562 | 560 |
563 if (val->change == NO_CHANGE) | 561 if (val->change == NO_CHANGE) |
564 return; | 562 return; |
565 | 563 |
566 /* update the sensitivity and userdata */ | 564 /* update the sensitivity and userdata */ |
567 /* Common to all widget types */ | 565 /* Common to all widget types */ |
568 XtVaSetValues (widget, | 566 XtSetArg (al [0], XmNsensitive, val->enabled); |
569 XmNsensitive, val->enabled, | 567 XtSetArg (al [1], XmNuserData, val->call_data); |
570 XmNuserData, val->call_data, | 568 XtSetValues (widget, al, 2); |
571 NULL); | |
572 | 569 |
573 /* update the menu button as a label. */ | 570 /* update the menu button as a label. */ |
574 if (val->change >= VISIBLE_CHANGE) | 571 if (val->change >= VISIBLE_CHANGE) |
575 { | 572 { |
576 xm_update_label (instance, widget, val); | 573 xm_update_label (instance, widget, val); |
582 } | 579 } |
583 | 580 |
584 | 581 |
585 /* update the pulldown/pullaside as needed */ | 582 /* update the pulldown/pullaside as needed */ |
586 menu = NULL; | 583 menu = NULL; |
587 XtVaGetValues (widget, XmNsubMenuId, &menu, NULL); | 584 XtSetArg (al [0], XmNsubMenuId, &menu); |
585 XtGetValues (widget, al, 1); | |
588 | 586 |
589 contents = val->contents; | 587 contents = val->contents; |
590 | 588 |
591 if (!menu) | 589 if (!menu) |
592 { | 590 { |
711 scrollbar_values *data = val->scrollbar_data; | 709 scrollbar_values *data = val->scrollbar_data; |
712 int widget_sliderSize, widget_val; | 710 int widget_sliderSize, widget_val; |
713 int new_sliderSize, new_value; | 711 int new_sliderSize, new_value; |
714 double percent; | 712 double percent; |
715 double h_water, l_water; | 713 double h_water, l_water; |
716 | 714 Arg al [4]; |
717 /* | 715 |
718 * First size and position the scrollbar widget. | 716 /* First size and position the scrollbar widget. */ |
719 */ | 717 XtSetArg (al [0], XtNx, data->scrollbar_x); |
720 XtVaSetValues (widget, | 718 XtSetArg (al [1], XtNy, data->scrollbar_y); |
721 XtNx, data->scrollbar_x, | 719 XtSetArg (al [2], XtNwidth, data->scrollbar_width); |
722 XtNy, data->scrollbar_y, | 720 XtSetArg (al [3], XtNheight, data->scrollbar_height); |
723 XtNwidth, data->scrollbar_width, | 721 XtSetValues (widget, al, 4); |
724 XtNheight, data->scrollbar_height, | 722 |
725 NULL); | 723 /* Now size the scrollbar's slider. */ |
726 | 724 XtSetArg (al [0], XmNsliderSize, &widget_sliderSize); |
727 /* | 725 XtSetArg (al [1], XmNvalue, &widget_val); |
728 * Now the size the scrollbar's slider. | 726 XtGetValues (widget, al, 2); |
729 */ | |
730 | |
731 XtVaGetValues (widget, | |
732 XmNsliderSize, &widget_sliderSize, | |
733 XmNvalue, &widget_val, | |
734 NULL); | |
735 | 727 |
736 percent = (double) data->slider_size / | 728 percent = (double) data->slider_size / |
737 (double) (data->maximum - data->minimum); | 729 (double) (data->maximum - data->minimum); |
738 new_sliderSize = (int) ((double) (INT_MAX - 1) * percent); | 730 new_sliderSize = (int) ((double) (INT_MAX - 1) * percent); |
739 | 731 |
741 (double) (data->maximum - data->minimum); | 733 (double) (data->maximum - data->minimum); |
742 new_value = (int) ((double) (INT_MAX - 1) * percent); | 734 new_value = (int) ((double) (INT_MAX - 1) * percent); |
743 | 735 |
744 if (new_sliderSize > (INT_MAX - 1)) | 736 if (new_sliderSize > (INT_MAX - 1)) |
745 new_sliderSize = INT_MAX - 1; | 737 new_sliderSize = INT_MAX - 1; |
746 if (new_sliderSize < 1) | 738 else if (new_sliderSize < 1) |
747 new_sliderSize = 1; | 739 new_sliderSize = 1; |
748 | 740 |
749 if (new_value > (INT_MAX - new_sliderSize)) | 741 if (new_value > (INT_MAX - new_sliderSize)) |
750 new_value = INT_MAX - new_sliderSize; | 742 new_value = INT_MAX - new_sliderSize; |
751 else if (new_value < 1) | 743 else if (new_value < 1) |
780 void | 772 void |
781 xm_update_one_widget (widget_instance* instance, Widget widget, | 773 xm_update_one_widget (widget_instance* instance, Widget widget, |
782 widget_value* val, Boolean deep_p) | 774 widget_value* val, Boolean deep_p) |
783 { | 775 { |
784 WidgetClass class; | 776 WidgetClass class; |
777 Arg al [2]; | |
785 | 778 |
786 /* Mark as not edited */ | 779 /* Mark as not edited */ |
787 val->edited = False; | 780 val->edited = False; |
788 | 781 |
789 /* Common to all widget types */ | 782 /* Common to all widget types */ |
790 XtVaSetValues (widget, | 783 XtSetArg (al [0], XmNsensitive, val->enabled); |
791 XmNsensitive, val->enabled, | 784 XtSetArg (al [1], XmNuserData, val->call_data); |
792 XmNuserData, val->call_data, | 785 XtSetValues (widget, al, 2); |
793 NULL); | |
794 | 786 |
795 #if defined (DIALOGS_MOTIF) || defined (MENUBARS_MOTIF) | 787 #if defined (DIALOGS_MOTIF) || defined (MENUBARS_MOTIF) |
796 /* Common to all label like widgets */ | 788 /* Common to all label like widgets */ |
797 if (XtIsSubclass (widget, xmLabelWidgetClass)) | 789 if (XtIsSubclass (widget, xmLabelWidgetClass)) |
798 xm_update_label (instance, widget, val); | 790 xm_update_label (instance, widget, val); |
817 xm_update_toggle (instance, widget, val); | 809 xm_update_toggle (instance, widget, val); |
818 } | 810 } |
819 else if (class == xmRowColumnWidgetClass) | 811 else if (class == xmRowColumnWidgetClass) |
820 { | 812 { |
821 Boolean radiobox = 0; | 813 Boolean radiobox = 0; |
822 | 814 |
823 XtVaGetValues (widget, XmNradioBehavior, &radiobox, NULL); | 815 XtSetArg (al [0], XmNradioBehavior, &radiobox); |
816 XtGetValues (widget, al, 1); | |
824 | 817 |
825 if (radiobox) | 818 if (radiobox) |
826 xm_update_radiobox (instance, widget, val); | 819 xm_update_radiobox (instance, widget, val); |
827 #ifdef MENUBARS_MOTIF | 820 #ifdef MENUBARS_MOTIF |
828 else | 821 else |
867 break; | 860 break; |
868 } | 861 } |
869 | 862 |
870 if (class == xmToggleButtonWidgetClass || class == xmToggleButtonGadgetClass) | 863 if (class == xmToggleButtonWidgetClass || class == xmToggleButtonGadgetClass) |
871 { | 864 { |
872 XtVaGetValues (widget, XmNset, &val->selected, NULL); | 865 Arg al [1]; |
866 XtSetArg (al [0], XmNset, &val->selected); | |
867 XtGetValues (widget, al, 1); | |
873 val->edited = True; | 868 val->edited = True; |
874 } | 869 } |
875 #ifdef DIALOGS_MOTIF | 870 #ifdef DIALOGS_MOTIF |
876 else if (class == xmTextWidgetClass) | 871 else if (class == xmTextWidgetClass) |
877 { | 872 { |
889 } | 884 } |
890 #endif | 885 #endif |
891 else if (class == xmRowColumnWidgetClass) | 886 else if (class == xmRowColumnWidgetClass) |
892 { | 887 { |
893 Boolean radiobox = 0; | 888 Boolean radiobox = 0; |
889 Arg al [1]; | |
894 | 890 |
895 XtVaGetValues (widget, XmNradioBehavior, &radiobox, NULL); | 891 XtSetArg (al [0], XmNradioBehavior, &radiobox); |
892 XtGetValues (widget, al, 1); | |
896 | 893 |
897 if (radiobox) | 894 if (radiobox) |
898 { | 895 { |
899 CompositeWidget radio = (CompositeWidget)widget; | 896 CompositeWidget radio = (CompositeWidget)widget; |
900 int i; | 897 int i; |
901 for (i = 0; i < radio->composite.num_children; i++) | 898 for (i = 0; i < radio->composite.num_children; i++) |
902 { | 899 { |
903 int set = False; | 900 int set = False; |
904 Widget toggle = radio->composite.children [i]; | 901 Widget toggle = radio->composite.children [i]; |
905 | 902 Arg al [1]; |
906 XtVaGetValues (toggle, XmNset, &set, NULL); | 903 |
904 XtSetArg (al [0], XmNset, &set); | |
905 XtGetValues (toggle, al, 1); | |
907 if (set) | 906 if (set) |
908 { | 907 { |
909 if (val->value) | 908 if (val->value) |
910 free (val->value); | 909 free (val->value); |
911 val->value = safe_strdup (XtName (toggle)); | 910 val->value = safe_strdup (XtName (toggle)); |
1345 Dimension parent_height = 0; | 1344 Dimension parent_height = 0; |
1346 Dimension child_width = 0; | 1345 Dimension child_width = 0; |
1347 Dimension child_height = 0; | 1346 Dimension child_height = 0; |
1348 Position x; | 1347 Position x; |
1349 Position y; | 1348 Position y; |
1350 | 1349 Arg al [2]; |
1351 XtVaGetValues (widget, XtNwidth, &child_width, XtNheight, &child_height, NULL); | 1350 |
1352 XtVaGetValues (parent, XtNwidth, &parent_width, XtNheight, &parent_height, | 1351 XtSetArg (al [0], XtNwidth, &child_width); |
1353 NULL); | 1352 XtSetArg (al [1], XtNheight, &child_height); |
1354 | 1353 XtGetValues (widget, al, 2); |
1355 x = (((Position)parent_width) - ((Position)child_width)) / 2; | 1354 |
1356 y = (((Position)parent_height) - ((Position)child_height)) / 2; | 1355 XtSetArg (al [0], XtNwidth, &parent_width); |
1356 XtSetArg (al [1], XtNheight, &parent_height); | |
1357 XtGetValues (parent, al, 2); | |
1358 | |
1359 x = (Position) ((parent_width - child_width) / 2); | |
1360 y = (Position) ((parent_height - child_height) / 2); | |
1357 | 1361 |
1358 XtTranslateCoords (parent, x, y, &x, &y); | 1362 XtTranslateCoords (parent, x, y, &x, &y); |
1359 | 1363 |
1360 if ((Dimension) (x + child_width) > screen_width) | 1364 if ((Dimension) (x + child_width) > screen_width) |
1361 x = screen_width - child_width; | 1365 x = screen_width - child_width; |
1365 if ((Dimension) (y + child_height) > screen_height) | 1369 if ((Dimension) (y + child_height) > screen_height) |
1366 y = screen_height - child_height; | 1370 y = screen_height - child_height; |
1367 if (y < 0) | 1371 if (y < 0) |
1368 y = 0; | 1372 y = 0; |
1369 | 1373 |
1370 XtVaSetValues (widget, XtNx, x, XtNy, y, NULL); | 1374 XtSetArg (al [0], XtNx, x); |
1375 XtSetArg (al [1], XtNy, y); | |
1376 XtSetValues (widget, al, 2); | |
1371 } | 1377 } |
1372 | 1378 |
1373 static Widget | 1379 static Widget |
1374 recycle_instance (destroyed_instance* instance) | 1380 recycle_instance (destroyed_instance* instance) |
1375 { | 1381 { |
1395 XmProcessTraversal(focus, XmTRAVERSE_CURRENT); | 1401 XmProcessTraversal(focus, XmTRAVERSE_CURRENT); |
1396 | 1402 |
1397 /* shrink the separator label back to their original size */ | 1403 /* shrink the separator label back to their original size */ |
1398 separator = XtNameToWidget (widget, "*separator_button"); | 1404 separator = XtNameToWidget (widget, "*separator_button"); |
1399 if (separator) | 1405 if (separator) |
1400 XtVaSetValues (separator, XtNwidth, 5, XtNheight, 5, NULL); | 1406 { |
1407 Arg al [2]; | |
1408 XtSetArg (al [0], XtNwidth, 5); | |
1409 XtSetArg (al [1], XtNheight, 5); | |
1410 XtSetValues (separator, al, 2); | |
1411 } | |
1401 | 1412 |
1402 /* Center the dialog in its parent */ | 1413 /* Center the dialog in its parent */ |
1403 recenter_widget (widget); | 1414 recenter_widget (widget); |
1404 } | 1415 } |
1405 free_destroyed_instance (instance); | 1416 free_destroyed_instance (instance); |
1747 if (event->xbutton.state & Button5Mask) trans = "<Btn5Down>"; | 1758 if (event->xbutton.state & Button5Mask) trans = "<Btn5Down>"; |
1748 else if (event->xbutton.state & Button4Mask) trans = "<Btn4Down>"; | 1759 else if (event->xbutton.state & Button4Mask) trans = "<Btn4Down>"; |
1749 else if (event->xbutton.state & Button3Mask) trans = "<Btn3Down>"; | 1760 else if (event->xbutton.state & Button3Mask) trans = "<Btn3Down>"; |
1750 else if (event->xbutton.state & Button2Mask) trans = "<Btn2Down>"; | 1761 else if (event->xbutton.state & Button2Mask) trans = "<Btn2Down>"; |
1751 else if (event->xbutton.state & Button1Mask) trans = "<Btn1Down>"; | 1762 else if (event->xbutton.state & Button1Mask) trans = "<Btn1Down>"; |
1752 if (trans) XtVaSetValues (widget, XmNmenuPost, trans, NULL); | 1763 if (trans) |
1764 { | |
1765 Arg al [1]; | |
1766 XtSetArg (al [0], XmNmenuPost, trans); | |
1767 XtSetValues (widget, al, 1); | |
1768 } | |
1753 XmMenuPosition (widget, (XButtonPressedEvent *) event); | 1769 XmMenuPosition (widget, (XButtonPressedEvent *) event); |
1754 } | 1770 } |
1755 XtManageChild (widget); | 1771 XtManageChild (widget); |
1756 } | 1772 } |
1757 | 1773 |
1762 static void | 1778 static void |
1763 set_min_dialog_size (Widget w) | 1779 set_min_dialog_size (Widget w) |
1764 { | 1780 { |
1765 short width; | 1781 short width; |
1766 short height; | 1782 short height; |
1767 XtVaGetValues (w, XmNwidth, &width, XmNheight, &height, NULL); | 1783 Arg al [2]; |
1768 XtVaSetValues (w, XmNminWidth, width, XmNminHeight, height, NULL); | 1784 |
1785 XtSetArg (al [0], XmNwidth, &width); | |
1786 XtSetArg (al [1], XmNheight, &height); | |
1787 XtGetValues (w, al, 2); | |
1788 | |
1789 XtSetArg (al [0], XmNminWidth, width); | |
1790 XtSetArg (al [1], XmNminHeight, height); | |
1791 XtSetValues (w, al, 2); | |
1769 } | 1792 } |
1770 | 1793 |
1771 #endif | 1794 #endif |
1772 | 1795 |
1773 void | 1796 void |
1808 { | 1831 { |
1809 XtPointer user_data; | 1832 XtPointer user_data; |
1810 widget_instance* instance = (widget_instance*)closure; | 1833 widget_instance* instance = (widget_instance*)closure; |
1811 Widget instance_widget; | 1834 Widget instance_widget; |
1812 LWLIB_ID id; | 1835 LWLIB_ID id; |
1836 Arg al [1]; | |
1813 | 1837 |
1814 if (!instance) | 1838 if (!instance) |
1815 return; | 1839 return; |
1816 if (widget->core.being_destroyed) | 1840 if (widget->core.being_destroyed) |
1817 return; | 1841 return; |
1820 if (!instance_widget) | 1844 if (!instance_widget) |
1821 return; | 1845 return; |
1822 | 1846 |
1823 id = instance->info->id; | 1847 id = instance->info->id; |
1824 user_data = NULL; | 1848 user_data = NULL; |
1825 XtVaGetValues (widget, XmNuserData, &user_data, NULL); | 1849 XtSetArg(al [0], XmNuserData, &user_data); |
1850 XtGetValues (widget, al, 1); | |
1826 switch (type) | 1851 switch (type) |
1827 { | 1852 { |
1828 case pre_activate: | 1853 case pre_activate: |
1829 if (instance->info->pre_activate_cb) | 1854 if (instance->info->pre_activate_cb) |
1830 instance->info->pre_activate_cb (widget, id, user_data); | 1855 instance->info->pre_activate_cb (widget, id, user_data); |
1872 should change. Yuck but correct. */ | 1897 should change. Yuck but correct. */ |
1873 if (XtClass (widget) == xmToggleButtonWidgetClass | 1898 if (XtClass (widget) == xmToggleButtonWidgetClass |
1874 || XtClass (widget) == xmToggleButtonGadgetClass) | 1899 || XtClass (widget) == xmToggleButtonGadgetClass) |
1875 { | 1900 { |
1876 Boolean check; | 1901 Boolean check; |
1877 XtVaGetValues (widget, XmNset, &check, NULL); | 1902 Arg al [1]; |
1878 XtVaSetValues (widget, XmNset, !check, NULL); | 1903 |
1904 XtSetArg (al [0], XmNset, &check); | |
1905 XtGetValues (widget, al, 1); | |
1906 | |
1907 XtSetArg (al [0], XmNset, !check); | |
1908 XtSetValues (widget, al, 1); | |
1879 } | 1909 } |
1880 #endif | 1910 #endif |
1881 lw_internal_update_other_instances (widget, closure, call_data); | 1911 lw_internal_update_other_instances (widget, closure, call_data); |
1882 do_call (widget, closure, selection); | 1912 do_call (widget, closure, selection); |
1883 } | 1913 } |