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:
fedor 2002-04-23 20:50:24 +00:00
parent f7a20d6c96
commit 5ea51941b5
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> 2002-04-22 Adam Fedor <fedor@gnu.org>
* Headers/gnustep/gui/GSDisplayServer.h: Add attribute strings. * Headers/gnustep/gui/GSDisplayServer.h: Add attribute strings.

View file

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

View file

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

View file

@ -620,13 +620,26 @@ GSCurrentServer(void)
[self subclassResponsibility: _cmd]; [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 - (NSPoint) mouselocation
{ {
[self subclassResponsibility: _cmd]; [self subclassResponsibility: _cmd];
return NSZeroPoint; 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 /** Grabs the pointer device so that all future mouse events will be
directed only to the window win. If successful, the return value directed only to the window win. If successful, the return value
is YES and this message must be balanced by a -releasemouse 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. // Release the memory for the depths array.
- (void) dealloc - (void) dealloc
{ {

View file

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

View file

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

File diff suppressed because it is too large Load diff