[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

1255.0. "Can't change icon by SetStandardProperties?" by TPOVC::JOHNNYHO () Thu Aug 10 1989 06:23

    	I'm using a DS3100 running UWS2.0.  The following is a simple
    	"hello world" program. I am trying to change the default icon
    	to another 16x16 icon which I created using /usr/bin/bitmap.
    	The routines I called to set the iconpixmap are in "SetProperties".
    
    	I don't know what's wrong with it. I always get th default
    	icon.  Would anyone please give me some hints?
    
        Johnny


    -------------------------------------------------------------------------
    #include	<stdio.h>
#include	</usr/include/X11/Xlib.h>
#include	</usr/include/X11/Xatom.h>
#include	</usr/include/X11/Xutil.h>
#include	"icon.bm"

#define	screenNumber	DefaultScreen(display)
#define rootWindow	RootWindow(display,screenNumber)
#define displayWidth	DisplayWidth(display,screenNumber)
#define displayHeight	DisplayHeight(display,screenNumber)
#define blackPixel	BlackPixel(display,screenNumber)
#define whitePixel	WhitePixel(display,screenNumber)
#define windowX		(displayWidth/2)
#define windowY		(displayHeight/2)
#define minWidth	200
#define minHeight	200
#define maxWidth	500
#define maxHeight	500
#define borderWidth	10	
#define xText		(width/4)
#define yText		(height/2)
#define hello		"Hello World!"
#define goodbye		"Goodbye World!"
#define forever		while(1)
#define defaultGC	DefaultGC(display,screenNumber)
#define windowName	"Salutations"
#define iconName	"Salute"

static	void SetProperties();
static	void Highlight();
static	void Print();
static	void UpdateDimensions();

main(argc,argv)
   unsigned int	argc;
   char		*argv;
{
   Display	*display;
   Window	window;
   unsigned int	width,
		height;

   if (!(display = XOpenDisplay(NULL))) {
      printf(stderr,"Can't open display\n");
      exit(0);
   }

   width = minWidth;
   height = minHeight;

   window = XCreateSimpleWindow(
      display,
      rootWindow,
      windowX,
      windowY,
      width,
      height,
      borderWidth,
      blackPixel,
      whitePixel);

   if (!window) {
      printf(stderr,"Can't open window\n");
      exit(0);
   }

   SetProperties(display,window,argc,argv);

   XSelectInput(display,window,ButtonPressMask|
				ButtonReleaseMask|
				StructureNotifyMask|
				ExposureMask);

   XMapWindow(display,window);

   forever {
      XEvent	event;
      char	*string = hello;

      XNextEvent(display,&event);
      switch (event.type) {
	 case ButtonPress	: Highlight(display,window,&string);
	 case Expose		: XClearWindow(display,window);
		  	 	  Print(display,window,width,height,string);
		   		  break;
	 case ButtonRelease	: exit(1);
       	 case ConfigureNotify	: UpdateDimensions(&event,&width,&height);
		   		  break;
	 default:;
      }
   }
}

static	void Highlight(display,window,string)
   Display	*display;
   Window	window;
   char		**string;
{
	XSetWindowBackground(display,window,blackPixel);
	XClearWindow(display,window);
	XSetForeground(display,defaultGC,whitePixel);
	*string = goodbye;
}

static	void SetProperties(display,window,argc,argv)
   Display	*display;
   Window	window;
   unsigned int argc;
   char		**argv;
{
	XSizeHints	size_hints;
	static Pixmap	iconPixmap;

	size_hints.min_width = minWidth;
	size_hints.max_width = maxWidth;
	size_hints.min_height = minHeight;
	size_hints.max_height = maxHeight;
	size_hints.flags = PMinSize|PMaxSize;

	iconPixmap = XCreateBitmapFromData(display,window,icon_bits,
					   icon_width,icon_height);

	XSetStandardProperties(display,window,windowName,iconName,
			       iconPixmap,argv,argc,&size_hints);
}

static	void Print(display,window,width,height,string)
   Display	*display;
   Window	window;
   unsigned int width, height;
   char		*string;
{
	XDrawString(display,window,defaultGC,xText,yText,string,
		    strlen(string));
}

static	void UpdateDimensions(event,width,height)
   XConfigureEvent	*event;
   unsigned int		*width,
			*height;
{
	*width = event->width;
	*height = event->height;
}

T.RTitleUserPersonal
Name
DateLines
1255.1Iconify_pixmapSTAR::CYPRYCHThu Aug 10 1989 15:5813
    There are two sized icons - depending on how you
    wish to you your workstation.  In order to change
    the small icons (17x17) you must set the iconify_pixmap
    instead of the icon_pixmap.  Iconify_pixmap is in
    the DECWmHints property,  and not accessible through
    XSetStandardProperties.   There are toolkit routines
    that let you set Iconify_pixmap,  or you can use
    the X XChangeProperty routine to change the property
    of the DECWmHints property to contain an Iconify_pixmap.
    
    icon_pixmap (in XSetStandardProperties) is the large
    icon (32x32).

1255.2When to use 32x32 icon size?TPOVC::JOHNNYHOThu Aug 10 1989 23:106
    Thanks, .1,
    
    It seems that 16x16 is the default size of icons,right?
    When will 32x32 icon size be used?
    

1255.3iconStyle 0 is 32x32, 1 is 17x17LBDUCK::SCHOELLERWho&#039;s on first?Fri Aug 11 1989 10:588
wm*iconStyle and wm*applicationClass.iconStyle can be used to tell the
DECwindows window manager whether to use big or little icons.  0 is big,
1 is little.

The sizes are 17x17 and 32x32 NOT 16x16

Dick

1255.4DECWmHints.h describes what you needRANCHO::KIMBALLYou&#039;re soaking in it...Tue Aug 15 1989 23:3824
    Take a look in DECWmHints.h ; it describes the DECWmHints record in
    which the iconify_pixmap hint resides.  In addition to the method 
    mentioned in .1, there is the (undocumented!) XSetDECWmHints
    routine:                                                  
    
    .
    #include <X11/DECWmHints.h>
    .
    .
    DECWmHintsRec dechints;
    .
    .
    dechints.value_mask = DECWmIconifyPixmapMask;
    dechints.iconify_pixmap = mypixmap;
    WmSetDECWmHints(mydisp,XInternAtom(mydisp,"DEC_WM_HINTS",0),
                            mywind, &dechints);

    
    The problem (if you consider it one :-) ) is that the dxwm window manager
    does not take the icon_pixmap in WM_HINTS but instead looks for
    the iconify_pixmap in DEC_WM_HINTS.  I have QAR'd this as incompatible
    with other applications and window managers, and was told that the
    window manager would be adjusted accordingly. 

1255.5huh?STAR::CYPRYCHWed Aug 16 1989 11:3317
    The iconify_pixmap is *always* used for the shrink to icon
    button.  If you wish your shrink to icon button to be
    the actual icon,  then you set "SMALL" as your preferred
    icon size.  Window manager uses iconify_pixmap in
    DECWmHints.
    
    If you wish to use BIG icons,  the window manager uses
    icon_pixmap in WmHints.  However,  for the shrink to
    icon button, the iconify_pixmap is always used.
    
    If you do not set any pixmap at all,  the window manager
    uses a default.   If you have your workstation set to SMALL
    icons and you do not set iconify_pixmap,  the window manager
    uses a default icon.
    
    This is how it works.  In V2 there are no changes here at all.

1255.6Oh yes it does.STAR::CYPRYCHWed Aug 16 1989 11:3612
    re: .4
    
    The window manager DOES used the pixmap in WMHINTS -
    if you set your workstation to have BIG icons.
    
    It ALWAYS has used this.
    
    Also,  any routine you use to begins with "WM" is
    an internal routine.  You use it at your own risk.
    Please just change the property DECWmHints via the
    XChangeProperty routine.