Skip to content

Commit

Permalink
Adjust MacOSX Window render code to allow for scroll bars
Browse files Browse the repository at this point in the history
  • Loading branch information
highperformancecoder committed Dec 27, 2024
1 parent e275c95 commit b44df39
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions model/getContext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ namespace minsky
// do not overwrite scrollbar
if (winfo.hasScrollBars)
{
height-=20;
width-=20;
}
[impl->cairoView setFrameSize: NSMakeSize(width,height)];
Expand All @@ -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<ecolab::cairo::Surface>(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();
}
Expand Down
9 changes: 6 additions & 3 deletions model/windowInformation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<HWND>(parentWin);

Expand Down

0 comments on commit b44df39

Please sign in to comment.