summaryrefslogtreecommitdiff
path: root/cocoa
diff options
context:
space:
mode:
authorSven Weidauer <sven.weidauer@gmail.com>2011-01-28 12:18:58 +0000
committerSven Weidauer <sven.weidauer@gmail.com>2011-01-28 12:18:58 +0000
commitccac2289cfe4a46e5819b0fb3de68d930f3f9dd8 (patch)
treed32d1a70b60058d5b49f92d4eead3e95ec5ece09 /cocoa
parentacc2c341bdd2bdc98480057c047f83c26d1c9f97 (diff)
downloadnetsurf-ccac2289cfe4a46e5819b0fb3de68d930f3f9dd8.tar.gz
netsurf-ccac2289cfe4a46e5819b0fb3de68d930f3f9dd8.tar.bz2
Setting current_redraw_browser and fixing mouse dragging
svn path=/trunk/netsurf/; revision=11515
Diffstat (limited to 'cocoa')
-rw-r--r--cocoa/BrowserView.m13
1 files changed, 9 insertions, 4 deletions
diff --git a/cocoa/BrowserView.m b/cocoa/BrowserView.m
index b58466cd1..b1511216a 100644
--- a/cocoa/BrowserView.m
+++ b/cocoa/BrowserView.m
@@ -108,6 +108,7 @@ static inline NSRect cocoa_get_caret_rect( BrowserView *view )
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ current_redraw_browser = browser;
cocoa_set_font_scale_factor( browser->scale );
NSRect frame = [self bounds];
@@ -131,6 +132,7 @@ static inline NSRect cocoa_get_caret_rect( BrowserView *view )
browser->scale,
0xFFFFFF);
}
+ current_redraw_browser = NULL;
NSRect caretRect = cocoa_get_caret_rect( self );
if (hasCaret && caretVisible && [self needsToDrawRect: caretRect]) {
@@ -204,15 +206,18 @@ static browser_mouse_state cocoa_mouse_flags_for_event( NSEvent *evt )
- (void) mouseDragged: (NSEvent *)theEvent;
{
NSPoint location = [self convertMousePoint: theEvent];
+ browser_mouse_state modifierFlags = cocoa_mouse_flags_for_event( theEvent );
if (!isDragging) {
const CGFloat distance = squared( dragStart.x - location.x ) + squared( dragStart.y - location.y );
- if (distance >= squared( MinDragDistance)) isDragging = YES;
+
+ if (distance >= squared( MinDragDistance)) {
+ isDragging = YES;
+ browser_window_mouse_click( browser, BROWSER_MOUSE_DRAG_1 | modifierFlags, dragStart.x, dragStart.y );
+ }
}
if (isDragging) {
- browser_mouse_state modifierFlags = cocoa_mouse_flags_for_event( theEvent );
- browser_window_mouse_click( browser, BROWSER_MOUSE_DRAG_1 | modifierFlags, location.x, location.y );
browser_window_mouse_track( browser, BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON | modifierFlags, location.x, location.y );
}
}
@@ -254,7 +259,7 @@ static browser_mouse_state cocoa_mouse_flags_for_event( NSEvent *evt )
- (void) moveDown: (id)sender;
{
- browser_window_key_press( browser, KEY_DOWN );
+ if (browser_window_key_press( browser, KEY_DOWN )) return;
}
- (void) deleteBackward: (id)sender;