X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lwlib%2Flwlib-Xlw.c;h=712a62bb83e2bc42d8ad5c6c34b4d6def13fd647;hb=b8eb553f1f7e62fc8f4e3a10077f18bfe917cf40;hp=6c3cd342eae0dbe145948fd16cd0fcb70ab331c2;hpb=ea1ea793fe6e244ef5555ed983423a204101af13;p=chise%2Fxemacs-chise.git.1 diff --git a/lwlib/lwlib-Xlw.c b/lwlib/lwlib-Xlw.c index 6c3cd34..712a62b 100644 --- a/lwlib/lwlib-Xlw.c +++ b/lwlib/lwlib-Xlw.c @@ -49,9 +49,15 @@ Boston, MA 02111-1307, USA. */ #include "../src/xmu.h" #include "xlwtabs.h" #endif - +#include +#include +#include +#include +#include + + #ifdef LWLIB_MENUBARS_LUCID /* Menu callbacks */ @@ -142,9 +148,8 @@ xlw_create_popup_menu (widget_instance* instance) XtSetArg (al [0], XtNmenu, instance->info->val); XtSetArg (al [1], XtNhorizontal, False); widget = XtCreateManagedWidget ("popup", xlwMenuWidgetClass, - popup_shell, al, 2); - XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance); - + popup_shell, al, 2); + XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance); return popup_shell; } #endif /* LWLIB_MENUBARS_LUCID */ @@ -158,13 +163,13 @@ xlw_scrollbar_callback (Widget widget, XtPointer closure, XtPointer call_data) XlwScrollBarCallbackStruct *data = (XlwScrollBarCallbackStruct *) call_data; scroll_event event_data; - scrollbar_values *val = - (scrollbar_values *) instance->info->val->scrollbar_data; + scrollbar_values *val; double percent; if (!instance || widget->core.being_destroyed) return; + val = (scrollbar_values *) instance->info->val->scrollbar_data; id = instance->info->id; percent = (double) (data->value - 1) / (double) (INT_MAX - 1); @@ -319,13 +324,21 @@ xlw_update_scrollbar (widget_instance *instance, Widget widget, #ifdef LWLIB_TABS_LUCID /* tab control - lwlib is such an incredible hairy crock. I just cannot believe + [[ lwlib is such an incredible hairy crock. I just cannot believe it! There are random dependencies between functions, there is a total lack of genericity, even though it initially appears to be generic. It should all be junked and begun again. Building tabs are an example - in theory we should be able to reuse a lot of the general stuff because we want to put labels of whatever toolkit we - are using in the tab. Instead we have to hack it by hand. */ + are using in the tab. Instead we have to hack it by hand. ]] + While lwlib is a hairy crock, whoever wrote that seems to misunderstand + Falk's tab control widget. The tab control widget has *two* kinds of + children: *widgets*, which all occupy a *single* pane below the row of + tabs---this is where the labels created in build_tabs_in_widget go, and + *gadgets*, the tabs themselves, which do *not* draw themselves, but + rather are drawn by the control. In fact, in XEmacs the true widget + children are *never* visible! So this case is not a problem in the + design of lwlib, but rather of Falk's widget. -- sjt */ static void xlw_tab_control_callback (Widget w, XtPointer client_data, XtPointer call_data) { @@ -375,9 +388,8 @@ xlw_create_tab_control (widget_instance *instance) widget_value* val = instance->info->val; XtSetArg (al [ac], XtNsensitive, val->enabled); ac++; - XtSetArg (al [ac], XtNmappedWhenManaged, FALSE); ac++; + XtSetArg (al [ac], XtNmappedWhenManaged, False); ac++; XtSetArg (al [ac], XtNorientation, XtorientHorizontal); ac++; - XtSetArg (al [ac], XtNresizable, False); ac++; /* add any args the user supplied for creation time */ lw_add_value_args_to_args (val, al, &ac); @@ -396,15 +408,22 @@ static void build_tabs_in_widget (widget_instance* instance, Widget widget, widget_value* val) { widget_value* cur = val; + Arg al[1]; + + /* Children are always invisible, don't permit resizing. */ + XtSetArg (al[0], XtNresizable, False); + for (cur = val; cur; cur = cur->next) { if (cur->value) { + Widget w; #ifdef LWLIB_WIDGETS_MOTIF - xm_create_label (widget, cur); + w = xm_create_label (widget, cur); #else - xaw_create_label (widget, cur); + w = xaw_create_label (widget, cur); #endif + XtSetValues (w, al, 1); } cur->change = NO_CHANGE; } @@ -482,7 +501,7 @@ xlw_create_clip_window (widget_instance *instance) } #endif -widget_creation_entry +const widget_creation_entry xlw_creation_table [] = { #ifdef LWLIB_MENUBARS_LUCID @@ -524,6 +543,10 @@ lw_lucid_widget_p (Widget widget) XtClass (((CompositeWidget)widget)->composite.children [0]) == xlwMenuWidgetClass; #endif +#ifdef HAVE_WIDGETS + if (the_class == emacsManagerWidgetClass) + return True; +#endif return False; } @@ -545,7 +568,7 @@ xlw_update_one_widget (widget_instance* instance, Widget widget, else mw = (XlwMenuWidget)widget; XtSetArg (al [0], XtNmenu, val); - XtSetValues (widget, al, 1); + XtSetValues (widget, al, 1); /* #### mw unused! */ } #endif #ifdef LWLIB_SCROLLBARS_LUCID @@ -560,6 +583,9 @@ xlw_update_one_widget (widget_instance* instance, Widget widget, xlw_update_tab_control (instance, widget, val); } #endif + /* Lastly update our global arg values. */ + if (val->args && val->args->nargs) + XtSetValues (widget, val->args->args, val->args->nargs); } void