From ccac2289cfe4a46e5819b0fb3de68d930f3f9dd8 Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Fri, 28 Jan 2011 12:18:58 +0000 Subject: Setting current_redraw_browser and fixing mouse dragging svn path=/trunk/netsurf/; revision=11515 --- cocoa/BrowserView.m | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'cocoa') 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; -- cgit v1.2.3