2003-07-31 23:52:10 +00:00
|
|
|
/** <title>GSDisplayServer</title>
|
|
|
|
|
|
|
|
<abstract>Abstract display server class.</abstract>
|
|
|
|
|
|
|
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Author: Adam Fedor <fedor@gnu.org>
|
|
|
|
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
|
2007-10-29 21:16:17 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
2003-07-31 23:52:10 +00:00
|
|
|
License as published by the Free Software Foundation; either
|
2008-06-10 04:01:49 +00:00
|
|
|
version 2 of the License, or (at your option) any later version.
|
2007-10-29 21:16:17 +00:00
|
|
|
|
2003-07-31 23:52:10 +00:00
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2007-10-29 21:16:17 +00:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with this library; see the file COPYING.LIB.
|
|
|
|
If not, see <http://www.gnu.org/licenses/> or write to the
|
|
|
|
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
2003-07-31 23:52:10 +00:00
|
|
|
|
|
|
|
#ifndef _GSDisplayServer_h_INCLUDE
|
|
|
|
#define _GSDisplayServer_h_INCLUDE
|
|
|
|
|
2010-04-07 08:59:43 +00:00
|
|
|
#import <Foundation/NSObject.h>
|
|
|
|
#import <Foundation/NSGeometry.h>
|
2003-07-31 23:52:10 +00:00
|
|
|
|
2010-04-07 08:59:43 +00:00
|
|
|
#import <AppKit/AppKitDefines.h>
|
|
|
|
#import <AppKit/NSDragging.h>
|
|
|
|
#import <AppKit/NSGraphicsContext.h>
|
2003-07-31 23:52:10 +00:00
|
|
|
|
|
|
|
@class NSArray;
|
2010-04-07 08:59:43 +00:00
|
|
|
@class NSCountedSet;
|
|
|
|
@class NSDictionary;
|
|
|
|
@class NSMapTable;
|
|
|
|
@class NSMutableArray;
|
|
|
|
@class NSMutableData;
|
2003-07-31 23:52:10 +00:00
|
|
|
@class NSMutableDictionary;
|
2010-04-07 08:59:43 +00:00
|
|
|
@class NSString;
|
|
|
|
|
2003-07-31 23:52:10 +00:00
|
|
|
@class NSEvent;
|
|
|
|
@class NSImage;
|
2010-04-07 08:59:43 +00:00
|
|
|
|
2003-07-31 23:52:10 +00:00
|
|
|
@class GSDisplayServer;
|
2008-01-19 13:11:16 +00:00
|
|
|
@class NSGraphicsContext;
|
2010-04-07 08:59:43 +00:00
|
|
|
@class NSWindow;
|
2003-07-31 23:52:10 +00:00
|
|
|
|
2010-02-21 11:01:43 +00:00
|
|
|
#if !NO_GNUSTEP
|
2010-04-07 08:59:43 +00:00
|
|
|
APPKIT_EXPORT GSDisplayServer *GSServerForWindow(NSWindow *window);
|
|
|
|
APPKIT_EXPORT GSDisplayServer *GSCurrentServer(void);
|
2003-07-31 23:52:10 +00:00
|
|
|
|
|
|
|
/* Display attributes */
|
2010-04-07 08:59:43 +00:00
|
|
|
APPKIT_EXPORT NSString *GSDisplayName;
|
|
|
|
APPKIT_EXPORT NSString *GSDisplayNumber;
|
|
|
|
APPKIT_EXPORT NSString *GSScreenNumber;
|
2003-07-31 23:52:10 +00:00
|
|
|
|
|
|
|
@interface GSDisplayServer : NSObject
|
|
|
|
{
|
|
|
|
NSMutableDictionary *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;
|
|
|
|
|
|
|
|
/* GL context */
|
|
|
|
- glContextClass;
|
|
|
|
- glPixelFormatClass;
|
|
|
|
|
2004-07-06 20:20:31 +00:00
|
|
|
- (BOOL) handlesWindowDecorations;
|
|
|
|
|
2003-07-31 23:52:10 +00:00
|
|
|
/* 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 <NSDraggingInfo>) dragInfo;
|
|
|
|
- (BOOL) slideImage: (NSImage*)image from: (NSPoint)from to: (NSPoint)to;
|
|
|
|
- (void) restrictWindow: (int)win toImage: (NSImage*)image;
|
2004-06-18 23:49:40 +00:00
|
|
|
- (int) findWindowAt: (NSPoint)screenLocation
|
|
|
|
windowRef: (int*)windowRef
|
|
|
|
excluding: (int)win;
|
|
|
|
|
2003-07-31 23:52:10 +00:00
|
|
|
|
|
|
|
/* Screen information */
|
|
|
|
- (NSSize) resolutionForScreen: (int)screen;
|
|
|
|
- (NSRect) boundsForScreen: (int)screen;
|
|
|
|
- (NSWindowDepth) windowDepthForScreen: (int)screen;
|
|
|
|
- (const NSWindowDepth *) availableDepthsForScreen: (int)screen;
|
|
|
|
- (NSArray *) screenList;
|
|
|
|
|
|
|
|
- (void *) serverDevice;
|
|
|
|
- (void *) windowDevice: (int)win;
|
|
|
|
|
|
|
|
- (void) beep;
|
2004-11-10 17:12:57 +00:00
|
|
|
|
|
|
|
/* AppIcon/MiniWindow information */
|
|
|
|
- (NSImage *) iconTileImage;
|
|
|
|
- (NSSize) iconSize;
|
|
|
|
|
2011-07-03 23:43:07 +00:00
|
|
|
/* Screen capture */
|
|
|
|
- (NSImage *) contentsOfScreen: (int)screen inRect: (NSRect)rect;
|
|
|
|
|
2020-09-25 14:20:40 +00:00
|
|
|
/* Desktops (workspaces) */
|
|
|
|
- (unsigned int) numberOfDesktops: (int)screen;
|
|
|
|
- (NSArray *) namesOfDesktops: (int)screen;
|
|
|
|
- (unsigned int) desktopNumberForScreen: (int)screen;
|
|
|
|
- (void) setDesktopNumber: (unsigned int)workspace forScreen: (int)screen;
|
|
|
|
- (unsigned int) desktopNumberForWindow: (int)win;
|
|
|
|
- (void) setDesktopNumber: (unsigned int)workspace forWindow: (int)win;
|
|
|
|
|
2003-07-31 23:52:10 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
/* GNUstep Window operations */
|
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
@interface GSDisplayServer (WindowOps)
|
|
|
|
- (void) _setWindowOwnedByServer: (int)win;
|
|
|
|
- (int) window: (NSRect)frame : (NSBackingStoreType)type : (unsigned int)style;
|
|
|
|
- (int) window: (NSRect)frame : (NSBackingStoreType)type : (unsigned int)style
|
|
|
|
: (int)screen;
|
2007-08-14 22:37:08 +00:00
|
|
|
- (void) termwindow: (int)win;
|
2006-05-03 21:09:08 +00:00
|
|
|
- (int) nativeWindow: (void *)winref : (NSRect*)frame : (NSBackingStoreType*)type
|
|
|
|
: (unsigned int*)style : (int*)screen;
|
2004-07-06 20:20:31 +00:00
|
|
|
|
|
|
|
/* Only if handlesWindowDecorations returns YES. */
|
2007-08-14 22:37:08 +00:00
|
|
|
- (void) stylewindow: (unsigned int)style : (int)win;
|
2004-07-06 20:20:31 +00:00
|
|
|
|
2007-08-14 22:37:08 +00:00
|
|
|
- (void) windowbacking: (NSBackingStoreType)type : (int)win;
|
|
|
|
- (void) titlewindow: (NSString *)window_title : (int)win;
|
|
|
|
- (void) miniwindow: (int)win;
|
2019-04-06 19:36:56 +00:00
|
|
|
- (BOOL) hideApplication: (int)win;
|
2003-07-31 23:52:10 +00:00
|
|
|
- (BOOL) appOwnsMiniwindow;
|
2008-01-19 13:11:16 +00:00
|
|
|
- (void) setWindowdevice: (int)win forContext: (NSGraphicsContext *)ctxt;
|
|
|
|
// Deprecated
|
|
|
|
- (void) windowdevice: (int) winNum;
|
2007-08-14 22:37:08 +00:00
|
|
|
- (void) orderwindow: (int)op : (int)otherWin : (int)win;
|
|
|
|
- (void) movewindow: (NSPoint)loc : (int)win;
|
|
|
|
- (void) placewindow: (NSRect)frame : (int)win;
|
|
|
|
- (NSRect) windowbounds: (int)win;
|
|
|
|
- (void) setwindowlevel: (int)level : (int)win;
|
|
|
|
- (int) windowlevel: (int)win;
|
2003-07-31 23:52:10 +00:00
|
|
|
- (NSArray *) windowlist;
|
2007-08-14 22:37:08 +00:00
|
|
|
- (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
|
|
|
|
: (unsigned int)style;
|
|
|
|
- (void) docedited: (int) edited : (int)win;
|
2003-07-31 23:52:10 +00:00
|
|
|
- (void) setinputstate: (int)state : (int)win;
|
2007-08-14 22:37:08 +00:00
|
|
|
- (void) setinputfocus: (int)win;
|
2013-01-30 09:48:54 +00:00
|
|
|
- (void) setalpha: (float)alpha : (int)win;
|
2007-08-14 22:37:08 +00:00
|
|
|
- (void) setShadow: (BOOL)hasShadow : (int)win;
|
2003-07-31 23:52:10 +00:00
|
|
|
|
|
|
|
- (NSPoint) mouselocation;
|
|
|
|
- (NSPoint) mouseLocationOnScreen: (int)aScreen window: (int *)win;
|
2007-08-14 22:37:08 +00:00
|
|
|
- (BOOL) capturemouse: (int)win;
|
2003-07-31 23:52:10 +00:00
|
|
|
- (void) releasemouse;
|
2009-10-27 18:32:58 +00:00
|
|
|
- (void) setMouseLocation: (NSPoint)mouseLocation onScreen: (int)aScreen;
|
2003-07-31 23:52:10 +00:00
|
|
|
- (void) hidecursor;
|
|
|
|
- (void) showcursor;
|
2007-08-14 22:37:08 +00:00
|
|
|
- (void) standardcursor: (int) style : (void**)cid;
|
2011-03-07 19:45:04 +00:00
|
|
|
- (void) imagecursor: (NSPoint)hotp : (NSImage *) image : (void**)cid;
|
2007-08-14 22:37:08 +00:00
|
|
|
- (void) setcursorcolor: (NSColor *)fg : (NSColor *)bg : (void*)cid;
|
2011-02-15 22:54:23 +00:00
|
|
|
- (void) recolorcursor: (NSColor *)fg : (NSColor *)bg : (void*) cid;
|
|
|
|
- (void) setcursor: (void*) cid;
|
|
|
|
- (void) freecursor: (void*) cid;
|
2009-01-31 09:59:32 +00:00
|
|
|
- (void) setParentWindow: (int)parentWin
|
|
|
|
forChildWindow: (int)childWin;
|
2013-07-08 20:42:49 +00:00
|
|
|
- (void) setIgnoreMouse: (BOOL)ignoreMouse : (int)win;
|
2003-07-31 23:52:10 +00:00
|
|
|
|
|
|
|
@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;
|
2013-08-30 11:27:10 +00:00
|
|
|
- (void) _printEventQueue;
|
2003-07-31 23:52:10 +00:00
|
|
|
@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
|