20#include "TGLIncludes.h"
46#include <ApplicationServices/ApplicationServices.h>
47#include <OpenGL/OpenGL.h>
48#include <Cocoa/Cocoa.h>
88#pragma mark - Display configuration management.
91void DisplayReconfigurationCallback(CGDirectDisplayID , CGDisplayChangeSummaryFlags flags,
void * )
93 if (flags & kCGDisplayBeginConfigurationFlag)
96 if (flags & kCGDisplayDesktopShapeChangedFlag) {
97 assert(
dynamic_cast<TGCocoa *
>(
gVirtualX) != 0 &&
"DisplayReconfigurationCallback, gVirtualX"
98 " is either null or has a wrong type");
104#pragma mark - Aux. functions called from GUI-rendering part.
109 assert(ctx != 0 &&
"SetStrokeForegroundColorFromX11Context, parameter 'ctx' is null");
115 ::Warning(
"SetStrokeForegroundColorFromX11Context",
116 "x11 context does not have line color information");
118 CGContextSetRGBStrokeColor(ctx, rgb[0], rgb[1], rgb[2], 1.);
125 assert(ctx != 0 &&
"SetStrokeDashFromX11Context, ctx parameter is null");
127 SetStrokeForegroundColorFromX11Context(ctx, gcVals);
129 static const std::size_t maxLength =
sizeof gcVals.
fDashes /
sizeof gcVals.
fDashes[0];
130 assert(maxLength >= std::size_t(gcVals.
fDashLen) &&
131 "SetStrokeDashFromX11Context, x11 context has bad dash length > sizeof(fDashes)");
133 CGFloat dashes[maxLength] = {};
144 ::Warning(
"SetStrokeDoubleDashFromX11Context",
"Not implemented yet, kick tpochep!");
152 assert(ctx != 0 &&
"SetStrokeParametersFromX11Context, parameter 'ctx' is null");
156 CGContextSetLineWidth(ctx, gcVals.
fLineWidth);
158 CGContextSetLineWidth(ctx, 1.);
160 CGContextSetLineDash(ctx, 0., 0, 0);
164 SetStrokeForegroundColorFromX11Context(ctx, gcVals);
166 SetStrokeDashFromX11Context(ctx, gcVals);
168 SetStrokeDoubleDashFromX11Context(ctx ,gcVals);
170 ::Warning(
"SetStrokeParametersFromX11Context",
"line style bit is set,"
171 " but line style is unknown");
172 SetStrokeForegroundColorFromX11Context(ctx, gcVals);
175 SetStrokeForegroundColorFromX11Context(ctx, gcVals);
183 assert(ctx != 0 &&
"SetFilledAreaColorFromX11Context, parameter 'ctx' is null");
189 ::Warning(
"SetFilledAreaColorFromX11Context",
"no fill color found in x11 context");
191 CGContextSetRGBFillColor(ctx, rgb[0], rgb[1], rgb[2], 1.);
194struct PatternContext {
197 : fMask(
mask), fFillStyle(fillStyle), fForeground(
foreground), fBackground(background), fPhase(phase)
199 fImage = [image retain];
206 PatternContext(
const PatternContext &) =
delete;
207 PatternContext(PatternContext &&) =
delete;
208 PatternContext &
operator = (
const PatternContext &) =
delete;
209 PatternContext &
operator = (PatternContext &&) =
delete;
213 if (image != fImage) {
215 fImage = [image retain];
220 Int_t fFillStyle = 0;
235bool HasFillTiledStyle(
const GCValues_t &gcVals)
247bool HasFillStippledStyle(
const GCValues_t &gcVals)
259bool HasFillOpaqueStippledStyle(
const GCValues_t &gcVals)
267 assert(patternImage != nil &&
"DrawTile, parameter 'patternImage' is nil");
268 assert(ctx != 0 &&
"DrawTile, ctx parameter is null");
270 const CGRect patternRect = CGRectMake(0, 0, patternImage.fWidth, patternImage.fHeight);
271 if ([patternImage isKindOfClass : [
QuartzImage class]]) {
272 CGContextDrawImage(ctx, patternRect, ((
QuartzImage *)patternImage).fImage);
273 }
else if ([patternImage isKindOfClass : [
QuartzPixmap class]]){
275 assert(imageFromPixmap.Get() != 0 &&
"DrawTile, createImageFromPixmap failed");
276 CGContextDrawImage(ctx, patternRect, imageFromPixmap.Get());
278 assert(0 &&
"DrawTile, pattern is neither a QuartzImage, nor a QuartzPixmap");
288 assert(info != 0 &&
"DrawPattern, parameter 'info' is null");
289 assert(ctx != 0 &&
"DrawPattern, parameter 'ctx' is null");
291 const PatternContext *
const patternContext = (PatternContext *)info;
293 const Int_t fillStyle = patternContext->fFillStyle;
296 assert(patternImage != nil &&
"DrawPattern, pattern (stipple) image is nil");
297 const CGRect patternRect = CGRectMake(0, 0, patternImage.fWidth, patternImage.fHeight);
299 if (HasFillTiledStyle(
mask, fillStyle)) {
300 DrawTile(patternImage, ctx);
301 }
else if (HasFillStippledStyle(
mask, fillStyle) || HasFillOpaqueStippledStyle(
mask, fillStyle)) {
302 assert([patternImage isKindOfClass : [
QuartzImage class]] &&
303 "DrawPattern, stipple must be a QuartzImage object");
305 assert(image.
fIsStippleMask == YES &&
"DrawPattern, image is not a stipple mask");
309 if (HasFillOpaqueStippledStyle(
mask,fillStyle)) {
312 "DrawPattern, fill style is FillOpaqueStippled, but background color is not set in a context");
314 CGContextSetRGBFillColor(ctx, rgb[0], rgb[1], rgb[2], 1.);
315 CGContextFillRect(ctx, patternRect);
321 CGContextSetRGBFillColor(ctx, rgb[0], rgb[1], rgb[2], 1.);
322 CGContextClipToMask(ctx, patternRect, image.
fImage);
323 CGContextFillRect(ctx, patternRect);
326 DrawTile(patternImage, ctx);
331void PatternRelease(
void *info)
333 delete static_cast<PatternContext *
>(info);
343 assert(ctx != 0 &&
"SetFillPattern, parameter 'ctx' is null");
344 assert(patternContext != 0 &&
"SetFillPattern, parameter 'patternContext' is null");
345 assert(patternContext->fImage != nil &&
"SetFillPattern, pattern image is nil");
348 CGContextSetFillColorSpace(ctx, patternColorSpace.Get());
350 CGPatternCallbacks callbacks = {};
352 callbacks.releaseInfo = PatternRelease;
353 const CGRect patternRect = CGRectMake(0, 0, patternContext->fImage.fWidth, patternContext->fImage.fHeight);
355 patternContext->fImage.fWidth, patternContext->fImage.fHeight,
356 kCGPatternTilingNoDistortion,
true, &callbacks));
357 const CGFloat alpha = 1.;
358 CGContextSetFillPattern(ctx, pattern.Get(), &alpha);
359 CGContextSetPatternPhase(ctx, patternContext->fPhase);
365 assert(
child != nil &&
"ParentRendersToChild, parameter 'child' is nil");
370 !
child.fIsOverlapped;
373class ViewFixer final {
378 const auto origin = viewToFix.frame.origin;
380 widToFix = viewToFix.
fID;
381 if ((context = viewToFix.
fContext)) {
382 CGContextSaveGState(context);
383 CGContextTranslateCTM(context, origin.x, origin.y);
390 CGContextRestoreGState(context);
392 ViewFixer(
const ViewFixer &rhs) =
delete;
393 ViewFixer &
operator = (
const ViewFixer &) =
delete;
400bool IsNonPrintableAsciiCharacter(UniChar
c)
402 if (
c == 9 || (
c >= 32 &&
c < 127))
409void FixAscii(std::vector<UniChar> &
text)
426 std::replace(
text.begin(),
text.end(), UniChar(16), UniChar(
' '));
429 text.erase(std::remove_if(
text.begin(),
text.end(), IsNonPrintableAsciiCharacter),
text.end());
440 : fSelectedDrawable(0),
444 fForegroundProcess(false),
446 fDisplayShapeChanged(true)
449 "TGCocoa, gSystem is eihter null or has a wrong type");
460 CGDisplayRegisterReconfigurationCallback (DisplayReconfigurationCallback, 0);
466 fSelectedDrawable(0),
470 fForegroundProcess(false),
472 fDisplayShapeChanged(true)
475 "TGCocoa, gSystem is eihter null or has a wrong type");
486 CGDisplayRegisterReconfigurationCallback (DisplayReconfigurationCallback, 0);
493 CGDisplayRemoveReconfigurationCallback (DisplayReconfigurationCallback, 0);
512 if (CGMainDisplayID() == kCGNullDirectDisplay)
565 return CGDisplayScreenSize(CGMainDisplayID()).width;
576 NSArray *
const screens = [NSScreen screens];
577 assert(screens != nil &&
"screens array is nil");
579 NSScreen *
const mainScreen = [screens objectAtIndex : 0];
580 assert(mainScreen != nil &&
"screen with index 0 is nil");
582 return NSBitsPerPixelFromDepth([mainScreen depth]);
591 assert(
gClient != 0 &&
"Update, gClient is null");
593 }
else if (
mode > 0) {
612 NSArray *
const screens = [NSScreen screens];
613 assert(screens != nil && screens.count != 0 &&
"GetDisplayGeometry, no screens found");
615 NSRect frame = [(NSScreen *)[screens objectAtIndex : 0] frame];
616 CGFloat xMin = frame.origin.x, xMax = xMin + frame.size.width;
617 CGFloat yMin = frame.origin.y, yMax = yMin + frame.size.height;
619 for (NSUInteger i = 1,
e = screens.count; i <
e; ++i) {
620 frame = [(NSScreen *)[screens objectAtIndex : i] frame];
621 xMin = std::min(xMin, frame.origin.x);
622 xMax = std::max(xMax, frame.origin.x + frame.size.width);
623 yMin = std::min(yMin, frame.origin.y);
624 yMax = std::max(yMax, frame.origin.y + frame.size.height);
638#pragma mark - Window management part.
644 return fPimpl->GetRootWindowID();
660 assert(parentID != 0 &&
"InitWindow, parameter 'parentID' is 0");
664 if (
fPimpl->IsRootWindow(parentID))
667 [
fPimpl->GetWindow(parentID) getAttributes : &
attr];
669 return CreateWindow(parentID, 0, 0,
attr.fWidth,
attr.fHeight, 0,
attr.fDepth,
attr.fClass, 0, 0, 0);
693 "ClearWindow, fSelectedDrawable is invalid");
696 if (drawable.fIsPixmap) {
702 assert(pixmapCtx != 0 &&
"ClearWindow, pixmap's context is null");
707 CGContextClearRect(pixmapCtx, CGRectMake(0, 0, drawable.fWidth, drawable.fHeight));
724 if (windowID < 0 || fPimpl->IsRootWindow(windowID)) {
738 h = drawable.fHeight;
740 if (!drawable.fIsPixmap) {
742 NSPoint srcPoint = {};
745 NSView<X11Window> *
const view = window.fContentView.fParentView ? window.fContentView.fParentView : window.fContentView;
762 assert(!
fPimpl->IsRootWindow(windowID) &&
"MoveWindow, called for root window");
767 [
fPimpl->GetWindow(windowID) setX :
x Y :
y];
787 assert(!
fPimpl->IsRootWindow(windowID) &&
788 "ResizeWindow, parameter 'windowID' is a root window's id");
793 if (window.fBackBuffer) {
813 "UpdateWindow, fSelectedDrawable is not a valid window id");
822 assert([window.fContentView isKindOfClass : [
QuartzView class]] &&
"UpdateWindow, content view is not a QuartzView");
825 if (dstView.fIsOverlapped)
828 if (dstView.fContext) {
830 const X11::Rectangle copyArea(0, 0, pixmap.fWidth, pixmap.fHeight);
831 [dstView copy : pixmap area : copyArea withMask : nil clipOrigin :
X11::Point() toPoint :
X11::Point()];
834 fPimpl->fX11CommandBuffer.AddUpdateWindow(dstView);
880 if (
fPimpl->IsRootWindow(parentID)) {
883 depth, clss, visual,
attr, wtype);
889 [newWindow setAcceptsMouseMovedEvents : YES];
895 assert([parentWin.fContentView isKindOfClass : [
QuartzView class]] &&
896 "CreateWindow, parent view must be QuartzView");
900 x,
y,
w,
h, border, depth, clss, visual,
attr, wtype);
904 [parentWin addChild : childView];
934 BOOL needFocusChange = NO;
939 fPimpl->fX11EventTranslator.CheckUnmappedView(
wid);
941 assert(
fPimpl->GetDrawable(
wid).fIsPixmap == NO &&
942 "DestroyWindow, can not be called for QuartzPixmap or QuartzImage object");
945 if (
fPimpl->fX11CommandBuffer.BufferSize())
946 fPimpl->fX11CommandBuffer.RemoveOperationsForDrawable(
wid);
949 if ((needFocusChange = window == window.fQuartzWindow && window.fQuartzWindow.fHasFocus))
950 window.fHasFocus = NO;
954 fPimpl->fX11EventTranslator.GenerateDestroyNotify(
wid);
985 assert(
fPimpl->GetDrawable(
wid).fIsPixmap == NO &&
986 "DestroySubwindows, can not be called for QuartzPixmap or QuartzImage object");
1023 assert(!
fPimpl->IsRootWindow(
wid) &&
"ChangeWindowAttributes, called for root window");
1024 assert(
attr != 0 &&
"ChangeWindowAttributes, parameter 'attr' is null");
1041 if (windowID <= fPimpl->GetRootWindowID())
1046 window.fEventMask = eventMask;
1055 assert(!
fPimpl->IsRootWindow(
wid) &&
"ReparentChild, can not re-parent root window");
1060 if (
fPimpl->IsRootWindow(pid)) {
1063 [view removeFromSuperview];
1064 view.fParentView = nil;
1066 NSRect frame = view.frame;
1067 frame.origin = NSPoint();
1069 NSUInteger styleMask = kClosableWindowMask | kMiniaturizableWindowMask | kResizableWindowMask;
1070 if (!view.fOverrideRedirect)
1071 styleMask |= kTitledWindowMask;
1074 styleMask : styleMask
1075 backing : NSBackingStoreBuffered
1077 [view setX :
x Y :
y];
1078 [newTopLevel addChild : view];
1080 fPimpl->ReplaceDrawable(
wid, newTopLevel);
1083 [newTopLevel release];
1086 [view removeFromSuperview];
1089 assert(newParent.fIsPixmap == NO &&
"ReparentChild, pixmap can not be a new parent");
1090 [view setX :
x Y :
y];
1091 [newParent addChild : view];
1102 if (
fPimpl->IsRootWindow(pid))
1109 [contentView retain];
1110 [contentView removeFromSuperview];
1111 [topLevel setContentView : nil];
1112 fPimpl->ReplaceDrawable(
wid, contentView);
1113 [contentView setX :
x Y :
y];
1114 [
fPimpl->GetWindow(pid) addChild : contentView];
1115 [contentView release];
1126 assert(!
fPimpl->IsRootWindow(
wid) &&
"ReparentWindow, can not re-parent root window");
1129 if (view.fParentView)
1142 assert(!
fPimpl->IsRootWindow(
wid) &&
"MapWindow, called for root window");
1162 assert(!
fPimpl->IsRootWindow(
wid) &&
"MapSubwindows, called for 'root' window");
1177 assert(!
fPimpl->IsRootWindow(
wid) &&
"MapRaised, called for root window");
1198 assert(!
fPimpl->IsRootWindow(
wid) &&
"UnmapWindow, called for root window");
1203 fPimpl->fX11EventTranslator.CheckUnmappedView(
wid);
1208 if (
win ==
win.fQuartzWindow &&
win.fQuartzWindow.fHasFocus)
1230 assert(!
fPimpl->IsRootWindow(
wid) &&
"RaiseWindow, called for root window");
1232 if (!
fPimpl->GetWindow(
wid).fParentView)
1247 assert(!
fPimpl->IsRootWindow(
wid) &&
"LowerWindow, called for root window");
1249 if (!
fPimpl->GetWindow(
wid).fParentView)
1268 assert(!
fPimpl->IsRootWindow(
wid) &&
"MoveWindow, called for root window");
1287 assert(!
fPimpl->IsRootWindow(
wid) &&
"MoveResizeWindow, called for 'root' window");
1299 assert(!
fPimpl->IsRootWindow(
wid) &&
"ResizeWindow, called for 'root' window");
1304 const UInt_t siMax = std::numeric_limits<Int_t>::max();
1305 if (
w > siMax ||
h > siMax)
1308 NSSize newSize = {};
1312 [
fPimpl->GetWindow(
wid) setDrawableSize : newSize];
1322 assert(!
fPimpl->IsRootWindow(
wid) &&
"IconifyWindow, can not iconify the root window");
1323 assert(
fPimpl->GetWindow(
wid).fIsPixmap == NO &&
"IconifyWindow, invalid window id");
1326 assert(
win.fQuartzWindow ==
win &&
"IconifyWindow, can be called only for a top level window");
1328 fPimpl->fX11EventTranslator.CheckUnmappedView(
wid);
1331 if (
fPimpl->fX11CommandBuffer.BufferSize())
1332 fPimpl->fX11CommandBuffer.RemoveOperationsForDrawable(
wid);
1334 if (window.fQuartzWindow.fHasFocus) {
1336 window.fQuartzWindow.fHasFocus = NO;
1339 [
win.fQuartzWindow miniaturize :
win.fQuartzWindow];
1354 if (!srcWin || !dstWin)
1357 const bool srcIsRoot =
fPimpl->IsRootWindow(srcWin);
1358 const bool dstIsRoot =
fPimpl->IsRootWindow(dstWin);
1360 if (srcIsRoot && dstIsRoot) {
1372 NSPoint srcPoint = {};
1376 NSPoint dstPoint = {};
1382 }
else if (srcIsRoot) {
1386 if ([dstView superview]) {
1390 dstPoint = [[dstView superview] convertPoint : dstPoint fromView : dstView];
1392 if (view != dstView && view.fMapState ==
kIsViewable)
1401 if ([dstView superview]) {
1405 const NSPoint
pt = [[dstView superview] convertPoint : dstPoint fromView : dstView];
1407 if (view != dstView && view.fMapState ==
kIsViewable)
1440 if (!window.fIsPixmap) {
1460 assert(!
fPimpl->IsRootWindow(
wid) &&
"SetWindowBackground, can not set color for root window");
1462 fPimpl->GetWindow(
wid).fBackgroundPixel = color;
1475 assert(!
fPimpl->IsRootWindow(windowID) &&
1476 "SetWindowBackgroundPixmap, can not set background for a root window");
1477 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
1478 "SetWindowBackgroundPixmap, invalid window id");
1481 if (pixmapID ==
kNone) {
1482 window.fBackgroundPixmap = nil;
1486 assert(pixmapID >
fPimpl->GetRootWindowID() &&
1487 "SetWindowBackgroundPixmap, parameter 'pixmapID' is not a valid pixmap id");
1488 assert(
fPimpl->GetDrawable(pixmapID).fIsPixmap == YES &&
1489 "SetWindowBackgroundPixmap, bad drawable");
1496 if ([pixmapOrImage isKindOfClass : [
QuartzPixmap class]]) {
1498 if (backgroundImage.
Get())
1499 window.fBackgroundPixmap = backgroundImage.
Get();
1502 if (backgroundImage.
Get())
1503 window.fBackgroundPixmap = backgroundImage.
Get();
1506 if (!backgroundImage.
Get())
1508 Error(
"SetWindowBackgroundPixmap",
"QuartzImage initialization failed");
1517 if (windowID <= fPimpl->GetRootWindowID())
1521 return view.fParentView ? view.fParentView.fID :
fPimpl->GetRootWindowID();
1535 NSString *
const windowTitle = [NSString stringWithCString :
name encoding : NSASCIIStringEncoding];
1536 [(
NSWindow *)drawable setTitle : windowTitle];
1566 assert(!
fPimpl->IsRootWindow(windowID) &&
1567 "ShapeCombineMask, windowID parameter is a 'root' window");
1568 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
1569 "ShapeCombineMask, windowID parameter is a bad window id");
1571 "ShapeCombineMask, pixmapID parameter must point to QuartzImage object");
1573 if (
fPimpl->GetWindow(windowID).fContentView.fParentView)
1577 assert(srcImage.
fIsStippleMask == YES &&
"ShapeCombineMask, source image is not a stipple mask");
1585 [qw setOpaque : NO];
1586 [qw setBackgroundColor : [NSColor clearColor]];
1590#pragma mark - "Window manager hints" set of functions.
1598 assert(!
fPimpl->IsRootWindow(
wid) &&
"SetMWMHints, called for 'root' window");
1601 NSUInteger newMask = 0;
1603 if ([qw styleMask] & kTitledWindowMask) {
1604 newMask |= kTitledWindowMask;
1605 newMask |= kClosableWindowMask;
1609 newMask |= kMiniaturizableWindowMask | kResizableWindowMask;
1612 newMask |= kMiniaturizableWindowMask;
1614 newMask |= kResizableWindowMask;
1617 [qw setStyleMask : newMask];
1621 [[qw standardWindowButton : NSWindowZoomButton] setEnabled : YES];
1622 [[qw standardWindowButton : NSWindowMiniaturizeButton] setEnabled : YES];
1649 assert(!
fPimpl->IsRootWindow(
wid) &&
"SetWMSizeHints, called for root window");
1651 const NSUInteger styleMask = kTitledWindowMask | kClosableWindowMask | kMiniaturizableWindowMask | kResizableWindowMask;
1652 const NSRect minRect = [
NSWindow frameRectForContentRect : NSMakeRect(0., 0., wMin, hMin) styleMask : styleMask];
1653 const NSRect maxRect = [
NSWindow frameRectForContentRect : NSMakeRect(0., 0., wMax, hMax) styleMask : styleMask];
1656 [qw setMinSize : minRect.size];
1657 [qw setMaxSize : maxRect.size];
1678 assert(
wid >
fPimpl->GetRootWindowID() &&
"SetWMTransientHint, wid parameter is not a valid window id");
1680 if (
fPimpl->IsRootWindow(mainWid))
1685 if (![mainWindow isVisible])
1690 if (mainWindow != transientWindow) {
1693 Error(
"SetWMTransientHint",
"window is already transient for other window");
1695 [[transientWindow standardWindowButton : NSWindowZoomButton] setEnabled : NO];
1696 [mainWindow addTransientWindow : transientWindow];
1699 Warning(
"SetWMTransientHint",
"transient and main windows are the same window");
1702#pragma mark - GUI-rendering part.
1708 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawLineAux, called for root window");
1712 assert(ctx != 0 &&
"DrawLineAux, context is null");
1725 CGContextSetAllowsAntialiasing(ctx,
false);
1727 if (!drawable.fIsPixmap)
1728 CGContextTranslateCTM(ctx, 0.5, 0.5);
1735 SetStrokeParametersFromX11Context(ctx, gcVals);
1736 CGContextBeginPath(ctx);
1737 CGContextMoveToPoint(ctx,
x1,
y1);
1738 CGContextAddLineToPoint(ctx,
x2,
y2);
1739 CGContextStrokePath(ctx);
1741 CGContextSetAllowsAntialiasing(ctx,
true);
1756 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawLine, called for root window");
1757 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"DrawLine, invalid context index");
1762 if (!drawable.fIsPixmap) {
1765 const ViewFixer fixer(view,
wid);
1784 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawSegmentsAux, called for root window");
1785 assert(segments != 0 &&
"DrawSegmentsAux, segments parameter is null");
1786 assert(nSegments > 0 &&
"DrawSegmentsAux, nSegments <= 0");
1788 for (
Int_t i = 0; i < nSegments; ++i)
1789 DrawLineAux(
wid, gcVals, segments[i].fX1, segments[i].fY1 - 3, segments[i].fX2, segments[i].fY2 - 3);
1801 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawSegments, called for root window");
1802 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"DrawSegments, invalid context index");
1803 assert(segments != 0 &&
"DrawSegments, parameter 'segments' is null");
1804 assert(nSegments > 0 &&
"DrawSegments, number of segments <= 0");
1809 if (!drawable.fIsPixmap) {
1811 const ViewFixer fixer(view,
wid);
1815 fPimpl->fX11CommandBuffer.AddDrawSegments(
wid, gcVals, segments, nSegments);
1821 fPimpl->fX11CommandBuffer.AddDrawSegments(
wid, gcVals, segments, nSegments);
1831 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawRectangleAux, called for root window");
1835 if (!drawable.fIsPixmap) {
1848 assert(ctx &&
"DrawRectangleAux, context is null");
1851 CGContextSetAllowsAntialiasing(ctx,
false);
1853 SetStrokeParametersFromX11Context(ctx, gcVals);
1855 const CGRect
rect = CGRectMake(
x,
y,
w,
h);
1856 CGContextStrokeRect(ctx,
rect);
1858 CGContextSetAllowsAntialiasing(ctx,
true);
1870 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawRectangle, called for root window");
1871 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"DrawRectangle, invalid context index");
1877 if (!drawable.fIsPixmap) {
1880 const ViewFixer fixer(view,
wid);
1884 fPimpl->fX11CommandBuffer.AddDrawRectangle(
wid, gcVals,
x,
y,
w,
h);
1890 fPimpl->fX11CommandBuffer.AddDrawRectangle(
wid, gcVals,
x,
y,
w,
h);
1906 assert(!
fPimpl->IsRootWindow(
wid) &&
"FillRectangleAux, called for root window");
1910 CGSize patternPhase = {};
1912 if (drawable.fIsPixmap) {
1917 const CGRect fillRect = CGRectMake(
x,
y,
w,
h);
1919 if (!drawable.fIsPixmap) {
1922 const NSPoint origin = [view.
fParentView convertPoint : view.frame.origin toView : nil];
1923 patternPhase.width = origin.x;
1924 patternPhase.height = origin.y;
1930 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals) || HasFillTiledStyle(gcVals)) {
1931 std::unique_ptr<PatternContext> patternContext(
new PatternContext(gcVals.
fMask, gcVals.
fFillStyle,
1932 0, 0, nil, patternPhase));
1933 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals)) {
1935 "FillRectangleAux, fill_style is FillStippled/FillOpaqueStippled,"
1936 " but no stipple is set in a context");
1941 if (HasFillOpaqueStippledStyle(gcVals))
1945 "FillRectangleAux, fill_style is FillTiled, but not tile is set in a context");
1947 patternContext->SetImage(
fPimpl->GetDrawable(gcVals.
fTile));
1950 SetFillPattern(ctx, patternContext.get());
1951 patternContext.release();
1952 CGContextFillRect(ctx, fillRect);
1957 SetFilledAreaColorFromX11Context(ctx, gcVals);
1958 CGContextFillRect(ctx, fillRect);
1971 assert(!
fPimpl->IsRootWindow(
wid) &&
"FillRectangle, called for root window");
1972 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"FillRectangle, invalid context index");
1977 if (!drawable.fIsPixmap) {
1980 const ViewFixer fixer(view,
wid);
1983 fPimpl->fX11CommandBuffer.AddFillRectangle(
wid, gcVals,
x,
y,
w,
h);
2000 assert(!
fPimpl->IsRootWindow(
wid) &&
"FillPolygonAux, called for root window");
2001 assert(polygon != 0 &&
"FillPolygonAux, parameter 'polygon' is null");
2002 assert(nPoints > 0 &&
"FillPolygonAux, number of points must be positive");
2007 CGSize patternPhase = {};
2009 if (!drawable.fIsPixmap) {
2011 const NSPoint origin = [view convertPoint : view.frame.origin toView : nil];
2012 patternPhase.width = origin.x;
2013 patternPhase.height = origin.y;
2018 CGContextSetAllowsAntialiasing(ctx,
false);
2020 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals) || HasFillTiledStyle(gcVals)) {
2021 std::unique_ptr<PatternContext> patternContext(
new PatternContext(gcVals.
fMask, gcVals.
fFillStyle, 0, 0, nil, patternPhase));
2023 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals)) {
2025 "FillRectangleAux, fill style is FillStippled/FillOpaqueStippled,"
2026 " but no stipple is set in a context");
2031 if (HasFillOpaqueStippledStyle(gcVals))
2035 "FillRectangleAux, fill_style is FillTiled, but not tile is set in a context");
2037 patternContext->SetImage(
fPimpl->GetDrawable(gcVals.
fTile));
2040 SetFillPattern(ctx, patternContext.get());
2041 patternContext.release();
2043 SetFilledAreaColorFromX11Context(ctx, gcVals);
2048 CGContextBeginPath(ctx);
2049 if (!drawable.fIsPixmap) {
2050 CGContextMoveToPoint(ctx, polygon[0].fX, polygon[0].fY - 2);
2051 for (
Int_t i = 1; i < nPoints; ++i)
2052 CGContextAddLineToPoint(ctx, polygon[i].fX, polygon[i].fY - 2);
2055 for (
Int_t i = 1; i < nPoints; ++i)
2059 CGContextFillPath(ctx);
2060 CGContextSetAllowsAntialiasing(ctx,
true);
2083 assert(polygon != 0 &&
"FillPolygon, parameter 'polygon' is null");
2084 assert(nPoints > 0 &&
"FillPolygon, number of points must be positive");
2085 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"FillPolygon, invalid context index");
2090 if (!drawable.fIsPixmap) {
2092 const ViewFixer fixer(view,
wid);
2096 fPimpl->fX11CommandBuffer.AddFillPolygon(
wid, gcVals, polygon, nPoints);
2102 fPimpl->fX11CommandBuffer.AddFillPolygon(
wid, gcVals, polygon, nPoints);
2116 assert(!
fPimpl->IsRootWindow(
src) &&
"CopyAreaAux, src parameter is root window");
2117 assert(!
fPimpl->IsRootWindow(dst) &&
"CopyAreaAux, dst parameter is root window");
2132 "CopyArea, mask is not a pixmap");
2142 [dstDrawable copy : srcDrawable area : copyArea withMask :
mask clipOrigin : clipOrigin toPoint : dstPoint];
2152 assert(!
fPimpl->IsRootWindow(
src) &&
"CopyArea, src parameter is root window");
2153 assert(!
fPimpl->IsRootWindow(dst) &&
"CopyArea, dst parameter is root window");
2154 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"CopyArea, invalid context index");
2159 if (!drawable.fIsPixmap) {
2161 const ViewFixer fixer(view, dst);
2165 fPimpl->fX11CommandBuffer.AddCopyArea(
src, dst, gcVals, srcX, srcY,
width,
height, dstX, dstY);
2170 if (
fPimpl->GetDrawable(
src).fIsPixmap) {
2175 fPimpl->fX11CommandBuffer.AddCopyArea(
src, dst, gcVals, srcX, srcY,
width,
height, dstX, dstY);
2186 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawStringAux, called for root window");
2190 assert(ctx != 0 &&
"DrawStringAux, context is null");
2194 CGContextSetTextMatrix(ctx, CGAffineTransformIdentity);
2197 if (!drawable.fIsPixmap) {
2198 CGContextTranslateCTM(ctx, 0., drawable.fHeight);
2199 CGContextScaleCTM(ctx, 1., -1.);
2203 CGContextSetAllowsAntialiasing(ctx,
true);
2205 assert(gcVals.
fMask &
kGCFont &&
"DrawString, font is not set in a context");
2210 CGFloat textColor[4] = {0., 0., 0., 1.};
2215 CGContextSetRGBFillColor(ctx, textColor[0], textColor[1], textColor[2], textColor[3]);
2220 std::vector<UniChar> unichars((
unsigned char *)
text, (
unsigned char *)
text +
len);
2233 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawString, called for root window");
2234 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"DrawString, invalid context index");
2238 assert(gcVals.
fMask &
kGCFont &&
"DrawString, font is not set in a context");
2240 if (!drawable.fIsPixmap) {
2242 const ViewFixer fixer(view,
wid);
2262 assert(!
fPimpl->IsRootWindow(windowID) &&
"ClearAreaAux, called for root window");
2265 assert(view.
fContext != 0 &&
"ClearAreaAux, view.fContext is null");
2275 CGFloat rgb[3] = {};
2279 CGContextSetRGBFillColor(view.
fContext, rgb[0], rgb[1], rgb[2], 1.);
2280 CGContextFillRect(view.
fContext, CGRectMake(
x,
y,
w,
h));
2282 const CGRect fillRect = CGRectMake(
x,
y,
w,
h);
2284 CGSize patternPhase = {};
2286 const NSPoint origin = [view.
fParentView convertPoint : view.frame.origin toView : nil];
2287 patternPhase.width = origin.x;
2288 patternPhase.height = origin.y;
2292 std::unique_ptr<PatternContext> patternContext(
new PatternContext({}, 0, 0, 0, view.
fBackgroundPixmap, patternPhase));
2293 SetFillPattern(view.
fContext, patternContext.get());
2294 patternContext.release();
2295 CGContextFillRect(view.
fContext, fillRect);
2309 assert(!
fPimpl->IsRootWindow(
wid) &&
"ClearArea, called for root window");
2313 if (ParentRendersToChild(view))
2336#pragma mark - Pixmap management.
2342 NSSize newSize = {};
2347 scaleFactor : [[NSScreen mainScreen] backingScaleFactor]]);
2349 pixmap.
Get().fID =
fPimpl->RegisterDrawable(pixmap.
Get());
2353 Error(
"OpenPixmap",
"QuartzPixmap initialization failed");
2361 assert(!
fPimpl->IsRootWindow(
wid) &&
"ResizePixmap, called for root window");
2364 assert(drawable.fIsPixmap == YES &&
"ResizePixmap, invalid drawable");
2370 if ([pixmap resizeW :
w H :
h scaleFactor : [[NSScreen mainScreen] backingScaleFactor]])
2379 assert(pixmapID > (
Int_t)
fPimpl->GetRootWindowID() &&
2380 "SelectPixmap, parameter 'pixmapID' is not a valid id");
2388 assert(pixmapID > (
Int_t)
fPimpl->GetRootWindowID() &&
2389 "CopyPixmap, parameter 'pixmapID' is not a valid id");
2391 "CopyPixmap, fSelectedDrawable is not a valid window id");
2394 assert([source isKindOfClass : [
QuartzPixmap class]] &&
2395 "CopyPixmap, source is not a pixmap");
2401 if (drawable.fIsPixmap) {
2402 destination = drawable;
2405 if (window.fBackBuffer) {
2406 destination = window.fBackBuffer;
2408 Warning(
"CopyPixmap",
"Operation skipped, since destination"
2409 " window is not double buffered");
2414 const X11::Rectangle copyArea(0, 0, pixmap.fWidth, pixmap.fHeight);
2417 [destination copy : pixmap area : copyArea withMask : nil clipOrigin :
X11::Point() toPoint : dstPoint];
2425 assert(
fPimpl->GetDrawable(
fSelectedDrawable).fIsPixmap == YES &&
"ClosePixmap, selected drawable is not a pixmap");
2431#pragma mark - Different functions to create pixmap from different data sources. Used by GUI.
2432#pragma mark - These functions implement TVirtualX interface, some of them dupilcate others.
2448 assert(
bitmap != 0 &&
"CreatePixmap, parameter 'bitmap' is null");
2449 assert(
width > 0 &&
"CreatePixmap, parameter 'width' is 0");
2450 assert(
height > 0 &&
"CreatePixmap, parameter 'height' is 0");
2455 backgroundPixel, depth, &imageData[0]);
2466 Error(
"CreatePixmap",
"QuartzImage initialization failed");
2470 image.
Get().fID =
fPimpl->RegisterDrawable(image.
Get());
2471 return image.
Get().fID;
2478 assert(bits != 0 &&
"CreatePixmapFromData, data parameter is null");
2479 assert(
width != 0 &&
"CreatePixmapFromData, width parameter is 0");
2480 assert(
height != 0 &&
"CreatePixmapFromData, height parameter is 0");
2484 std::vector<unsigned char> imageData(bits, bits +
width *
height * 4);
2487 unsigned char *
p = &imageData[0];
2489 std::swap(
p[0],
p[2]);
2497 Error(
"CreatePixmapFromData",
"QuartzImage initialziation failed");
2501 image.
Get().fID =
fPimpl->RegisterDrawable(image.
Get());
2502 return image.
Get().fID;
2509 assert(std::numeric_limits<unsigned char>::digits == 8 &&
"CreateBitmap, ASImage requires octets");
2517 std::vector<unsigned char> imageData(
width *
height);
2520 for (
unsigned i = 0, j = 0,
e =
width / 8 *
height; i <
e; ++i) {
2521 for(
unsigned bit = 0; bit < 8; ++bit, ++j) {
2522 if (
bitmap[i] & (1 << bit))
2531 H :
height bitmapMask : &imageData[0]]);
2534 Error(
"CreateBitmap",
"QuartzImage initialization failed");
2538 image.
Get().fID =
fPimpl->RegisterDrawable(image.
Get());
2539 return image.
Get().fID;
2545 fPimpl->DeleteDrawable(pixmapID);
2552 assert(
fPimpl->GetDrawable(pixmapID).fIsPixmap == YES &&
"DeletePixmap, object is not a pixmap");
2553 fPimpl->fX11CommandBuffer.AddDeletePixmap(pixmapID);
2570 Warning(
"GetColorBits",
"Called for root window");
2572 assert(
x >= 0 &&
"GetColorBits, parameter 'x' is negative");
2573 assert(
y >= 0 &&
"GetColorBits, parameter 'y' is negative");
2574 assert(
w != 0 &&
"GetColorBits, parameter 'w' is 0");
2575 assert(
h != 0 &&
"GetColorBits, parameter 'h' is 0");
2578 return [
fPimpl->GetDrawable(
wid) readColorBits : area];
2584#pragma mark - XImage emulation.
2600 assert(
wid >
fPimpl->GetRootWindowID() &&
"GetImageSize, parameter 'wid' is invalid");
2603 width = drawable.fWidth;
2604 height = drawable.fHeight;
2618 "PutPixel, parameter 'imageID' is a bad pixmap id");
2619 assert(
x >= 0 &&
"PutPixel, parameter 'x' is negative");
2620 assert(
y >= 0 &&
"PutPixel, parameter 'y' is negative");
2624 unsigned char rgb[3] = {};
2626 [pixmap putPixel : rgb X :
x Y :
y];
2645 "DeleteImage, imageID parameter is not a valid image id");
2649#pragma mark - Mouse related code.
2667 assert(!
fPimpl->IsRootWindow(
wid) &&
"GrabButton, called for 'root' window");
2672 widget.fPassiveGrabOwnerEvents = YES;
2673 widget.fPassiveGrabButton =
button;
2674 widget.fPassiveGrabEventMask = eventMask;
2675 widget.fPassiveGrabKeyModifiers = keyModifiers;
2678 widget.fPassiveGrabOwnerEvents = NO;
2679 widget.fPassiveGrabButton = -1;
2680 widget.fPassiveGrabEventMask = 0;
2681 widget.fPassiveGrabKeyModifiers = 0;
2695 assert(!
fPimpl->IsRootWindow(
wid) &&
"GrabPointer, called for 'root' window");
2698 fPimpl->fX11EventTranslator.SetPointerGrab(view, eventMask, ownerEvents);
2702 fPimpl->fX11EventTranslator.CancelPointerGrab();
2753 assert(!
fPimpl->IsRootWindow(
wid) &&
"GrabKey, called for root window");
2759 [view addPassiveKeyGrab : keyCode modifiers : cocoaKeyModifiers];
2761 [view removePassiveKeyGrab : keyCode modifiers : cocoaKeyModifiers];
2780 return fPimpl->fX11EventTranslator.GetInputFocus();
2787 assert(!
fPimpl->IsRootWindow(
wid) &&
"SetInputFocus, called for root window");
2790 fPimpl->fX11EventTranslator.SetInputFocus(nil);
2792 fPimpl->fX11EventTranslator.SetInputFocus(
fPimpl->GetWindow(
wid).fContentView);
2808 assert(buf != 0 &&
"LookupString, parameter 'buf' is null");
2809 assert(
length >= 2 &&
"LookupString, parameter 'length' - not enough memory to return null-terminated ASCII string");
2814#pragma mark - Font management.
2821 assert(fontName != 0 &&
"LoadQueryFont, fontName is null");
2824 if (ParseXLFDName(fontName, xlfd)) {
2830 return fPimpl->fFontManager.LoadFont(xlfd);
2845 fPimpl->fFontManager.UnloadFont(
fs);
2860 return fPimpl->fFontManager.GetTextWidth(font, s,
len);
2867 fPimpl->fFontManager.GetFontProperties(font, maxAscent, maxDescent);
2894 if (fontName && fontName[0]) {
2897 return fPimpl->fFontManager.ListFonts(xlfd, maxNames, count);
2910 fPimpl->fFontManager.FreeFontNames(fontList);
2913#pragma mark - Color management.
2921 return fPimpl->fX11ColorParser.ParseColor(colorName, color);
2927 const unsigned red = unsigned(
double(color.
fRed) / 0xFFFF * 0xFF);
2928 const unsigned green = unsigned(
double(color.
fGreen) / 0xFFFF * 0xFF);
2929 const unsigned blue = unsigned(
double(color.
fBlue) / 0xFFFF * 0xFF);
2930 color.
fPixel = red << 16 | green << 8 | blue;
2938 color.
fRed = (color.
fPixel >> 16 & 0xFF) * 0xFFFF / 0xFF;
2939 color.
fGreen = (color.
fPixel >> 8 & 0xFF) * 0xFFFF / 0xFF;
2940 color.
fBlue = (color.
fPixel & 0xFF) * 0xFFFF / 0xFF;
2954 Float_t red = 0.f, green = 0.f, blue = 0.f;
2955 color->GetRGB(red, green, blue);
2956 pixel = unsigned(red * 255) << 16;
2957 pixel |= unsigned(green * 255) << 8;
2958 pixel |= unsigned(blue * 255);
2992#pragma mark - Graphical context management.
3012 assert(
gc <=
fX11Contexts.size() &&
gc > 0 &&
"ChangeGC, invalid context id");
3023 assert(
gc <=
fX11Contexts.size() &&
gc > 0 &&
"ChangeGC, invalid context id");
3024 assert(
gval != 0 &&
"ChangeGC, gval parameter is null");
3078 const unsigned nDashes =
sizeof x11Context.
fDashes /
sizeof x11Context.
fDashes[0];
3079 for (
unsigned i = 0; i < nDashes; ++i)
3089 assert(dst <=
fX11Contexts.size() && dst > 0 &&
"CopyGC, bad destination context");
3112#pragma mark - Cursor management.
3134 assert(!
fPimpl->IsRootWindow(
wid) &&
"SetCursor, called for root window");
3137 view.fCurrentCursor =
cursor;
3157 const NSPoint screenPoint = [
NSEvent mouseLocation];
3173 rootWinID =
fPimpl->GetRootWindowID();
3175 NSPoint screenPoint = [
NSEvent mouseLocation];
3178 rootX = screenPoint.x;
3179 rootY = screenPoint.y;
3182 if (winID >
fPimpl->GetRootWindowID()) {
3188 winX = screenPoint.x;
3189 winY = screenPoint.y;
3194 childWinID = childWin.fID;
3202#pragma mark - OpenGL management.
3210 return [[NSScreen mainScreen] backingScaleFactor];
3215 const std::vector<std::pair<UInt_t, Int_t> > &formatComponents)
3219 typedef std::pair<UInt_t, Int_t> component_type;
3220 typedef std::vector<component_type>::size_type size_type;
3223 std::vector<NSOpenGLPixelFormatAttribute> attribs;
3224 for (size_type i = 0,
e = formatComponents.size(); i <
e; ++i) {
3225 const component_type &comp = formatComponents[i];
3228 attribs.push_back(NSOpenGLPFADoubleBuffer);
3230 attribs.push_back(NSOpenGLPFADepthSize);
3231 attribs.push_back(comp.second > 0 ? comp.second : 32);
3233 attribs.push_back(NSOpenGLPFAAccumSize);
3234 attribs.push_back(comp.second > 0 ? comp.second : 1);
3236 attribs.push_back(NSOpenGLPFAStencilSize);
3237 attribs.push_back(comp.second > 0 ? comp.second : 8);
3239 attribs.push_back(NSOpenGLPFAMultisample);
3240 attribs.push_back(NSOpenGLPFASampleBuffers);
3241 attribs.push_back(1);
3242 attribs.push_back(NSOpenGLPFASamples);
3243 attribs.push_back(comp.second ? comp.second : 8);
3247 attribs.push_back(0);
3249 NSOpenGLPixelFormat *
const pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes : &attribs[0]];
3253 if (!
fPimpl->IsRootWindow(parentID)) {
3254 parentView =
fPimpl->GetWindow(parentID).fContentView;
3255 assert([parentView isKindOfClass : [
QuartzView class]] &&
3256 "CreateOpenGLWindow, parent view must be QuartzView");
3259 NSRect viewFrame = {};
3260 viewFrame.size.width =
width;
3261 viewFrame.size.height =
height;
3269 [parentView addChild : glView];
3270 glID =
fPimpl->RegisterDrawable(glView);
3280 Error(
"CreateOpenGLWindow",
"QuartzWindow allocation/initialization"
3281 " failed for a top-level GL widget");
3285 glID =
fPimpl->RegisterDrawable(parent);
3295 assert(!
fPimpl->IsRootWindow(windowID) &&
3296 "CreateOpenGLContext, parameter 'windowID' is a root window");
3298 "CreateOpenGLContext, view is not an OpenGL view");
3300 NSOpenGLContext *
const sharedContext =
fPimpl->GetGLContextForHandle(sharedID);
3304 newContext([[NSOpenGLContext alloc] initWithFormat : glView.
pixelFormat shareContext : sharedContext]);
3322 assert(ctxID > 0 &&
"MakeOpenGLContextCurrent, invalid context id");
3324 NSOpenGLContext *
const glContext =
fPimpl->GetGLContextForHandle(ctxID);
3326 Error(
"MakeOpenGLContextCurrent",
"No OpenGL context found for id %d",
int(ctxID));
3334 if ([glContext view] != glView)
3335 [glContext setView : glView];
3343 [glContext makeCurrentContext];
3361 const UInt_t width = std::max(glView.frame.size.width, CGFloat(100));
3362 const UInt_t height = std::max(glView.frame.size.height, CGFloat(100));
3364 NSRect viewFrame = {};
3365 viewFrame.size.width =
width;
3366 viewFrame.size.height =
height;
3368 const NSUInteger styleMask = kTitledWindowMask | kClosableWindowMask |
3369 kMiniaturizableWindowMask | kResizableWindowMask;
3372 fakeWindow = [[
QuartzWindow alloc] initWithContentRect : viewFrame styleMask : styleMask
3373 backing : NSBackingStoreBuffered defer : NO windowAttributes : &
attr];
3377 [fakeView setHidden : NO];
3379 fPimpl->SetFakeGLWindow(fakeWindow);
3383 [fakeView setHidden : NO];
3387 [glContext setView : fakeView];
3388 [glContext makeCurrentContext];
3397 NSOpenGLContext *
const currentContext = [NSOpenGLContext currentContext];
3398 if (!currentContext) {
3399 Error(
"GetCurrentOpenGLContext",
"The current OpenGL context is null");
3403 const Handle_t contextID =
fPimpl->GetHandleForGLContext(currentContext);
3405 Error(
"GetCurrentOpenGLContext",
"The current OpenGL context was"
3406 " not created/registered by TGCocoa");
3414 assert(ctxID > 0 &&
"FlushOpenGLBuffer, invalid context id");
3416 NSOpenGLContext *
const glContext =
fPimpl->GetGLContextForHandle(ctxID);
3417 assert(glContext != nil &&
"FlushOpenGLBuffer, bad context id");
3419 if (glContext != [NSOpenGLContext currentContext])
3423 [glContext flushBuffer];
3432 NSOpenGLContext *
const glContext =
fPimpl->GetGLContextForHandle(ctxID);
3433 if (
NSView *
const v = [glContext view]) {
3437 [glContext clearDrawable];
3440 if (glContext == [NSOpenGLContext currentContext])
3441 [NSOpenGLContext clearCurrentContext];
3443 fPimpl->DeleteGLContext(ctxID);
3446#pragma mark - Off-screen rendering for TPad/TCanvas.
3452 assert(windowID > (
Int_t)
fPimpl->GetRootWindowID() &&
"SetDoubleBuffer called for root window");
3454 if (windowID == 999) {
3455 Warning(
"SetDoubleBuffer",
"called with wid == 999");
3476 "SetDoubleBufferON, called, but no correct window was selected before");
3480 if (!window)
return;
3482 assert(window.fIsPixmap == NO &&
3483 "SetDoubleBufferON, selected drawable is a pixmap, can not attach pixmap to pixmap");
3485 const unsigned currW = window.fWidth;
3486 const unsigned currH = window.fHeight;
3488 if (
QuartzPixmap *
const currentPixmap = window.fBackBuffer) {
3489 if (currH == currentPixmap.fHeight && currW == currentPixmap.fWidth)
3494 H : currH scaleFactor : [[NSScreen mainScreen] backingScaleFactor]]);
3496 window.fBackBuffer = pixmap.
Get();
3499 Error(
"SetDoubleBufferON",
"QuartzPixmap initialization failed");
3510 auto windows = NSApplication.sharedApplication.windows;
3511 for (
NSWindow *candidate : windows) {
3515 fPimpl->fX11CommandBuffer.ClearXOROperations();
3521#pragma mark - Event management part.
3535 fPimpl->fX11EventTranslator.fEventQueue.push_back(newEvent);
3541 assert(
fPimpl->fX11EventTranslator.fEventQueue.size() > 0 &&
"NextEvent, event queue is empty");
3543 event =
fPimpl->fX11EventTranslator.fEventQueue.front();
3544 fPimpl->fX11EventTranslator.fEventQueue.pop_front();
3550 return (
Int_t)
fPimpl->fX11EventTranslator.fEventQueue.size();
3557 typedef X11::EventQueue_t::iterator iterator_type;
3559 iterator_type it =
fPimpl->fX11EventTranslator.fEventQueue.begin();
3560 iterator_type eIt =
fPimpl->fX11EventTranslator.fEventQueue.end();
3562 for (; it != eIt; ++it) {
3563 const Event_t &queuedEvent = *it;
3565 event = queuedEvent;
3566 fPimpl->fX11EventTranslator.fEventQueue.erase(it);
3582#pragma mark - "Drag and drop", "Copy and paste", X11 properties.
3589 assert(
name != 0 &&
"InternAtom, parameter 'name' is null");
3606 assert(!
fPimpl->IsRootWindow(windowID) &&
3607 "SetPrimarySelectionOwner, windowID parameter is a 'root' window");
3608 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3609 "SetPrimarySelectionOwner, windowID parameter is not a valid window");
3611 const Atom_t primarySelectionAtom =
FindAtom(
"XA_PRIMARY",
false);
3612 assert(primarySelectionAtom !=
kNone &&
3613 "SetPrimarySelectionOwner, predefined XA_PRIMARY atom was not found");
3631 assert(!
fPimpl->IsRootWindow(windowID) &&
3632 "SetSelectionOwner, windowID parameter is a 'root' window'");
3633 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3634 "SetSelectionOwner, windowID parameter is not a valid window");
3649 const Atom_t primarySelectionAtom =
FindAtom(
"XA_PRIMARY",
false);
3650 assert(primarySelectionAtom !=
kNone &&
3651 "GetPrimarySelectionOwner, predefined XA_PRIMARY atom was not found");
3674 assert(!
fPimpl->IsRootWindow(windowID) &&
3675 "ConvertPrimarySelection, parameter 'windowID' is root window");
3676 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3677 "ConvertPrimarySelection, parameter windowID parameter is not a window id");
3680 assert(primarySelectionAtom !=
kNone &&
3681 "ConvertPrimarySelection, XA_PRIMARY predefined atom not found");
3684 assert(stringAtom !=
kNone &&
3685 "ConvertPrimarySelection, XA_STRING predefined atom not found");
3703 assert(!
fPimpl->IsRootWindow(windowID) &&
3704 "ConvertSelection, parameter 'windowID' is root window'");
3705 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3706 "ConvertSelection, parameter 'windowID' is not a window id");
3717 newEvent.
fUser[0] = windowID;
3718 newEvent.
fUser[1] = selection;
3728 ULong_t *bytesAfterReturn,
unsigned char **propertyReturn)
3737 if (
fPimpl->IsRootWindow(windowID))
3740 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3741 "GetProperty, parameter 'windowID' is not a valid window id");
3742 assert(propertyID > 0 && propertyID <=
fAtomToName.size() &&
3743 "GetProperty, parameter 'propertyID' is not a valid atom");
3744 assert(actualType != 0 &&
"GetProperty, parameter 'actualType' is null");
3745 assert(actualFormat != 0 &&
"GetProperty, parameter 'actualFormat' is null");
3746 assert(bytesAfterReturn != 0 &&
"GetProperty, parameter 'bytesAfterReturn' is null");
3747 assert(propertyReturn != 0 &&
"GetProperty, parameter 'propertyReturn' is null");
3751 *bytesAfterReturn = 0;
3752 *propertyReturn = 0;
3755 const std::string &atomName =
fAtomToName[propertyID - 1];
3758 if (![window hasProperty : atomName.c_str()]) {
3759 Error(
"GetProperty",
"Unknown property %s requested", atomName.c_str());
3763 unsigned tmpFormat = 0, tmpElements = 0;
3764 *propertyReturn = [window getProperty : atomName.c_str() returnType : actualType
3765 returnFormat : &tmpFormat nElements : &tmpElements];
3766 *actualFormat = (
Int_t)tmpFormat;
3767 *nItems = tmpElements;
3786 assert(!
fPimpl->IsRootWindow(windowID) &&
3787 "GetPasteBuffer, parameter 'windowID' is root window");
3788 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3789 "GetPasteBuffer, parameter 'windowID' is not a valid window");
3790 assert(propertyID && propertyID <=
fAtomToName.size() &&
3791 "GetPasteBuffer, parameter 'propertyID' is not a valid atom");
3795 const std::string &atomString =
fAtomToName[propertyID - 1];
3798 if (![window hasProperty : atomString.c_str()]) {
3799 Error(
"GetPasteBuffer",
"No property %s on a window", atomString.c_str());
3804 unsigned tmpFormat = 0, nElements = 0;
3807 propertyData((
char *)[window getProperty : atomString.c_str()
3808 returnType : &tmpType returnFormat : &tmpFormat
3809 nElements : &nElements]);
3811 assert(tmpFormat == 8 &&
"GetPasteBuffer, property has wrong format");
3813 text.Insert(0, propertyData.
Get(), nElements);
3814 nChars = (
Int_t)nElements;
3819 [window removeProperty : atomString.c_str()];
3850 assert(!
fPimpl->IsRootWindow(windowID) &&
3851 "ChangeProperty, parameter 'windowID' is root window");
3852 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3853 "ChangeProperty, parameter 'windowID' is not a valid window id");
3854 assert(propertyID && propertyID <=
fAtomToName.size() &&
3855 "ChangeProperty, parameter 'propertyID' is not a valid atom");
3859 const std::string &atomString =
fAtomToName[propertyID - 1];
3884 assert(!
fPimpl->IsRootWindow(windowID) &&
3885 "ChangeProperties, parameter 'windowID' is root window");
3886 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3887 "ChangeProperties, parameter 'windowID' is not a valid window id");
3888 assert(propertyID && propertyID <=
fAtomToName.size() &&
3889 "ChangeProperties, parameter 'propertyID' is not a valid atom");
3893 const std::string &atomName =
fAtomToName[propertyID - 1];
3896 [window setProperty : atomName.c_str()
data :
data
3914 assert(!
fPimpl->IsRootWindow(windowID) &&
3915 "DeleteProperty, parameter 'windowID' is root window");
3916 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3917 "DeleteProperty, parameter 'windowID' is not a valid window");
3918 assert(propertyID && propertyID <=
fAtomToName.size() &&
3919 "DeleteProperty, parameter 'propertyID' is not a valid atom");
3921 const std::string &atomString =
fAtomToName[propertyID - 1];
3922 [
fPimpl->GetWindow(windowID) removeProperty : atomString.c_str()];
3938 assert(windowID >
fPimpl->GetRootWindowID() &&
3939 "SetDNDAware, parameter 'windowID' is not a valid window id");
3940 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3941 "SetDNDAware, parameter 'windowID' is not a window");
3946 NSArray *
const supportedTypes = [NSArray arrayWithObjects : NSFilenamesPboardType, nil];
3950 [view registerForDraggedTypes : supportedTypes];
3957 assert(xaAtomAtom == 4 &&
"SetDNDAware, XA_ATOM is not defined");
3962 assert(
sizeof(
unsigned) == 4 &&
"SetDNDAware, sizeof(unsigned) must be 4");
3964 std::vector<unsigned> propertyData;
3965 propertyData.push_back(4);
3968 for (
unsigned i = 0; typeList[i]; ++i)
3969 propertyData.push_back(
unsigned(typeList[i]));
3972 [view setProperty :
"XdndAware" data : (
unsigned char *)&propertyData[0]
3973 size : propertyData.size() forType : xaAtomAtom
format : 32];
3981 if (windowID <= fPimpl->GetRootWindowID())
3984 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3985 "IsDNDAware, windowID parameter is not a window");
3996 ::Warning(
"SetTypeList",
"Not implemented");
4020 fPimpl->IsRootWindow(winID) ? nil :
fPimpl->GetWindow(winID).fContentView,
4021 dragWinID, inputWinID,
x,
y, maxDepth);
4023 return testView.fID;
4028#pragma mark - Noops.
4153 NSPoint newCursorPosition = {};
4154 newCursorPosition.x = ix;
4155 newCursorPosition.y = iy;
4157 if (
fPimpl->GetRootWindowID() == winID) {
4161 assert(
fPimpl->GetDrawable(winID).fIsPixmap == NO &&
4162 "Warp, drawable is not a window");
4167 CGWarpMouseCursorPosition(NSPointToCGPoint(newCursorPosition));
4399#pragma mark - Details and aux. functions.
4404 return &
fPimpl->fX11EventTranslator;
4410 return &
fPimpl->fX11CommandBuffer;
4422 assert(
fCocoaDraw > 0 &&
"CocoaDrawOFF, was already off");
4436 if (!drawable.fIsPixmap) {
4437 Error(
"GetCurrentContext",
"TCanvas/TPad's internal error,"
4438 " selected drawable is not a pixmap!");
4442 return drawable.fContext;
4455 ProcessSerialNumber psn = {0, kCurrentProcess};
4457 const OSStatus res1 = TransformProcessType(&psn, kProcessTransformToForegroundApplication);
4462 if (res1 != noErr && res1 != paramErr) {
4463 Error(
"MakeProcessForeground",
"TransformProcessType failed with code %d",
int(res1));
4466#ifdef MAC_OS_X_VERSION_10_9
4468 [[NSApplication sharedApplication] activateIgnoringOtherApps : YES];
4470 const OSErr res2 = SetFrontProcess(&psn);
4471 if (res2 != noErr) {
4472 Error(
"MakeProcessForeground",
"SetFrontProcess failed with code %d", res2);
4479#ifdef MAC_OS_X_VERSION_10_9
4481 [[NSApplication sharedApplication] activateIgnoringOtherApps : YES];
4483 ProcessSerialNumber psn = {};
4485 OSErr res = GetCurrentProcess(&psn);
4487 Error(
"MakeProcessForeground",
"GetCurrentProcess failed with code %d", res);
4491 res = SetFrontProcess(&psn);
4493 Error(
"MapProcessForeground",
"SetFrontProcess failed with code %d", res);
4505 const std::map<std::string, Atom_t>::const_iterator it =
fNameToAtom.find(atomName);
4509 else if (addIfNotFound) {
4525 if (iconDirectoryPath) {
4527 if (fileName.
Get()) {
4530 NSString *cocoaStr = [NSString stringWithCString : fileName.
Get() encoding : NSASCIIStringEncoding];
4531 NSImage *image = [[[NSImage alloc] initWithContentsOfFile : cocoaStr] autorelease];
4532 [NSApp setApplicationIconImage : image];
Handle_t Region_t
Region handle.
const Mask_t kGCDashOffset
const Mask_t kGCBackground
const Mask_t kGCForeground
const Mask_t kGCLineStyle
const Mask_t kGCSubwindowMode
const Mask_t kGCLineWidth
Handle_t Pixmap_t
Pixmap handle.
const Mask_t kGCClipXOrigin
Handle_t FontH_t
Font handle (as opposed to Font_t which is an index)
Handle_t Visual_t
Visual handle.
const Mask_t kGCFillStyle
Handle_t Window_t
Window handle.
const Mask_t kGCJoinStyle
Handle_t Display_t
Display handle.
ULong_t Time_t
Event time.
Handle_t GContext_t
Graphics context handle.
EInitialState
Initial window mapping state.
const Mask_t kGCTileStipXOrigin
Handle_t Drawable_t
Drawable handle.
Handle_t Cursor_t
Cursor handle.
const Mask_t kStructureNotifyMask
const Mask_t kGCPlaneMask
const Mask_t kGCGraphicsExposures
const Mask_t kGCClipYOrigin
const Mask_t kGCTileStipYOrigin
EMouseButton
Button names.
Handle_t Colormap_t
Colormap handle.
ULongptr_t Handle_t
Generic resource handle.
Handle_t FontStruct_t
Pointer to font structure.
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void chupy
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t mask
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t cursor
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void pixel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize wid
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void clipboard
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize DestroySubwindows
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t rect
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t child
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void chupx
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t CopyArea
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void foreground
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char bitmap
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void funcs
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t win
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t attr
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t format
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void SetCursor
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t grab
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void when
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize fs
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t gval
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t property
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list ConvertSelection
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void gc
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t button
Option_t Option_t TPoint TPoint const char text
Option_t Option_t TPoint TPoint const char y1
Binding & operator=(OUT(*fun)(void))
R__EXTERN TVirtualMutex * gROOTMutex
R__EXTERN TSystem * gSystem
#define R__LOCKGUARD(mutex)
DerivedType * Get() const
void Reset(NSObject *object)
The color creation and management class.
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
This class implements TVirtualX interface for MacOS X, using Cocoa and Quartz 2D.
void DeleteFont(FontStruct_t fs) override
Explicitly deletes the font structure "fs" obtained via LoadQueryFont().
Int_t WriteGIF(char *name) override
Writes the current window into GIF file.
void SetCharacterUp(Float_t chupx, Float_t chupy) override
Sets character up vector.
Bool_t IsDNDAware(Window_t win, Atom_t *typelist) override
Checks if the Window is DND aware, and knows any of the DND formats passed in argument.
Pixmap_t CreatePixmap(Drawable_t wid, UInt_t w, UInt_t h) override
Creates a pixmap of the specified width and height and returns a pixmap ID that identifies it.
void TranslateCoordinates(Window_t src, Window_t dest, Int_t src_x, Int_t src_y, Int_t &dest_x, Int_t &dest_y, Window_t &child) override
Translates coordinates in one window to the coordinate space of another window.
void GetRegionBox(Region_t reg, Rectangle_t *rect) override
Returns smallest enclosing rectangle.
Window_t GetParent(Window_t wid) const override
Returns the parent of the window "id".
Double_t GetOpenGLScalingFactor() override
On a HiDPI resolution it can be > 1., this means glViewport should use scaled width and height.
void GetCharacterUp(Float_t &chupx, Float_t &chupy) override
Returns character up vector.
UInt_t ScreenWidthMM() const override
Returns the width of the screen in millimeters.
std::vector< GCValues_t > fX11Contexts
void GrabPointer(Window_t wid, UInt_t evmask, Window_t confine, Cursor_t cursor, Bool_t grab=kTRUE, Bool_t owner_events=kTRUE) override
Establishes an active pointer grab.
void DrawLineAux(Drawable_t wid, const GCValues_t &gcVals, Int_t x1, Int_t y1, Int_t x2, Int_t y2)
Int_t GetProperty(Window_t, Atom_t, Long_t, Long_t, Bool_t, Atom_t, Atom_t *, Int_t *, ULong_t *, ULong_t *, unsigned char **) override
Returns the actual type of the property; the actual format of the property; the number of 8-bit,...
void ReparentTopLevel(Window_t wid, Window_t pid, Int_t x, Int_t y)
void SetDoubleBufferON() override
Turns double buffer mode on.
void PutPixel(Drawable_t wid, Int_t x, Int_t y, ULong_t pixel) override
Overwrites the pixel in the image with the specified pixel value.
Bool_t IsCocoaDraw() const
void GetWindowSize(Drawable_t wid, Int_t &x, Int_t &y, UInt_t &w, UInt_t &h) override
Returns the location and the size of window "id".
void SetApplicationIcon()
void SetWindowBackgroundPixmap(Window_t wid, Pixmap_t pxm) override
Sets the background pixmap of the window "id" to the specified pixmap "pxm".
bool fDisplayShapeChanged
void DeleteOpenGLContext(Int_t ctxID) override
Deletes OpenGL context for window "wid".
Bool_t AllocColor(Colormap_t cmap, ColorStruct_t &color) override
Allocates a read-only colormap entry corresponding to the closest RGB value supported by the hardware...
Bool_t EqualRegion(Region_t rega, Region_t regb) override
Returns kTRUE if the two regions have the same offset, size, and shape.
void CopyPixmap(Int_t wid, Int_t xpos, Int_t ypos) override
Copies the pixmap "wid" at the position [xpos,ypos] in the current window.
void FreeFontStruct(FontStruct_t fs) override
Frees the font structure "fs".
void DestroySubwindows(Window_t wid) override
The DestroySubwindows function destroys all inferior windows of the specified window,...
Int_t OpenPixmap(UInt_t w, UInt_t h) override
Creates a pixmap of the width "w" and height "h" you specified.
Int_t TextWidth(FontStruct_t font, const char *s, Int_t len) override
Return length of the string "s" in pixels. Size depends on font.
void ResizeWindow(Int_t wid) override
Resizes the window "wid" if necessary.
void FillRectangleAux(Drawable_t wid, const GCValues_t &gcVals, Int_t x, Int_t y, UInt_t w, UInt_t h)
Atom_t FindAtom(const std::string &atomName, bool addIfNotFound)
ROOT::MacOSX::X11::CommandBuffer * GetCommandBuffer() const
void ChangeGC(GContext_t gc, GCValues_t *gval) override
Changes the components specified by the mask in gval for the specified GC.
void CopyAreaAux(Drawable_t src, Drawable_t dst, const GCValues_t &gc, Int_t srcX, Int_t srcY, UInt_t width, UInt_t height, Int_t dstX, Int_t dstY)
void SetDoubleBufferOFF() override
Turns double buffer mode off.
void DrawRectangleAux(Drawable_t wid, const GCValues_t &gcVals, Int_t x, Int_t y, UInt_t w, UInt_t h)
void Bell(Int_t percent) override
Sets the sound