[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

1978.0. "How to acquire a drawable" by FREZEN::PROJECTS () Thu Dec 28 1989 14:55


	Hi ... could someone give me ahand here,

	I am trying to use XCreateGC and the 2nd parameter is asking for a 
	drawable.

	I'm wondering how I can acquire the drawable I want. I'm very fogged up
	on this drawable entity. Which drawable do I want to use? 
	Which Decwindows calls and X-Windows calls can I use to acquire this
	drawable.

	Much appreciated
T.RTitleUserPersonal
Name
DateLines
1978.1Have you read X-Window-System yet?DECWIN::KLEINThu Dec 28 1989 15:5616
Hi again, []Mr, []Mrs, []Miss, []Ms or []Other Project.

The drawable really doesn't matter too much.  It just must have the same
display/screen as the window/drawable that you eventually use the GC against.
I believe that XCreateGC only uses the drawable to get depth information.

If you got back a widget (w) from XtInitialize (are you even using the
toolkit?), then simply use XtWindow(w) as the drawable for XCreateGC.

Have you considered also using XtGetGC, which gives you a shared GC?
If you are not modifying the GC after it has been created, it is
more efficient to use a shared one.

Either way, you can only do this after the widget has been realized.

-steve-
1978.2How to acquire a drawable FREZEN::PROJECTSThu Dec 28 1989 19:4321
            /
	[ \/ ]Mr, [ ]Mrs, [ ]Miss, [ ]Ms or [ ]Other  Project.

When I use XtWindow (w), I get...

X error event received from server: BadDrawable - parameter not a Pixmap or Wind
ow
  Failed request major op code 55 X_CreateGC
  Failed request minor op code 0 (if applicable)
  ResourceID 0x0 in failed request (if applicable)
  Serial number of failed request 353
  Current serial number in output stream 354
%XLIB-E-ERROREVENT, error event received from server
%TRACE-E-TRACEBACK, symbolic stack dump follows


When I use XRootOfScreen I get an accessvio


Much appreciated... Ken
1978.3How to acquire a drawableFREZEN::PROJECTSThu Dec 28 1989 19:468

	by the way I'm trying to implement a private color cell strategy and
	cannot use the XtGetGC routine... also I am acquiring a widget (w)
	to perform Xt routines upon


	Ken
1978.4SDSVAX::SWEENEYInternational House of WorkstationsFri Dec 29 1989 09:2329
    Ken,
    
    I think you're going around getting this information incorrectly. 
    There are plenty of examples that get and manipulate gc's that would
    directly answer your question.
    
    There's good documentation published by Digital and books published by
    third parties on X that can answer the sort of questions you are asking
    here.
    
    Finally, "bad drawable" when using any kind of Xt... call usually means
    that the widget has not been realized.  Until a widget is realized the
    window is not created and therefore whatever is in XtWindow(w) is
    meaningless to X.
    
    A couple of macros from Xlib.h
    
    #define RootWindow(dpy, scr)    (((dpy)->screens[(scr)]).root)
    #define DefaultGC(dpy, scr)     (((dpy)->screens[(scr)]).default_gc)
    #define DefaultGCOfScreen(s)    ((s)->default_gc)
    
    dpy is the display returned by XtOpenDisplay
    scr is the screen index (0,1,2...)
    s is the screen returned by XtScreen(widget)
    
    But as a earlier reply indicated the best method to get a GC is XtGetGC
    In VMS, "$SEARCH DECW$INCLUDE:*.H string", I find to be very helpful
    
    Patrick Sweeney
1978.5How to acquire a drawableFREZEN::PROJECTSFri Dec 29 1989 12:5213

	re. 4

	Isn't is appropriate create the GC before it is realized?

	If I can't do this then set_gcs routines for user defined
	widgets in DECWINDOWS does not allow for the X windows private 
	color cell strategy to be used which wouldn't be nice.

	Could you correct me if I am wrong.

	Much appreciated
1978.6DECWIN::FISHERBurns Fisher 381-1466, ZKO3-4/W23Mon Jan 01 1990 13:2412
    As Steve said earlier, you can use just about anything that has the
    right screen and depth.  For example, how about XRootWindowOfScreen()?
    
	If I can't do this then set_gcs routines for user defined
	widgets in DECWINDOWS does not allow for the X windows private 
	color cell strategy to be used which wouldn't be nice.
    
    Sorry, but I don't understand this statement.  You don't need a GC till
    you are about to draw.  You can allocate colors anytime you want.
    
    Burns