New mouselocation methods

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@13530 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2002-04-23 20:50:24 +00:00
parent 309e040ca5
commit 6d269aec7d
8 changed files with 39 additions and 1194 deletions

View file

@ -1,3 +1,11 @@
2002-04-23 Adam Fedor <fedor@gnu.org>
* Source/GSDisplayServer.m (mouseLocationOnScreen:window:): New
* Source/NSScreen.m (screenNumber): New.
* Source/NSWindow.m (mouseLocationOutsideOfEventStream): Use them.
* Tools/gpbs.m: Remove.
2002-04-22 Adam Fedor <fedor@gnu.org>
* Headers/gnustep/gui/GSDisplayServer.h: Add attribute strings.

View file

@ -122,6 +122,7 @@ APPKIT_DECLARE NSString * GSScreenNumber;
- (void) setinputfocus: (int) win;
- (NSPoint) mouselocation;
- (NSPoint) mouseLocationOnScreen: (int)aScreen window: (int *)win;
- (BOOL) capturemouse: (int) win;
- (void) releasemouse;
- (void) hidecursor;

View file

@ -67,6 +67,9 @@
- (const NSWindowDepth*) supportedWindowDepths;
- (NSRect) visibleFrame;
#endif
#ifndef NO_GNUSTEP
- (int) screenNumber;
#endif
@end
#endif // _GNUstep_H_NSScreen

View file

@ -620,13 +620,26 @@ GSCurrentServer(void)
[self subclassResponsibility: _cmd];
}
/** Returns the current mouse location */
/** Returns the current mouse location on the default screen. If the
pointer is not on the default screen, an invalid point (-1,-1} is
returned. */
- (NSPoint) mouselocation
{
[self subclassResponsibility: _cmd];
return NSZeroPoint;
}
/** Returns the current mouse location on aScreen. If the pointer is
not on aScreen, this method acts like -mouselocation. If aScreen is -1,
then the location of the mouse on any screen is returned. The
win pointer returns the window number of the GNUstep window
that the mouse is in or 0 if it is not in a window. */
- (NSPoint) mouseLocationOnScreen: (int)aScreen window: (int *)win
{
[self subclassResponsibility: _cmd];
return NSZeroPoint;
}
/** 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

View file

@ -282,6 +282,12 @@ static NSMutableArray *screenArray = nil;
}
}
/** Returns the screen number */
- (int) screenNumber
{
return _screenNumber;
}
// Release the memory for the depths array.
- (void) dealloc
{

View file

@ -651,7 +651,7 @@ static NSNotificationCenter *nc = nil;
NSGraphicsContext *context = GSCurrentContext();
GSDisplayServer *srv = GSCurrentServer();
/* If we were deferred or one shot, out drag types may not have
/* If we were deferred or one shot, our drag types may not have
been registered properly in the backend. Remove them then re-add
them when we create the window */
dragTypes = [srv dragTypesForWindow: self];
@ -663,8 +663,7 @@ static NSNotificationCenter *nc = nil;
[srv removeDragTypes: dragTypes fromWindow: self];
}
screenNumber = [[[_screen deviceDescription] objectForKey: @"NSScreenNumber"]
intValue];
screenNumber = [_screen screenNumber];
_windowNum = [srv window: frame : _backingType : _styleMask : screenNumber];
[srv setwindowlevel: [self level] : _windowNum];
@ -2404,10 +2403,13 @@ resetCursorRectsForView(NSView *theView)
* loop status */
- (NSPoint) mouseLocationOutsideOfEventStream
{
int screen;
NSPoint p;
p = [GSCurrentServer() mouselocation];
p = [self convertScreenToBase: p];
screen = [_screen screenNumber];
p = [GSServerForWindow(self) mouseLocationOnScreen: screen window: NULL];
if (p.x != -1)
p = [self convertScreenToBase: p];
return p;
}

View file

@ -41,8 +41,6 @@ SERVICE_NAME = example GSspell
# The source files to be compiled
gopen_OBJC_FILES = gopen.m
gpbs_OBJC_FILES = gpbs.m
make_services_OBJC_FILES = make_services.m
set_show_service_OBJC_FILES = set_show_service.m

File diff suppressed because it is too large Load diff