gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GSDisplayServer


From: Adam Fedor
Subject: GSDisplayServer
Date: Sat, 23 Mar 2002 21:07:28 -0700
User-agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:0.9.7) Gecko/20020120

This is my interface for GSDisplayServer, where I basically took the window, event and various other display methods out of NSGraphicsContext. I removed a bunch and reformated the reset so they are a little easier to work with.

I wrote the class so you could have more than one (e.g. more than one display), although I can't really imagine a case where this would be useful (I'm not sure it is even possible on non-X11 servers). It does sort-of complicate the code, so perhaps I should remove that feature (although in my tests it's actually 15% faster than the old version, but that's probably just due to computer load or something else).


--
Adam Fedor, Digital Optics Corp.      | I'm glad I hate spinach, because
http://www.doc.com                    | if I didn't, I'd eat it, and you
                                      | know how I hate the stuff.
/** Abstract display server class. Copyright (C) 2002 Free Software Foundation, Inc. Author: Adam Fedor Date: Mar 2002 This file is part of the GNU Objective C User interface library. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ #ifndef _GSDisplayServer_h_INCLUDE #define _GSDisplayServer_h_INCLUDE #include #include #include #include #include #include #include @class NSArray; @class NSDictionary; @class NSEvent; @class NSImage; @class NSMutableArray; @class NSMutableData; @class GSDisplayServer; #ifndef NO_GNUSTEP GSDisplayServer * GSServerForWindow(NSWindow *window); GSDisplayServer * GSCurrentServer(void); @interface GSDisplayServer : NSObject { NSDictionary *server_info; NSMutableArray *event_queue; NSMapTable *drag_types; } + (void) setDefaultServerClass: (Class)aClass; + (GSDisplayServer *) serverWithAttributes: (NSDictionary *)attributes; + (void) setCurrentServer: (GSDisplayServer *)server; - initWithAttributes: (NSDictionary *)attributes; - (NSDictionary *) attributes; - (void) closeServer; /* Drag and drop support. */ + (BOOL) addDragTypes: (NSArray*)types toWindow: (NSWindow *)win; + (BOOL) removeDragTypes: (NSArray*)types fromWindow: (NSWindow *)win; + (NSCountedSet*) dragTypesForWindow: (NSWindow *)win; - (BOOL) addDragTypes: (NSArray*)types toWindow: (NSWindow *)win; - (BOOL) removeDragTypes: (NSArray*)types fromWindow: (NSWindow *)win; - (NSCountedSet*) dragTypesForWindow: (NSWindow *)win; - (id ) dragInfo; - (BOOL) slideImage: (NSImage*)image from: (NSPoint)from to: (NSPoint)to; /* Screen information */ - (NSSize) resolutionForScreen: (int) screen; - (NSWindowDepth) windowDepthForScreen: (int) screen; - (const NSWindowDepth *) availableDepthsForScreen: (int) screen; - (NSArray *) screenList; - (void *) serverDevice; - (void *) windowDevice: (int)win; @end /* ----------------------------------------------------------------------- */ /* GNUstep Window operations */ /* ----------------------------------------------------------------------- */ @interface GSDisplayServer (WindowOps) - (void) _setWindowOwnedByServer: (int)win; - (int) window: (NSRect)frame : (NSBackingStoreType) type; - (void) termwindow: (int) win; - (void) stylewindow: (int) style : (int) win; - (void) titlewindow: (NSString *) window_title : (int) win; - (void) miniwindow: (int) win; - (void) windowdevice: (int) win; - (void) orderwindow: (int) op : (int) otherWin : (int) win; - (void) movewindow: (NSPoint)loc : (int) win; - (void) placewindow: (NSRect)frame : (int) win; - (BOOL) findwindow: (NSPoint)loc : (int) op : (int) otherWin : (NSPoint *)floc : (int*) winFound; - (NSRect) windowbounds: (int) win; - (void) setwindowlevel: (int) level : (int) win; - (int) windowlevel: (int) win; - (NSArray *) windowlist; - (int) windowdepth: (int) win; - (void) setmaxsize: (NSSize)size : (int) win; - (void) setminsize: (NSSize)size : (int) win; - (void) setresizeincrements: (NSSize)size : (int) win; - (void) flushwindowrect: (NSRect)rect : (int) win; - (void) styleoffsets: (float*) l : (float*) r : (float*) t : (float*) b : (int) style; - (void) docedited: (int) edited : (int) win; - (void) setinputstate: (int)state : (int)win; - (void) setinputfocus: (int) win; - (NSPoint) mouselocation; - (BOOL) capturemouse: (int) win; - (void) releasemouse; - (void) hidecursor; - (void) showcursor; - (void) standardcursor: (int) style : (void**) cid; - (void) imagecursor: (NSPoint)hotp : (int)w : (int)h : (int) colors : (const char*) image : (void**) cid; - (void) setcursorcolor: (NSColor *)fg : (NSColor *)bg : (void*) cid; @end /* ----------------------------------------------------------------------- */ /* GNUstep Event Operations */ /* ----------------------------------------------------------------------- */ @interface GSDisplayServer (EventOps) - (NSEvent*) getEventMatchingMask: (unsigned)mask beforeDate: (NSDate*)limit inMode: (NSString*)mode dequeue: (BOOL)flag; - (void) discardEventsMatchingMask: (unsigned)mask beforeEvent: (NSEvent*)limit; - (void) postEvent: (NSEvent*)anEvent atStart: (BOOL)flag; @end static inline NSEvent* DPSGetEvent(GSDisplayServer *ctxt, unsigned mask, NSDate* limit, NSString *mode) { return [ctxt getEventMatchingMask: mask beforeDate: limit inMode: mode dequeue: YES]; } static inline NSEvent* DPSPeekEvent(GSDisplayServer *ctxt, unsigned mask, NSDate* limit, NSString *mode) { return [ctxt getEventMatchingMask: mask beforeDate: limit inMode: mode dequeue: NO]; } static inline void DPSDiscardEvents(GSDisplayServer *ctxt, unsigned mask, NSEvent* limit) { [ctxt discardEventsMatchingMask: mask beforeEvent: limit]; } static inline void DPSPostEvent(GSDisplayServer *ctxt, NSEvent* anEvent, BOOL atStart) { [ctxt postEvent: anEvent atStart: atStart]; } #endif /* NO_GNUSTEP */ #endif
reply via email to

[Prev in Thread] Current Thread [Next in Thread]