From b44df395f816cf179d7b208a12c9f600499001f5 Mon Sep 17 00:00:00 2001 From: Russell Standish Date: Fri, 27 Dec 2024 12:16:09 +1100 Subject: [PATCH] Adjust MacOSX Window render code to allow for scroll bars --- model/getContext.cc | 5 +++-- model/windowInformation.cc | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/model/getContext.cc b/model/getContext.cc index e7273a744..f5bf53b4c 100644 --- a/model/getContext.cc +++ b/model/getContext.cc @@ -88,7 +88,6 @@ namespace minsky // do not overwrite scrollbar if (winfo.hasScrollBars) { - height-=20; width-=20; } [impl->cairoView setFrameSize: NSMakeSize(width,height)]; @@ -110,9 +109,11 @@ namespace minsky { auto context = [[NSGraphicsContext currentContext] CGContext]; auto frame=[self frame]; - CGContextTranslateCTM(context,winfo->offsetLeft,winfo->childHeight); + CGContextTranslateCTM(context,winfo->offsetLeft,winfo->childHeight+(winfo->hasScrollBars?20:0)); CGContextScaleCTM(context,1,-1); //CoreGraphics's y dimension is opposite to everybody else's winfo->bufferSurface=make_shared(cairo_quartz_surface_create_for_cg_context(context, NSWidth(frame), NSHeight(frame))); + if (winfo->hasScrollBars) + cairo_surface_set_device_offset(winfo->bufferSurface->surface(), 0, 20); winfo->draw(); winfo->bufferSurface.reset(); } diff --git a/model/windowInformation.cc b/model/windowInformation.cc index af4999cfc..f9f5de308 100644 --- a/model/windowInformation.cc +++ b/model/windowInformation.cc @@ -218,17 +218,20 @@ namespace minsky #endif hasScrollBars(hasScrollBars) { + + offsetLeft = left; + offsetTop = top; + #if defined(MAC_OSX_TK) + childHeight = cHeight; return; #endif - - offsetLeft = left; - offsetTop = top; auto scrollBarOffs=hasScrollBars? 20:0; childWidth = cWidth - scrollBarOffs; childHeight = cHeight - scrollBarOffs; + #ifdef USE_WIN32_SURFACE parentWindowId = reinterpret_cast(parentWin);