aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Reilly1995-04-08 18:01:09 +0000
committerPaul Reilly1995-04-08 18:01:09 +0000
commit41bf6a06459d0f62219a92aedbf9ca182c870b4f (patch)
tree728153fa45cbe8be93274d4d40272450a1ad80dd
parent1d0b600d3198c05975f565228ab342212fb19714 (diff)
downloademacs-41bf6a06459d0f62219a92aedbf9ca182c870b4f.tar.gz
emacs-41bf6a06459d0f62219a92aedbf9ca182c870b4f.zip
(*): remove function prototypes.
(xm_pop_down_callback): Call the deactivation callback only when popping down the top level submenu.
-rw-r--r--lwlib/lwlib-Xm.c216
1 files changed, 152 insertions, 64 deletions
diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c
index 13730027259..0fe6caa0019 100644
--- a/lwlib/lwlib-Xm.c
+++ b/lwlib/lwlib-Xm.c
@@ -55,16 +55,16 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
55#include <Xm/DialogS.h> 55#include <Xm/DialogS.h>
56#include <Xm/Form.h> 56#include <Xm/Form.h>
57 57
58static void xm_pull_down_callback (Widget, XtPointer, XtPointer); 58static void xm_pull_down_callback (/* Widget, XtPointer, XtPointer */);
59static void xm_internal_update_other_instances (Widget, XtPointer, 59static void xm_internal_update_other_instances (/* Widget, XtPointer,
60 XtPointer); 60 XtPointer */);
61static void xm_generic_callback (Widget, XtPointer, XtPointer); 61static void xm_generic_callback (/* Widget, XtPointer, XtPointer */);
62static void xm_nosel_callback (Widget, XtPointer, XtPointer); 62static void xm_nosel_callback (/* Widget, XtPointer, XtPointer */);
63static void xm_pop_down_callback (Widget, XtPointer, XtPointer); 63static void xm_pop_down_callback (/* Widget, XtPointer, XtPointer */);
64
65static void xm_update_menu (/* widget_instance*, Widget, widget_value*,
66 Boolean) */);
64 67
65static void
66xm_update_menu (widget_instance* instance, Widget widget, widget_value* val,
67 Boolean deep_p);
68 68
69 /* Structures to keep destroyed instances */ 69 /* Structures to keep destroyed instances */
70typedef struct _destroyed_instance 70typedef struct _destroyed_instance
@@ -81,8 +81,12 @@ static destroyed_instance*
81all_destroyed_instances = NULL; 81all_destroyed_instances = NULL;
82 82
83static destroyed_instance* 83static destroyed_instance*
84make_destroyed_instance (char* name, char* type, Widget widget, Widget parent, 84make_destroyed_instance (name, type, widget, parent, pop_up_p)
85 Boolean pop_up_p) 85 char* name;
86 char* type;
87 Widget widget;
88 Widget parent;
89 Boolean pop_up_p;
86{ 90{
87 destroyed_instance* instance = 91 destroyed_instance* instance =
88 (destroyed_instance*)malloc (sizeof (destroyed_instance)); 92 (destroyed_instance*)malloc (sizeof (destroyed_instance));
@@ -96,7 +100,8 @@ make_destroyed_instance (char* name, char* type, Widget widget, Widget parent,
96} 100}
97 101
98static void 102static void
99free_destroyed_instance (destroyed_instance* instance) 103free_destroyed_instance (instance)
104 destroyed_instance* instance;
100{ 105{
101 free (instance->name); 106 free (instance->name);
102 free (instance->type); 107 free (instance->type);
@@ -105,13 +110,15 @@ free_destroyed_instance (destroyed_instance* instance)
105 110
106 /* motif utility functions */ 111 /* motif utility functions */
107Widget 112Widget
108first_child (Widget widget) 113first_child (widget)
114 Widget widget;
109{ 115{
110 return ((CompositeWidget)widget)->composite.children [0]; 116 return ((CompositeWidget)widget)->composite.children [0];
111} 117}
112 118
113Boolean 119Boolean
114lw_motif_widget_p (Widget widget) 120lw_motif_widget_p (widget)
121 Widget widget;
115{ 122{
116 return 123 return
117 XtClass (widget) == xmDialogShellWidgetClass 124 XtClass (widget) == xmDialogShellWidgetClass
@@ -119,7 +126,9 @@ lw_motif_widget_p (Widget widget)
119} 126}
120 127
121static XmString 128static XmString
122resource_motif_string (Widget widget, char* name) 129resource_motif_string (widget, name)
130 Widget widget;
131 char* name;
123{ 132{
124 XtResource resource; 133 XtResource resource;
125 XmString result = 0; 134 XmString result = 0;
@@ -138,7 +147,8 @@ resource_motif_string (Widget widget, char* name)
138} 147}
139 148
140static void 149static void
141destroy_all_children (Widget widget) 150destroy_all_children (widget)
151 Widget widget;
142{ 152{
143 Widget* children; 153 Widget* children;
144 unsigned int number; 154 unsigned int number;
@@ -164,7 +174,10 @@ destroy_all_children (Widget widget)
164 174
165 /* update the label of anything subclass of a label */ 175 /* update the label of anything subclass of a label */
166static void 176static void
167xm_update_label (widget_instance* instance, Widget widget, widget_value* val) 177xm_update_label (instance, widget, val)
178 widget_instance* instance;
179 Widget widget;
180 widget_value* val;
168{ 181{
169 XmString res_string = 0; 182 XmString res_string = 0;
170 XmString built_string = 0; 183 XmString built_string = 0;
@@ -209,7 +222,10 @@ xm_update_label (widget_instance* instance, Widget widget, widget_value* val)
209 222
210 /* update of list */ 223 /* update of list */
211static void 224static void
212xm_update_list (widget_instance* instance, Widget widget, widget_value* val) 225xm_update_list (instance, widget, val)
226 widget_instance* instance;
227 Widget widget;
228 widget_value* val;
213{ 229{
214 widget_value* cur; 230 widget_value* cur;
215 int i; 231 int i;
@@ -230,8 +246,10 @@ xm_update_list (widget_instance* instance, Widget widget, widget_value* val)
230 246
231 /* update of buttons */ 247 /* update of buttons */
232static void 248static void
233xm_update_pushbutton (widget_instance* instance, Widget widget, 249xm_update_pushbutton (instance, widget, val)
234 widget_value* val) 250 widget_instance* instance;
251 Widget widget;
252 widget_value* val;
235{ 253{
236 XtVaSetValues (widget, XmNalignment, XmALIGNMENT_CENTER, 0); 254 XtVaSetValues (widget, XmNalignment, XmALIGNMENT_CENTER, 0);
237 XtRemoveAllCallbacks (widget, XmNactivateCallback); 255 XtRemoveAllCallbacks (widget, XmNactivateCallback);
@@ -250,7 +268,10 @@ xm_update_cascadebutton (widget_instance* instance, Widget widget,
250 268
251 /* update toggle and radiobox */ 269 /* update toggle and radiobox */
252static void 270static void
253xm_update_toggle (widget_instance* instance, Widget widget, widget_value* val) 271xm_update_toggle (instance, widget, val)
272 widget_instance* instance;
273 Widget widget;
274 widget_value* val;
254{ 275{
255 XtRemoveAllCallbacks (widget, XmNvalueChangedCallback); 276 XtRemoveAllCallbacks (widget, XmNvalueChangedCallback);
256 XtAddCallback (widget, XmNvalueChangedCallback, 277 XtAddCallback (widget, XmNvalueChangedCallback,
@@ -260,8 +281,11 @@ xm_update_toggle (widget_instance* instance, Widget widget, widget_value* val)
260} 281}
261 282
262static void 283static void
263xm_update_radiobox (widget_instance* instance, Widget widget, 284xm_update_radiobox (instance, widget, val)
264 widget_value* val) 285 widget_instance* instance;
286 Widget widget;
287 widget_value* val;
288
265{ 289{
266 Widget toggle; 290 Widget toggle;
267 widget_value* cur; 291 widget_value* cur;
@@ -300,7 +324,8 @@ xm_update_radiobox (widget_instance* instance, Widget widget,
300 324
301 /* update a popup menu, pulldown menu or a menubar */ 325 /* update a popup menu, pulldown menu or a menubar */
302static Boolean 326static Boolean
303all_dashes_p (char* s) 327all_dashes_p (s)
328 char* s;
304{ 329{
305 char* t; 330 char* t;
306 for (t = s; *t; t++) 331 for (t = s; *t; t++)
@@ -310,8 +335,10 @@ all_dashes_p (char* s)
310} 335}
311 336
312static void 337static void
313make_menu_in_widget (widget_instance* instance, Widget widget, 338make_menu_in_widget (instance, widget, val)
314 widget_value* val) 339 widget_instance* instance;
340 Widget widget;
341 widget_value* val;
315{ 342{
316 Widget* children = 0; 343 Widget* children = 0;
317 int num_children; 344 int num_children;
@@ -403,8 +430,11 @@ make_menu_in_widget (widget_instance* instance, Widget widget,
403} 430}
404 431
405static void 432static void
406update_one_menu_entry (widget_instance* instance, Widget widget, 433update_one_menu_entry (instance, widget, val, deep_p)
407 widget_value* val, Boolean deep_p) 434 widget_instance* instance;
435 Widget widget;
436 widget_value* val;
437 Boolean deep_p;
408{ 438{
409 Arg al [256]; 439 Arg al [256];
410 int ac; 440 int ac;
@@ -456,8 +486,11 @@ update_one_menu_entry (widget_instance* instance, Widget widget,
456} 486}
457 487
458static void 488static void
459xm_update_menu (widget_instance* instance, Widget widget, widget_value* val, 489xm_update_menu (instance, widget, val, deep_p)
460 Boolean deep_p) 490 widget_instance* instance;
491 Widget widget;
492 widget_value* val;
493 Boolean deep_p;
461{ 494{
462 /* Widget is a RowColumn widget whose contents have to be updated 495 /* Widget is a RowColumn widget whose contents have to be updated
463 * to reflect the list of items in val->contents */ 496 * to reflect the list of items in val->contents */
@@ -498,7 +531,10 @@ xm_update_menu (widget_instance* instance, Widget widget, widget_value* val,
498/* update text widgets */ 531/* update text widgets */
499 532
500static void 533static void
501xm_update_text (widget_instance* instance, Widget widget, widget_value* val) 534xm_update_text (instance, widget, val)
535 widget_instance* instance;
536 Widget widget;
537 widget_value* val;
502{ 538{
503 XmTextSetString (widget, val->value ? val->value : ""); 539 XmTextSetString (widget, val->value ? val->value : "");
504 XtRemoveAllCallbacks (widget, XmNactivateCallback); 540 XtRemoveAllCallbacks (widget, XmNactivateCallback);
@@ -509,8 +545,10 @@ xm_update_text (widget_instance* instance, Widget widget, widget_value* val)
509} 545}
510 546
511static void 547static void
512xm_update_text_field (widget_instance* instance, Widget widget, 548xm_update_text_field (instance, widget, val)
513 widget_value* val) 549 widget_instance* instance;
550 Widget widget;
551 widget_value* val;
514{ 552{
515 XmTextFieldSetString (widget, val->value ? val->value : ""); 553 XmTextFieldSetString (widget, val->value ? val->value : "");
516 XtRemoveAllCallbacks (widget, XmNactivateCallback); 554 XtRemoveAllCallbacks (widget, XmNactivateCallback);
@@ -524,8 +562,11 @@ xm_update_text_field (widget_instance* instance, Widget widget,
524/* update a motif widget */ 562/* update a motif widget */
525 563
526void 564void
527xm_update_one_widget (widget_instance* instance, Widget widget, 565xm_update_one_widget (instance, widget, val, deep_p)
528 widget_value* val, Boolean deep_p) 566 widget_instance* instance;
567 Widget widget;
568 widget_value* val;
569 Boolean deep_p;
529{ 570{
530 WidgetClass class; 571 WidgetClass class;
531 572
@@ -588,8 +629,10 @@ xm_update_one_widget (widget_instance* instance, Widget widget,
588 629
589 /* getting the value back */ 630 /* getting the value back */
590void 631void
591xm_update_one_value (widget_instance* instance, Widget widget, 632xm_update_one_value (instance, widget, val)
592 widget_value* val) 633 widget_instance* instance;
634 Widget widget;
635 widget_value* val;
593{ 636{
594 WidgetClass class = XtClass (widget); 637 WidgetClass class = XtClass (widget);
595 widget_value *old_wv; 638 widget_value *old_wv;
@@ -695,10 +738,18 @@ activate_button (Widget widget, XtPointer closure, XtPointer call_data)
695 738
696/* dialogs */ 739/* dialogs */
697static Widget 740static Widget
698make_dialog (char* name, Widget parent, Boolean pop_up_p, 741make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot,
699 char* shell_title, char* icon_name, Boolean text_input_slot, 742 radio_box, list, left_buttons, right_buttons)
700 Boolean radio_box, Boolean list, 743 char* name;
701 int left_buttons, int right_buttons) 744 Widget parent;
745 Boolean pop_up_p;
746 char* shell_title;
747 char* icon_name;
748 Boolean text_input_slot;
749 Boolean radio_box;
750 Boolean list;
751 int left_buttons;
752 int right_buttons;
702{ 753{
703 Widget result; 754 Widget result;
704 Widget form; 755 Widget form;
@@ -946,7 +997,8 @@ make_dialog (char* name, Widget parent, Boolean pop_up_p,
946} 997}
947 998
948static destroyed_instance* 999static destroyed_instance*
949find_matching_instance (widget_instance* instance) 1000find_matching_instance (instance)
1001 widget_instance* instance;
950{ 1002{
951 destroyed_instance* cur; 1003 destroyed_instance* cur;
952 destroyed_instance* prev; 1004 destroyed_instance* prev;
@@ -983,15 +1035,18 @@ find_matching_instance (widget_instance* instance)
983} 1035}
984 1036
985static void 1037static void
986mark_dead_instance_destroyed (Widget widget, XtPointer closure, 1038mark_dead_instance_destroyed (widget, closure, call_data)
987 XtPointer call_data) 1039 Widget widget;
1040 XtPointer closure;
1041 XtPointer call_data;
988{ 1042{
989 destroyed_instance* instance = (destroyed_instance*)closure; 1043 destroyed_instance* instance = (destroyed_instance*)closure;
990 instance->widget = NULL; 1044 instance->widget = NULL;
991} 1045}
992 1046
993static void 1047static void
994recenter_widget (Widget widget) 1048recenter_widget (widget)
1049 Widget widget;
995{ 1050{
996 Widget parent = XtParent (widget); 1051 Widget parent = XtParent (widget);
997 Screen* screen = XtScreen (widget); 1052 Screen* screen = XtScreen (widget);
@@ -1027,7 +1082,8 @@ recenter_widget (Widget widget)
1027} 1082}
1028 1083
1029static Widget 1084static Widget
1030recycle_instance (destroyed_instance* instance) 1085recycle_instance (instance)
1086 destroyed_instance* instance;
1031{ 1087{
1032 Widget widget = instance->widget; 1088 Widget widget = instance->widget;
1033 1089
@@ -1063,7 +1119,8 @@ recycle_instance (destroyed_instance* instance)
1063} 1119}
1064 1120
1065Widget 1121Widget
1066xm_create_dialog (widget_instance* instance) 1122xm_create_dialog (instance)
1123 widget_instance* instance;
1067{ 1124{
1068 char* name = instance->info->type; 1125 char* name = instance->info->type;
1069 Widget parent = instance->parent; 1126 Widget parent = instance->parent;
@@ -1139,20 +1196,25 @@ xm_create_dialog (widget_instance* instance)
1139} 1196}
1140 1197
1141static Widget 1198static Widget
1142make_menubar (widget_instance* instance) 1199make_menubar (instance)
1200 widget_instance* instance;
1143{ 1201{
1144 return XmCreateMenuBar (instance->parent, instance->info->name, NULL, 0); 1202 return XmCreateMenuBar (instance->parent, instance->info->name, NULL, 0);
1145} 1203}
1146 1204
1147static void 1205static void
1148remove_grabs (Widget shell, XtPointer closure, XtPointer call_data) 1206remove_grabs (shell, closure, call_data)
1207 Widget shell;
1208 XtPointer closure;
1209 XtPointer call_data;
1149{ 1210{
1150 Widget menu = (Widget) closure; 1211 Widget menu = (Widget) closure;
1151 XmRemoveFromPostFromList (menu, XtParent (XtParent (menu))); 1212 XmRemoveFromPostFromList (menu, XtParent (XtParent (menu)));
1152} 1213}
1153 1214
1154static Widget 1215static Widget
1155make_popup_menu (widget_instance* instance) 1216make_popup_menu (instance)
1217 widget_instance* instance;
1156{ 1218{
1157 Widget parent = instance->parent; 1219 Widget parent = instance->parent;
1158 Window parent_window = parent->core.window; 1220 Window parent_window = parent->core.window;
@@ -1167,7 +1229,8 @@ make_popup_menu (widget_instance* instance)
1167 return result; 1229 return result;
1168} 1230}
1169static Widget 1231static Widget
1170make_main (widget_instance* instance) 1232make_main (instance)
1233 widget_instance* instance;
1171{ 1234{
1172 Widget parent = instance->parent; 1235 Widget parent = instance->parent;
1173 Widget result; 1236 Widget result;
@@ -1306,7 +1369,8 @@ xm_creation_table [] =
1306 1369
1307 /* Destruction of instances */ 1370 /* Destruction of instances */
1308void 1371void
1309xm_destroy_instance (widget_instance* instance) 1372xm_destroy_instance (instance)
1373 widget_instance* instance;
1310{ 1374{
1311 Widget widget = instance->widget; 1375 Widget widget = instance->widget;
1312 /* recycle the dialog boxes */ 1376 /* recycle the dialog boxes */
@@ -1340,7 +1404,8 @@ xm_destroy_instance (widget_instance* instance)
1340 1404
1341 /* popup utility */ 1405 /* popup utility */
1342void 1406void
1343xm_popup_menu (Widget widget) 1407xm_popup_menu (widget)
1408 Widget widget;
1344{ 1409{
1345 XButtonPressedEvent dummy; 1410 XButtonPressedEvent dummy;
1346 XEvent* event; 1411 XEvent* event;
@@ -1376,7 +1441,8 @@ xm_popup_menu (Widget widget)
1376} 1441}
1377 1442
1378static void 1443static void
1379set_min_dialog_size (Widget w) 1444set_min_dialog_size (w)
1445 Widget w;
1380{ 1446{
1381 short width; 1447 short width;
1382 short height; 1448 short height;
@@ -1385,7 +1451,9 @@ set_min_dialog_size (Widget w)
1385} 1451}
1386 1452
1387void 1453void
1388xm_pop_instance (widget_instance* instance, Boolean up) 1454xm_pop_instance (instance, up)
1455 widget_instance* instance;
1456 Boolean up;
1389{ 1457{
1390 Widget widget = instance->widget; 1458 Widget widget = instance->widget;
1391 1459
@@ -1416,7 +1484,10 @@ xm_pop_instance (widget_instance* instance, Boolean up)
1416enum do_call_type { pre_activate, selection, no_selection, post_activate }; 1484enum do_call_type { pre_activate, selection, no_selection, post_activate };
1417 1485
1418static void 1486static void
1419do_call (Widget widget, XtPointer closure, enum do_call_type type) 1487do_call (widget, closure, type)
1488 Widget widget;
1489 XtPointer closure;
1490 enum do_call_type type;
1420{ 1491{
1421 Arg al [256]; 1492 Arg al [256];
1422 int ac; 1493 int ac;
@@ -1468,8 +1539,10 @@ do_call (Widget widget, XtPointer closure, enum do_call_type type)
1468 if the widget was ``destroyed'' by caching it in the all_destroyed_instances 1539 if the widget was ``destroyed'' by caching it in the all_destroyed_instances
1469 list */ 1540 list */
1470static void 1541static void
1471xm_internal_update_other_instances (Widget widget, XtPointer closure, 1542xm_internal_update_other_instances (widget, closure, call_data)
1472 XtPointer call_data) 1543 Widget widget;
1544 XtPointer closure;
1545 XtPointer call_data;
1473{ 1546{
1474 Widget parent; 1547 Widget parent;
1475 for (parent = widget; parent; parent = XtParent (parent)) 1548 for (parent = widget; parent; parent = XtParent (parent))
@@ -1481,14 +1554,20 @@ xm_internal_update_other_instances (Widget widget, XtPointer closure,
1481} 1554}
1482 1555
1483static void 1556static void
1484xm_generic_callback (Widget widget, XtPointer closure, XtPointer call_data) 1557xm_generic_callback (widget, closure, call_data)
1558 Widget widget;
1559 XtPointer closure;
1560 XtPointer call_data;
1485{ 1561{
1486 lw_internal_update_other_instances (widget, closure, call_data); 1562 lw_internal_update_other_instances (widget, closure, call_data);
1487 do_call (widget, closure, selection); 1563 do_call (widget, closure, selection);
1488} 1564}
1489 1565
1490static void 1566static void
1491xm_nosel_callback (Widget widget, XtPointer closure, XtPointer call_data) 1567xm_nosel_callback (widget, closure, call_data)
1568 Widget widget;
1569 XtPointer closure;
1570 XtPointer call_data;
1492{ 1571{
1493 /* This callback is only called when a dialog box is dismissed with the wm's 1572 /* This callback is only called when a dialog box is dismissed with the wm's
1494 destroy button (WM_DELETE_WINDOW.) We want the dialog box to be destroyed 1573 destroy button (WM_DELETE_WINDOW.) We want the dialog box to be destroyed
@@ -1503,24 +1582,33 @@ xm_nosel_callback (Widget widget, XtPointer closure, XtPointer call_data)
1503} 1582}
1504 1583
1505static void 1584static void
1506xm_pull_down_callback (Widget widget, XtPointer closure, XtPointer call_data) 1585xm_pull_down_callback (widget, closure, call_data)
1586 Widget widget;
1587 XtPointer closure;
1588 XtPointer call_data;
1507{ 1589{
1508 do_call (widget, closure, pre_activate); 1590 do_call (widget, closure, pre_activate);
1509} 1591}
1510 1592
1511static void 1593static void
1512xm_pop_down_callback (Widget widget, XtPointer closure, XtPointer call_data) 1594xm_pop_down_callback (widget, closure, call_data)
1595 Widget widget;
1596 XtPointer closure;
1597 XtPointer call_data;
1513{ 1598{
1514 widget_instance *instance = (widget_instance *) closure; 1599 widget_instance *instance = (widget_instance *) closure;
1515 1600
1516 if (!instance->pop_up_p || (XtParent (widget) == instance->parent)) 1601 if ((!instance->pop_up_p && (XtParent (widget) == instance->widget))
1602 || (XtParent (widget) == instance->parent))
1517 do_call (widget, closure, post_activate); 1603 do_call (widget, closure, post_activate);
1518} 1604}
1519 1605
1520 1606
1521/* set the keyboard focus */ 1607/* set the keyboard focus */
1522void 1608void
1523xm_set_keyboard_focus (Widget parent, Widget w) 1609xm_set_keyboard_focus (parent, w)
1610 Widget parent;
1611 Widget w;
1524{ 1612{
1525 XmProcessTraversal (w, 0); 1613 XmProcessTraversal (w, 0);
1526 XtSetKeyboardFocus (parent, w); 1614 XtSetKeyboardFocus (parent, w);