9.4 Mirrors and Mirrored Sheets

  • 9.4.1 Mirror Functions
  • 9.4.2 Internal Interfaces for Native Coordinates
  • A mirrored sheet is a special class of sheet that is attached directly to a window on a display server. Grafts, for example, are always mirrored sheets. However, any sheet anywhere in a sheet hierarchy may be a mirrored sheet. A mirrored sheet will usually contain a reference to a window system object, called a mirror. For example, a mirrored sheet attached to an X11 server might have an X window system object stored in one of its slots. Allowing mirrored sheets at any point in the hierarchy enables the adaptive toolkit facilities. [annotate]

    [mirrored sheet, Concept← A Glossary]
    [mirrored sheet, Concept← A Glossary]
    [mirrored sheet, Concept← A Glossary]

    Since not all sheets in the hierarchy have mirrors, there is no direct correspondence between the sheet hierarchy and the mirror hierarchy. However, on those display servers that support hierarchical windows, the hierarchies must be parallel. If a mirrored sheet is an ancestor of another mirrored sheet, their corresponding mirrors must have a similar ancestor/descendant relationship. [annotate]

    CLIM interacts with mirrors when it must display output or process events. On output, the mirrored sheet closest in ancestry to the sheet on which we wish to draw provides the mirror on which to draw. The mirror's drawing clipping region is set up to be the intersection of the user's clipping region and the sheet's region (both transformed to the appropriate coordinate system) for the duration of the output. On input, events are delivered from mirrors to the sheet hierarchy. The CLIM port must determine which sheet shall receive events based on information such as the location of the pointer. [annotate]

    In both of these cases, we must have a coordinate transformation that converts coordinates in the mirror (so-called "native" coordinates) into coordinates in the sheet and vice-versa. [annotate]

    mirrored-sheet-mixin   [Class]
              

    This class is mixed in to sheet classes that can be directly mirrored. [annotate]

    [annotate]

    9.4.1 Mirror Functions

    Minor issue: What kind of an object is a mirror? Is it the Lisp object that is the handle to the actual toolkit window or gadget? --- SWM [annotate]

    sheet-direct-mirror  sheet [Generic Function]
              

    Returns the mirror of the sheet sheet. If the sheet is not a subclass of mirrored-sheet-mixin, this will return nil. If the sheet is a subclass of mirrored-sheet-mixin and does not currently have a mirror, sheet-mirror will return nil. [annotate]

    Note: In the final sentence, "sheet-mirror" should probably be "sheet-direct-mirror". [edit]-- Willem Broekema 2009-05-10 13:02Z
     

    [annotate]

    sheet-mirrored-ancestor  sheet [Generic Function]
              

    Returns the nearest mirrored ancestor of the sheet sheet. [annotate]

    [annotate]

    Note: Note, that this could be the sheet itself also, if it is mirrored. [edit]-- Gilbert Baumann 2017-08-09 02:41Z
     

    sheet-mirror  sheet [Generic Function]
              

    Returns the mirror of the sheet sheet. If the sheet is not itself mirrored, sheet-mirror returns the direct mirror of its nearest mirrored ancestor. sheet-mirror could be implemented as: [annotate]

    (defun sheet-mirror (sheet)
      (sheet-direct-mirror (sheet-mirrored-ancestor sheet)))
    

    [annotate]

    Note: Except, of course, that this example defines a normal function and the specification calls for a generic function. [edit]-- Alastair Bridgewater 2011-04-29 18:37Z
     

    realize-mirror  port mirrored-sheet [Generic Function]
              

    Creates a mirror for the sheet mirrored-sheet on the port port, if it does not already have one. The returned value is the sheet's mirror; the type of this object is implementation dependent. [annotate]

    [annotate]

    destroy-mirror  port mirrored-sheet [Generic Function]
              

    Destroys the mirror for the sheet mirrored-sheet on the port port. [annotate]

    [annotate]

    raise-mirror  port sheet [Generic Function]
              

    Raises the sheet sheet's mirror to the top of all of the host windows on the port port. sheet need not be a directly mirrored sheet. [annotate]

    [annotate]

    bury-mirror  port sheet [Generic Function]
              

    Buries the sheet sheet's mirror at the bottom of all of the host windows on the port port. sheet need not be a directly mirrored sheet. [annotate]

    [annotate]

    port  (sheet basic-sheet) [Method]
              

    If sheet is currently mirrored on a display server, this returns the port with which sheet is associated. Otherwise it returns nil. [annotate]

    [annotate]

    9.4.2 Internal Interfaces for Native Coordinates

    Minor issue: Do these functions work on any sheet, or only on sheets that have a mirror, or only on sheets that have a direct mirror? Also, define what a "native coordinate" are. Also, do sheet-device-transformation and sheet-device-region really account for the user's transformation and clipping region? --- SWM [annotate]

    sheet-native-transformation  sheet [Generic Function]
              

    Returns the transformation for the sheet sheet that converts sheet coordinates into native coordinates. The object returned by this function is volatile, so programmers must not depend on the components of the object remaining constant. [annotate]

    Note: What if the sheet is not grafted? Or rather: We don't find any mirror along the parent chain. [edit]-- Gilbert Baumann 2021-02-18 04:46Z
     

    [annotate]

    sheet-native-region  sheet [Generic Function]
              

    Returns the region for the sheet sheet in native coordinates. The object returned by this function is volatile, so programmers must not depend on the components of the object remaining constant. [annotate]

    [annotate]

    Note: Which region? SHEET-REGION or the actual region clipped by the parent, siblings and children? [edit]-- Gilbert Baumann 2021-02-18 13:46Z
     

    sheet-device-transformation  sheet [Generic Function]
              

    Returns the transformation used by the graphics output routines when drawing on the mirror. This is the composition of the sheet's native transformation and the user transformation. The object returned by this function is volatile, so programmers must not depend on the components of the object remaining constant. [annotate]

    [annotate]

    Note: What if the device we draw to is not the mirror? [edit]-- Gilbert Baumann 2021-02-18 07:52Z
     

    sheet-device-region  sheet [Generic Function]
              

    Returns the actual clipping region to be used when drawing on the mirror. This is the intersection of the user's clipping region (transformed by the device transformation) with the sheet's native region. The object returned by this function is volatile, so programmers must not depend on the components of the object remaining constant. [annotate]

    [annotate]

    Note: Again, who says I'll draw on the mirror? [edit]-- Gilbert Baumann 2021-02-18 13:51Z
     
    Note: It says "the actual clipping region" and "the intersection [...] with the sheet's native region." This would imply that SHEET-NATIVE-REGION would account for the regions of the parent, [non-mirrored] siblings, and children. [edit]-- Gilbert Baumann 2021-02-18 13:53Z
     

    invalidate-cached-transformations  sheet [Generic Function]
              

    sheet-native-transformation and sheet-device-transformation typically cache the transformations for performance reasons. invalidate-cached-transformations clears the cached native and device values for the sheet sheet's transformation and clipping region. It is invoked when a sheet's native transformation changes, which happens when a sheet's transformation is changed or when invalidate-cached-transformations is called on any of its ancestors. [annotate]

    [annotate]

    invalidate-cached-regions  sheet [Generic Function]
              

    sheet-native-region and sheet-device-region typically cache the regions for performance reasons. invalidate-cached-regions clears the cached native and device values for the sheet sheet's native clipping region. It is invoked when a sheet's native clipping region changes, which happens when the clipping region changes or when invalidate-cached-regions is called on any of its ancestors. [annotate]

    [annotate]

    Note: What about siblings? [edit]-- Gilbert Baumann 2013-03-15 19:34Z