diff --git a/vlib/gg/draw.c.v b/vlib/gg/draw.c.v index 15a9c0f5e1a496..2f06f04ffc2f26 100644 --- a/vlib/gg/draw.c.v +++ b/vlib/gg/draw.c.v @@ -540,6 +540,13 @@ fn radius_to_segments(r f32) int { // `radius` defines the radius of the circle. // `c` is the color of the outline. pub fn (ctx &Context) draw_circle_empty(x f32, y f32, radius f32, c gx.Color) { + $if macos { + if ctx.native_rendering { + C.darwin_draw_circle_empty(x - radius + 1, ctx.height - (y + radius + 3), + radius, c) + return + } + } if c.a != 255 { sgl.load_pipeline(ctx.pipeline.alpha) } diff --git a/vlib/gg/gg_darwin.c.v b/vlib/gg/gg_darwin.c.v index d95b8c4bdec1e4..086c2dbf0e5fd4 100644 --- a/vlib/gg/gg_darwin.c.v +++ b/vlib/gg/gg_darwin.c.v @@ -19,5 +19,6 @@ fn C.darwin_create_image(path string) Image fn C.darwin_draw_image(f32, f32, f32, f32, &Image) fn C.darwin_draw_circle(f32, f32, f32, voidptr) +fn C.darwin_draw_circle_empty(f32, f32, f32, voidptr) //, gx.Color c) diff --git a/vlib/gg/gg_darwin.m b/vlib/gg/gg_darwin.m index c2de37b92aa2af..53c0c493885468 100644 --- a/vlib/gg/gg_darwin.m +++ b/vlib/gg/gg_darwin.m @@ -120,3 +120,16 @@ void darwin_draw_circle(float x, float y, float d, gx__Color color) { [circlePath fill]; // NSRectFill(rect); } + +void darwin_draw_circle_empty(float x, float y, float d, gx__Color color) { + NSColor* outlineColor = nscolor(color); + CGFloat outlineWidth = 1.0; //2.0; + + NSRect rect = NSMakeRect(x, y, d * 2, d * 2); + NSBezierPath* circlePath = [NSBezierPath bezierPath]; + [circlePath appendBezierPathWithOvalInRect:rect]; + + [outlineColor setStroke]; + [circlePath setLineWidth:outlineWidth]; + [circlePath stroke]; +} diff --git a/vlib/gg/image.c.v b/vlib/gg/image.c.v index 1a030ea0db28ea..bf84d571f1956f 100644 --- a/vlib/gg/image.c.v +++ b/vlib/gg/image.c.v @@ -291,7 +291,9 @@ pub fn (ctx &Context) draw_image_with_config(config DrawImageConfig) { if config.img_id > 0 { img = &ctx.image_cache[config.img_id] } else { + //$if !noggverbose ? { eprintln('gg: failed to get image to draw natively') + //} return } } diff --git a/vlib/net/http/http.v b/vlib/net/http/http.v index e3f22de9c50b60..b790fd1d3cd87d 100644 --- a/vlib/net/http/http.v +++ b/vlib/net/http/http.v @@ -90,6 +90,16 @@ pub fn post_form(url string, data map[string]string) !Response { ) } +pub fn post_form_with_cookies(url string, data map[string]string, cookies map[string]string) !Response { + return fetch( + method: .post + url: url + header: new_header(key: .content_type, value: 'application/x-www-form-urlencoded') + data: url_encode_form_data(data) + cookies: cookies + ) +} + @[params] pub struct PostMultipartFormConfig { pub mut: diff --git a/vlib/v/checker/errors.v b/vlib/v/checker/errors.v index e9b4637511e61a..b6b76c3be3877f 100644 --- a/vlib/v/checker/errors.v +++ b/vlib/v/checker/errors.v @@ -37,7 +37,19 @@ fn (mut c Checker) error(message string, pos token.Pos) { // TODO move this return } - msg := message.replace('`Array_', '`[]') + mut msg := message.replace('`Array_', '`[]') + if c.pref.is_vweb { + // Show in which veb action the error occurred (for easier debugging) + veb_action := c.table.cur_fn.name.replace('vweb_tmpl_', '') + mut j := 0 + for _, ch in veb_action { + if ch.is_digit() { + break + } + j++ + } + msg += ' (veb action: ${veb_action[..j]})' + } c.warn_or_error(msg, pos, false) } diff --git a/vlib/x/vweb/context.v b/vlib/x/vweb/context.v index ffdb3af7e658b6..7f463e4000224a 100644 --- a/vlib/x/vweb/context.v +++ b/vlib/x/vweb/context.v @@ -291,11 +291,16 @@ pub fn (ctx &Context) user_agent() string { // Returns the ip address from the current user pub fn (ctx &Context) ip() string { - mut ip := ctx.req.header.get(.x_forwarded_for) or { '' } + mut ip := ctx.req.header.get_custom('CF-Connecting-IP') or { '' } + if ip == '' { + ip = ctx.req.header.get(.x_forwarded_for) or { '' } + } + if ip == '' { + ip = ctx.req.header.get_custom('X-Forwarded-For') or { '' } + } if ip == '' { ip = ctx.req.header.get_custom('X-Real-Ip') or { '' } } - if ip.contains(',') { ip = ip.all_before(',') }