r11907 chris_y - /trunk/netsurf/amiga/gui.c
by netsurf@semichrome.net
Author: chris_y
Date: Fri Mar 4 13:13:23 2011
New Revision: 11907
URL: http://source.netsurf-browser.org?rev=11907&view=rev
Log:
Use browser_window_redraw_ready
Modified:
trunk/netsurf/amiga/gui.c
Modified: trunk/netsurf/amiga/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.c?rev=11907&r1=...
==============================================================================
--- trunk/netsurf/amiga/gui.c (original)
+++ trunk/netsurf/amiga/gui.c Fri Mar 4 13:13:23 2011
@@ -3076,7 +3076,7 @@
* Redraw an area of the browser window - Amiga-specific function
*
* \param g a struct gui_window
- * \param c a struct content
+ * \param bw a struct browser_window
* \param x0 top-left co-ordinate (in document co-ordinates)
* \param y0 top-left co-ordinate (in document co-ordinates)
* \param x1 bottom-right co-ordinate (in document co-ordinates)
@@ -3094,6 +3094,7 @@
struct rect clip;
if(!g) return;
+ if(browser_window_redraw_ready(bw) == false) return;
sx = g->scrollx;
sy = g->scrolly;
@@ -3107,8 +3108,6 @@
}
GetAttr(SPACE_AreaBox, g->shared->objects[GID_BROWSER], (ULONG *)&bbox);
-
- if(!bw) return;
current_redraw_browser = bw;
@@ -3206,14 +3205,13 @@
ULONG oldh=g->oldh,oldv=g->oldv;
bool morescroll = false;
+ if(browser_window_redraw_ready(g->bw) == false) return;
+
GetAttr(SPACE_AreaBox, (Object *)g->objects[GID_BROWSER], (ULONG *)&bbox);
ami_get_hscroll_pos(g, (ULONG *)&hcurrent);
ami_get_vscroll_pos(g, (ULONG *)&vcurrent);
c = g->bw->current_content;
-
- if(!c) return;
- if(content_is_locked(c)) return;
current_redraw_browser = g->bw;
12 years, 6 months
r11906 chris_y - /trunk/netsurf/amiga/gui.c
by netsurf@semichrome.net
Author: chris_y
Date: Fri Mar 4 13:05:12 2011
New Revision: 11906
URL: http://source.netsurf-browser.org?rev=11906&view=rev
Log:
Use BltBitMapTags
Modified:
trunk/netsurf/amiga/gui.c
Modified: trunk/netsurf/amiga/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.c?rev=11906&r1=...
==============================================================================
--- trunk/netsurf/amiga/gui.c (original)
+++ trunk/netsurf/amiga/gui.c Fri Mar 4 13:05:12 2011
@@ -3139,12 +3139,29 @@
if(browser_window_redraw(bw, -sx, -sy, &clip))
{
ami_clearclipreg(&browserglob);
+
+/* This is identical to the below, but for some reason doesn't blit anything.
+ * Probably some values are wrong and BltBitMapTags is fussier.
+
+ BltBitMapTags(BLITA_SrcType, BLITT_BITMAP,
+ BLITA_Source, browserglob.bm,
+ BLITA_SrcX, clip.x0 * g->shared->bw->scale,
+ BLITA_SrcY, clip.y0 * g->shared->bw->scale,
+ BLITA_DestType, BLITT_RASTPORT,
+ BLITA_Dest, g->shared->win->RPort,
+ BLITA_DestX, xoffset + (clip.x0 * g->shared->bw->scale),
+ BLITA_DestY, yoffset + (clip.y0 * g->shared->bw->scale),
+ BLITA_Width, (x1 - x0) * g->shared->bw->scale,
+ BLITA_Height, (y1 - y0) * g->shared->bw->scale,
+ TAG_DONE);
+*/
+
BltBitMapRastPort(browserglob.bm,
- (x0 - sx) * g->shared->bw->scale,
- (y0 - sy) * g->shared->bw->scale,
+ clip.x0 * g->shared->bw->scale,
+ clip.y0 * g->shared->bw->scale,
g->shared->win->RPort,
- xoffset + ((x0 - sx) * g->shared->bw->scale),
- yoffset + ((y0 - sy) * g->shared->bw->scale),
+ xoffset + (clip.x0 * g->shared->bw->scale),
+ yoffset + (clip.y0 * g->shared->bw->scale),
(x1 - x0) * g->shared->bw->scale,
(y1 - y0) * g->shared->bw->scale,
0x0C0);
@@ -3199,7 +3216,6 @@
if(content_is_locked(c)) return;
current_redraw_browser = g->bw;
-// currp = &browserglob.rp;
width=bbox->Width;
height=bbox->Height;
@@ -3278,8 +3294,18 @@
if(browser_window_redraw(g->bw, -hcurrent, -vcurrent, &clip))
{
ami_clearclipreg(&browserglob);
- BltBitMapRastPort(browserglob.bm,0,0,g->win->RPort,bbox->Left,bbox->Top,
- bbox->Width,bbox->Height,0x0C0);
+
+ BltBitMapTags(BLITA_SrcType, BLITT_BITMAP,
+ BLITA_Source, browserglob.bm,
+ BLITA_SrcX, 0,
+ BLITA_SrcY, 0,
+ BLITA_DestType, BLITT_RASTPORT,
+ BLITA_Dest, g->win->RPort,
+ BLITA_DestX, bbox->Left,
+ BLITA_DestY, bbox->Top,
+ BLITA_Width, bbox->Width,
+ BLITA_Height, bbox->Height,
+ TAG_DONE);
}
}
12 years, 6 months
r11905 swdr - /trunk/netsurf/cocoa/font.m
by netsurf@semichrome.net
Author: swdr
Date: Fri Mar 4 08:53:16 2011
New Revision: 11905
URL: http://source.netsurf-browser.org?rev=11905&view=rev
Log:
Fixed text scaling.
Modified:
trunk/netsurf/cocoa/font.m
Modified: trunk/netsurf/cocoa/font.m
URL: http://source.netsurf-browser.org/trunk/netsurf/cocoa/font.m?rev=11905&r1...
==============================================================================
--- trunk/netsurf/cocoa/font.m (original)
+++ trunk/netsurf/cocoa/font.m Fri Mar 4 08:53:16 2011
@@ -113,7 +113,10 @@
void cocoa_draw_string( CGFloat x, CGFloat y, const char *bytes, size_t length, const plot_font_style_t *style )
{
- NSLayoutManager *layout = cocoa_prepare_layout_manager( bytes, length, style );
+ plot_font_style_t actualStyle = *style;
+ actualStyle.size = (CGFloat)actualStyle.size * cocoa_font_scale_factor;
+
+ NSLayoutManager *layout = cocoa_prepare_layout_manager( bytes, length, &actualStyle );
if (layout == nil) return;
NSFont *font = [cocoa_text_storage attribute: NSFontAttributeName atIndex: 0 effectiveRange: NULL];
@@ -219,7 +222,7 @@
static inline NSFont *cocoa_font_get_nsfont( const plot_font_style_t *style )
{
NSFont *font = [NSFont fontWithName: cocoa_font_families[style->family]
- size: cocoa_font_scale_factor * (CGFloat)style->size / FONT_SIZE_SCALE];
+ size: (CGFloat)style->size / FONT_SIZE_SCALE];
NSFontTraitMask traits = 0;
if (style->flags & FONTF_ITALIC || style->flags & FONTF_OBLIQUE) traits |= NSItalicFontMask;
12 years, 6 months
r11904 swdr - /trunk/netsurf/cocoa/font.m
by netsurf@semichrome.net
Author: swdr
Date: Fri Mar 4 08:53:12 2011
New Revision: 11904
URL: http://source.netsurf-browser.org?rev=11904&view=rev
Log:
Fixed text splitting.
Modified:
trunk/netsurf/cocoa/font.m
Modified: trunk/netsurf/cocoa/font.m
URL: http://source.netsurf-browser.org/trunk/netsurf/cocoa/font.m?rev=11904&r1...
==============================================================================
--- trunk/netsurf/cocoa/font.m (original)
+++ trunk/netsurf/cocoa/font.m Fri Mar 4 08:53:12 2011
@@ -85,7 +85,7 @@
}
- chars = [[cocoa_text_storage string] rangeOfString: @" " options: NSBackwardsSearch range: NSMakeRange( 0, chars )].location;
+ chars = [[cocoa_text_storage string] rangeOfString: @" " options: NSBackwardsSearch range: NSMakeRange( 0, chars + 1 )].location;
if (chars == NSNotFound) {
*char_offset = 0;
*actual_x = 0;
12 years, 6 months
r11903 swdr - /trunk/netsurf/cocoa/gui.m
by netsurf@semichrome.net
Author: swdr
Date: Fri Mar 4 05:38:08 2011
New Revision: 11903
URL: http://source.netsurf-browser.org?rev=11903&view=rev
Log:
Remove unused function gui_window_redraw.
Modified:
trunk/netsurf/cocoa/gui.m
Modified: trunk/netsurf/cocoa/gui.m
URL: http://source.netsurf-browser.org/trunk/netsurf/cocoa/gui.m?rev=11903&r1=...
==============================================================================
--- trunk/netsurf/cocoa/gui.m (original)
+++ trunk/netsurf/cocoa/gui.m Fri Mar 4 05:38:08 2011
@@ -129,12 +129,6 @@
[(BrowserViewController *)g setTitle: [NSString stringWithUTF8String: title]];
}
-void gui_window_redraw(struct gui_window *g, int x0, int y0, int x1, int y1)
-{
- const NSRect rect = cocoa_rect( x0, y0, x1, y1 );
- [[(BrowserViewController *)g browserView] setNeedsDisplayInRect: rect];
-}
-
void gui_window_redraw_window(struct gui_window *g)
{
[[(BrowserViewController *)g browserView] setNeedsDisplay: YES];
12 years, 6 months
r11902 mmu_man - /trunk/netsurf/beos/beos_window.cpp
by netsurf@semichrome.net
Author: mmu_man
Date: Fri Mar 4 05:17:07 2011
New Revision: 11902
URL: http://source.netsurf-browser.org?rev=11902&view=rev
Log:
Fix build: inline what used to be gui_window_redraw().
Modified:
trunk/netsurf/beos/beos_window.cpp
Modified: trunk/netsurf/beos/beos_window.cpp
URL: http://source.netsurf-browser.org/trunk/netsurf/beos/beos_window.cpp?rev=...
==============================================================================
--- trunk/netsurf/beos/beos_window.cpp (original)
+++ trunk/netsurf/beos/beos_window.cpp Fri Mar 4 05:17:07 2011
@@ -1358,12 +1358,6 @@
if (g->careth == 0)
return;
- gui_window_redraw(g, g->caretx, g->carety,
- g->caretx, g->carety + g->careth);
-}
-
-void gui_window_redraw(struct gui_window *g, int x0, int y0, int x1, int y1)
-{
if (g->view == NULL)
return;
if (!g->view->LockLooper())
@@ -1371,7 +1365,8 @@
nsbeos_current_gc_set(g->view);
- g->view->Invalidate(BRect(x0, y0, x1, y1));
+ g->view->Invalidate(BRect(g->caretx, g->carety,
+ g->caretx, g->carety + g->careth));
nsbeos_current_gc_set(NULL);
g->view->UnlockLooper();
@@ -1727,8 +1722,17 @@
g->careth = 0;
- gui_window_redraw(g, g->caretx, g->carety,
- g->caretx, g->carety + oh);
+ if (g->view == NULL)
+ return;
+ if (!g->view->LockLooper())
+ return;
+
+ nsbeos_current_gc_set(g->view);
+
+ g->view->Invalidate(BRect(g->caretx, g->carety, g->caretx, g->carety + oh));
+
+ nsbeos_current_gc_set(NULL);
+ g->view->UnlockLooper();
}
void gui_window_new_content(struct gui_window *g)
12 years, 6 months
r11901 swdr - /trunk/netsurf/cocoa/BrowserView.m
by netsurf@semichrome.net
Author: swdr
Date: Fri Mar 4 04:38:07 2011
New Revision: 11901
URL: http://source.netsurf-browser.org?rev=11901&view=rev
Log:
Checking for public.url pasteboard type first, so dragging a .webloc file from the Finder opens the URL and not the .webloc file itself.
Modified:
trunk/netsurf/cocoa/BrowserView.m
Modified: trunk/netsurf/cocoa/BrowserView.m
URL: http://source.netsurf-browser.org/trunk/netsurf/cocoa/BrowserView.m?rev=1...
==============================================================================
--- trunk/netsurf/cocoa/BrowserView.m (original)
+++ trunk/netsurf/cocoa/BrowserView.m Fri Mar 4 04:38:07 2011
@@ -612,7 +612,7 @@
{
NSPasteboard *pb = [sender draggingPasteboard];
- NSString *type = [pb availableTypeFromArray:[NSArray arrayWithObjects: NSURLPboardType, @"public.url", nil]];
+ NSString *type = [pb availableTypeFromArray:[NSArray arrayWithObjects: @"public.url", NSURLPboardType, nil]];
NSString *url = nil;
if ([type isEqualToString: NSURLPboardType]) url = [[NSURL URLFromPasteboard: pb] absoluteString];
12 years, 6 months
r11900 swdr - /trunk/netsurf/cocoa/BrowserView.m
by netsurf@semichrome.net
Author: swdr
Date: Fri Mar 4 03:18:26 2011
New Revision: 11900
URL: http://source.netsurf-browser.org?rev=11900&view=rev
Log:
Accepting URLs dropped onto the browser view.
Modified:
trunk/netsurf/cocoa/BrowserView.m
Modified: trunk/netsurf/cocoa/BrowserView.m
URL: http://source.netsurf-browser.org/trunk/netsurf/cocoa/BrowserView.m?rev=1...
==============================================================================
--- trunk/netsurf/cocoa/BrowserView.m (original)
+++ trunk/netsurf/cocoa/BrowserView.m Fri Mar 4 03:18:26 2011
@@ -58,6 +58,16 @@
static const CGFloat CaretWidth = 1.0;
static const NSTimeInterval CaretBlinkTime = 0.8;
static NSMutableArray *cocoa_reformat_pending = nil;
+
+
+- initWithFrame: (NSRect) frame;
+{
+ if ((self = [super initWithFrame: frame]) == nil) return nil;
+
+ [self registerForDraggedTypes: [NSArray arrayWithObjects: NSURLPboardType, @"public.url", nil]];
+
+ return self;
+}
- (void) dealloc;
{
@@ -580,4 +590,38 @@
[pb setString: [sender representedObject] forType: NSStringPboardType];
}
+
+// MARK: -
+// MARK: Accepting dragged URLs
+
+- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
+{
+ if ((NSDragOperationCopy | NSDragOperationGeneric) & [sender draggingSourceOperationMask]) {
+ return NSDragOperationCopy;
+ }
+
+ return NSDragOperationNone;
+}
+
+- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
+{
+ return YES;
+}
+
+- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
+{
+ NSPasteboard *pb = [sender draggingPasteboard];
+
+ NSString *type = [pb availableTypeFromArray:[NSArray arrayWithObjects: NSURLPboardType, @"public.url", nil]];
+
+ NSString *url = nil;
+ if ([type isEqualToString: NSURLPboardType]) url = [[NSURL URLFromPasteboard: pb] absoluteString];
+ else url = [pb stringForType: type];
+
+ browser_window_go( browser, [url UTF8String], NULL, true );
+
+ return YES;
+}
+
+
@end
12 years, 6 months
r11899 swdr - /trunk/netsurf/cocoa/URLFieldCell.m
by netsurf@semichrome.net
Author: swdr
Date: Fri Mar 4 03:18:23 2011
New Revision: 11899
URL: http://source.netsurf-browser.org?rev=11899&view=rev
Log:
Allow dragging of URLs from the URL field out of NetSurf.
Modified:
trunk/netsurf/cocoa/URLFieldCell.m
Modified: trunk/netsurf/cocoa/URLFieldCell.m
URL: http://source.netsurf-browser.org/trunk/netsurf/cocoa/URLFieldCell.m?rev=...
==============================================================================
--- trunk/netsurf/cocoa/URLFieldCell.m (original)
+++ trunk/netsurf/cocoa/URLFieldCell.m Fri Mar 4 03:18:23 2011
@@ -18,6 +18,7 @@
#import "cocoa/URLFieldCell.h"
+#import "content/urldb.h"
@interface URLFieldCell ()
@@ -73,11 +74,57 @@
delegate: anObject event: theEvent];
}
+- (void) startDragURLAt: (NSPoint) point inView: (NSView *) view;
+{
+ NSString *url = [self stringValue];
+ NSString *title = url;
+
+ const struct url_data *data = urldb_get_url_data( [url UTF8String] );
+ if (data && data->title) title = [NSString stringWithUTF8String: data->title];
+
+ NSPasteboard *pb = [NSPasteboard pasteboardWithName: NSDragPboard];
+ [pb declareTypes: [NSArray arrayWithObjects: NSStringPboardType, NSURLPboardType,
+ @"public.url", @"public.url-name", nil] owner: nil];
+ [pb setString: url forType: NSStringPboardType];
+ [pb setString: url forType: @"public.url"];
+ [pb setString: title forType: @"public.url-name"];
+ [[NSURL URLWithString: url] writeToPasteboard: pb];
+
+ NSRect urlBounds = NSZeroRect;
+ urlBounds.size = [title sizeWithAttributes: nil];
+ urlBounds.size.width += urlBounds.size.height + 2;
+
+ NSImage *image = [[NSImage alloc] initWithSize: urlBounds.size];
+
+ [image lockFocus];
+ [favicon drawInRect: NSMakeRect( urlBounds.origin.x, urlBounds.origin.y, urlBounds.size.height, urlBounds.size.height )
+ fromRect: NSZeroRect operation: NSCompositeCopy fraction: 1.0];
+ urlBounds.origin.x += urlBounds.size.height + 2;
+ [title drawInRect: urlBounds withAttributes: nil];
+ [image unlockFocus];
+
+ point.x -= urlBounds.size.height / 2;
+ point.y += urlBounds.size.height / 2;
+
+ [view dragImage: image at: point offset: NSZeroSize event: [NSApp currentEvent]
+ pasteboard: pb source: self slideBack: YES];
+
+ [image release];
+}
+
+- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal
+{
+ return NSDragOperationCopy | NSDragOperationGeneric;
+}
+
- (BOOL) trackMouse: (NSEvent *)theEvent inRect: (NSRect)cellFrame ofView: (NSView *)controlView untilMouseUp: (BOOL)flag;
{
const NSPoint point = [controlView convertPoint: [theEvent locationInWindow] fromView: nil];
const NSRect buttonRect = [self buttonFrame: cellFrame];
- if (NSPointInRect( point, buttonRect )) {
+ if (NSPointInRect( point, [self iconFrame: cellFrame] )) {
+ [self startDragURLAt: point inView: controlView];
+ return NO;
+ } else if (NSPointInRect( point, buttonRect )) {
return [[self refreshCell] trackMouse: theEvent inRect: buttonRect
ofView: controlView untilMouseUp: flag];
} else {
12 years, 6 months
r11898 jmb - in /trunk/netsurf/content: content.h content_protected.h hlcache.c
by netsurf@semichrome.net
Author: jmb
Date: Thu Mar 3 15:13:58 2011
New Revision: 11898
URL: http://source.netsurf-browser.org?rev=11898&view=rev
Log:
Do not attempt to destroy contents that are still loading
Modified:
trunk/netsurf/content/content.h
trunk/netsurf/content/content_protected.h
trunk/netsurf/content/hlcache.c
Modified: trunk/netsurf/content/content.h
URL: http://source.netsurf-browser.org/trunk/netsurf/content/content.h?rev=118...
==============================================================================
--- trunk/netsurf/content/content.h (original)
+++ trunk/netsurf/content/content.h Thu Mar 3 15:13:58 2011
@@ -107,6 +107,7 @@
uint32_t content_count_users(struct content *c);
bool content_matches_quirks(struct content *c, bool quirks);
bool content_is_shareable(struct content *c);
+content_status content__get_status(struct content *c);
const struct llcache_handle *content_get_llcache_handle(struct content *c);
Modified: trunk/netsurf/content/content_protected.h
URL: http://source.netsurf-browser.org/trunk/netsurf/content/content_protected...
==============================================================================
--- trunk/netsurf/content/content_protected.h (original)
+++ trunk/netsurf/content/content_protected.h Thu Mar 3 15:13:58 2011
@@ -219,7 +219,6 @@
const char *content__get_mime_type(struct content *c);
const char *content__get_url(struct content *c);
const char *content__get_title(struct content *c);
-content_status content__get_status(struct content *c);
const char *content__get_status_message(struct content *c);
int content__get_width(struct content *c);
int content__get_height(struct content *c);
Modified: trunk/netsurf/content/hlcache.c
URL: http://source.netsurf-browser.org/trunk/netsurf/content/hlcache.c?rev=118...
==============================================================================
--- trunk/netsurf/content/hlcache.c (original)
+++ trunk/netsurf/content/hlcache.c Thu Mar 3 15:13:58 2011
@@ -378,6 +378,10 @@
if (entry->content == NULL)
continue;
+ if (content__get_status(entry->content) ==
+ CONTENT_STATUS_LOADING)
+ continue;
+
if (content_count_users(entry->content) != 0)
continue;
12 years, 6 months