X11R6 patches for X11 extension

Rich Neitzel (thor@ymir.atd.ucar.edu)
26 May 1994 17:36:40 GMT

Having just recently gotten X11R6 running, I decided to recompile python
with the X11 extensions. Xawmodule.c needs some fixing, since some of the
widgets were removed in R6. Also, in R6 you have to explictly call
XtSetLanguageProc if you want things like the compose key to work. So I've
appended a some files that contain a patch to fix Xawmodule.c, a patch to
add XtSetLanguageProc support and a test file py file for the latter.

Also, if you are including stdwin support in your python, there a number
of fixes needed in stdwin for X11R6. I'll post those in another few
minutes.

-- 
Richard Neitzel thor@thor.atd.ucar.edu          Torren med sitt skjegg
National Center For Atmospheric Research        lokkar borni under sole-vegg
Box 3000 Boulder, CO 80307-3000	                Gjx'i med sitt shinn
303-497-2057                                    jagar borni inn.

--------------------------------------------------------------------- Patch for Xawmodule.c --------------------------------------------------------------------- --- Xawmodule.c.FCS Fri Feb 4 06:17:15 1994 +++ Xawmodule.c Wed May 25 13:19:08 1994 @@ -8,9 +8,9 @@ /* Methods for Xaw objects */ #include <X11/Xaw/Box.h> - +#ifndef X11R6 #include <X11/Xaw/Clock.h> - +#endif #include <X11/Xaw/Command.h> #include <X11/Xaw/Dialog.h> @@ -22,11 +22,11 @@ #include <X11/Xaw/Label.h> #include <X11/Xaw/List.h> - +#ifndef X11R6 #include <X11/Xaw/Logo.h> #include <X11/Xaw/Mailbox.h> - +#endif #include <X11/Xaw/MenuButton.h> #include <X11/Xaw/Paned.h> @@ -86,9 +86,11 @@ dictinsert(d, "Box", (object*)newwclassobject(boxWidgetClass, wclass_methodlists)); +#ifndef X11R6 dictinsert(d, "Clock", (object*)newwclassobject(clockWidgetClass, wclass_methodlists)); +#endif dictinsert(d, "Command", (object*)newwclassobject(commandWidgetClass, wclass_methodlists)); @@ -107,12 +109,14 @@ dictinsert(d, "List", (object*)newwclassobject(listWidgetClass, wclass_methodlists)); +#ifndef X11R6 dictinsert(d, "Logo", (object*)newwclassobject(logoWidgetClass, wclass_methodlists)); dictinsert(d, "Mailbox", (object*)newwclassobject(mailboxWidgetClass, - wclass_methodlists)); + wclass_methodlists)); +#endif dictinsert(d, "MenuButton", (object*)newwclassobject(menuButtonWidgetClass, wclass_methodlists)); ------------------------------------------------------------------ Patch to add XtSetLanguageProc ------------------------------------------------------------------ --- Xtgenerated.h.FCS Thu May 26 09:41:14 1994 +++ Xtgenerated.h Thu May 26 11:21:45 1994 @@ -240,6 +240,35 @@ return None; } +#ifdef X11R6 +static object * +Xt_SetLanguageProc(self, args) + object *self; + object *args; +{ + object *proc, *data, *passed; + + if (!getargs(args, "(OO)", &proc, &data)) + return NULL; + + passed = mkvalue("(OO)", proc, data); + + if (!setjmp(jump_where)) { + XtLanguageProc func = (XtLanguageProc)univ_setlanguageproc; + if (proc == NULL) { + func = NULL; + passed = NULL; + } + jump_flag = 1; + XtSetLanguageProc(NULL,func,(XtPointer)passed); + jump_flag = 0; + } + if (jump_flag) { jump_flag = 0; return NULL; } + INCREF(None); + return None; +} +#endif + struct methodlist Xt_methods[] = { {"Initialize", Xt_Initialize}, {"CreateApplicationShell", Xt_CreateApplicationShell}, @@ -254,6 +283,9 @@ {"Pending", Xt_Pending}, {"ProcessEvent", Xt_ProcessEvent}, {"MainLoop", Xt_MainLoop}, +#ifdef X11R6 + {"SetLanguageProc", Xt_SetLanguageProc}, +#endif {0, 0} /* Sentinel */ }; --- Xtmodule.c.FCS Thu May 26 10:03:46 1994 +++ Xtmodule.c Thu May 26 11:00:38 1994 @@ -634,6 +634,45 @@ return remove; } +#ifdef X11R6 +void +univ_setlanguageproc(d, xnl, closure) + Display *d; + String xnl; + object *closure; +{ + object *cbfunc, *cbarg, *cbargs, *result; + + if (!getargs(closure, "(OO)", &cbfunc, &cbarg)) { + if (jump_flag) + longjmp(jump_where, 1); + fprintf(stderr, + "--- bad closure for univ_setlanguageproc ---\n"); + print_error(); + fprintf(stderr, "---\n"); + return; + } + + cbargs = mkvalue("(O)", cbarg); + + if (cbargs == NULL) + result = NULL; + else { + result = call_object_save_jump(cbfunc, cbargs); + DECREF(cbargs); + } + if (result == NULL) { + if (jump_flag) + longjmp(jump_where, 1); + fprintf(stderr, "--- setting locale failed ---\n"); + print_error(); + fprintf(stderr, "---\n"); + } + else + DECREF(result); +} +#endif + static object * wclass_GetResourceList(self, args) wclassobject *self; ------------------------------------------------------------------ Test file ------------------------------------------------------------------ # Test Xt.SetLanguageProc # # Note: Xt.SetLanguageProc() must be called BEFORE Xt.Initialize()! # import Xt import sys

def main(): i = Xt.SetLanguageProc(set,'Hi!') t = Xt.Initialize('T', [], sys.argv)

def set(udata): print 'Hello from set' print udata

main()