From 5b7d36d143a6874439fa143ae93dc071f0b77275 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 15 Apr 2011 18:36:46 -0700 Subject: * xlwmenu.c (XlwMenuSetValues): Rename/ move locals to avoid shadowing. --- lwlib/ChangeLog | 4 ++++ lwlib/xlwmenu.c | 36 ++++++++++++++++++------------------ 2 files changed, 22 insertions(+), 18 deletions(-) (limited to 'lwlib') diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index 64ae2fe085d..f083f64990a 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog @@ -1,3 +1,7 @@ +2011-04-16 Paul Eggert + + * xlwmenu.c (XlwMenuSetValues): Rename/ move locals to avoid shadowing. + 2011-03-07 Chong Yidong * Version 23.3 released. diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c index 5b97f2bf999..507d1f168af 100644 --- a/lwlib/xlwmenu.c +++ b/lwlib/xlwmenu.c @@ -1220,9 +1220,9 @@ display_menu (XlwMenuWidget mw, { if (val->enabled) *hit_return = val; - else + else no_return = 1; - if (mw->menu.inside_entry != val) + if (mw->menu.inside_entry != val) { if (mw->menu.inside_entry) XtCallCallbackList ((Widget)mw, mw->menu.leave, @@ -1426,7 +1426,7 @@ fit_to_screen (XlwMenuWidget mw, static void create_pixmap_for_menu (window_state* ws, XlwMenuWidget mw) { - if (ws->pixmap != None) + if (ws->pixmap != None) { XFreePixmap (XtDisplay (ws->w), ws->pixmap); ws->pixmap = None; @@ -1592,9 +1592,9 @@ map_event_to_widget_value (XlwMenuWidget mw, } } - if (!inside) + if (!inside) { - if (mw->menu.inside_entry != NULL) + if (mw->menu.inside_entry != NULL) XtCallCallbackList ((Widget)mw, mw->menu.leave, (XtPointer) mw->menu.inside_entry); mw->menu.inside_entry = NULL; @@ -1881,7 +1881,7 @@ openXftFont (XlwMenuWidget mw) if (!mw->menu.font) { mw->menu.xft_font = XftFontOpenName (XtDisplay (mw), screen, fname); - if (!mw->menu.xft_font) + if (!mw->menu.xft_font) { fprintf (stderr, "Can't find font '%s'\n", fname); mw->menu.xft_font = getDefaultXftFont (mw); @@ -1930,19 +1930,19 @@ XlwMenuInitialize (Widget request, Widget w, ArgList args, Cardinal *num_args) if (!mw->menu.font) { mw->menu.font = XLoadQueryFont (display, "fixed"); - if (!mw->menu.font) + if (!mw->menu.font) { fprintf (stderr, "Menu font fixed not found, can't continue.\n"); abort (); } } } - + #ifdef HAVE_X_I18N if (mw->menu.fontSet) mw->menu.font_extents = XExtentsOfFontSet (mw->menu.fontSet); #endif - + make_drawing_gcs (mw); make_shadow_gcs (mw); @@ -2118,12 +2118,12 @@ XlwMenuDestroy (Widget w) XftFontClose (XtDisplay (mw), mw->menu.xft_font); #endif - if (mw->menu.windows [0].pixmap != None) + if (mw->menu.windows [0].pixmap != None) XFreePixmap (XtDisplay (mw), mw->menu.windows [0].pixmap); /* start from 1 because the one in slot 0 is w->core.window */ for (i = 1; i < mw->menu.windows_length; i++) { - if (mw->menu.windows [i].pixmap != None) + if (mw->menu.windows [i].pixmap != None) XFreePixmap (XtDisplay (mw), mw->menu.windows [i].pixmap); #ifdef HAVE_XFT if (mw->menu.windows [i].xft_draw) @@ -2153,18 +2153,17 @@ XlwMenuSetValues (Widget current, Widget request, Widget new, { XlwMenuWidget oldmw = (XlwMenuWidget)current; XlwMenuWidget newmw = (XlwMenuWidget)new; - Boolean redisplay = False; - int i; + Boolean do_redisplay = False; if (newmw->menu.contents && newmw->menu.contents->contents && newmw->menu.contents->contents->change >= VISIBLE_CHANGE) - redisplay = True; + do_redisplay = True; /* Do redisplay if the contents are entirely eliminated. */ if (newmw->menu.contents && newmw->menu.contents->contents == 0 && newmw->menu.contents->change >= VISIBLE_CHANGE) - redisplay = True; + do_redisplay = True; if (newmw->core.background_pixel != oldmw->core.background_pixel || newmw->menu.foreground != oldmw->menu.foreground @@ -2179,6 +2178,7 @@ XlwMenuSetValues (Widget current, Widget request, Widget new, #endif ) { + int i; release_drawing_gcs (newmw); make_drawing_gcs (newmw); @@ -2188,7 +2188,7 @@ XlwMenuSetValues (Widget current, Widget request, Widget new, newmw->menu.bottom_shadow_color = -1; make_shadow_gcs (newmw); - redisplay = True; + do_redisplay = True; if (XtIsRealized (current)) /* If the menu is currently displayed, change the display. */ @@ -2229,12 +2229,12 @@ XlwMenuSetValues (Widget current, Widget request, Widget new, #ifdef HAVE_X_I18N if (newmw->menu.fontSet != oldmw->menu.fontSet && newmw->menu.fontSet != NULL) { - redisplay = True; + do_redisplay = True; newmw->menu.font_extents = XExtentsOfFontSet (newmw->menu.fontSet); } #endif - return redisplay; + return do_redisplay; } static void -- cgit v1.2.1 From 1fbb4609138cca32a9bac72561f63f22b0f26469 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 15 Apr 2011 18:38:14 -0700 Subject: * xlwmenu.c (MINL): Define only if not emacs. --- lwlib/ChangeLog | 1 + lwlib/xlwmenu.c | 2 ++ 2 files changed, 3 insertions(+) (limited to 'lwlib') diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index f083f64990a..f098b6d0ad6 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog @@ -1,6 +1,7 @@ 2011-04-16 Paul Eggert * xlwmenu.c (XlwMenuSetValues): Rename/ move locals to avoid shadowing. + (MINL): Define only if not emacs. 2011-03-07 Chong Yidong diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c index 507d1f168af..e9ec604ae7f 100644 --- a/lwlib/xlwmenu.c +++ b/lwlib/xlwmenu.c @@ -1693,8 +1693,10 @@ release_drawing_gcs (XlwMenuWidget mw) mw->menu.background_gc = (GC) -1; } +#ifndef emacs #define MINL(x,y) ((((unsigned long) (x)) < ((unsigned long) (y))) \ ? ((unsigned long) (x)) : ((unsigned long) (y))) +#endif static void make_shadow_gcs (XlwMenuWidget mw) -- cgit v1.2.1 From 4d511c40f437adec6b8a635fe717605c1354f49c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 15 Apr 2011 18:41:12 -0700 Subject: * lwlib-utils.h, lwlib-utils.c (XtSafelyDestroyWidget): Remove; unused. --- lwlib/ChangeLog | 2 ++ lwlib/lwlib-utils.c | 26 -------------------------- lwlib/lwlib-utils.h | 3 --- 3 files changed, 2 insertions(+), 29 deletions(-) (limited to 'lwlib') diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index f098b6d0ad6..d6a76a96471 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog @@ -1,5 +1,7 @@ 2011-04-16 Paul Eggert + * lwlib-utils.h, lwlib-utils.c (XtSafelyDestroyWidget): Remove; unused. + * xlwmenu.c (XlwMenuSetValues): Rename/ move locals to avoid shadowing. (MINL): Define only if not emacs. diff --git a/lwlib/lwlib-utils.c b/lwlib/lwlib-utils.c index a3e1cb3b432..c590270a2af 100644 --- a/lwlib/lwlib-utils.c +++ b/lwlib/lwlib-utils.c @@ -141,29 +141,3 @@ XtWidgetBeingDestroyedP (Widget widget) { return widget->core.being_destroyed; } - -void -XtSafelyDestroyWidget (Widget widget) -{ -#if 0 - - /* this requires IntrinsicI.h (actually, InitialI.h) */ - - XtAppContext app = XtWidgetToApplicationContext(widget); - - if (app->dispatch_level == 0) - { - app->dispatch_level = 1; - XtDestroyWidget (widget); - /* generates an event so that the event loop will be called */ - XChangeProperty (XtDisplay (widget), XtWindow (widget), - XA_STRING, XA_STRING, 32, PropModeAppend, NULL, 0); - app->dispatch_level = 0; - } - else - XtDestroyWidget (widget); - -#else - abort (); -#endif -} diff --git a/lwlib/lwlib-utils.h b/lwlib/lwlib-utils.h index b988374288a..ec3daab94ef 100644 --- a/lwlib/lwlib-utils.h +++ b/lwlib/lwlib-utils.h @@ -15,7 +15,4 @@ Widget *XtCompositeChildren (Widget, unsigned int *); Boolean XtWidgetBeingDestroyedP (Widget widget); -void XtSafelyDestroyWidget (Widget); - #endif /* _LWLIB_UTILS_H_ */ - -- cgit v1.2.1 From 9ac71959cbb35dd0e24001ea11e2d89db08f099c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 15 Apr 2011 18:42:03 -0700 Subject: * lwlib.c (EXPLAIN, destroy_one_instance): Avoid "else;". --- lwlib/ChangeLog | 2 ++ lwlib/lwlib.c | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'lwlib') diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index d6a76a96471..cea02d79993 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog @@ -1,5 +1,7 @@ 2011-04-16 Paul Eggert + * lwlib.c (EXPLAIN, destroy_one_instance): Avoid "else;". + * lwlib-utils.h, lwlib-utils.c (XtSafelyDestroyWidget): Remove; unused. * xlwmenu.c (XlwMenuSetValues): Rename/ move locals to avoid shadowing. diff --git a/lwlib/lwlib.c b/lwlib/lwlib.c index 290ce091301..90461c0ba51 100644 --- a/lwlib/lwlib.c +++ b/lwlib/lwlib.c @@ -422,7 +422,7 @@ safe_strcmp (const char *s1, const char *s2) (nc == STRUCTURAL_CHANGE ? "structural" : "???")))), \ nc, desc, a1, a2) #else -# define EXPLAIN(name, oc, nc, desc, a1, a2) +# define EXPLAIN(name, oc, nc, desc, a1, a2) ((void) 0) #endif @@ -912,8 +912,9 @@ destroy_one_instance (widget_instance *instance) xaw_destroy_instance (instance); else #endif - /* do not remove the empty statement */ - ; + { + /* Empty compound statement to terminate if-then-else chain. */ + } } free_widget_instance (instance); -- cgit v1.2.1 From 748945cc8b8c7898e922f0e658f60dc4994e43ef Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 16 Apr 2011 09:42:58 -0700 Subject: * lwlib.c (first_child) [USE_MOTIF]: Protoize. --- lwlib/ChangeLog | 1 + lwlib/lwlib.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'lwlib') diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index cea02d79993..8476547ce61 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog @@ -1,6 +1,7 @@ 2011-04-16 Paul Eggert * lwlib.c (EXPLAIN, destroy_one_instance): Avoid "else;". + (first_child) [USE_MOTIF]: Protoize. * lwlib-utils.h, lwlib-utils.c (XtSafelyDestroyWidget): Remove; unused. diff --git a/lwlib/lwlib.c b/lwlib/lwlib.c index 90461c0ba51..9d8ec3330d3 100644 --- a/lwlib/lwlib.c +++ b/lwlib/lwlib.c @@ -979,7 +979,7 @@ lw_destroy_all_pop_ups (void) } #ifdef USE_MOTIF -extern Widget first_child (/* Widget */); /* garbage */ +extern Widget first_child (Widget); /* garbage */ #endif Widget -- cgit v1.2.1 From 5c5e6a401e4a857aa8747111438797d88641dfef Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 16 Apr 2011 14:22:40 -0700 Subject: * lwlib-Xm.c (make_dialog): Rename local to avoid shadowing. (make_menu_in_widget): Add cast to avoid warning. --- lwlib/ChangeLog | 3 +++ lwlib/lwlib-Xm.c | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'lwlib') diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index 8476547ce61..fd9b10d243c 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog @@ -1,5 +1,8 @@ 2011-04-16 Paul Eggert + * lwlib-Xm.c (make_dialog): Rename local to avoid shadowing. + (make_menu_in_widget): Add cast to avoid warning. + * lwlib.c (EXPLAIN, destroy_one_instance): Avoid "else;". (first_child) [USE_MOTIF]: Protoize. diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c index 55b27b9dab0..2b7677a02f5 100644 --- a/lwlib/lwlib-Xm.c +++ b/lwlib/lwlib-Xm.c @@ -511,7 +511,7 @@ make_menu_in_widget (widget_instance* instance, /* Allocate the children array */ for (num_children = 0, cur = val; cur; num_children++, cur = cur->next) ; - children = (Widget*)XtMalloc (num_children * sizeof (Widget)); + children = (Widget*)(void*)XtMalloc (num_children * sizeof (Widget)); /* WIDGET should be a RowColumn. */ if (!XmIsRowColumn (widget)) @@ -1020,10 +1020,10 @@ dialog_key_cb (Widget widget, { KeySym sym = 0; Modifiers modif_ret; - + XtTranslateKeycode (event->xkey.display, event->xkey.keycode, 0, &modif_ret, &sym); - + if (sym == osfXK_Cancel) { Widget w = *((Widget *) closure); @@ -1055,7 +1055,7 @@ make_dialog (char* name, Widget row; Widget icon; Widget icon_separator; - Widget message; + Widget message_label; Widget value = 0; Widget separator; Widget button = 0; @@ -1269,7 +1269,7 @@ make_dialog (char* name, XtSetArg(al[ac], XmNleftWidget, icon); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, 13); ac++; - message = XmCreateLabel (form, "message", al, ac); + message_label = XmCreateLabel (form, "message", al, ac); if (list) XtManageChild (value); @@ -1281,7 +1281,7 @@ make_dialog (char* name, { children [i] = value; i++; } - children [i] = message; i++; + children [i] = message_label; i++; children [i] = icon; i++; children [i] = icon_separator; i++; XtManageChildren (children, i); -- cgit v1.2.1 From b165261a478678b338c6cac70af59b8d16651c1e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 16 Apr 2011 14:23:30 -0700 Subject: * lwlib-utils.c (XtCompositeChildren): Likewise. --- lwlib/ChangeLog | 1 + lwlib/lwlib-utils.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'lwlib') diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index fd9b10d243c..91f79536a42 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog @@ -2,6 +2,7 @@ * lwlib-Xm.c (make_dialog): Rename local to avoid shadowing. (make_menu_in_widget): Add cast to avoid warning. + * lwlib-utils.c (XtCompositeChildren): Likewise. * lwlib.c (EXPLAIN, destroy_one_instance): Avoid "else;". (first_child) [USE_MOTIF]: Protoize. diff --git a/lwlib/lwlib-utils.c b/lwlib/lwlib-utils.c index c590270a2af..7a0dd1b264a 100644 --- a/lwlib/lwlib-utils.c +++ b/lwlib/lwlib-utils.c @@ -129,7 +129,7 @@ XtCompositeChildren (Widget widget, unsigned int *number) return NULL; } n = cw->composite.num_children; - result = (Widget*)XtMalloc (n * sizeof (Widget)); + result = (Widget*)(void*)XtMalloc (n * sizeof (Widget)); *number = n; for (i = 0; i < n; i++) result [i] = cw->composite.children [i]; -- cgit v1.2.1