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");
369class ViewFixer final {
374 const auto origin = viewToFix.frame.origin;
376 widToFix = viewToFix.
fID;
377 if ((context = viewToFix.
fContext)) {
378 CGContextSaveGState(context);
379 CGContextTranslateCTM(context, origin.x, origin.y);
386 CGContextRestoreGState(context);
388 ViewFixer(
const ViewFixer &rhs) =
delete;
389 ViewFixer &
operator = (
const ViewFixer &) =
delete;
396bool IsNonPrintableAsciiCharacter(UniChar
c)
398 if (
c == 9 || (
c >= 32 &&
c < 127))
405void FixAscii(std::vector<UniChar> &
text)
422 std::replace(
text.begin(),
text.end(), UniChar(16), UniChar(
' '));
425 text.erase(std::remove_if(
text.begin(),
text.end(), IsNonPrintableAsciiCharacter),
text.end());
436 : fSelectedDrawable(0),
440 fForegroundProcess(false),
442 fDisplayShapeChanged(true)
445 "TGCocoa, gSystem is eihter null or has a wrong type");
456 CGDisplayRegisterReconfigurationCallback (DisplayReconfigurationCallback, 0);
462 fSelectedDrawable(0),
466 fForegroundProcess(false),
468 fDisplayShapeChanged(true)
471 "TGCocoa, gSystem is eihter null or has a wrong type");
482 CGDisplayRegisterReconfigurationCallback (DisplayReconfigurationCallback, 0);
489 CGDisplayRemoveReconfigurationCallback (DisplayReconfigurationCallback, 0);
508 if (CGMainDisplayID() == kCGNullDirectDisplay)
561 return CGDisplayScreenSize(CGMainDisplayID()).width;
572 NSArray *
const screens = [NSScreen screens];
573 assert(screens != nil &&
"screens array is nil");
575 NSScreen *
const mainScreen = [screens objectAtIndex : 0];
576 assert(mainScreen != nil &&
"screen with index 0 is nil");
578 return NSBitsPerPixelFromDepth([mainScreen depth]);
587 assert(
gClient != 0 &&
"Update, gClient is null");
589 }
else if (
mode > 0) {
608 NSArray *
const screens = [NSScreen screens];
609 assert(screens != nil && screens.count != 0 &&
"GetDisplayGeometry, no screens found");
611 NSRect frame = [(NSScreen *)[screens objectAtIndex : 0] frame];
612 CGFloat xMin = frame.origin.x, xMax = xMin + frame.size.width;
613 CGFloat yMin = frame.origin.y, yMax = yMin + frame.size.height;
615 for (NSUInteger i = 1,
e = screens.count; i <
e; ++i) {
616 frame = [(NSScreen *)[screens objectAtIndex : i] frame];
617 xMin = std::min(xMin, frame.origin.x);
618 xMax = std::max(xMax, frame.origin.x + frame.size.width);
619 yMin = std::min(yMin, frame.origin.y);
620 yMax = std::max(yMax, frame.origin.y + frame.size.height);
634#pragma mark - Window management part.
640 return fPimpl->GetRootWindowID();
656 assert(parentID != 0 &&
"InitWindow, parameter 'parentID' is 0");
660 if (
fPimpl->IsRootWindow(parentID))
663 [
fPimpl->GetWindow(parentID) getAttributes : &
attr];
665 return CreateWindow(parentID, 0, 0,
attr.fWidth,
attr.fHeight, 0,
attr.fDepth,
attr.fClass, 0, 0, 0);
689 "ClearWindow, fSelectedDrawable is invalid");
692 if (drawable.fIsPixmap) {
698 assert(pixmapCtx != 0 &&
"ClearWindow, pixmap's context is null");
703 CGContextClearRect(pixmapCtx, CGRectMake(0, 0, drawable.fWidth, drawable.fHeight));
720 if (windowID < 0 || fPimpl->IsRootWindow(windowID)) {
734 h = drawable.fHeight;
736 if (!drawable.fIsPixmap) {
738 NSPoint srcPoint = {};
741 NSView<X11Window> *
const view = window.fContentView.fParentView ? window.fContentView.fParentView : window.fContentView;
758 assert(!
fPimpl->IsRootWindow(windowID) &&
"MoveWindow, called for root window");
763 [
fPimpl->GetWindow(windowID) setX :
x Y :
y];
783 assert(!
fPimpl->IsRootWindow(windowID) &&
784 "ResizeWindow, parameter 'windowID' is a root window's id");
789 if (window.fBackBuffer) {
809 "UpdateWindow, fSelectedDrawable is not a valid window id");
818 assert([window.fContentView isKindOfClass : [
QuartzView class]] &&
"UpdateWindow, content view is not a QuartzView");
821 if (dstView.fIsOverlapped)
824 if (dstView.fContext) {
826 const X11::Rectangle copyArea(0, 0, pixmap.fWidth, pixmap.fHeight);
827 [dstView copy : pixmap area : copyArea withMask : nil clipOrigin :
X11::Point() toPoint :
X11::Point()];
830 fPimpl->fX11CommandBuffer.AddUpdateWindow(dstView);
876 if (
fPimpl->IsRootWindow(parentID)) {
879 depth, clss, visual,
attr, wtype);
885 [newWindow setAcceptsMouseMovedEvents : YES];
891 assert([parentWin.fContentView isKindOfClass : [
QuartzView class]] &&
892 "CreateWindow, parent view must be QuartzView");
896 x,
y,
w,
h, border, depth, clss, visual,
attr, wtype);
900 [parentWin addChild : childView];
930 BOOL needFocusChange = NO;
935 fPimpl->fX11EventTranslator.CheckUnmappedView(
wid);
937 assert(
fPimpl->GetDrawable(
wid).fIsPixmap == NO &&
938 "DestroyWindow, can not be called for QuartzPixmap or QuartzImage object");
941 if (
fPimpl->fX11CommandBuffer.BufferSize())
942 fPimpl->fX11CommandBuffer.RemoveOperationsForDrawable(
wid);
945 if ((needFocusChange = window == window.fQuartzWindow && window.fQuartzWindow.fHasFocus))
946 window.fHasFocus = NO;
950 fPimpl->fX11EventTranslator.GenerateDestroyNotify(
wid);
981 assert(
fPimpl->GetDrawable(
wid).fIsPixmap == NO &&
982 "DestroySubwindows, can not be called for QuartzPixmap or QuartzImage object");
1019 assert(!
fPimpl->IsRootWindow(
wid) &&
"ChangeWindowAttributes, called for root window");
1020 assert(
attr != 0 &&
"ChangeWindowAttributes, parameter 'attr' is null");
1037 if (windowID <= fPimpl->GetRootWindowID())
1042 window.fEventMask = eventMask;
1051 assert(!
fPimpl->IsRootWindow(
wid) &&
"ReparentChild, can not re-parent root window");
1056 if (
fPimpl->IsRootWindow(pid)) {
1059 [view removeFromSuperview];
1060 view.fParentView = nil;
1062 NSRect frame = view.frame;
1063 frame.origin = NSPoint();
1065 NSUInteger styleMask = kClosableWindowMask | kMiniaturizableWindowMask | kResizableWindowMask;
1066 if (!view.fOverrideRedirect)
1067 styleMask |= kTitledWindowMask;
1070 styleMask : styleMask
1071 backing : NSBackingStoreBuffered
1073 [view setX :
x Y :
y];
1074 [newTopLevel addChild : view];
1076 fPimpl->ReplaceDrawable(
wid, newTopLevel);
1079 [newTopLevel release];
1082 [view removeFromSuperview];
1085 assert(newParent.fIsPixmap == NO &&
"ReparentChild, pixmap can not be a new parent");
1086 [view setX :
x Y :
y];
1087 [newParent addChild : view];
1098 if (
fPimpl->IsRootWindow(pid))
1105 [contentView retain];
1106 [contentView removeFromSuperview];
1107 [topLevel setContentView : nil];
1108 fPimpl->ReplaceDrawable(
wid, contentView);
1109 [contentView setX :
x Y :
y];
1110 [
fPimpl->GetWindow(pid) addChild : contentView];
1111 [contentView release];
1122 assert(!
fPimpl->IsRootWindow(
wid) &&
"ReparentWindow, can not re-parent root window");
1125 if (view.fParentView)
1138 assert(!
fPimpl->IsRootWindow(
wid) &&
"MapWindow, called for root window");
1158 assert(!
fPimpl->IsRootWindow(
wid) &&
"MapSubwindows, called for 'root' window");
1173 assert(!
fPimpl->IsRootWindow(
wid) &&
"MapRaised, called for root window");
1194 assert(!
fPimpl->IsRootWindow(
wid) &&
"UnmapWindow, called for root window");
1199 fPimpl->fX11EventTranslator.CheckUnmappedView(
wid);
1204 if (
win ==
win.fQuartzWindow &&
win.fQuartzWindow.fHasFocus)
1226 assert(!
fPimpl->IsRootWindow(
wid) &&
"RaiseWindow, called for root window");
1228 if (!
fPimpl->GetWindow(
wid).fParentView)
1243 assert(!
fPimpl->IsRootWindow(
wid) &&
"LowerWindow, called for root window");
1245 if (!
fPimpl->GetWindow(
wid).fParentView)
1264 assert(!
fPimpl->IsRootWindow(
wid) &&
"MoveWindow, called for root window");
1283 assert(!
fPimpl->IsRootWindow(
wid) &&
"MoveResizeWindow, called for 'root' window");
1295 assert(!
fPimpl->IsRootWindow(
wid) &&
"ResizeWindow, called for 'root' window");
1300 const UInt_t siMax = std::numeric_limits<Int_t>::max();
1301 if (
w > siMax ||
h > siMax)
1304 NSSize newSize = {};
1308 [
fPimpl->GetWindow(
wid) setDrawableSize : newSize];
1318 assert(!
fPimpl->IsRootWindow(
wid) &&
"IconifyWindow, can not iconify the root window");
1319 assert(
fPimpl->GetWindow(
wid).fIsPixmap == NO &&
"IconifyWindow, invalid window id");
1322 assert(
win.fQuartzWindow ==
win &&
"IconifyWindow, can be called only for a top level window");
1324 fPimpl->fX11EventTranslator.CheckUnmappedView(
wid);
1327 if (
fPimpl->fX11CommandBuffer.BufferSize())
1328 fPimpl->fX11CommandBuffer.RemoveOperationsForDrawable(
wid);
1330 if (window.fQuartzWindow.fHasFocus) {
1332 window.fQuartzWindow.fHasFocus = NO;
1335 [
win.fQuartzWindow miniaturize :
win.fQuartzWindow];
1350 if (!srcWin || !dstWin)
1353 const bool srcIsRoot =
fPimpl->IsRootWindow(srcWin);
1354 const bool dstIsRoot =
fPimpl->IsRootWindow(dstWin);
1356 if (srcIsRoot && dstIsRoot) {
1368 NSPoint srcPoint = {};
1372 NSPoint dstPoint = {};
1378 }
else if (srcIsRoot) {
1382 if ([dstView superview]) {
1386 dstPoint = [[dstView superview] convertPoint : dstPoint fromView : dstView];
1388 if (view != dstView && view.fMapState ==
kIsViewable)
1397 if ([dstView superview]) {
1401 const NSPoint
pt = [[dstView superview] convertPoint : dstPoint fromView : dstView];
1403 if (view != dstView && view.fMapState ==
kIsViewable)
1436 if (!window.fIsPixmap) {
1456 assert(!
fPimpl->IsRootWindow(
wid) &&
"SetWindowBackground, can not set color for root window");
1458 fPimpl->GetWindow(
wid).fBackgroundPixel = color;
1471 assert(!
fPimpl->IsRootWindow(windowID) &&
1472 "SetWindowBackgroundPixmap, can not set background for a root window");
1473 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
1474 "SetWindowBackgroundPixmap, invalid window id");
1477 if (pixmapID ==
kNone) {
1478 window.fBackgroundPixmap = nil;
1482 assert(pixmapID >
fPimpl->GetRootWindowID() &&
1483 "SetWindowBackgroundPixmap, parameter 'pixmapID' is not a valid pixmap id");
1484 assert(
fPimpl->GetDrawable(pixmapID).fIsPixmap == YES &&
1485 "SetWindowBackgroundPixmap, bad drawable");
1492 if ([pixmapOrImage isKindOfClass : [
QuartzPixmap class]]) {
1494 if (backgroundImage.
Get())
1495 window.fBackgroundPixmap = backgroundImage.
Get();
1498 if (backgroundImage.
Get())
1499 window.fBackgroundPixmap = backgroundImage.
Get();
1502 if (!backgroundImage.
Get())
1504 Error(
"SetWindowBackgroundPixmap",
"QuartzImage initialization failed");
1513 if (windowID <= fPimpl->GetRootWindowID())
1517 return view.fParentView ? view.fParentView.fID :
fPimpl->GetRootWindowID();
1531 NSString *
const windowTitle = [NSString stringWithCString :
name encoding : NSASCIIStringEncoding];
1532 [(
NSWindow *)drawable setTitle : windowTitle];
1562 assert(!
fPimpl->IsRootWindow(windowID) &&
1563 "ShapeCombineMask, windowID parameter is a 'root' window");
1564 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
1565 "ShapeCombineMask, windowID parameter is a bad window id");
1567 "ShapeCombineMask, pixmapID parameter must point to QuartzImage object");
1569 if (
fPimpl->GetWindow(windowID).fContentView.fParentView)
1573 assert(srcImage.
fIsStippleMask == YES &&
"ShapeCombineMask, source image is not a stipple mask");
1581 [qw setOpaque : NO];
1582 [qw setBackgroundColor : [NSColor clearColor]];
1586#pragma mark - "Window manager hints" set of functions.
1594 assert(!
fPimpl->IsRootWindow(
wid) &&
"SetMWMHints, called for 'root' window");
1597 NSUInteger newMask = 0;
1599 if ([qw styleMask] & kTitledWindowMask) {
1600 newMask |= kTitledWindowMask;
1601 newMask |= kClosableWindowMask;
1605 newMask |= kMiniaturizableWindowMask | kResizableWindowMask;
1608 newMask |= kMiniaturizableWindowMask;
1610 newMask |= kResizableWindowMask;
1613 [qw setStyleMask : newMask];
1617 [[qw standardWindowButton : NSWindowZoomButton] setEnabled : YES];
1618 [[qw standardWindowButton : NSWindowMiniaturizeButton] setEnabled : YES];
1645 assert(!
fPimpl->IsRootWindow(
wid) &&
"SetWMSizeHints, called for root window");
1647 const NSUInteger styleMask = kTitledWindowMask | kClosableWindowMask | kMiniaturizableWindowMask | kResizableWindowMask;
1648 const NSRect minRect = [
NSWindow frameRectForContentRect : NSMakeRect(0., 0., wMin, hMin) styleMask : styleMask];
1649 const NSRect maxRect = [
NSWindow frameRectForContentRect : NSMakeRect(0., 0., wMax, hMax) styleMask : styleMask];
1652 [qw setMinSize : minRect.size];
1653 [qw setMaxSize : maxRect.size];
1674 assert(
wid >
fPimpl->GetRootWindowID() &&
"SetWMTransientHint, wid parameter is not a valid window id");
1676 if (
fPimpl->IsRootWindow(mainWid))
1681 if (![mainWindow isVisible])
1686 if (mainWindow != transientWindow) {
1689 Error(
"SetWMTransientHint",
"window is already transient for other window");
1691 [[transientWindow standardWindowButton : NSWindowZoomButton] setEnabled : NO];
1692 [mainWindow addTransientWindow : transientWindow];
1695 Warning(
"SetWMTransientHint",
"transient and main windows are the same window");
1698#pragma mark - GUI-rendering part.
1704 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawLineAux, called for root window");
1708 assert(ctx != 0 &&
"DrawLineAux, context is null");
1721 CGContextSetAllowsAntialiasing(ctx,
false);
1723 if (!drawable.fIsPixmap)
1724 CGContextTranslateCTM(ctx, 0.5, 0.5);
1731 SetStrokeParametersFromX11Context(ctx, gcVals);
1732 CGContextBeginPath(ctx);
1733 CGContextMoveToPoint(ctx,
x1,
y1);
1734 CGContextAddLineToPoint(ctx,
x2,
y2);
1735 CGContextStrokePath(ctx);
1737 CGContextSetAllowsAntialiasing(ctx,
true);
1752 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawLine, called for root window");
1753 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"DrawLine, invalid context index");
1758 if (!drawable.fIsPixmap) {
1761 const ViewFixer fixer(view,
wid);
1780 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawSegmentsAux, called for root window");
1781 assert(segments != 0 &&
"DrawSegmentsAux, segments parameter is null");
1782 assert(nSegments > 0 &&
"DrawSegmentsAux, nSegments <= 0");
1784 for (
Int_t i = 0; i < nSegments; ++i)
1785 DrawLineAux(
wid, gcVals, segments[i].fX1, segments[i].fY1 - 3, segments[i].fX2, segments[i].fY2 - 3);
1797 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawSegments, called for root window");
1798 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"DrawSegments, invalid context index");
1799 assert(segments != 0 &&
"DrawSegments, parameter 'segments' is null");
1800 assert(nSegments > 0 &&
"DrawSegments, number of segments <= 0");
1805 if (!drawable.fIsPixmap) {
1807 const ViewFixer fixer(view,
wid);
1811 fPimpl->fX11CommandBuffer.AddDrawSegments(
wid, gcVals, segments, nSegments);
1817 fPimpl->fX11CommandBuffer.AddDrawSegments(
wid, gcVals, segments, nSegments);
1827 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawRectangleAux, called for root window");
1831 if (!drawable.fIsPixmap) {
1844 assert(ctx &&
"DrawRectangleAux, context is null");
1847 CGContextSetAllowsAntialiasing(ctx,
false);
1849 SetStrokeParametersFromX11Context(ctx, gcVals);
1851 const CGRect
rect = CGRectMake(
x,
y,
w,
h);
1852 CGContextStrokeRect(ctx,
rect);
1854 CGContextSetAllowsAntialiasing(ctx,
true);
1866 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawRectangle, called for root window");
1867 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"DrawRectangle, invalid context index");
1873 if (!drawable.fIsPixmap) {
1876 const ViewFixer fixer(view,
wid);
1880 fPimpl->fX11CommandBuffer.AddDrawRectangle(
wid, gcVals,
x,
y,
w,
h);
1886 fPimpl->fX11CommandBuffer.AddDrawRectangle(
wid, gcVals,
x,
y,
w,
h);
1902 assert(!
fPimpl->IsRootWindow(
wid) &&
"FillRectangleAux, called for root window");
1906 CGSize patternPhase = {};
1908 if (drawable.fIsPixmap) {
1913 const CGRect fillRect = CGRectMake(
x,
y,
w,
h);
1915 if (!drawable.fIsPixmap) {
1918 const NSPoint origin = [view.
fParentView convertPoint : view.frame.origin toView : nil];
1919 patternPhase.width = origin.x;
1920 patternPhase.height = origin.y;
1926 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals) || HasFillTiledStyle(gcVals)) {
1927 std::unique_ptr<PatternContext> patternContext(
new PatternContext(gcVals.
fMask, gcVals.
fFillStyle,
1928 0, 0, nil, patternPhase));
1929 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals)) {
1931 "FillRectangleAux, fill_style is FillStippled/FillOpaqueStippled,"
1932 " but no stipple is set in a context");
1937 if (HasFillOpaqueStippledStyle(gcVals))
1941 "FillRectangleAux, fill_style is FillTiled, but not tile is set in a context");
1943 patternContext->SetImage(
fPimpl->GetDrawable(gcVals.
fTile));
1946 SetFillPattern(ctx, patternContext.get());
1947 patternContext.release();
1948 CGContextFillRect(ctx, fillRect);
1953 SetFilledAreaColorFromX11Context(ctx, gcVals);
1954 CGContextFillRect(ctx, fillRect);
1967 assert(!
fPimpl->IsRootWindow(
wid) &&
"FillRectangle, called for root window");
1968 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"FillRectangle, invalid context index");
1973 if (!drawable.fIsPixmap) {
1976 const ViewFixer fixer(view,
wid);
1979 fPimpl->fX11CommandBuffer.AddFillRectangle(
wid, gcVals,
x,
y,
w,
h);
1996 assert(!
fPimpl->IsRootWindow(
wid) &&
"FillPolygonAux, called for root window");
1997 assert(polygon != 0 &&
"FillPolygonAux, parameter 'polygon' is null");
1998 assert(nPoints > 0 &&
"FillPolygonAux, number of points must be positive");
2003 CGSize patternPhase = {};
2005 if (!drawable.fIsPixmap) {
2007 const NSPoint origin = [view convertPoint : view.frame.origin toView : nil];
2008 patternPhase.width = origin.x;
2009 patternPhase.height = origin.y;
2014 CGContextSetAllowsAntialiasing(ctx,
false);
2016 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals) || HasFillTiledStyle(gcVals)) {
2017 std::unique_ptr<PatternContext> patternContext(
new PatternContext(gcVals.
fMask, gcVals.
fFillStyle, 0, 0, nil, patternPhase));
2019 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals)) {
2021 "FillRectangleAux, fill style is FillStippled/FillOpaqueStippled,"
2022 " but no stipple is set in a context");
2027 if (HasFillOpaqueStippledStyle(gcVals))
2031 "FillRectangleAux, fill_style is FillTiled, but not tile is set in a context");
2033 patternContext->SetImage(
fPimpl->GetDrawable(gcVals.
fTile));
2036 SetFillPattern(ctx, patternContext.get());
2037 patternContext.release();
2039 SetFilledAreaColorFromX11Context(ctx, gcVals);
2044 CGContextBeginPath(ctx);
2045 if (!drawable.fIsPixmap) {
2046 CGContextMoveToPoint(ctx, polygon[0].fX, polygon[0].fY - 2);
2047 for (
Int_t i = 1; i < nPoints; ++i)
2048 CGContextAddLineToPoint(ctx, polygon[i].fX, polygon[i].fY - 2);
2051 for (
Int_t i = 1; i < nPoints; ++i)
2055 CGContextFillPath(ctx);
2056 CGContextSetAllowsAntialiasing(ctx,
true);
2079 assert(polygon != 0 &&
"FillPolygon, parameter 'polygon' is null");
2080 assert(nPoints > 0 &&
"FillPolygon, number of points must be positive");
2081 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"FillPolygon, invalid context index");
2086 if (!drawable.fIsPixmap) {
2088 const ViewFixer fixer(view,
wid);
2092 fPimpl->fX11CommandBuffer.AddFillPolygon(
wid, gcVals, polygon, nPoints);
2098 fPimpl->fX11CommandBuffer.AddFillPolygon(
wid, gcVals, polygon, nPoints);
2112 assert(!
fPimpl->IsRootWindow(
src) &&
"CopyAreaAux, src parameter is root window");
2113 assert(!
fPimpl->IsRootWindow(dst) &&
"CopyAreaAux, dst parameter is root window");
2128 "CopyArea, mask is not a pixmap");
2138 [dstDrawable copy : srcDrawable area : copyArea withMask :
mask clipOrigin : clipOrigin toPoint : dstPoint];
2148 assert(!
fPimpl->IsRootWindow(
src) &&
"CopyArea, src parameter is root window");
2149 assert(!
fPimpl->IsRootWindow(dst) &&
"CopyArea, dst parameter is root window");
2150 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"CopyArea, invalid context index");
2155 if (!drawable.fIsPixmap) {
2157 const ViewFixer fixer(view, dst);
2161 fPimpl->fX11CommandBuffer.AddCopyArea(
src, dst, gcVals, srcX, srcY,
width,
height, dstX, dstY);
2166 if (
fPimpl->GetDrawable(
src).fIsPixmap) {
2171 fPimpl->fX11CommandBuffer.AddCopyArea(
src, dst, gcVals, srcX, srcY,
width,
height, dstX, dstY);
2182 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawStringAux, called for root window");
2186 assert(ctx != 0 &&
"DrawStringAux, context is null");
2190 CGContextSetTextMatrix(ctx, CGAffineTransformIdentity);
2193 if (!drawable.fIsPixmap) {
2194 CGContextTranslateCTM(ctx, 0., drawable.fHeight);
2195 CGContextScaleCTM(ctx, 1., -1.);
2199 CGContextSetAllowsAntialiasing(ctx,
true);
2201 assert(gcVals.
fMask &
kGCFont &&
"DrawString, font is not set in a context");
2206 CGFloat textColor[4] = {0., 0., 0., 1.};
2211 CGContextSetRGBFillColor(ctx, textColor[0], textColor[1], textColor[2], textColor[3]);
2216 std::vector<UniChar> unichars((
unsigned char *)
text, (
unsigned char *)
text +
len);
2229 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawString, called for root window");
2230 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"DrawString, invalid context index");
2234 assert(gcVals.
fMask &
kGCFont &&
"DrawString, font is not set in a context");
2236 if (!drawable.fIsPixmap) {
2238 const ViewFixer fixer(view,
wid);
2258 assert(!
fPimpl->IsRootWindow(windowID) &&
"ClearAreaAux, called for root window");
2261 assert(view.
fContext != 0 &&
"ClearAreaAux, view.fContext is null");
2271 CGFloat rgb[3] = {};
2275 CGContextSetRGBFillColor(view.
fContext, rgb[0], rgb[1], rgb[2], 1.);
2276 CGContextFillRect(view.
fContext, CGRectMake(
x,
y,
w,
h));
2278 const CGRect fillRect = CGRectMake(
x,
y,
w,
h);
2280 CGSize patternPhase = {};
2282 const NSPoint origin = [view.
fParentView convertPoint : view.frame.origin toView : nil];
2283 patternPhase.width = origin.x;
2284 patternPhase.height = origin.y;
2288 std::unique_ptr<PatternContext> patternContext(
new PatternContext({}, 0, 0, 0, view.
fBackgroundPixmap, patternPhase));
2289 SetFillPattern(view.
fContext, patternContext.get());
2290 patternContext.release();
2291 CGContextFillRect(view.
fContext, fillRect);
2305 assert(!
fPimpl->IsRootWindow(
wid) &&
"ClearArea, called for root window");
2309 if (ParentRendersToChild(view))
2332#pragma mark - Pixmap management.
2338 NSSize newSize = {};
2343 scaleFactor : [[NSScreen mainScreen] backingScaleFactor]]);
2345 pixmap.
Get().fID =
fPimpl->RegisterDrawable(pixmap.
Get());
2349 Error(
"OpenPixmap",
"QuartzPixmap initialization failed");
2357 assert(!
fPimpl->IsRootWindow(
wid) &&
"ResizePixmap, called for root window");
2360 assert(drawable.fIsPixmap == YES &&
"ResizePixmap, invalid drawable");
2366 if ([pixmap resizeW :
w H :
h scaleFactor : [[NSScreen mainScreen] backingScaleFactor]])
2375 assert(pixmapID > (
Int_t)
fPimpl->GetRootWindowID() &&
2376 "SelectPixmap, parameter 'pixmapID' is not a valid id");
2384 assert(pixmapID > (
Int_t)
fPimpl->GetRootWindowID() &&
2385 "CopyPixmap, parameter 'pixmapID' is not a valid id");
2387 "CopyPixmap, fSelectedDrawable is not a valid window id");
2390 assert([source isKindOfClass : [
QuartzPixmap class]] &&
2391 "CopyPixmap, source is not a pixmap");
2397 if (drawable.fIsPixmap) {
2398 destination = drawable;
2401 if (window.fBackBuffer) {
2402 destination = window.fBackBuffer;
2404 Warning(
"CopyPixmap",
"Operation skipped, since destination"
2405 " window is not double buffered");
2410 const X11::Rectangle copyArea(0, 0, pixmap.fWidth, pixmap.fHeight);
2413 [destination copy : pixmap area : copyArea withMask : nil clipOrigin :
X11::Point() toPoint : dstPoint];
2421 assert(
fPimpl->GetDrawable(
fSelectedDrawable).fIsPixmap == YES &&
"ClosePixmap, selected drawable is not a pixmap");
2427#pragma mark - Different functions to create pixmap from different data sources. Used by GUI.
2428#pragma mark - These functions implement TVirtualX interface, some of them dupilcate others.
2444 assert(
bitmap != 0 &&
"CreatePixmap, parameter 'bitmap' is null");
2445 assert(
width > 0 &&
"CreatePixmap, parameter 'width' is 0");
2446 assert(
height > 0 &&
"CreatePixmap, parameter 'height' is 0");
2451 backgroundPixel, depth, &imageData[0]);
2462 Error(
"CreatePixmap",
"QuartzImage initialization failed");
2466 image.
Get().fID =
fPimpl->RegisterDrawable(image.
Get());
2467 return image.
Get().fID;
2474 assert(bits != 0 &&
"CreatePixmapFromData, data parameter is null");
2475 assert(
width != 0 &&
"CreatePixmapFromData, width parameter is 0");
2476 assert(
height != 0 &&
"CreatePixmapFromData, height parameter is 0");
2480 std::vector<unsigned char> imageData(bits, bits +
width *
height * 4);
2483 unsigned char *
p = &imageData[0];
2485 std::swap(
p[0],
p[2]);
2493 Error(
"CreatePixmapFromData",
"QuartzImage initialziation failed");
2497 image.
Get().fID =
fPimpl->RegisterDrawable(image.
Get());
2498 return image.
Get().fID;
2505 assert(std::numeric_limits<unsigned char>::digits == 8 &&
"CreateBitmap, ASImage requires octets");
2513 std::vector<unsigned char> imageData(
width *
height);
2516 for (
unsigned i = 0, j = 0,
e =
width / 8 *
height; i <
e; ++i) {
2517 for(
unsigned bit = 0; bit < 8; ++bit, ++j) {
2518 if (
bitmap[i] & (1 << bit))
2527 H :
height bitmapMask : &imageData[0]]);
2530 Error(
"CreateBitmap",
"QuartzImage initialization failed");
2534 image.
Get().fID =
fPimpl->RegisterDrawable(image.
Get());
2535 return image.
Get().fID;
2541 fPimpl->DeleteDrawable(pixmapID);
2548 assert(
fPimpl->GetDrawable(pixmapID).fIsPixmap == YES &&
"DeletePixmap, object is not a pixmap");
2549 fPimpl->fX11CommandBuffer.AddDeletePixmap(pixmapID);
2566 Warning(
"GetColorBits",
"Called for root window");
2568 assert(
x >= 0 &&
"GetColorBits, parameter 'x' is negative");
2569 assert(
y >= 0 &&
"GetColorBits, parameter 'y' is negative");
2570 assert(
w != 0 &&
"GetColorBits, parameter 'w' is 0");
2571 assert(
h != 0 &&
"GetColorBits, parameter 'h' is 0");
2574 return [
fPimpl->GetDrawable(
wid) readColorBits : area];
2580#pragma mark - XImage emulation.
2596 assert(
wid >
fPimpl->GetRootWindowID() &&
"GetImageSize, parameter 'wid' is invalid");
2599 width = drawable.fWidth;
2600 height = drawable.fHeight;
2614 "PutPixel, parameter 'imageID' is a bad pixmap id");
2615 assert(
x >= 0 &&
"PutPixel, parameter 'x' is negative");
2616 assert(
y >= 0 &&
"PutPixel, parameter 'y' is negative");
2620 unsigned char rgb[3] = {};
2622 [pixmap putPixel : rgb
X :
x Y :
y];
2641 "DeleteImage, imageID parameter is not a valid image id");
2645#pragma mark - Mouse related code.
2663 assert(!
fPimpl->IsRootWindow(
wid) &&
"GrabButton, called for 'root' window");
2668 widget.fPassiveGrabOwnerEvents = YES;
2669 widget.fPassiveGrabButton =
button;
2670 widget.fPassiveGrabEventMask = eventMask;
2671 widget.fPassiveGrabKeyModifiers = keyModifiers;
2674 widget.fPassiveGrabOwnerEvents = NO;
2675 widget.fPassiveGrabButton = -1;
2676 widget.fPassiveGrabEventMask = 0;
2677 widget.fPassiveGrabKeyModifiers = 0;
2691 assert(!
fPimpl->IsRootWindow(
wid) &&
"GrabPointer, called for 'root' window");
2694 fPimpl->fX11EventTranslator.SetPointerGrab(view, eventMask, ownerEvents);
2698 fPimpl->fX11EventTranslator.CancelPointerGrab();
2749 assert(!
fPimpl->IsRootWindow(
wid) &&
"GrabKey, called for root window");
2755 [view addPassiveKeyGrab : keyCode modifiers : cocoaKeyModifiers];
2757 [view removePassiveKeyGrab : keyCode modifiers : cocoaKeyModifiers];
2776 return fPimpl->fX11EventTranslator.GetInputFocus();
2783 assert(!
fPimpl->IsRootWindow(
wid) &&
"SetInputFocus, called for root window");
2786 fPimpl->fX11EventTranslator.SetInputFocus(nil);
2788 fPimpl->fX11EventTranslator.SetInputFocus(
fPimpl->GetWindow(
wid).fContentView);
2804 assert(buf != 0 &&
"LookupString, parameter 'buf' is null");
2805 assert(
length >= 2 &&
"LookupString, parameter 'length' - not enough memory to return null-terminated ASCII string");
2810#pragma mark - Font management.
2817 assert(fontName != 0 &&
"LoadQueryFont, fontName is null");
2820 if (ParseXLFDName(fontName, xlfd)) {
2826 return fPimpl->fFontManager.LoadFont(xlfd);
2841 fPimpl->fFontManager.UnloadFont(
fs);
2856 return fPimpl->fFontManager.GetTextWidth(font, s,
len);
2863 fPimpl->fFontManager.GetFontProperties(font, maxAscent, maxDescent);
2890 if (fontName && fontName[0]) {
2893 return fPimpl->fFontManager.ListFonts(xlfd, maxNames, count);
2906 fPimpl->fFontManager.FreeFontNames(fontList);
2909#pragma mark - Color management.
2917 return fPimpl->fX11ColorParser.ParseColor(colorName, color);
2923 const unsigned red = unsigned(
double(color.
fRed) / 0xFFFF * 0xFF);
2924 const unsigned green = unsigned(
double(color.
fGreen) / 0xFFFF * 0xFF);
2925 const unsigned blue = unsigned(
double(color.
fBlue) / 0xFFFF * 0xFF);
2926 color.
fPixel = red << 16 | green << 8 | blue;
2934 color.
fRed = (color.
fPixel >> 16 & 0xFF) * 0xFFFF / 0xFF;
2935 color.
fGreen = (color.
fPixel >> 8 & 0xFF) * 0xFFFF / 0xFF;
2936 color.
fBlue = (color.
fPixel & 0xFF) * 0xFFFF / 0xFF;
2950 Float_t red = 0.f, green = 0.f, blue = 0.f;
2951 color->GetRGB(red, green, blue);
2952 pixel = unsigned(red * 255) << 16;
2953 pixel |= unsigned(green * 255) << 8;
2954 pixel |= unsigned(blue * 255);
2988#pragma mark - Graphical context management.
3008 assert(
gc <=
fX11Contexts.size() &&
gc > 0 &&
"ChangeGC, invalid context id");
3019 assert(
gc <=
fX11Contexts.size() &&
gc > 0 &&
"ChangeGC, invalid context id");
3020 assert(
gval != 0 &&
"ChangeGC, gval parameter is null");
3074 const unsigned nDashes =
sizeof x11Context.
fDashes /
sizeof x11Context.
fDashes[0];
3075 for (
unsigned i = 0; i < nDashes; ++i)
3085 assert(dst <=
fX11Contexts.size() && dst > 0 &&
"CopyGC, bad destination context");
3108#pragma mark - Cursor management.
3130 assert(!
fPimpl->IsRootWindow(
wid) &&
"SetCursor, called for root window");
3133 view.fCurrentCursor =
cursor;
3153 const NSPoint screenPoint = [
NSEvent mouseLocation];
3169 rootWinID =
fPimpl->GetRootWindowID();
3171 NSPoint screenPoint = [
NSEvent mouseLocation];
3174 rootX = screenPoint.x;
3175 rootY = screenPoint.y;
3178 if (winID >
fPimpl->GetRootWindowID()) {
3184 winX = screenPoint.x;
3185 winY = screenPoint.y;
3190 childWinID = childWin.fID;
3198#pragma mark - OpenGL management.
3206 return [[NSScreen mainScreen] backingScaleFactor];
3211 const std::vector<std::pair<UInt_t, Int_t> > &formatComponents)
3215 typedef std::pair<UInt_t, Int_t> component_type;
3216 typedef std::vector<component_type>::size_type size_type;
3219 std::vector<NSOpenGLPixelFormatAttribute> attribs;
3220 for (size_type i = 0,
e = formatComponents.size(); i <
e; ++i) {
3221 const component_type &comp = formatComponents[i];
3224 attribs.push_back(NSOpenGLPFADoubleBuffer);
3226 attribs.push_back(NSOpenGLPFADepthSize);
3227 attribs.push_back(comp.second > 0 ? comp.second : 32);
3229 attribs.push_back(NSOpenGLPFAAccumSize);
3230 attribs.push_back(comp.second > 0 ? comp.second : 1);
3232 attribs.push_back(NSOpenGLPFAStencilSize);
3233 attribs.push_back(comp.second > 0 ? comp.second : 8);
3235 attribs.push_back(NSOpenGLPFAMultisample);
3236 attribs.push_back(NSOpenGLPFASampleBuffers);
3237 attribs.push_back(1);
3238 attribs.push_back(NSOpenGLPFASamples);
3239 attribs.push_back(comp.second ? comp.second : 8);
3243 attribs.push_back(0);
3245 NSOpenGLPixelFormat *
const pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes : &attribs[0]];
3249 if (!
fPimpl->IsRootWindow(parentID)) {
3250 parentView =
fPimpl->GetWindow(parentID).fContentView;
3251 assert([parentView isKindOfClass : [
QuartzView class]] &&
3252 "CreateOpenGLWindow, parent view must be QuartzView");
3255 NSRect viewFrame = {};
3256 viewFrame.size.width =
width;
3257 viewFrame.size.height =
height;
3265 [parentView addChild : glView];
3266 glID =
fPimpl->RegisterDrawable(glView);
3276 Error(
"CreateOpenGLWindow",
"QuartzWindow allocation/initialization"
3277 " failed for a top-level GL widget");
3281 glID =
fPimpl->RegisterDrawable(parent);
3291 assert(!
fPimpl->IsRootWindow(windowID) &&
3292 "CreateOpenGLContext, parameter 'windowID' is a root window");
3294 "CreateOpenGLContext, view is not an OpenGL view");
3296 NSOpenGLContext *
const sharedContext =
fPimpl->GetGLContextForHandle(sharedID);
3300 newContext([[NSOpenGLContext alloc] initWithFormat : glView.
pixelFormat shareContext : sharedContext]);
3318 assert(ctxID > 0 &&
"MakeOpenGLContextCurrent, invalid context id");
3320 NSOpenGLContext *
const glContext =
fPimpl->GetGLContextForHandle(ctxID);
3322 Error(
"MakeOpenGLContextCurrent",
"No OpenGL context found for id %d",
int(ctxID));
3330 if ([glContext view] != glView)
3331 [glContext setView : glView];
3339 [glContext makeCurrentContext];
3357 const UInt_t width = std::max(glView.frame.size.width, CGFloat(100));
3358 const UInt_t height = std::max(glView.frame.size.height, CGFloat(100));
3360 NSRect viewFrame = {};
3361 viewFrame.size.width =
width;
3362 viewFrame.size.height =
height;
3364 const NSUInteger styleMask = kTitledWindowMask | kClosableWindowMask |
3365 kMiniaturizableWindowMask | kResizableWindowMask;
3368 fakeWindow = [[
QuartzWindow alloc] initWithContentRect : viewFrame styleMask : styleMask
3369 backing : NSBackingStoreBuffered defer : NO windowAttributes : &
attr];
3373 [fakeView setHidden : NO];
3375 fPimpl->SetFakeGLWindow(fakeWindow);
3379 [fakeView setHidden : NO];
3383 [glContext setView : fakeView];
3384 [glContext makeCurrentContext];
3393 NSOpenGLContext *
const currentContext = [NSOpenGLContext currentContext];
3394 if (!currentContext) {
3395 Error(
"GetCurrentOpenGLContext",
"The current OpenGL context is null");
3399 const Handle_t contextID =
fPimpl->GetHandleForGLContext(currentContext);
3401 Error(
"GetCurrentOpenGLContext",
"The current OpenGL context was"
3402 " not created/registered by TGCocoa");
3410 assert(ctxID > 0 &&
"FlushOpenGLBuffer, invalid context id");
3412 NSOpenGLContext *
const glContext =
fPimpl->GetGLContextForHandle(ctxID);
3413 assert(glContext != nil &&
"FlushOpenGLBuffer, bad context id");
3415 if (glContext != [NSOpenGLContext currentContext])
3419 [glContext flushBuffer];
3428 NSOpenGLContext *
const glContext =
fPimpl->GetGLContextForHandle(ctxID);
3429 if (
NSView *
const v = [glContext view]) {
3433 [glContext clearDrawable];
3436 if (glContext == [NSOpenGLContext currentContext])
3437 [NSOpenGLContext clearCurrentContext];
3439 fPimpl->DeleteGLContext(ctxID);
3442#pragma mark - Off-screen rendering for TPad/TCanvas.
3448 assert(windowID > (
Int_t)
fPimpl->GetRootWindowID() &&
"SetDoubleBuffer called for root window");
3450 if (windowID == 999) {
3451 Warning(
"SetDoubleBuffer",
"called with wid == 999");
3472 "SetDoubleBufferON, called, but no correct window was selected before");
3476 if (!window)
return;
3478 assert(window.fIsPixmap == NO &&
3479 "SetDoubleBufferON, selected drawable is a pixmap, can not attach pixmap to pixmap");
3481 const unsigned currW = window.fWidth;
3482 const unsigned currH = window.fHeight;
3484 if (
QuartzPixmap *
const currentPixmap = window.fBackBuffer) {
3485 if (currH == currentPixmap.fHeight && currW == currentPixmap.fWidth)
3490 H : currH scaleFactor : [[NSScreen mainScreen] backingScaleFactor]]);
3492 window.fBackBuffer = pixmap.
Get();
3495 Error(
"SetDoubleBufferON",
"QuartzPixmap initialization failed");
3506 auto windows = NSApplication.sharedApplication.windows;
3507 for (
NSWindow *candidate : windows) {
3511 fPimpl->fX11CommandBuffer.ClearXOROperations();
3517#pragma mark - Event management part.
3531 fPimpl->fX11EventTranslator.fEventQueue.push_back(newEvent);
3537 assert(
fPimpl->fX11EventTranslator.fEventQueue.size() > 0 &&
"NextEvent, event queue is empty");
3539 event =
fPimpl->fX11EventTranslator.fEventQueue.front();
3540 fPimpl->fX11EventTranslator.fEventQueue.pop_front();
3546 return (
Int_t)
fPimpl->fX11EventTranslator.fEventQueue.size();
3553 typedef X11::EventQueue_t::iterator iterator_type;
3555 iterator_type it =
fPimpl->fX11EventTranslator.fEventQueue.begin();
3556 iterator_type eIt =
fPimpl->fX11EventTranslator.fEventQueue.end();
3558 for (; it != eIt; ++it) {
3559 const Event_t &queuedEvent = *it;
3561 event = queuedEvent;
3562 fPimpl->fX11EventTranslator.fEventQueue.erase(it);
3578#pragma mark - "Drag and drop", "Copy and paste", X11 properties.
3585 assert(
name != 0 &&
"InternAtom, parameter 'name' is null");
3602 assert(!
fPimpl->IsRootWindow(windowID) &&
3603 "SetPrimarySelectionOwner, windowID parameter is a 'root' window");
3604 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3605 "SetPrimarySelectionOwner, windowID parameter is not a valid window");
3607 const Atom_t primarySelectionAtom =
FindAtom(
"XA_PRIMARY",
false);
3608 assert(primarySelectionAtom !=
kNone &&
3609 "SetPrimarySelectionOwner, predefined XA_PRIMARY atom was not found");
3627 assert(!
fPimpl->IsRootWindow(windowID) &&
3628 "SetSelectionOwner, windowID parameter is a 'root' window'");
3629 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3630 "SetSelectionOwner, windowID parameter is not a valid window");
3645 const Atom_t primarySelectionAtom =
FindAtom(
"XA_PRIMARY",
false);
3646 assert(primarySelectionAtom !=
kNone &&
3647 "GetPrimarySelectionOwner, predefined XA_PRIMARY atom was not found");
3670 assert(!
fPimpl->IsRootWindow(windowID) &&
3671 "ConvertPrimarySelection, parameter 'windowID' is root window");
3672 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3673 "ConvertPrimarySelection, parameter windowID parameter is not a window id");
3676 assert(primarySelectionAtom !=
kNone &&
3677 "ConvertPrimarySelection, XA_PRIMARY predefined atom not found");
3680 assert(stringAtom !=
kNone &&
3681 "ConvertPrimarySelection, XA_STRING predefined atom not found");
3699 assert(!
fPimpl->IsRootWindow(windowID) &&
3700 "ConvertSelection, parameter 'windowID' is root window'");
3701 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3702 "ConvertSelection, parameter 'windowID' is not a window id");
3713 newEvent.
fUser[0] = windowID;
3714 newEvent.
fUser[1] = selection;
3724 ULong_t *bytesAfterReturn,
unsigned char **propertyReturn)
3733 if (
fPimpl->IsRootWindow(windowID))
3736 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3737 "GetProperty, parameter 'windowID' is not a valid window id");
3738 assert(propertyID > 0 && propertyID <=
fAtomToName.size() &&
3739 "GetProperty, parameter 'propertyID' is not a valid atom");
3740 assert(actualType != 0 &&
"GetProperty, parameter 'actualType' is null");
3741 assert(actualFormat != 0 &&
"GetProperty, parameter 'actualFormat' is null");
3742 assert(bytesAfterReturn != 0 &&
"GetProperty, parameter 'bytesAfterReturn' is null");
3743 assert(propertyReturn != 0 &&
"GetProperty, parameter 'propertyReturn' is null");
3747 *bytesAfterReturn = 0;
3748 *propertyReturn = 0;
3751 const std::string &atomName =
fAtomToName[propertyID - 1];
3754 if (![window hasProperty : atomName.c_str()]) {
3755 Error(
"GetProperty",
"Unknown property %s requested", atomName.c_str());
3759 unsigned tmpFormat = 0, tmpElements = 0;
3760 *propertyReturn = [window getProperty : atomName.c_str() returnType : actualType
3761 returnFormat : &tmpFormat nElements : &tmpElements];
3762 *actualFormat = (
Int_t)tmpFormat;
3763 *nItems = tmpElements;
3782 assert(!
fPimpl->IsRootWindow(windowID) &&
3783 "GetPasteBuffer, parameter 'windowID' is root window");
3784 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3785 "GetPasteBuffer, parameter 'windowID' is not a valid window");
3786 assert(propertyID && propertyID <=
fAtomToName.size() &&
3787 "GetPasteBuffer, parameter 'propertyID' is not a valid atom");
3791 const std::string &atomString =
fAtomToName[propertyID - 1];
3794 if (![window hasProperty : atomString.c_str()]) {
3795 Error(
"GetPasteBuffer",
"No property %s on a window", atomString.c_str());
3800 unsigned tmpFormat = 0, nElements = 0;
3803 propertyData((
char *)[window getProperty : atomString.c_str()
3804 returnType : &tmpType returnFormat : &tmpFormat
3805 nElements : &nElements]);
3807 assert(tmpFormat == 8 &&
"GetPasteBuffer, property has wrong format");
3809 text.Insert(0, propertyData.
Get(), nElements);
3810 nChars = (
Int_t)nElements;
3815 [window removeProperty : atomString.c_str()];
3846 assert(!
fPimpl->IsRootWindow(windowID) &&
3847 "ChangeProperty, parameter 'windowID' is root window");
3848 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3849 "ChangeProperty, parameter 'windowID' is not a valid window id");
3850 assert(propertyID && propertyID <=
fAtomToName.size() &&
3851 "ChangeProperty, parameter 'propertyID' is not a valid atom");
3855 const std::string &atomString =
fAtomToName[propertyID - 1];
3880 assert(!
fPimpl->IsRootWindow(windowID) &&
3881 "ChangeProperties, parameter 'windowID' is root window");
3882 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3883 "ChangeProperties, parameter 'windowID' is not a valid window id");
3884 assert(propertyID && propertyID <=
fAtomToName.size() &&
3885 "ChangeProperties, parameter 'propertyID' is not a valid atom");
3889 const std::string &atomName =
fAtomToName[propertyID - 1];
3892 [window setProperty : atomName.c_str()
data :
data
3910 assert(!
fPimpl->IsRootWindow(windowID) &&
3911 "DeleteProperty, parameter 'windowID' is root window");
3912 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3913 "DeleteProperty, parameter 'windowID' is not a valid window");
3914 assert(propertyID && propertyID <=
fAtomToName.size() &&
3915 "DeleteProperty, parameter 'propertyID' is not a valid atom");
3917 const std::string &atomString =
fAtomToName[propertyID - 1];
3918 [
fPimpl->GetWindow(windowID) removeProperty : atomString.c_str()];
3934 assert(windowID >
fPimpl->GetRootWindowID() &&
3935 "SetDNDAware, parameter 'windowID' is not a valid window id");
3936 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3937 "SetDNDAware, parameter 'windowID' is not a window");
3942 NSArray *
const supportedTypes = [NSArray arrayWithObjects : NSFilenamesPboardType, nil];
3946 [view registerForDraggedTypes : supportedTypes];
3953 assert(xaAtomAtom == 4 &&
"SetDNDAware, XA_ATOM is not defined");
3958 assert(
sizeof(
unsigned) == 4 &&
"SetDNDAware, sizeof(unsigned) must be 4");
3960 std::vector<unsigned> propertyData;
3961 propertyData.push_back(4);
3964 for (
unsigned i = 0; typeList[i]; ++i)
3965 propertyData.push_back(
unsigned(typeList[i]));
3968 [view setProperty :
"XdndAware" data : (
unsigned char *)&propertyData[0]
3969 size : propertyData.size() forType : xaAtomAtom
format : 32];
3977 if (windowID <= fPimpl->GetRootWindowID())
3980 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3981 "IsDNDAware, windowID parameter is not a window");
3992 ::Warning(
"SetTypeList",
"Not implemented");
4016 fPimpl->IsRootWindow(winID) ? nil :
fPimpl->GetWindow(winID).fContentView,
4017 dragWinID, inputWinID,
x,
y, maxDepth);
4019 return testView.fID;
4024#pragma mark - Noops.
4149 NSPoint newCursorPosition = {};
4150 newCursorPosition.x = ix;
4151 newCursorPosition.y = iy;
4153 if (
fPimpl->GetRootWindowID() == winID) {
4157 assert(
fPimpl->GetDrawable(winID).fIsPixmap == NO &&
4158 "Warp, drawable is not a window");
4163 CGWarpMouseCursorPosition(NSPointToCGPoint(newCursorPosition));
4395#pragma mark - Details and aux. functions.
4400 return &
fPimpl->fX11EventTranslator;
4406 return &
fPimpl->fX11CommandBuffer;
4418 assert(
fCocoaDraw > 0 &&
"CocoaDrawOFF, was already off");
4432 if (!drawable.fIsPixmap) {
4433 Error(
"GetCurrentContext",
"TCanvas/TPad's internal error,"
4434 " selected drawable is not a pixmap!");
4438 return drawable.fContext;
4451 ProcessSerialNumber psn = {0, kCurrentProcess};
4453 const OSStatus res1 = TransformProcessType(&psn, kProcessTransformToForegroundApplication);
4458 if (res1 != noErr && res1 != paramErr) {
4459 Error(
"MakeProcessForeground",
"TransformProcessType failed with code %d",
int(res1));
4462#ifdef MAC_OS_X_VERSION_10_9
4464 [[NSApplication sharedApplication] activateIgnoringOtherApps : YES];
4466 const OSErr res2 = SetFrontProcess(&psn);
4467 if (res2 != noErr) {
4468 Error(
"MakeProcessForeground",
"SetFrontProcess failed with code %d", res2);
4475#ifdef MAC_OS_X_VERSION_10_9
4477 [[NSApplication sharedApplication] activateIgnoringOtherApps : YES];
4479 ProcessSerialNumber psn = {};
4481 OSErr res = GetCurrentProcess(&psn);
4483 Error(
"MakeProcessForeground",
"GetCurrentProcess failed with code %d", res);
4487 res = SetFrontProcess(&psn);
4489 Error(
"MapProcessForeground",
"SetFrontProcess failed with code %d", res);
4501 const std::map<std::string, Atom_t>::const_iterator it =
fNameToAtom.find(atomName);
4505 else if (addIfNotFound) {
4521 if (iconDirectoryPath) {
4523 if (fileName.
Get()) {
4526 NSString *cocoaStr = [NSString stringWithCString : fileName.
Get() encoding : NSASCIIStringEncoding];
4527 NSImage *image = [[[NSImage alloc] initWithContentsOfFile : cocoaStr] autorelease];
4528 [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 bell. Percent is loudness from -100% to 100%.
void SetWMState(Window_t winID, EInitialState state) override
Sets the initial state of the window "id": either kNormalState or kIconicState.
Window_t GetWindowID(Int_t wid) override
Returns the X11 window identifier.
<