/* scrollbar implementation -- X interface.
Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
- Copyright (C) 1994 Amdhal Corporation.
+ Copyright (C) 1994 Amdahl Corporation.
Copyright (C) 1995 Sun Microsystems, Inc.
Copyright (C) 1995 Darrell Kindred <dkindred+@cmu.edu>.
/* Synched up with: Not in FSF. */
+/* This file Mule-ized (more like Mule-verified) by Ben Wing, 7-8-00. */
+
#include <config.h>
#include "lisp.h"
#include "console-x.h"
-#include "glyphs-x.h"
#include "EmacsFrame.h"
-#include "EmacsManager.h"
+#include "glyphs-x.h"
#include "gui-x.h"
#include "scrollbar-x.h"
static void
x_free_scrollbar_instance (struct scrollbar_instance *instance)
{
- if (SCROLLBAR_X_NAME (instance))
- xfree (SCROLLBAR_X_NAME (instance));
-
- if (SCROLLBAR_X_WIDGET (instance))
+ if (instance->scrollbar_data)
{
- if (XtIsManaged (SCROLLBAR_X_WIDGET (instance)))
- XtUnmanageChild (SCROLLBAR_X_WIDGET (instance));
+ if (SCROLLBAR_X_NAME (instance))
+ xfree (SCROLLBAR_X_NAME (instance));
- lw_destroy_all_widgets (SCROLLBAR_X_ID (instance));
- }
+ if (SCROLLBAR_X_WIDGET (instance))
+ {
+ if (XtIsManaged (SCROLLBAR_X_WIDGET (instance)))
+ XtUnmanageChild (SCROLLBAR_X_WIDGET (instance));
- if (instance->scrollbar_data)
- xfree (instance->scrollbar_data);
+ lw_destroy_all_widgets (SCROLLBAR_X_ID (instance));
+ }
+
+ xfree (instance->scrollbar_data);
+ }
}
/* A device method. */
wv->scrollbar_data = xnew (scrollbar_values);
wv->name = SCROLLBAR_X_NAME (instance);
+ wv->name = xstrdup (wv->name);
wv->value = 0;
wv->key = 0;
wv->enabled = instance->scrollbar_is_active;
}
}
- if (!wv->scrollbar_data) abort ();
- xfree (wv->scrollbar_data);
- wv->scrollbar_data = 0;
- free_widget_value (wv);
+ if (!wv->scrollbar_data) ABORT ();
+ free_widget_value_tree (wv);
}
else if (managed)
{
}
break;
default:
- abort ();
+ ABORT ();
}
}
return;
mirror = find_scrollbar_window_mirror (f, id);
+ if (!mirror)
+ return;
+
win = real_window (mirror, 1);
if (NILP (win))
return;
mirror = find_scrollbar_window_mirror (f, id);
+ if (!mirror)
+ return;
+
win = real_window (mirror, 1);
if (NILP (win))
0, (Window) NULL);
}
-/* Called directly from x_any_window_to_frame in frame-x.c */
-EMACS_INT
-x_window_is_scrollbar (struct frame *f, Window win)
-{
- if (!FRAME_X_P (f))
- return 0;
-
- if (f->mirror_dirty)
- update_frame_window_mirror (f);
- return (EMACS_INT) x_scrollbar_loop (X_WINDOW_IS_SCROLLBAR, f->root_window,
- f->root_mirror, 0, win);
-}
-
/* Make sure that all scrollbars on frame are up-to-date. Called
directly from x_set_frame_properties in frame-x.c*/
void
x_update_frame_scrollbars (struct frame *f)
{
- /* Consider this code to be "in_display" so that we abort() if Fsignal()
+ /* Consider this code to be "in_display" so that we ABORT() if Fsignal()
gets called. */
in_display++;
x_scrollbar_loop (X_UPDATE_FRAME_SCROLLBARS, f->root_window, f->root_mirror,
0, (Window) NULL);
in_display--;
- if (in_display < 0) abort ();
+ if (in_display < 0) ABORT ();
}
#ifdef MEMORY_USAGE_STATS
}
void
+reinit_vars_of_scrollbar_x (void)
+{
+ stupid_vertical_scrollbar_drag_hack = 1;
+}
+
+void
vars_of_scrollbar_x (void)
{
+ reinit_vars_of_scrollbar_x ();
+
#if defined (LWLIB_SCROLLBARS_LUCID)
Fprovide (intern ("lucid-scrollbars"));
#elif defined (LWLIB_SCROLLBARS_MOTIF)
#elif defined (LWLIB_SCROLLBARS_ATHENA)
Fprovide (intern ("athena-scrollbars"));
#endif
- stupid_vertical_scrollbar_drag_hack = 1;
}