Up

GSDisplayServer

Authors

Adam Fedor( fedor@gnu.org )
Abstract display server class.

Copyright: (C) 2002 Free Software Foundation, Inc.


Contents -

  1. GSDisplayServer
  2. Software documentation for the GSDisplayServer(EventOps) category
  3. Software documentation for the GSDisplayServer(WindowOps) category

GSDisplayServer

This is an abstract class which provides a framework for a device independant window server. A window server handles the very basic control of the computer display and input. This includes basic window creation and handling, event handling, cursors, and providing miscellaneous information about the display.

Typically a backend library will provide a concrete subclass which implements the device specific methods described below.

In almost all cases, you should not call these methods directly in an application. You should use the equivalent methods available elsewhere in the library (e.g. NSWindow, NSScreen, etc).

GSDisplayServer : NSObject

Declared in:
AppKit/GSDisplayServer.h
Standards:

Method summary

addDragTypes:toWindow:

+ (BOOL) addDragTypes: (NSArray*)types toWindow: (NSWindow*)win;

Convienience method that calls -addDragTypes:toWindow: using the server that controls win.


dragTypesForWindow:

+ (NSCountedSet*) dragTypesForWindow: (NSWindow*)win;

Convienience method that calls -dragTypesForWindow: using the server that controls win.


removeDragTypes:fromWindow:

+ (BOOL) removeDragTypes: (NSArray*)types fromWindow: (NSWindow*)win;

Convienience method that calls -removeDragTypes:fromWindow: using the server that controls win.


serverWithAttributes:

+ (GSDisplayServer*) serverWithAttributes: (NSDictionary*)attributes;

Create a window server with attributes, which contains key/value pairs which describe the specifics of how the window server is to be initialized. Typically these values are specific to the concrete implementation. Currently there are no standard set of attributes defined for GSDisplayServer.

In almost all applications one would only create a single instance of a window server. Although it is possible, it is unlikely that you would need more than one window server (and you would have to be very careful how you handled window creation and events in this case).


setCurrentServer:

+ (void) setCurrentServer: (GSDisplayServer*)server;

Sets the current server that will be handling windows, events, etc. This method must be called after a window server is created in order to make it available to the rest of the GUI library


setDefaultServerClass:

+ (void) setDefaultServerClass: (Class)aClass;

Set the concrete subclass that will provide the device dependant implementation.


addDragTypes:toWindow:

- (BOOL) addDragTypes: (NSArray*)types toWindow: (NSWindow*)win;

Add (increment count by 1) each drag type to those registered for the window. If this results in a change to the types registered in the counted set, return YES, otherwise return NO. Subclasses should override this method, call 'super' and take appropriate action if the method returns 'YES'.


attributes

- (NSDictionary*) attributes;

Return information used to create the server


availableDepthsForScreen:

- (const NSWindowDepth*) availableDepthsForScreen: (int)screen;

Returns a null terminated list of possible window depths for screen.


boundsForScreen:

- (NSRect) boundsForScreen: (int)screen;

Retuns the bounds, in pixels, for the indicated screen of the display.


closeServer

- (void) closeServer;

Causes the server to disconnect from the display. If the receiver is the current server, it removes itself and sets the current server to nil. Sending any more messages to the receiver after this is likely to cause severe problems and probably crash the application.


dragInfo

- (id) dragInfo;

Returns an instance of a class which implements the NSDraggingInfo protocol.


dragTypesForWindow:

- (NSCountedSet*) dragTypesForWindow: (NSWindow*)win;

Returns the drag types set for the window win.


initWithAttributes:

- (id) initWithAttributes: (NSDictionary*)attributes;
This is a designated initialiser for the class.

Initializes the server. This typically causes the receiver to connect to the display (e.g. XOpenDisplay() on an X-Windows server).


removeDragTypes:fromWindow:

- (BOOL) removeDragTypes: (NSArray*)types fromWindow: (NSWindow*)win;

Remove (decrement count by 1) each drag type from those registered for the window. If this results in a change to the types registered in the counted set, return YES, otherwise return NO. If given 'nil' as the array of types, remove ALL. Subclasses should override this method, call 'super' and take appropriate action if the method returns 'YES'.


resolutionForScreen:

- (NSSize) resolutionForScreen: (int)screen;

Retuns the resolution, in points, for the indicated screen of the display.


screenList

- (NSArray*) screenList;

Returns an array of NSNumbers, where each number describes a screen that is available on this display.


serverDevice

- (void*) serverDevice;

Returns a display dependant pointer that describes the internal connection to the display. On X-Windows, for example, this is a pointer to the Display variable.


slideImage:from:to:

- (BOOL) slideImage: (NSImage*)image from: (NSPoint)from to: (NSPoint)to;

Description forthcoming.


windowDepthForScreen:

- (NSWindowDepth) windowDepthForScreen: (int)screen;

Returns the default depth of windows that are created on screen.


windowDevice:

- (void*) windowDevice: (int)win;

Returns a display dependant pointer that describes the internal window representation for win. On X-Windows, for example, this is a pointer to the Window variable.


Software documentation for the GSDisplayServer(EventOps) category

GSDisplayServer(EventOps)

Declared in:
AppKit/GSDisplayServer.h
Standards:

Description forthcoming.

Method summary

discardEventsMatchingMask:beforeEvent:

- (void) discardEventsMatchingMask: (unsigned)mask beforeEvent: (NSEvent*)limit;

Description forthcoming.


getEventMatchingMask:beforeDate:inMode:dequeue:

- (NSEvent*) getEventMatchingMask: (unsigned)mask beforeDate: (NSDate*)limit inMode: (NSString*)mode dequeue: (BOOL)flag;

Description forthcoming.


postEvent:atStart:

- (void) postEvent: (NSEvent*)anEvent atStart: (BOOL)flag;

Description forthcoming.


Software documentation for the GSDisplayServer(WindowOps) category

GSDisplayServer(WindowOps)

Declared in:
AppKit/GSDisplayServer.h
Standards:

Description forthcoming.

Method summary

_setWindowOwnedByServer:

- (void) _setWindowOwnedByServer: (int)win;

Tells the receiver that it owns the window described by win. Concrete subclasses must call this function when creating a window. Do not call this method in any other case, particularly for a window that has already been created


appOwnsMiniwindow

- (BOOL) appOwnsMiniwindow;

Returns YES if the application should create the miniwindow counterpart to the full size window and own it. Some display systems handle the miniwindow themselves. In this case the backend subclass should override this method to return NO.


capturemouse:

- (BOOL) capturemouse: (int)win;

Grabs the pointer device so that all future mouse events will be directed only to the window win. If successful, the return value is YES and this message must be balanced by a -releasemouse message.


docedited::

- (void) docedited: (int)edited : (int)win;

Sets the document edited flag for the window


findwindow:::::

- (BOOL) findwindow: (NSPoint)loc : (int)op : (int)otherWin : (NSPoint*)floc : (int*)winFound;

Description forthcoming.


flushwindowrect::

- (void) flushwindowrect: (NSRect)rect : (int)win;

Causes buffered graphics to be flushed to the screen


hidecursor

- (void) hidecursor;

Hides the cursor


imagecursor::::::

- (void) imagecursor: (NSPoint)hotp : (int)w : (int)h : (int)colors : (const char*)image : (void**)cid;

Create a cursor from an image. Returns a pointer to the internal device representation that can be used later to make this cursor the current one


miniwindow:

- (void) miniwindow: (int)win;

Miniaturizes the window


mouselocation

- (NSPoint) mouselocation;

Returns the current mouse location


movewindow::

- (void) movewindow: (NSPoint)loc : (int)win;

Moves the bottom left cornder of the window to loc


orderwindow:::

- (void) orderwindow: (int)op : (int)otherWin : (int)win;

Causes the window to be ordered onto or off the screen depending on the value of op. The window is ordered relative to otherWin.


placewindow::

- (void) placewindow: (NSRect)frame : (int)win;

Moves and resizes the window on the screen as described by frame.


releasemouse

- (void) releasemouse;

Release a previous captured mouse from -capturemouse:


setcursorcolor:::

- (void) setcursorcolor: (NSColor*)fg : (NSColor*)bg : (void*)cid;

Set the cursor given by the cid representation as being the current cursor. The cursor has a foreground color fg and a background color bg. To keep the default color for the cursor, pass nil for fg and bg.


setinputfocus:

- (void) setinputfocus: (int)win;

Forces focus to the window so that all key events are sent to this window


setinputstate::

- (void) setinputstate: (int)state : (int)win;

Sets the input state for the window given by the GSWindowInputState constant. Instructs the window manager that the specified window is 'key', 'main', or just a normal window.


setmaxsize::

- (void) setmaxsize: (NSSize)size : (int)win;

Set the maximum size of the window


setminsize::

- (void) setminsize: (NSSize)size : (int)win;

Set the minimum size of the window


setresizeincrements::

- (void) setresizeincrements: (NSSize)size : (int)win;

Set the resize incremenet of the window


setwindowlevel::

- (void) setwindowlevel: (int)level : (int)win;

Set the level of the window as in [NSWindow -setLevel]


showcursor

- (void) showcursor;

Show a previously hidden cursor


standardcursor::

- (void) standardcursor: (int)style : (void**)cid;

Create a standard cursor (such as an arror or IBeam). Returns a pointer to the internal device representation that can be used later to make this cursor the current one


styleoffsets:::::

- (void) styleoffsets: (float*)l : (float*)r : (float*)t : (float*)b : (int)style;

Returns the dimensions of the window that are inside the window frame but are controlled by the window manager. For instance, t gives the height of the title bar for the window


stylewindow::

- (void) stylewindow: (int)style : (int)win;

Sets the style of the window. See [NSWindow -styleMask] for a description of the available styles


termwindow:

- (void) termwindow: (int)win;

Destroys the representation of the window and frees and memory associated with it.


titlewindow::

- (void) titlewindow: (NSString*)window_title : (int)win;

Sets the window title


window:::

- (int) window: (NSRect)frame : (NSBackingStoreType)type : (unsigned int)style;

Creates a window whose location and size is described by frame and whose backing store is described by type. This window is not mapped to the screen by this call


windowbacking:

- (void) windowbacking: (NSBackingStoreType)type;

Changes window's the backing store to type


windowbounds:

- (NSRect) windowbounds: (int)win;

Retuns the frame of the window on the screen


windowdepth:

- (int) windowdepth: (int)win;

Returns the depth of the window


windowdevice:

- (void) windowdevice: (int)win;

Sets the window drawable for the current NSGraphicsContext, typically by calling [NSGraphicsContext -DPSsetgcdrawable::::], although depending on the concrete implmentation, more information than this may need to be exchanged.


windowlevel:

- (int) windowlevel: (int)win;

Returns the window level as in [NSWindow -level]


windowlist

- (NSArray*) windowlist;

Returns the list of windows that the server controls



Up