You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
#ifdef NeXT
#undef __STRICT_BSD__ /* ick */
#include "lwlib-utils.h"
#include <X11/StringDefs.h>
+#ifdef __osf__
+#include <string.h>
+#include <stdlib.h>
+extern long *xmalloc();
+#endif
+
#if defined (USE_LUCID)
#include "lwlib-Xlw.h"
#endif
static widget_info*
all_widget_info = NULL;
+#ifdef USE_MOTIF
+char *lwlib_toolkit_type = "motif";
+#else
+char *lwlib_toolkit_type = "lucid";
+#endif
\f/* Forward declarations */
static void
-instanciate_widget_instance (/* widget_instance* instance */);
+instantiate_widget_instance (/* widget_instance* instance */);
lwlib_memset (address, value, length)
char *address;
return wv;
}
-/* this is analagous to free(). It frees only what was allocated
+/* this is analogous to free(). It frees only what was allocated
by malloc_widget_value(), and no substructures.
*/
void
if (wv->toolkit_data && wv->free_toolkit_data)
{
- free (wv->toolkit_data);
+ XtFree (wv->toolkit_data);
wv->toolkit_data = (void *) 0xDEADBEEF;
}
copy->selected = val->selected;
copy->edited = False;
copy->change = change;
+ copy->this_one_change = change;
copy->contents = copy_widget_value_tree (val->contents, change);
copy->call_data = val->call_data;
copy->next = copy_widget_value_tree (val->next, change);
instance->next = info->instances;
info->instances = instance;
- instanciate_widget_instance (instance);
+ instantiate_widget_instance (instance);
XtAddCallback (instance->widget, XtNdestroyCallback,
mark_widget_destroyed, (XtPointer)instance);
widget_value* val2;
int level;
{
- change_type change;
+ change_type change, this_one_change;
widget_value* merged_next;
widget_value* merged_contents;
if (val1->contents && !merged_contents)
{
- EXPLAIN (val1->name, change, INVISIBLE_CHANGE, "(contents gone)",
+ /* This used to say INVISIBLE_CHANGE,
+ but it is visible and vitally important when
+ the contents of the menu bar itself are entirely deleted.
+
+ But maybe it doesn't matter. This fails to fix the bug. */
+ EXPLAIN (val1->name, change, STRUCTURAL_CHANGE, "(contents gone)",
0, 0);
- change = max (change, INVISIBLE_CHANGE);
+ change = max (change, STRUCTURAL_CHANGE);
}
else if (merged_contents && merged_contents->change != NO_CHANGE)
{
EXPLAIN (val1->name, change, INVISIBLE_CHANGE, "(contents change)",
0, 0);
change = max (change, INVISIBLE_CHANGE);
+#if 0 /* This was replaced by the August 9 1996 change in lwlib-Xm.c. */
+#ifdef USE_MOTIF
+ change = max (merged_contents->change, change);
+#endif
+#endif
}
val1->contents = merged_contents;
}
+ this_one_change = change;
+
merged_next = merge_widget_value (val1->next, val2->next, level);
if (val1->next && !merged_next)
val1->next = merged_next;
+ val1->this_one_change = this_one_change;
val1->change = change;
if (change > NO_CHANGE && val1->toolkit_data)
{
if (val1->free_toolkit_data)
- free (val1->toolkit_data);
+ XtFree (val1->toolkit_data);
val1->toolkit_data = NULL;
}
}
static void
-instanciate_widget_instance (instance)
+instantiate_widget_instance (instance)
widget_instance* instance;
{
widget_creation_function function = NULL;
}
#ifdef USE_MOTIF
-extern Widget first_child (Widget); /* garbage */
+extern Widget first_child (/* Widget */); /* garbage */
#endif
Widget
}
void
-lw_popup_menu (widget)
+lw_popup_menu (widget, event)
Widget widget;
+ XEvent *event;
{
#if defined (USE_LUCID)
if (lw_lucid_widget_p (widget))
- xlw_popup_menu (widget);
+ xlw_popup_menu (widget, event);
#endif
#if defined (USE_MOTIF)
if (lw_motif_widget_p (widget))
- xm_popup_menu (widget);
+ xm_popup_menu (widget, event);
#endif
#if defined (USE_OLIT)
if (lw_olit_widget_p (widget))
- xol_popup_menu (widget);
+ xol_popup_menu (widget, event);
#endif
#if defined (USE_XAW)
if (lw_xaw_widget_p (widget))
- xaw_popup_menu (widget);
+ xaw_popup_menu (widget, event);
#endif
}
}
\f/* update other instances value when one thing changed */
+
+/* To forbid recursive calls */
+static Boolean lwlib_updating;
+
/* This function can be used as a an XtCallback for the widgets that get
modified to update other instances of the widgets. Closure should be the
widget_instance. */
XtPointer closure;
XtPointer call_data;
{
- /* To forbid recursive calls */
- static Boolean updating;
-
widget_instance* instance = (widget_instance*)closure;
char* name = XtName (widget);
widget_info* info;
widget_instance* cur;
widget_value* val;
- /* never recurse as this could cause infinite recursions. */
- if (updating)
+ /* Avoid possibly infinite recursion. */
+ if (lwlib_updating)
return;
/* protect against the widget being destroyed */
if (!info->instances->next)
return;
- updating = True;
+ lwlib_updating = True;
for (val = info->val; val && strcmp (val->name, name); val = val->next);
if (cur != instance)
set_one_value (cur, val, True);
- updating = False;
+ lwlib_updating = False;
}
#endif
#if defined (USE_MOTIF)
if (doit)
- XtUnmanageChild (w);
- else
XtManageChild (w);
+ else
+ XtUnmanageChild (w);
#endif
}
&& XtWindow (menubar_widget) == win;
#endif
#if defined (USE_MOTIF)
- && XtWindowToWidget (XtDisplay (menubar_widget), win)
- && (XtParent (XtWindowToWidget (XtDisplay (menubar_widget), win))
- == menubar_widget);
+ && ((XtWindow (menubar_widget) == win)
+ || (XtWindowToWidget (XtDisplay (menubar_widget), win)
+ && (XtParent (XtWindowToWidget (XtDisplay (menubar_widget), win))
+ == menubar_widget)));
#endif
}