[comp.windows.x] XGetGCValues doesn't work per documentation

mouse@LARRY.MCRCIM.MCGILL.EDU (der Mouse) (07/09/90)

		      [ sent to xbugs as well as xpert ]

			  X Window System Bug Report
			    xbugs@expo.lcs.mit.edu


VERSION:
    R4

CLIENT MACHINE and OPERATING SYSTEM:
    Sun-3/60, release 3.5 (but this is irrelevant)

DISPLAY TYPE:
    Sun bwtwo (but this is irrelevant)

WINDOW MANAGER:
    any or none

AREA:
    Xlib / protocol

SYNOPSIS:
    XGetGCValues works only for values Xlib has in its cache.  In
    particular, it cannot get the font from a GC whose font has been
    set in some way other than by client action (eg, by letting it
    default at creation time, or with XCopyGC from another such GC).

DESCRIPTION:

    The restrictions mentioned in the documentation for XGetGCValues do
    not include any note to the effect that asking for GCFont works
    only sometimes.

    This is annoying, because it means that there is *still*[%] no way
    to get a font ID for the server default font.

    This was one of the more annoying (to me) shortcomings of R3; I had
    assumed that the presence of XGetGCValues in R4 meant that it was
    cured, and the documentation implies this.  But the situation
    really is not improved at all.

    This also means that one of the major uses of XGetGCValues - saving
    and restoring GC state - doesn't work for fonts, because if the GC
    used to have the server default font in it then when it's retrieved
    with XGetGCValues and set back later with XChangeGC it will not
    work.  (Presumably it will generate a Font error, though I haven't
    tried it.)

REPEAT BY:
    Call XGetGCValues on the default GC of a connection, asking for
    GCFont.  Notice that the generated value bears no relationship to a
    valid font ID.

SAMPLE FIX:
    Nope.  I would prefer to fix the code, but it is not obvious how to
    do this, for there appears to be no protocol request allowing a
    client to determine the ID of the default font.  The only
    alternative is to mention the restriction in the documentation,
    which I don't like doing because I *want* to be able to get a font
    ID for the server default font.  (An alternative fix for my problem
    would be to allow a GContext ID in the font slot of a change-GC
    call, with the server required to fetch the corresponding font ID
    if passed a graphics context ID.  In some ways I actually prefer
    this alternative.)

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (07/09/90)

    The only
    alternative is to mention the restriction in the documentation,

Right.

    which I don't like doing because I *want* to be able to get a font
    ID for the server default font.

Sorry.