mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 11:40:48 +00:00
Mouse handling fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3973 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c444b09026
commit
bceff2165a
6 changed files with 148 additions and 106 deletions
|
@ -40,6 +40,7 @@
|
|||
#include <AppKit/NSScrollView.h>
|
||||
#include <AppKit/NSMatrix.h>
|
||||
#include <AppKit/NSTextFieldCell.h>
|
||||
#include <AppKit/PSOperators.h>
|
||||
|
||||
#define COLUMN_SEP 6
|
||||
|
||||
|
@ -1296,6 +1297,7 @@
|
|||
{
|
||||
int i;
|
||||
|
||||
NSRectClip(rect);
|
||||
// Load the first column if not already done
|
||||
if (!_isLoaded)
|
||||
{
|
||||
|
|
|
@ -90,6 +90,11 @@ id _nsbuttonCellClass = nil;
|
|||
return self;
|
||||
}
|
||||
|
||||
- (BOOL) acceptsFirstMouse: (NSEvent *)theEvent
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
//
|
||||
// Setting the Button Type
|
||||
//
|
||||
|
|
|
@ -68,6 +68,11 @@
|
|||
// Class variables
|
||||
static NSFont* menuFont = nil;
|
||||
|
||||
- (BOOL) acceptsFirstMouse: (NSEvent *)theEvent
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (id) initWithFrame: (NSRect)rect
|
||||
{
|
||||
[super initWithFrame: rect];
|
||||
|
|
|
@ -88,6 +88,11 @@ static BOOL preCalcValues = NO;
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL) acceptsFirstMouse: (NSEvent *)theEvent
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSScrollArrowPosition) arrowsPosition
|
||||
{
|
||||
return _arrowsPosition;
|
||||
|
|
|
@ -45,6 +45,11 @@
|
|||
//
|
||||
// Instance methods
|
||||
//
|
||||
- (BOOL) acceptsFirstMouse: (NSEvent *)theEvent
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) mouseDown: (NSEvent*)theEvent
|
||||
{
|
||||
NSApplication *app = [NSApplication sharedApplication];
|
||||
|
|
|
@ -1142,6 +1142,7 @@
|
|||
- (void) sendEvent: (NSEvent *)theEvent
|
||||
{
|
||||
NSView *v;
|
||||
NSEventType type;
|
||||
|
||||
if (!cursor_rects_valid) // If the cursor rects are invalid
|
||||
{ // Then discard and reset
|
||||
|
@ -1149,14 +1150,18 @@
|
|||
[self resetCursorRects];
|
||||
}
|
||||
|
||||
switch ([theEvent type])
|
||||
type = [theEvent type];
|
||||
switch (type)
|
||||
{
|
||||
case NSLeftMouseDown: // Left mouse down
|
||||
v = [content_view hitTest: [theEvent locationInWindow]];
|
||||
NSDebugLog([v description]);
|
||||
NSDebugLog(@"\n");
|
||||
if (first_responder != v) // if hit view is not first
|
||||
[self makeFirstResponder: v]; // responder ask it to be
|
||||
if (first_responder != v)
|
||||
{
|
||||
[self makeFirstResponder: v];
|
||||
if ([v acceptsFirstMouse: theEvent] == YES)
|
||||
[v mouseDown: theEvent];
|
||||
}
|
||||
else
|
||||
[v mouseDown: theEvent];
|
||||
last_point = [theEvent locationInWindow];
|
||||
break;
|
||||
|
@ -1179,28 +1184,43 @@
|
|||
last_point = [theEvent locationInWindow];
|
||||
break;
|
||||
|
||||
case NSMouseMoved: // Mouse moved
|
||||
v = [content_view hitTest: [theEvent locationInWindow]];
|
||||
[v mouseMoved: theEvent]; // First send the NSMouseMoved event
|
||||
// We need to go through all of the views, and any with
|
||||
// a tracking rectangle then we need to determine if we
|
||||
// should send a NSMouseEntered or NSMouseExited event
|
||||
[self checkTrackingRectangles: content_view forEvent: theEvent];
|
||||
// We need to go through all of the views, and any with
|
||||
// a cursor rectangle then we need to determine if we
|
||||
// should send a cursor update event
|
||||
// We only do this if we are the key window
|
||||
if (is_key)
|
||||
[self checkCursorRectangles: content_view forEvent: theEvent];
|
||||
|
||||
last_point = [theEvent locationInWindow];
|
||||
break;
|
||||
|
||||
case NSLeftMouseDragged: // Left mouse dragged
|
||||
last_point = [theEvent locationInWindow];
|
||||
break;
|
||||
|
||||
case NSRightMouseDragged: // Right mouse dragged
|
||||
case NSMouseMoved: // Mouse moved
|
||||
switch (type)
|
||||
{
|
||||
case NSLeftMouseDragged:
|
||||
v = [content_view hitTest: [theEvent locationInWindow]];
|
||||
[v mouseDragged: theEvent];
|
||||
break;
|
||||
case NSRightMouseDragged:
|
||||
v = [content_view hitTest: [theEvent locationInWindow]];
|
||||
[v rightMouseDragged: theEvent];
|
||||
break;
|
||||
default:
|
||||
if (accepts_mouse_moved)
|
||||
{
|
||||
// If the window is set to accept mouse movements, we need to
|
||||
// forward the mouse movement to the correct view.
|
||||
v = [content_view hitTest: [theEvent locationInWindow]];
|
||||
[v mouseMoved: theEvent];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// We need to go through all of the views, and if there is any with
|
||||
// a tracking rectangle then we need to determine if we should send
|
||||
// a NSMouseEntered or NSMouseExited event.
|
||||
[self checkTrackingRectangles: content_view forEvent: theEvent];
|
||||
|
||||
if (is_key)
|
||||
{
|
||||
// We need to go through all of the views, and if there is any with
|
||||
// a cursor rectangle then we need to determine if we should send a
|
||||
// cursor update event.
|
||||
[self checkCursorRectangles: content_view forEvent: theEvent];
|
||||
}
|
||||
|
||||
last_point = [theEvent locationInWindow];
|
||||
break;
|
||||
|
||||
|
@ -1642,7 +1662,7 @@
|
|||
disable_flush_window = NO;
|
||||
menu_exclude = NO;
|
||||
hides_on_deactivate = NO;
|
||||
accepts_mouse_moved = YES;
|
||||
accepts_mouse_moved = NO;
|
||||
}
|
||||
|
||||
- (id) cleanInit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue