X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/f5d0ac07d63bfce83dcf45045b4541fe7a1bca7c..3928f2b67e69cd22995558cc205a2fc6aa33d477:/lwlib/lwlib-Xaw.c diff --git a/lwlib/lwlib-Xaw.c b/lwlib/lwlib-Xaw.c index 14d85db428..9c9a007bc1 100644 --- a/lwlib/lwlib-Xaw.c +++ b/lwlib/lwlib-Xaw.c @@ -1,7 +1,7 @@ /* The lwlib interface to Athena widgets. + Copyright (C) 1993 Chuck Thompson -Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009 Free Software Foundation, Inc. +Copyright (C) 1994, 2001-2011 Free Software Foundation, Inc. This file is part of the Lucid Widget Library. @@ -25,8 +25,10 @@ Boston, MA 02110-1301, USA. */ #endif #include +#include +#include -#include "../src/lisp.h" +#include #include "lwlib-Xaw.h" @@ -53,111 +55,259 @@ Boston, MA 02110-1301, USA. */ #include -static void xaw_generic_callback (/*Widget, XtPointer, XtPointer*/); +#ifdef HAVE_XFT +#include + +struct widget_xft_data +{ + Widget widget; + XftFont *xft_font; + XftDraw *xft_draw; + XftColor xft_fg, xft_bg; + int p_width, p_height; + Pixmap p; +}; + + +#endif + +static void xaw_generic_callback (Widget widget, + XtPointer closure, + XtPointer call_data); Boolean -lw_xaw_widget_p (widget) - Widget widget; +lw_xaw_widget_p (Widget widget) { return (XtIsSubclass (widget, scrollbarWidgetClass) || XtIsSubclass (widget, dialogWidgetClass)); } -#if 0 + +#ifdef HAVE_XFT static void -xaw_update_scrollbar (instance, widget, val) - widget_instance *instance; - Widget widget; - widget_value *val; +fill_xft_data (struct widget_xft_data *data, Widget widget, XftFont *font) { - if (val->scrollbar_data) + Pixel bg, fg; + XColor colors[2]; + + data->widget = widget; + data->xft_font = font; + XtVaGetValues (widget, + XtNbackground, &bg, + XtNforeground, &fg, + NULL); + + colors[0].pixel = data->xft_fg.pixel = fg; + colors[1].pixel = data->xft_bg.pixel = bg; + XQueryColors (XtDisplay (widget), + DefaultColormapOfScreen (XtScreen (widget)), + colors, 2); + + data->xft_fg.color.alpha = 0xFFFF; + data->xft_fg.color.red = colors[0].red; + data->xft_fg.color.green = colors[0].green; + data->xft_fg.color.blue = colors[0].blue; + data->xft_bg.color.alpha = 0xFFFF; + data->xft_bg.color.red = colors[1].red; + data->xft_bg.color.green = colors[1].green; + data->xft_bg.color.blue = colors[1].blue; + + data->p = None; + data->xft_draw = 0; + data->p_width = data->p_height = 0; +} + +static XftFont* +openFont (Widget widget, char *name) +{ + char *fname = name; + int screen = XScreenNumberOfScreen (XtScreen (widget)); + int len = strlen (fname), i = len-1; + XftFont *fn; + + /* Try to convert Gtk-syntax (Sans 9) to Xft syntax Sans-9. */ + while (i > 0 && isdigit (fname[i])) + --i; + if (fname[i] == ' ') { - scrollbar_values *data = val->scrollbar_data; - Dimension height, width; - Dimension pos_x, pos_y; - int widget_shown, widget_topOfThumb; - float new_shown, new_topOfThumb; - - XtVaGetValues (widget, - XtNheight, &height, - XtNwidth, &width, - XtNx, &pos_x, - XtNy, &pos_y, - XtNtopOfThumb, &widget_topOfThumb, - XtNshown, &widget_shown, - NULL); - - /* - * First size and position the scrollbar widget. - * We need to position it to second-guess the Paned widget's notion - * of what should happen when the WMShell gets resized. - */ - if (height != data->scrollbar_height || pos_y != data->scrollbar_pos) - { - XtConfigureWidget (widget, pos_x, data->scrollbar_pos, - width, data->scrollbar_height, 0); + fname = xstrdup (name); + fname[i] = '-'; + } - XtVaSetValues (widget, - XtNlength, data->scrollbar_height, - XtNthickness, width, - NULL); - } + fn = XftFontOpenName (XtDisplay (widget), screen, fname); + if (fname != name) free (fname); - /* - * Now the size the scrollbar's slider. - */ - new_shown = (float) data->slider_size / - (float) (data->maximum - data->minimum); + return fn; +} - new_topOfThumb = (float) (data->slider_position - data->minimum) / - (float) (data->maximum - data->minimum); +static int +get_text_width_and_height (Widget widget, char *text, + XftFont *xft_font, + int *height) +{ + int w = 0, h = 0; + char *bp = text; + + while (bp && *bp != '\0') + { + XGlyphInfo gi; + char *cp = strchr (bp, '\n'); + XftTextExtentsUtf8 (XtDisplay (widget), xft_font, + (FcChar8 *) bp, + cp ? cp - bp : strlen (bp), + &gi); + bp = cp ? cp + 1 : NULL; + h += xft_font->height; + if (w < gi.width) w = gi.width; + } - if (new_shown > 1.0) - new_shown = 1.0; - if (new_shown < 0) - new_shown = 0; + *height = h; + return w; +} - if (new_topOfThumb > 1.0) - new_topOfThumb = 1.0; - if (new_topOfThumb < 0) - new_topOfThumb = 0; +static void +draw_text (struct widget_xft_data *data, char *lbl, int inverse) +{ + Screen *sc = XtScreen (data->widget); + int screen = XScreenNumberOfScreen (sc); + int y = data->xft_font->ascent; + int x = inverse ? 0 : 2; + char *bp = lbl; + + data->xft_draw = XftDrawCreate (XtDisplay (data->widget), + data->p, + DefaultVisual (XtDisplay (data->widget), + screen), + DefaultColormapOfScreen (sc)); + XftDrawRect (data->xft_draw, + inverse ? &data->xft_fg : &data->xft_bg, + 0, 0, data->p_width, data->p_height); + + if (!inverse) y += 2; + while (bp && *bp != '\0') + { + char *cp = strchr (bp, '\n'); + XftDrawStringUtf8 (data->xft_draw, + inverse ? &data->xft_bg : &data->xft_fg, + data->xft_font, x, y, + (FcChar8 *) bp, + cp ? cp - bp : strlen (bp)); + bp = cp ? cp + 1 : NULL; + /* 1.2 gives reasonable line spacing. */ + y += data->xft_font->height * 1.2; + } + +} - if (new_shown != widget_shown || new_topOfThumb != widget_topOfThumb) - XawScrollbarSetThumb (widget, new_topOfThumb, new_shown); + +static void +set_text (struct widget_xft_data *data, Widget toplevel, char *lbl, int margin) +{ + int width, height; + + width = get_text_width_and_height (data->widget, lbl, data->xft_font, + &height); + data->p_width = width + margin; + data->p_height = height + margin; + + data->p = XCreatePixmap (XtDisplay (data->widget), + XtWindow (toplevel), + data->p_width, + data->p_height, + DefaultDepthOfScreen (XtScreen (data->widget))); + draw_text (data, lbl, 0); + XtVaSetValues (data->widget, XtNbitmap, data->p, NULL); +} + +static struct widget_xft_data * +find_xft_data (Widget widget) +{ + widget_instance *inst = NULL; + Widget parent = XtParent (widget); + struct widget_xft_data *data = NULL; + int nr; + while (parent && !inst) + { + inst = lw_get_widget_instance (parent); + parent = XtParent (parent); } + if (!inst || !inst->xft_data || !inst->xft_data[0].xft_font) return 0; + + for (nr = 0; data == NULL && nr < inst->nr_xft_data; ++nr) + { + if (inst->xft_data[nr].widget == widget) + data = &inst->xft_data[nr]; + } + + return data; } -#endif -void -#ifdef PROTOTYPES -xaw_update_one_widget (widget_instance *instance, Widget widget, - widget_value *val, Boolean deep_p) -#else -xaw_update_one_widget (instance, widget, val, deep_p) - widget_instance *instance; - Widget widget; - widget_value *val; - Boolean deep_p; -#endif +static void +command_press (Widget widget, + XEvent* event, + String *params, + Cardinal *num_params) { -#if 0 - if (XtIsSubclass (widget, scrollbarWidgetClass)) + struct widget_xft_data *data = find_xft_data (widget); + if (data) { - xaw_update_scrollbar (instance, widget, val); + char *lbl; + /* Since this isn't used for rectangle buttons, use it to for armed. */ + XtVaSetValues (widget, XtNcornerRoundPercent, 1, NULL); + + XtVaGetValues (widget, XtNlabel, &lbl, NULL); + draw_text (data, lbl, 1); } +} + +static void +command_reset (Widget widget, + XEvent* event, + String *params, + Cardinal *num_params) +{ + struct widget_xft_data *data = find_xft_data (widget); + if (data) + { + Dimension cr; + XtVaGetValues (widget, XtNcornerRoundPercent, &cr, NULL); + if (cr == 1) + { + char *lbl; + XtVaSetValues (widget, XtNcornerRoundPercent, 0, NULL); + XtVaGetValues (widget, XtNlabel, &lbl, NULL); + draw_text (data, lbl, 0); + } + } +} + + #endif + +void +xaw_update_one_widget (widget_instance *instance, + Widget widget, + widget_value *val, + Boolean deep_p) +{ if (XtIsSubclass (widget, dialogWidgetClass)) { - Arg al[1]; - int ac = 0; - XtSetArg (al[ac], XtNlabel, val->contents->value); ac++; - XtSetValues (widget, al, ac); + +#ifdef HAVE_XFT + if (instance->xft_data && instance->xft_data[0].xft_font) + { + set_text (&instance->xft_data[0], instance->parent, + val->contents->value, 10); + } +#endif + XtVaSetValues (widget, XtNlabel, val->contents->value, NULL); } else if (XtIsSubclass (widget, commandWidgetClass)) { Dimension bw = 0; - Arg al[3]; + Arg al[10]; + int ac = 0; XtVaGetValues (widget, XtNborderWidth, &bw, NULL); if (bw == 0) @@ -173,20 +323,39 @@ xaw_update_one_widget (instance, widget, val, deep_p) } XtSetSensitive (widget, val->enabled); - XtSetArg (al[0], XtNlabel, val->value); + XtSetArg (al[ac], XtNlabel, val->value);ac++; /* Force centered button text. Se above. */ - XtSetArg (al[1], XtNjustify, XtJustifyCenter); - XtSetValues (widget, al, 2); + XtSetArg (al[ac], XtNjustify, XtJustifyCenter);ac++; +#ifdef HAVE_XFT + if (instance->xft_data && instance->xft_data[0].xft_font) + { + int th; + int nr; + for (nr = 0; nr < instance->nr_xft_data; ++nr) + if (instance->xft_data[nr].widget == widget) + break; + if (nr < instance->nr_xft_data) + { + set_text (&instance->xft_data[nr], instance->parent, + val->value, 6); + + /* Must set internalHeight to twice the highlight thickness, + or else it gets overwritten by our pixmap. Probably a bug. */ + XtVaGetValues (widget, XtNhighlightThickness, &th, NULL); + XtSetArg (al[ac], XtNinternalHeight, 2*th);ac++; + } + } +#endif + XtSetValues (widget, al, ac); XtRemoveAllCallbacks (widget, XtNcallback); XtAddCallback (widget, XtNcallback, xaw_generic_callback, instance); } } void -xaw_update_one_value (instance, widget, val) - widget_instance *instance; - Widget widget; - widget_value *val; +xaw_update_one_value (widget_instance *instance, + Widget widget, + widget_value *val) { /* This function is not used by the scrollbars and those are the only Athena widget implemented at the moment so do nothing. */ @@ -194,9 +363,30 @@ xaw_update_one_value (instance, widget, val) } void -xaw_destroy_instance (instance) - widget_instance *instance; +xaw_destroy_instance (widget_instance *instance) { +#ifdef HAVE_XFT + if (instance->xft_data) + { + int i; + for (i = 0; i < instance->nr_xft_data; ++i) + { + if (instance->xft_data[i].xft_draw) + XftDrawDestroy (instance->xft_data[i].xft_draw); + if (instance->xft_data[i].p != None) + { + XtVaSetValues (instance->xft_data[i].widget, XtNbitmap, None, + NULL); + XFreePixmap (XtDisplay (instance->widget), + instance->xft_data[i].p); + } + } + if (instance->xft_data[0].xft_font) + XftFontClose (XtDisplay (instance->widget), + instance->xft_data[0].xft_font); + free (instance->xft_data); + } +#endif if (XtIsSubclass (instance->widget, dialogWidgetClass)) /* Need to destroy the Shell too. */ XtDestroyWidget (XtParent (instance->widget)); @@ -205,22 +395,14 @@ xaw_destroy_instance (instance) } void -xaw_popup_menu (widget, event) - Widget widget; - XEvent *event; +xaw_popup_menu (Widget widget, XEvent *event) { /* An Athena menubar has not been implemented. */ return; } void -#ifdef PROTOTYPES xaw_pop_instance (widget_instance *instance, Boolean up) -#else -xaw_pop_instance (instance, up) - widget_instance *instance; - Boolean up; -#endif { Widget widget = instance->widget; @@ -291,24 +473,39 @@ static char overrideTrans[] = /* Dialogs pop down on any key press */ static char dialogOverride[] = "Escape: lwlib_delete_dialog()"; -static void wm_delete_window(); +static void wm_delete_window (Widget w, + XEvent *event, + String *params, + Cardinal *num_params); static XtActionsRec xaw_actions [] = { {"lwlib_delete_dialog", wm_delete_window} }; static Boolean actions_initted = False; +#ifdef HAVE_XFT +static XtActionsRec button_actions[] = + { + { "my_reset", command_reset }, + { "my_press", command_press }, + }; +char buttonTrans[] = + ": reset() my_reset()\n" + ": set() my_press()\n" + ": my_reset() notify() unset()\n"; +#endif + static Widget -make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot, radio_box, list, left_buttons, right_buttons) - char* name; - Widget parent; - Boolean pop_up_p; - char* shell_title; - char* icon_name; - Boolean text_input_slot; - Boolean radio_box; - Boolean list; - int left_buttons; - int right_buttons; +make_dialog (char* name, + Widget parent, + Boolean pop_up_p, + char* shell_title, + char* icon_name, + Boolean text_input_slot, + Boolean radio_box, + Boolean list, + int left_buttons, + int right_buttons, + widget_instance *instance) { Arg av [20]; int ac = 0; @@ -318,6 +515,10 @@ make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot, ra Widget dialog; Widget button; XtTranslations override; +#ifdef HAVE_XFT + XftFont *xft_font = 0; + XtTranslations button_override; +#endif if (! pop_up_p) abort (); /* not implemented */ if (text_input_slot) abort (); /* not implemented */ @@ -329,6 +530,10 @@ make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot, ra XtAppContext app = XtWidgetToApplicationContext (parent); XtAppAddActions (app, xaw_actions, sizeof (xaw_actions) / sizeof (xaw_actions[0])); +#ifdef HAVE_XFT + XtAppAddActions (app, button_actions, + sizeof (button_actions) / sizeof (button_actions[0])); +#endif actions_initted = True; } @@ -350,6 +555,56 @@ make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot, ra override = XtParseTranslationTable (dialogOverride); XtOverrideTranslations (dialog, override); +#ifdef HAVE_XFT + { + int num; + Widget *ch = NULL; + Widget w = 0; + XtVaGetValues (dialog, + XtNnumChildren, &num, + XtNchildren, &ch, NULL); + for (i = 0; i < num; ++i) + { + if (!XtIsSubclass (ch[i], commandWidgetClass) + && XtIsSubclass (ch[i], labelWidgetClass)) + { + w = ch[i]; + break; + } + } + instance->xft_data = 0; + instance->nr_xft_data = 0; + if (w) + { + XtResource rec[] = + { { "font", "Font", XtRString, sizeof(String), 0, XtRString, + (XtPointer)"Sans-10" }}; + char *fontName = NULL; + XtVaGetSubresources (dialog, &fontName, "Dialog", "dialog", + rec, 1, (String)NULL); + if (fontName) + { + XFontStruct *xfn = XLoadQueryFont (XtDisplay (dialog), fontName); + if (!xfn) + xft_font = openFont (dialog, fontName); + else + XFreeFont (XtDisplay (dialog), xfn); + } + + if (xft_font) + { + instance->nr_xft_data = left_buttons + right_buttons + 1; + instance->xft_data = calloc (instance->nr_xft_data, + sizeof(*instance->xft_data)); + + fill_xft_data (&instance->xft_data[0], w, xft_font); + } + } + + button_override = XtParseTranslationTable (buttonTrans); + } +#endif + bc = 0; button = 0; for (i = 0; i < left_buttons; i++) @@ -361,59 +616,63 @@ make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot, ra XtSetArg (av [ac], XtNtop, XtChainBottom); ac++; XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++; XtSetArg (av [ac], XtNresizable, True); ac++; +#ifdef HAVE_XAW3D + if (DefaultDepthOfScreen (XtScreen (dialog)) >= 16) + { + /* Turn of dithered shadow if we can. Looks bad */ + XtSetArg (av [ac], "beNiceToColormap", False); ac++; + } +#endif sprintf (button_name, "button%d", ++bc); button = XtCreateManagedWidget (button_name, commandWidgetClass, dialog, av, ac); +#ifdef HAVE_XFT + if (xft_font) + { + fill_xft_data (&instance->xft_data[bc], button, xft_font); + XtOverrideTranslations (button, button_override); + } +#endif } - if (right_buttons) - { - /* Create a separator - I want the separator to take up the slack between the buttons on - the right and the buttons on the left (that is I want the buttons - after the separator to be packed against the right edge of the - window) but I can't seem to make it do it. - */ - ac = 0; - XtSetArg (av [ac], XtNfromHoriz, button); ac++; -/* XtSetArg (av [ac], XtNfromVert, XtNameToWidget (dialog, "label")); ac++; */ - XtSetArg (av [ac], XtNleft, XtChainLeft); ac++; - XtSetArg (av [ac], XtNright, XtChainRight); ac++; - XtSetArg (av [ac], XtNtop, XtChainBottom); ac++; - XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++; - XtSetArg (av [ac], XtNlabel, ""); ac++; - XtSetArg (av [ac], XtNwidth, 30); ac++; /* #### aaack!! */ - XtSetArg (av [ac], XtNborderWidth, 0); ac++; - XtSetArg (av [ac], XtNshapeStyle, XmuShapeRectangle); ac++; - XtSetArg (av [ac], XtNresizable, False); ac++; - XtSetArg (av [ac], XtNsensitive, False); ac++; - button = XtCreateManagedWidget ("separator", - /* labelWidgetClass, */ - /* This has to be Command to fake out - the Dialog widget... */ - commandWidgetClass, - dialog, av, ac); - } for (i = 0; i < right_buttons; i++) { ac = 0; XtSetArg (av [ac], XtNfromHoriz, button); ac++; + if (i == 0) + { + /* Separator to the other buttons. */ + XtSetArg (av [ac], XtNhorizDistance, 30); ac++; + } XtSetArg (av [ac], XtNleft, XtChainRight); ac++; XtSetArg (av [ac], XtNright, XtChainRight); ac++; XtSetArg (av [ac], XtNtop, XtChainBottom); ac++; XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++; XtSetArg (av [ac], XtNresizable, True); ac++; +#ifdef HAVE_XAW3D + if (DefaultDepthOfScreen (XtScreen (dialog)) >= 16) + { + /* Turn of dithered shadow if we can. Looks bad */ + XtSetArg (av [ac], "beNiceToColormap", False); ac++; + } +#endif sprintf (button_name, "button%d", ++bc); button = XtCreateManagedWidget (button_name, commandWidgetClass, dialog, av, ac); +#ifdef HAVE_XFT + if (xft_font) + { + fill_xft_data (&instance->xft_data[bc], button, xft_font); + XtOverrideTranslations (button, button_override); + } +#endif } return dialog; } Widget -xaw_create_dialog (instance) - widget_instance* instance; +xaw_create_dialog (widget_instance *instance) { char *name = instance->info->type; Widget parent = instance->parent; @@ -471,17 +730,13 @@ xaw_create_dialog (instance) widget = make_dialog (name, parent, pop_up_p, shell_name, icon_name, text_input_slot, radio_box, - list, left_buttons, right_buttons); - + list, left_buttons, right_buttons, instance); return widget; } static void -xaw_generic_callback (widget, closure, call_data) - Widget widget; - XtPointer closure; - XtPointer call_data; +xaw_generic_callback (Widget widget, XtPointer closure, XtPointer call_data) { widget_instance *instance = (widget_instance *) closure; Widget instance_widget; @@ -501,10 +756,6 @@ xaw_generic_callback (widget, closure, call_data) id = instance->info->id; -#if 0 - user_data = NULL; - XtVaGetValues (widget, XtNuserData, &user_data, NULL); -#else /* Damn! Athena doesn't give us a way to hang our own data on the buttons, so we have to go find it... I guess this assumes that all instances of a button have the same call data. */ @@ -520,23 +771,22 @@ xaw_generic_callback (widget, closure, call_data) if (! val) abort (); user_data = val->call_data; } -#endif if (instance->info->selection_cb) instance->info->selection_cb (widget, id, user_data); } static void -wm_delete_window (w, closure, call_data) - Widget w; - XtPointer closure; - XtPointer call_data; +wm_delete_window (Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { LWLIB_ID id; Cardinal nkids; int i; Widget *kids = 0; - Widget widget, shell; + Widget widget = 0, shell; if (XtIsSubclass (w, dialogWidgetClass)) shell = XtParent (w); @@ -555,6 +805,8 @@ wm_delete_window (w, closure, call_data) if (XtIsSubclass (widget, dialogWidgetClass)) break; } + if (! widget) return; + id = lw_get_widget_id (widget); if (! id) abort (); @@ -569,111 +821,9 @@ wm_delete_window (w, closure, call_data) } -/* Scrollbars */ - -#if 0 -static void -xaw_scrollbar_scroll (widget, closure, call_data) - Widget widget; - XtPointer closure; - XtPointer call_data; -{ - widget_instance *instance = (widget_instance *) closure; - LWLIB_ID id; - scroll_event event_data; - - if (!instance || widget->core.being_destroyed) - return; - - id = instance->info->id; - event_data.slider_value = 0; - event_data.time = 0; - - if ((int) call_data > 0) - event_data.action = SCROLLBAR_PAGE_DOWN; - else - event_data.action = SCROLLBAR_PAGE_UP; - - if (instance->info->pre_activate_cb) - instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data); -} -#endif - -#if 0 -static void -xaw_scrollbar_jump (widget, closure, call_data) - Widget widget; - XtPointer closure; - XtPointer call_data; -{ - widget_instance *instance = (widget_instance *) closure; - LWLIB_ID id; - scroll_event event_data; - scrollbar_values *val = - (scrollbar_values *) instance->info->val->scrollbar_data; - float percent; - - if (!instance || widget->core.being_destroyed) - return; - - id = instance->info->id; - - percent = * (float *) call_data; - event_data.slider_value = - (int) (percent * (float) (val->maximum - val->minimum)) + val->minimum; - - event_data.time = 0; - event_data.action = SCROLLBAR_DRAG; - - if (instance->info->pre_activate_cb) - instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data); -} -#endif static Widget -xaw_create_scrollbar (instance) - widget_instance *instance; -{ -#if 0 - Arg av[20]; - int ac = 0; - Dimension width; - Widget scrollbar; - - XtVaGetValues (instance->parent, XtNwidth, &width, NULL); - - XtSetArg (av[ac], XtNshowGrip, 0); ac++; - XtSetArg (av[ac], XtNresizeToPreferred, 1); ac++; - XtSetArg (av[ac], XtNallowResize, True); ac++; - XtSetArg (av[ac], XtNskipAdjust, True); ac++; - XtSetArg (av[ac], XtNwidth, width); ac++; - XtSetArg (av[ac], XtNmappedWhenManaged, True); ac++; - - scrollbar = - XtCreateWidget (instance->info->name, scrollbarWidgetClass, - instance->parent, av, ac); - - /* We have to force the border width to be 0 otherwise the - geometry manager likes to start looping for awhile... */ - XtVaSetValues (scrollbar, XtNborderWidth, 0, NULL); - - XtRemoveAllCallbacks (scrollbar, "jumpProc"); - XtRemoveAllCallbacks (scrollbar, "scrollProc"); - - XtAddCallback (scrollbar, "jumpProc", xaw_scrollbar_jump, - (XtPointer) instance); - XtAddCallback (scrollbar, "scrollProc", xaw_scrollbar_scroll, - (XtPointer) instance); - - return scrollbar; -#else - return NULL; -#endif -} - -static Widget -xaw_create_main (instance) - widget_instance *instance; +xaw_create_main (widget_instance *instance) { Arg al[1]; int ac; @@ -688,10 +838,6 @@ xaw_create_main (instance) widget_creation_entry xaw_creation_table [] = { - {"scrollbar", xaw_create_scrollbar}, {"main", xaw_create_main}, {NULL, NULL} }; - -/* arch-tag: fbbd3589-ae1c-41a0-9142-f628cfee6564 - (do not change this comment) */