Path: utzoo!attcan!uunet!lll-winken!ames!pasteur!ucbvax!tut.cis.ohio-state.edu!bloom-beacon!LBL.GOV!todd%sfsu1.hepnet From: todd%sfsu1.hepnet@LBL.GOV Newsgroups: comp.windows.x Subject: resizing windows on hp9000 Message-ID: <890227105000.23a0090f@LBL.Gov> Date: 27 Feb 89 18:50:00 GMT Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 162 we are using g++ and Xlib to write applications on hp9000 workstations. windows i have created have done what i wanted usually, but the window manager (uwm) doesnt seem to know how to resize them... tho ive set all sorts ofhints and things. uwms acts like its resizing - an outline of a smaller or larger window appears, and a box with the dimensions of the oyutlined window. But when the mouse button is released, the window is in its original state ..tho it sometimes moves, apparently due to bit gravity. similar windows programmmed in the x10 environment were resized ok. below is the code for one such x11 application, a utility to display the color map . /***************************************************************************** File Name: showcolormap.cc Author: Jim Todd Creation Date:2/8/89 Modified: 2/16/89 Purpose: Show the current colors available on screen this version is designed for 16 color map, as 320s only support 16 Compile With: g++ showcolormap.cc -lm -lX11 Executable is in ~/bin/xcmap This version has transparent background Object List: *****************************************************************************/ #include "Xlib.h" // #include #include #define AllEventsMask ~0L #define COLORSTRIPEWIDTH 18 #define HALF_COLORSTRIPEWIDTH (COLORSTRIPEWIDTH / 2) int strlen(char *string); main() { Display *dpy; unsigned long fth, pad; //font size parameters unsigned long bd, bg,fg; /*background and border colors, etc*/ unsigned short center_line; //x location of line Window win; XEvent event; XGCValues gcvals; GC lgc, fgc; //graphic contexts for lines, fonts XFontStruct *fontstruct; char numstring[3] ; XSetWindowAttributes setat; // open display dpy = XOpenDisplay(0); // create window bd = WhitePixel(dpy,DefaultScreen(dpy)); bg = BlackPixel(dpy, DefaultScreen(dpy)); fg = bd; win =XCreateSimpleWindow(dpy, RootWindow(dpy, 0), 50, 50, 320, 55, 1, bd, bg); // change the background to be transparent setat.background_pixmap = None; XChangeWindowAttributes(dpy, win,CWBackPixmap , &setat); // load the font to use , other font stuff if((fontstruct = XLoadQueryFont(dpy, "vrb-25")) == 0) { fprintf(stderr, "font unknown"); exit(1); } fth = fontstruct->max_bounds.ascent + fontstruct->max_bounds.descent; pad = 1; gcvals.font = fontstruct->fid; //gc for drawing font gcvals.foreground = fg; gcvals.background = bg; fgc = XCreateGC(dpy, win, (GCForeground | GCBackground), &gcvals); // select input events to see XSelectInput(dpy, win, AllEventsMask); // set window's name and icon name XSetIconName(dpy, win, "color map"); XStoreName(dpy, win, "color map"); // map window XMapWindow(dpy, win); //wait for window to be reified (in case the fwm interferes) // XMaskEvent(dpy, (ExposureMask|EnterWindowMask) , &event); // XMaskEvent(dpy, VisibilityChangeMask , &event) ; XMaskEvent(dpy, (ExposureMask|EnterWindowMask) , &event) ; //initialize invariant part of XGCValues structure gcvals.line_width = COLORSTRIPEWIDTH; // draw in colors and label // drawmap(); for(register unsigned short i= 0; i < 16; i++) { //specify the graphics context of the draw gcvals.foreground = i; lgc = XCreateGC(dpy, win, (GCLineWidth | GCForeground), &gcvals); center_line = HALF_COLORSTRIPEWIDTH +i * 20; XDrawLine(dpy, win, lgc, center_line, 2 , center_line, 42); sprintf(numstring, "%x", i); XDrawString(dpy, (Drawable) win, fgc, center_line, 53, numstring , strlen(numstring)); } // wait for events in window for(;;) { XNextEvent(dpy, &event); if(event.type == ButtonRelease)break; // leave loop, end execution if(event.type == Expose) // redraw contents { for(register unsigned short i= 0; i < 16; i++) { //specify the graphics context of the draw gcvals.foreground = i; lgc = XCreateGC(dpy, win, (GCLineWidth | GCForeground), &gcvals); center_line = HALF_COLORSTRIPEWIDTH +i * 20; XDrawLine(dpy, win, lgc, center_line, 2 , center_line, 42); sprintf(numstring, "%x", i); XDrawString(dpy, (Drawable) win, fgc, center_line, 53, numstring , strlen(numstring)); } } //end if exposed }//end event loop }// end main any suggestions ? thanks