lambert@unix.cis.pitt.edu (Michael H Lambert) (12/19/90)
I have a question regarding the use of menu buttons under XView 2.0 on a DECstation. I have keyed in the program btn_menu.c from Dan Heller's XView Programming Manual (1989 copyright), section 7.7.2, page 146, and it does not appear to run correctly. The menu draws correctly the first time it is invoked, but on subsequent clicks in the menu button a white rectangle with no text is drawn where the menu should be. I compiled the application with the Gnu C compiler (OSF version 1.9.2.14, -traditional switch), and ran it under olwm with the X11R4 server. Has anyone seen this problem before? Is it just a bug in the example, or is there a work-around? The operating system is Ultrix 3.1. The sample program is as follows: /*---------- cut here -------------------- */ #include <xview/xview.h> #include <xview/panel.h> #include <xview/openmenu.h> main(argc,argv) int argc; char *argv[]; { Frame frame; Panel panel; Menu menu; int selected(); void menu_proc(); xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL); frame= (Frame)xv_create(NULL, FRAME, NULL); panel= (Panel)xv_create(frame, PANEL, NULL); menu= (Menu)xv_create(NULL, MENU, MENU_NOTIFY_PROC, menu_proc, MENU_STRINGS, "Yes", "No", "Quit", NULL, NULL); (void) xv_create(panel, PANEL_BUTTON, PANEL_LABEL_STRING, "Y/N/Q", PANEL_NOTIFY_PROC, selected, PANEL_ITEM_MENU, menu, NULL); window_fit(panel); window_fit(frame); xv_main_loop(frame); } int selected (item, event) Panel_item item; Event *event; { printf("%s selected...\n", xv_get(item, PANEL_LABEL_STRING)); return(XV_OK); } void menu_proc(menu, menu_item) Menu menu; Menu_item menu_item; { printf("Menu Item: %s\n", xv_get(menu_item, MENU_STRING)); if (!strcmp((char *)xv_get(menu_item, MENU_STRING), "Quit")) exit(0); }
halazar@media-lab.MEDIA.MIT.EDU (Michael Halle) (12/19/90)
I posted the following to comp.windows.x a couple of days ago. Sounds like your problem. Hopefully you can hack the xview sources. Do any applications work on your system??? All mine (except olwm and "notice" windows) showed signs of similar brokenness. I had the problem under Ultrix 4.0, using the Ultrix (MIPS) compiler. -------------- Here are a couple of other patches that I had to apply to get XView to work on a Decstation 5000. I hate the idea of passing out a lot of unofficial patches to XView, but it took me a long time to track these down and I don't see a public patch collection showing up anywhere. So here goes. The first patch is to fix a slider core dump...looks like something got broken in the 2D->3D code transition. The file is lib/libolgx/ol_slider.c . The second bug was much more sinister. My 3D-look panels were all coming up monochromatic and broken-looking. 2D was fine. Also, menus would work only the first time, then would come up blank. It turned out that the colormap was not being properly initialized because the cmap code uses a bunch of single bit bitfields for status . These bits were, unfortunately, declared as "int". Looks like some interesting sign error happened when a bit got set: where's the sign bit in a one bit signed field? Anyway, I changed the declaration to be "unsigned int" and all was well. The file is lib/libxvin/color/cms_impl.h . *** lib/libolgx/ol_slider.c Fri Nov 23 02:07:34 1990 --- lib/libolgx/ol_slider.c.~1~ Fri Nov 23 01:29:48 1990 *************** *** 318,325 **** /* * erase the old slider */ ! XFillRectangle(info->dpy, win, info->three_d ? info->gc_rec[OLGX_BG1]->gc ! : info->gc_rec[OLGX_WHITE]->gc, xstart, y, xwidth, info->slider_height + 1); --- 318,324 ---- /* * erase the old slider */ ! XFillRectangle(info->dpy, win, info->gc_rec[OLGX_BG1]->gc, xstart, y, xwidth, info->slider_height + 1); *** lib/libxvin/color/cms_impl.h Fri Nov 23 07:01:20 1990 --- lib/libxvin/color/cms_impl.h.~1~ Fri Nov 23 07:00:37 1990 *************** *** 43,49 **** #define STATUS(cms, field) ((cms)->status_bits.field) #define STATUS_SET(cms, field) STATUS(cms, field) = TRUE #define STATUS_RESET(cms, field) STATUS(cms, field) = FALSE ! #define BIT_FIELD(field) unsigned int field : 1 /* *********************************************************************** --- 43,49 ---- #define STATUS(cms, field) ((cms)->status_bits.field) #define STATUS_SET(cms, field) STATUS(cms, field) = TRUE #define STATUS_RESET(cms, field) STATUS(cms, field) = FALSE ! #define BIT_FIELD(field) int field : 1 /* ***********************************************************************