[comp.windows.x] Dec Toolkit PIXMAP/Label question

gerolima@wdl1.UUCP (Mark K Gerolimatos) (08/24/89)

	Ever tried to use the Dec toolkit? Without pulling your hair out?

	I'm trying to do something very simple: make a label widget with
	a pixmap label.

	The following code:

	#include "cofirm_right.pr"
		:
		:
		:
	Pixmap middle;
		:
		:
		:
        middle = XCreatePixmapFromBitmapData(display,rootwin,confirm_right_bits,
                                confirm_middle_width,confirm_middle_height,1);
        /* first off, the icons for the mouse buttons */
	n = 0;
	XtSetArg(list[n],DwtNlabelType,DwtPixmap);n++;
	XtSetArg(list[n],DwtNx,110);n++;
	XtSetArg(list[n],DwtNy,2);n++;
	XtSetArg(list[n],DwtNpixmap,left);n++;
	/* error occurs here VVVVVV	*/
        mousemsg_left_mouse_item = DwtLabelCreate(parent,"dfg",list,n);
	/*	^^^^^^^^		*/

	produces the following semi-useless garbage:

X Protocol error:  BadValue, integer parameter out of range for operation
  Major opcode of failed request:  53 (X_CreatePixmap)
  Minor opcode of failed request:  0
  Resource id in failed request:  0x0
  Serial number of failed request:  29
  Current serial number in output stream:  41

	What's going on here? What's the bad value? Huh?

	Does anyone got an idea out there? How about some documentation
	as to how to do this? It would really be nice if DEC would provide
	some examples that aren't using that bogus UIL (I'm sorry, as of now,
	I simply find little or no use for it, and resent the implicit
	"ram down the throat" that I sense from their manuals)--a non-UIL
	version of DECburger would be real keen.

	Please mail me directly, as I don't "rn" all that often.
	-Mark
		sun!wdl1!gerolima
			or
		         gerolima@
			          wdl1.fac.ford.com
			          wdl34.fac.ford.com
			          polya.stanford.edu
			          wdl1.uucp

P.S. What the hell is a drawable? What does the line:
     "Specifies the drrawable that indicates the screen."
     mean?  Who X/Dwt manuals? George Bush? (If so, there'd
     have been no Quid Pro Quo.)
P.P.S. To {First Name Forgotton} Graham at DECWRL: my mind is open
       now, but I still feel that the Sunview programming interface 
       is FAR superior.

converse@EXPO.LCS.MIT.EDU (Donna Converse) (08/31/89)

> 	I'm trying to do something very simple: make a label widget with
> 	a pixmap label.

[excerpts of code]

>      middle = XCreatePixmapFromBitmapData(display,rootwin,confirm_right_bits,
>                              confirm_middle_width,confirm_middle_height,1);

>	produces the following semi-useless garbage:
> 
> X Protocol error:  BadValue, integer parameter out of range for operation
>   Major opcode of failed request:  53 (X_CreatePixmap)
>   Minor opcode of failed request:  0
>   Resource id in failed request:  0x0
>   Serial number of failed request:  29
>   Current serial number in output stream:  41
> 
> 	What's going on here? What's the bad value? Huh?

Wrong number of arguments to XCreatePixmapFromBitmapData.  If your width or
height are 0 that would produce the BadValue error.  But it is probably the
depth argument, which is missing, which is resulting in the BadValue error.

> P.S. What the hell is a drawable? What does the line:
>      "Specifies the drrawable that indicates the screen."
>      mean? 

The glossary defines drawable.  The server uses the drawable argument to 
determine on which screen to create the pixmap; pixmaps can only be used
on the screen on which they were created.


Donna Converse
converse@expo.lcs.mit.edu

graham@fuel.dec.com (kris graham) (08/31/89)

> > 	I'm trying to do something very simple: make a label widget with
> > 	a pixmap label.
> 
> [excerpts of code]
> 
> >      middle = XCreatePixmapFromBitmapData(display,rootwin,confirm_right_bits,
> >                              confirm_middle_width,confirm_middle_height,1);
> 
> >	produces the following semi-useless garbage:
> > 
> > X Protocol error:  BadValue, integer parameter out of range for operation
> >   Major opcode of failed request:  53 (X_CreatePixmap)
> >   Minor opcode of failed request:  0
> >   Resource id in failed request:  0x0
> >   Serial number of failed request:  29
> >   Current serial number in output stream:  41
> > 
> > 	What's going on here? What's the bad value? Huh?
> 
> Wrong number of arguments to XCreatePixmapFromBitmapData.  If your width or
> height are 0 that would produce the BadValue error.  But it is probably the
> depth argument, which is missing, which is resulting in the BadValue error.
> 
> > P.S. What the hell is a drawable? What does the line:
> >      "Specifies the drrawable that indicates the screen."
> >      mean? 
> 
> The glossary defines drawable.  The server uses the drawable argument to 
> determine on which screen to create the pixmap; pixmaps can only be used
> on the screen on which they were created.
> 
> 
> Donna Converse
> converse@expo.lcs.mit.edu

I don't write that much  DECwindows toolkit code.......however.........

Mark K Gerolimatos' statement in the base article caught my attention ;-)

>	Ever tried to use the Dec toolkit? Without pulling your hair out?
>                I'm trying to do something very simple: make a label widget with
>                a pixmap label.......

Overall, Donna is correct.

The following is a sample of how to create pixmaps with the DECwindows toolkit.

/* routine to make a pixmap */
static Pixmap MakePixmap(dpy, root, data, width, height)
    Display     *dpy;
    Drawable    root;
    short       *data;
    Dimension   width, height;
{
    Pixmap pid;
    unsigned long       ScreenNumber;

    ScreenNumber = XDefaultScreen (dpy);

    pid = XCreatePixmapFromBitmapData (dpy, root, data,
                (Dimension) width, (Dimension) height,
                (unsigned long) BlackPixel (dpy, ScreenNumber),
                (unsigned long) WhitePixel (dpy, ScreenNumber),
                (unsigned int) DefaultDepth (dpy, ScreenNumber));
   return(pid);
}



-- 
Christopher Graham          
Digital Equipment Corp            
Ultrix Resource Center                                             
New York City

ctr@xpiinc.UU.NET (Christian Reimer) (08/31/89)

In article <1459@riscy.dec.com> graham@fuel.dec.com (kris graham) writes:
>
>The following is a sample of how to create pixmaps with the DECwindows toolkit.
>
>static Pixmap MakePixmap(dpy, root, data, width, height)
>    Display     *dpy;
>    Drawable    root;
>    short       *data;
>    Dimension   width, height;
>{
>    Pixmap pid;
>    unsigned long       ScreenNumber;
>    ScreenNumber = XDefaultScreen (dpy);
>    pid = XCreatePixmapFromBitmapData (dpy, root, data,
>                (Dimension) width, (Dimension) height,
>                (unsigned long) BlackPixel (dpy, ScreenNumber),
>                (unsigned long) WhitePixel (dpy, ScreenNumber),
>                (unsigned int) DefaultDepth (dpy, ScreenNumber));
>   return(pid);
>}

  I don't see any DECwindows toolkit calls here, do you?

  Using the term "DECwindows" gives the impression that you are talking
about some proprietary DEC system, not the freely distributed X Window System.
There ARE people out there that do not automatically make the identification
between DECwindows and X.  Let's not confuse them further by abusing our
terminology.

By the way,
  Does anyone have an example which *really* shows how to use the DEC toolkit
to do  something simple (like make a label widget with a pixmap label) without
having to pull one's hair out?

------------------------------------------------------------------------------
  Christian Reimer |	"Live free or develop a
 Visual Technology |		proprietary [operating|windowing] system!"
 ctr@xpiinc.uu.net |
------------------------------------------------------------------------------

graham@fuel.dec.com (kris graham) (09/01/89)

In article <226@xpiinc.UU.NET>, ctr@xpiinc.UU.NET (Christian Reimer) writes:

> Subject: Re: Dec Toolkit PIXMAP/Label question
> Date: 31 Aug 89 16:16:01 GMT
> 
> In article <1459@riscy.dec.com> graham@fuel.dec.com (kris graham) writes:

>The following is a sample of how to create pixmaps with the DECwindows toolkit.
>
>static Pixmap MakePixmap(dpy, root, data, width, height)
>    Display     *dpy;
>    Drawable    root;
>    short       *data;
>    Dimension   width, height;
>{
>    Pixmap pid;
>    unsigned long       ScreenNumber;
>    ScreenNumber = XDefaultScreen (dpy);
>    pid = XCreatePixmapFromBitmapData (dpy, root, data,
>                (Dimension) width, (Dimension) height,
>                (unsigned long) BlackPixel (dpy, ScreenNumber),
>                (unsigned long) WhitePixel (dpy, ScreenNumber),
>                (unsigned int) DefaultDepth (dpy, ScreenNumber));
>   return(pid);
>}

>>I don't see any DECwindows toolkit calls here, do you?

You are missing the point.   Arguing about not seeing  "any DECwindows toolkit calls "
does not solve the base problem.   What causes the program to bomb was due to
an oversight in the use of an Xlib routine.   I  communicated with the base article's
author off-line..and his problem is solved.
It's common practice to ( be able to ) mix and match Xlib routines with most toolkits...be it 
from HP, DEC, Sun, or "St. Elsewhere" ;-)

>Using the term "DECwindows" gives the impression that you are talking
>about some proprietary DEC system, not the freely distributed X Window System.

This is unnecessary harassment....
I guess the name DEC in anything makes a product "PROPRIETARY"....heh ?  ;-)
Maybe it should  have been called OPENXXXXX......

DECwindows is  an epitome of an architecture that DIGITAL assigns to designs (products)
that imbibes the X philosophy.   (Sorry to those offended by any  "marketeering" in this
definition).

>There ARE people out there that do not automatically make the identification
>between DECwindows and X.  Let's not confuse them further by abusing our
>terminology.

If this is true, then it rather unfortunate.  There is enuff literature out there to
help resolve this confusion.    MIT's implementation of X  should be seen more
like specs, and how-it-should-be-done....rather than branding it the de facto
everything (adherence to the specs is the most important thing).  Most of
the programs on the X tape are contributions that show how things should
be done...the X-way.....that is.

>By the way,
>Does anyone have an example which *really* shows how to use the DEC toolkit
>to do  something simple (like make a label widget with a pixmap label) without
>having to pull one's hair out?

I pray that you do not get "bald" as a result of using  "the DEC toolkit  to do  something 
simple " ;^)

-- 
Christopher Graham          "Discontent is the first step in the progress of humans, beasts,
Digital Equipment Corp       and nations"           
Ultrix Resource Center                                            
New York City        (representing free speech...not DIGITAL)

marbru@auto-trol.UUCP (Martin Brunecky) (09/01/89)

>There ARE people out there that do not automatically make the identification
>between DECwindows and X.  Let's not confuse them further by abusing our
>terminology.
>
>If this is true, then it rather unfortunate....
>MIT's implementation of X  should be seen more
>like specs, and how-it-should-be-done....rather than branding it the de facto
>everything (adherence to the specs is the most important thing)...

	Mhmmm. Then I have a problem. My experience shows that EVEN
	though DECwindows is BASED on X/Xt, it:
	1) is not identical (for example, DECWindows Xt is NOT Xt R3)
	   (I'v spent countless hours debugging widgets which run under
	    XtR3 but not DECwindows, just to discover that SetValuesHook
	    is called with a "clone" widget in DWT...etc.etc.)
	2) very often does NOT FOLLOW "how-it-should-be-done", primarily
	   because - VMS engineering aparently knows better than MIT
		   - they try to support other languages than "C", and
		     thus had to sacrifise here and there....

>
>Does anyone have an example which *really* shows how to use the DEC toolkit
>to do  something simple (like make a label widget with a pixmap label) without
>having to pull one's hair out?
>
	We will see a LOTS of remarks like this one. The problem is that
	Xtoolkit is object oriented (but neither Smaltalk-80 nor C++),
	and not many programmers out there understand what that really means.

	DECwindows (and Motiff seems to follow) made that fact less clear
	by providing bunch of convenience routines, which pretend that
	Xt is NOT OBJECT oriented - making it look like "yet another subroutine
	library".
	In part, it makes things LOOK familiar and easy, but on the other hand 
	causes lots of confusion. Whenever the poor user wants to something
	more than the toolkit developer had in mind, he is thrown into the 
	reality which he is NOT prepared to face. 

###############################################################################
Martin Brunecky, Auto-trol Technology Corporation,
12500 North Washington Street, Denver, CO-80241-2404
(303) 252-2499                                        ncar!ico!auto-trol!marbru
###############################################################################

graham@fuel.dec.com (kris graham) (09/02/89)

>	Mhmmm. Then I have a problem. My experience shows that EVEN
>	though DECwindows is BASED on X/Xt, it:
>	1) is not identical (for example, DECWindows Xt is NOT Xt R3)


DECwindows conforms to X specs.....*not* 'BASED on X/Xt'.   MIT's  toolkit (Xt) is
only a reference implementation....most vendors  provide access to *some* features in
the MIT toolkit.  The protocol and Xlib are the most important specifications.   As far I 
know no vendor is under obligation to roll out revision levels at the same pace as MIT.
The vendors are paid by their customers to minimize bugs and provide stable software.
Also, most vendors ship other products, in addition to "toolkits".   Toolkits are the toys
of developers, not application end users.

>(I'v spent countless hours debugging widgets which run unde
>XtR3 but not DECwindows, just to discover that SetValuesHook......

So, who do you want to point fingers at?   XtR3  != DECwindows toolkit!
Mixing and matching different toolkits is nothing but a masochist adventure ;-)
The XtR3 stuff that you mention is supported under ULTRIX/DECwindows......and there
is a special library provided to link against.

>very often does NOT FOLLOW "how-it-should-be-done", primarily
>because - VMS engineering aparently knows better than MIT
>	  - they try to support other languages than "C", and
>                        thus had to sacrifise here and there....


A very daring and silly thing indeed to say in here!!
Get this straight........VMS IS NOT EQUAL TO DECwindows!
The DECwindows architecture supports MSDOS, U*IX, and VMS ( among others to come).

- 
Christopher Graham          "Judgement.....thou hast fled to brutish beasts"
Digital Equipment Corp         Shakespeare in Henry IV part 1.   
Ultrix Resource Center