T.R | Title | User | Personal Name | Date | Lines |
---|
1978.1 | Have you read X-Window-System yet? | DECWIN::KLEIN | | Thu Dec 28 1989 15:56 | 16 |
| 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.2 | How to acquire a drawable
| FREZEN::PROJECTS | | Thu Dec 28 1989 19:43 | 21 |
|
/
[ \/ ]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.3 | How to acquire a drawable | FREZEN::PROJECTS | | Thu Dec 28 1989 19:46 | 8 |
|
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.4 | | SDSVAX::SWEENEY | International House of Workstations | Fri Dec 29 1989 09:23 | 29 |
| 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.5 | How to acquire a drawable | FREZEN::PROJECTS | | Fri Dec 29 1989 12:52 | 13 |
|
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.6 | | DECWIN::FISHER | Burns Fisher 381-1466, ZKO3-4/W23 | Mon Jan 01 1990 13:24 | 12 |
| 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
|