9.2 Ports

A port is a logical connection to a display server. It is responsible for managing display output and server resources, and for handling incoming input events. Typically, the programmer will create a single port that will manage all of the windows on the display. [annotate]

[port, Concept← 13.3.2 Contrasting Colors, contrasting-inks-limit]
[port, Concept← 11.3 Controlling Text Style Mappings, text-style-mapping]
[port, Concept← 10.3.2 Contrasting Dash Patterns, contrasting-dash-pattern-limit]
[port, Concept← 9.4.1 Mirror Functions, bury-mirror]
[port, Concept← 9.4.1 Mirror Functions, raise-mirror]
[port, Concept← 9.4.1 Mirror Functions, destroy-mirror]
[port, Concept← 9.4.1 Mirror Functions, realize-mirror]
[port, Concept← 9.3 Grafts, map-over-grafts]
[port, Concept← 9.2 Ports, destroy-port]
[port, Concept← 9.2 Ports, restart-port]
[port, Concept← 9.2 Ports, port-server-path]
[port, Concept← 9.2 Ports, with-port-locked]
[port, Concept← 9.2 Ports, portp]
[port, Concept← 8.3.4.1 Grafting and Degrafting of Mediums, degraft-medium]
[port, Concept← 8.3.4.1 Grafting and Degrafting of Mediums, engraft-medium]
[port, Concept← 8.3.4.1 Grafting and Degrafting of Mediums, make-medium]
[port, Concept← 8.3.4.1 Grafting and Degrafting of Mediums, allocate-medium]
[port, Concept← 6.1 Introduction]

A port is described with a server path. A server path is a list whose first element is a keyword that selects the kind of port. The remainder of the server path is a list of alternating keywords and values whose interpretation is port type-specific. [annotate]

port   [Protocol Class]
          

The protocol class that corresponds to a port. If you want to create a new class that behaves like a port, it should be a subclass of port. All instantiable subclasses of port must obey the port protocol. [annotate]

Note: The "should be a subclass of port" part misleads one away from subclassing basic-port, or am I missing something? [edit]-- Samium Gromoff 2009-08-28 23:25Z
 
Note: For difference between port and basic-port, I think it's just like basic-port is like standard-class in mop (usually we only define class of standard-class, but for special purpose class we define class of different meta class.) In this case we usually define our port of basic-port, but if under some platforms port object has same utility but different internal process, we may direct subclass port? For example, on Windows and OSX, the native GUI is not via a client-server approach that use a port connect to x-server, but directly manipulate foreign pointers. [edit]-- Bo Yao 2016-12-03 21:58Z
 

All of the subclasses of port are mutable. [annotate]

[annotate]

portp  object [Protocol Predicate]
          

Returns true if object is a port, otherwise returns false. [annotate]

[annotate]

basic-port   [Class]
          

The basic class on which all CLIM ports are built, a subclass of port. This class is an abstract class, intended only to be subclassed, not instantiated. [annotate]

[annotate]

find-port  &rest initargs &key (server-path *default-server-path*) &allow-other-keys  [Function]
          

Finds a port that provides a connection to the window server addressed by server-path. If no such connection exists, a new connection will be constructed and returned. The initargs in initargs will be passed to the function that constructed the new port. [annotate]

[annotate]

*default-server-path*   [Variable]
          

This special variable is used by find-port and its callers to default the choice of a display service to locate. Binding this variable in a dynamic context will affect the defaulting of this argument to these functions. This variable will be defaulted according to the environment. In the Unix environment, for example, CLIM will attempt to set this variable based on the value of the DISPLAY environment variable. [annotate]

The value of *default-server-path* is a cons of a port type followed by a list of initargs. [annotate]

The following are the recommendations for port types and their initargs. This list is not intended to be comprehensive, nor is it required that a CLIM implementation support any of these port types. [annotate]

[annotate]

:clx  &key host display-id screen-id [Server Path]
          

Given this server path, find-port finds a port for the X server on the given host, using the display-id and screen-id. [annotate]

On a Unix host, if these values are not supplied, the defaults come from the DISPLAY environment variable. Each CLIM implementation must describe how it uses such environment variables. [annotate]

[annotate]

:motif  &key host display-id screen-id [Server Path]
          

Given this server path, find-port finds a port for a Motif X server on the given host, using the display-id and screen-id. [annotate]

On a Unix host, if these values are not supplied, the defaults come from the DISPLAY environment variable. [annotate]

[annotate]

:openlook  &key host display-id screen-id [Server Path]
          

Given this server path, find-port finds a port for an OpenLook X server on the given host, using the display-id and screen-id. [annotate]

On a Unix host, if these values are not supplied, the defaults come from the DISPLAY environment variable. [annotate]

[annotate]

:genera  &key screen [Server Path]
          

Given this server path, find-port finds a port for local Genera platform on the screen object screen. screen defaults to tv:main-screen, but could also be an object return from color:find-color-screen. [annotate]

[annotate]

port  object [Generic Function]
          

Returns the port associated with object. port is defined for all sheet classes (including grafts and streams that support the CLIM graphics protocol), mediums, and application frames. For degrafted sheets or other objects that aren't currently associated with particular ports, port will return nil. [annotate]

[annotate]

with-port-locked  (port) &body body [Macro]
          

Executes body after grabbing a lock associated with the port port, which may be a port or any object on which the function port works. If object currently has no port, body will be executed without locking. [annotate]

body may have zero or more declarations as its first forms. [annotate]

[annotate]

map-over-ports  function [Function]
          

Invokes function on each existing port. Function is a function of one argument, the port; it has dynamic extent. [annotate]

[annotate]

port-server-path  port [Generic Function]
          

Returns the server path associated with the port port. [annotate]

[annotate]

port-name  port [Generic Function]
          

Returns an implementation-dependent string that is the name of the port. For example, a :clx port might have a name of "summer:0.0". [annotate]

[annotate]

port-type  port [Generic Function]
          

Returns the type of the port, that is, the first element of the server path spec. [annotate]

[annotate]

port-properties  port indicator [Generic Function]
(setf port-properties)  property port indicator [Generic Function]
          

These functions provide a port-based property list. They are primarily intended to support users of CLIM that may need to associate certain information with ports. For example, the implementor of a special graphics package may need to maintain resource tables for each port on which it is used. [annotate]

[annotate]

restart-port  port [Generic Function]
          

In a multi-process Lisp, restart-port restarts the global input processing loop associated with the port port. All pending input events are discarded. Server resources may or may not be released and reallocated during or after this action. [annotate]

[annotate]

destroy-port  port [Generic Function]
          

Destroys the connection with the window server represented by the port port. All sheet hierarchies that are associated with port are forcibly degrafted by disowning the children of grafts on port using sheet-disown-child. All server resources utilized by such hierarchies or by any graphics objects on port are released as part of the connection shutdown. [annotate]

[annotate]