Flexible Windows

version 13/130803 by Jon Ingold

  • Home page
  • Beginning
  • Previous
  • Next



  • Section - Gargoyle Workaround

    [Added by Erik Temple 22 May 2010]

    [Workaround provided by Ben Cressey, with this explanation:

    "Gargoyle has a bit of an issue with multiple text buffers. The
    background color for the most recently created text buffer is used as
    the color of the padding between the application borders and the
    boundaries of the Glk window model. This padding is not part of Glk's
    model and at best its behavior is undefined. At worst, the very
    existence of such padding is disallowed by the spec. (I don't
    actually know for sure.)

    Gargoyle uses these hints to "guess" the appropriate color of the
    padding. The above example would set it back to white, once you're
    done opening all of your text buffers. Per the Glk spec, this will
    have no effect on any Glk windows until the next time you open a text
    buffer, so as a practical matter it should do nothing in other Glk
    implementations."

    ( from http://groups.google.com/group/rec.arts.int-fiction/msg/b88316e2dcf1bb6b )

    (The workaround as incorporated here accepts a glulx color value (see Glulx Text Effects) rather than defaulting to white as in the originally posted code.)

    After each text-buffer window is opened, the "Gargoyle text-buffer workaround rule" resets the text-buffer background color stylehint to the background color of the main-window.

    The phrase used to accomplish this could also be used to set the Gargoyle border color to a *different* color from that of any of the windows. After all of your text-buffers have been opened, set the background color as desired, e.g.:

        set the Gargoyle background color to the color g-Lavender.

    ]

    After constructing a g-window when the type of the pending g-window is g-text-buffer (this is the Gargoyle text-buffer workaround rule):
        if the back-colour of the main-window is g-placenullcol:
            set the text-buffer background color to g-white;
        otherwise:
            reset the text-buffer background color to the back-colour of the main-window.

    To set/reset the/-- Gargoyle/-- text/text-buffer/-- window/-- background color/-- to the/-- color/-- (color_value - a glulx color value):
        (- HintGargoyleBorder ({color_value});-)

    Include (-

    [ HintGargoyleBorder color_value col ;
        col = ColVal(color_value);
        glk_stylehint_set(wintype_textbuffer, 0, stylehint_backcolor, col);
    ];

    -).