41#include <ApplicationServices/ApplicationServices.h>
42#include <OpenGL/OpenGL.h>
44#include <Cocoa/Cocoa.h>
84#pragma mark - Display configuration management.
87void DisplayReconfigurationCallback(CGDirectDisplayID , CGDisplayChangeSummaryFlags flags,
void * )
89 if (flags & kCGDisplayBeginConfigurationFlag)
92 if (flags & kCGDisplayDesktopShapeChangedFlag) {
93 assert(
dynamic_cast<TGCocoa *
>(
gVirtualX) != 0 &&
"DisplayReconfigurationCallback, gVirtualX"
94 " is either null or has a wrong type");
100#pragma mark - Aux. functions called from GUI-rendering part.
105 assert(ctx != 0 &&
"SetStrokeForegroundColorFromX11Context, parameter 'ctx' is null");
111 ::Warning(
"SetStrokeForegroundColorFromX11Context",
112 "x11 context does not have line color information");
114 CGContextSetRGBStrokeColor(ctx, rgb[0], rgb[1], rgb[2], 1.);
121 assert(ctx != 0 &&
"SetStrokeDashFromX11Context, ctx parameter is null");
123 SetStrokeForegroundColorFromX11Context(ctx, gcVals);
125 static const std::size_t maxLength =
sizeof gcVals.
fDashes /
sizeof gcVals.
fDashes[0];
126 assert(maxLength >= std::size_t(gcVals.
fDashLen) &&
127 "SetStrokeDashFromX11Context, x11 context has bad dash length > sizeof(fDashes)");
129 CGFloat dashes[maxLength] = {};
140 ::Warning(
"SetStrokeDoubleDashFromX11Context",
"Not implemented yet, kick tpochep!");
148 assert(ctx != 0 &&
"SetStrokeParametersFromX11Context, parameter 'ctx' is null");
152 CGContextSetLineWidth(ctx, gcVals.
fLineWidth);
154 CGContextSetLineWidth(ctx, 1.);
156 CGContextSetLineDash(ctx, 0., 0, 0);
160 SetStrokeForegroundColorFromX11Context(ctx, gcVals);
162 SetStrokeDashFromX11Context(ctx, gcVals);
164 SetStrokeDoubleDashFromX11Context(ctx ,gcVals);
166 ::Warning(
"SetStrokeParametersFromX11Context",
"line style bit is set,"
167 " but line style is unknown");
168 SetStrokeForegroundColorFromX11Context(ctx, gcVals);
171 SetStrokeForegroundColorFromX11Context(ctx, gcVals);
179 assert(ctx != 0 &&
"SetFilledAreaColorFromX11Context, parameter 'ctx' is null");
185 ::Warning(
"SetFilledAreaColorFromX11Context",
"no fill color found in x11 context");
187 CGContextSetRGBFillColor(ctx, rgb[0], rgb[1], rgb[2], 1.);
190struct PatternContext {
193 : fMask(
mask), fFillStyle(fillStyle), fForeground(
foreground), fBackground(background), fPhase(phase)
195 fImage = [image retain];
202 PatternContext(
const PatternContext &) =
delete;
203 PatternContext(PatternContext &&) =
delete;
204 PatternContext &operator = (
const PatternContext &) =
delete;
205 PatternContext &operator = (PatternContext &&) =
delete;
209 if (image != fImage) {
211 fImage = [image retain];
216 Int_t fFillStyle = 0;
231bool HasFillTiledStyle(
const GCValues_t &gcVals)
243bool HasFillStippledStyle(
const GCValues_t &gcVals)
255bool HasFillOpaqueStippledStyle(
const GCValues_t &gcVals)
263 assert(patternImage != nil &&
"DrawTile, parameter 'patternImage' is nil");
264 assert(ctx != 0 &&
"DrawTile, ctx parameter is null");
266 const CGRect patternRect = CGRectMake(0, 0, patternImage.fWidth, patternImage.fHeight);
267 if ([patternImage isKindOfClass : [
QuartzImage class]]) {
268 CGContextDrawImage(ctx, patternRect, ((
QuartzImage *)patternImage).fImage);
269 }
else if ([patternImage isKindOfClass : [
QuartzPixmap class]]){
271 assert(imageFromPixmap.Get() != 0 &&
"DrawTile, createImageFromPixmap failed");
272 CGContextDrawImage(ctx, patternRect, imageFromPixmap.Get());
274 assert(0 &&
"DrawTile, pattern is neither a QuartzImage, nor a QuartzPixmap");
284 assert(info != 0 &&
"DrawPattern, parameter 'info' is null");
285 assert(ctx != 0 &&
"DrawPattern, parameter 'ctx' is null");
287 const PatternContext *
const patternContext = (PatternContext *)info;
289 const Int_t fillStyle = patternContext->fFillStyle;
292 assert(patternImage != nil &&
"DrawPattern, pattern (stipple) image is nil");
293 const CGRect patternRect = CGRectMake(0, 0, patternImage.fWidth, patternImage.fHeight);
295 if (HasFillTiledStyle(
mask, fillStyle)) {
296 DrawTile(patternImage, ctx);
297 }
else if (HasFillStippledStyle(
mask, fillStyle) || HasFillOpaqueStippledStyle(
mask, fillStyle)) {
298 assert([patternImage isKindOfClass : [
QuartzImage class]] &&
299 "DrawPattern, stipple must be a QuartzImage object");
301 assert(image.
fIsStippleMask == YES &&
"DrawPattern, image is not a stipple mask");
305 if (HasFillOpaqueStippledStyle(
mask,fillStyle)) {
308 "DrawPattern, fill style is FillOpaqueStippled, but background color is not set in a context");
310 CGContextSetRGBFillColor(ctx, rgb[0], rgb[1], rgb[2], 1.);
311 CGContextFillRect(ctx, patternRect);
317 CGContextSetRGBFillColor(ctx, rgb[0], rgb[1], rgb[2], 1.);
318 CGContextClipToMask(ctx, patternRect, image.
fImage);
319 CGContextFillRect(ctx, patternRect);
322 DrawTile(patternImage, ctx);
327void PatternRelease(
void *info)
329 delete static_cast<PatternContext *
>(info);
339 assert(ctx != 0 &&
"SetFillPattern, parameter 'ctx' is null");
340 assert(patternContext != 0 &&
"SetFillPattern, parameter 'patternContext' is null");
341 assert(patternContext->fImage != nil &&
"SetFillPattern, pattern image is nil");
344 CGContextSetFillColorSpace(ctx, patternColorSpace.Get());
346 CGPatternCallbacks callbacks = {};
348 callbacks.releaseInfo = PatternRelease;
349 const CGRect patternRect = CGRectMake(0, 0, patternContext->fImage.fWidth, patternContext->fImage.fHeight);
351 patternContext->fImage.fWidth, patternContext->fImage.fHeight,
352 kCGPatternTilingNoDistortion,
true, &callbacks));
353 const CGFloat alpha = 1.;
354 CGContextSetFillPattern(ctx, pattern.Get(), &alpha);
355 CGContextSetPatternPhase(ctx, patternContext->fPhase);
361 assert(
child != nil &&
"ParentRendersToChild, parameter 'child' is nil");
365class ViewFixer final {
370 const auto origin = viewToFix.frame.origin;
372 widToFix = viewToFix.
fID;
373 if ((context = viewToFix.
fContext)) {
374 CGContextSaveGState(context);
375 CGContextTranslateCTM(context, origin.x, origin.y);
382 CGContextRestoreGState(context);
384 ViewFixer(
const ViewFixer &rhs) =
delete;
385 ViewFixer &operator = (
const ViewFixer &) =
delete;
392bool IsNonPrintableAsciiCharacter(UniChar
c)
394 if (
c == 9 || (
c >= 32 &&
c < 127))
401void FixAscii(std::vector<UniChar> &
text)
418 std::replace(
text.begin(),
text.end(), UniChar(16), UniChar(
' '));
421 text.erase(std::remove_if(
text.begin(),
text.end(), IsNonPrintableAsciiCharacter),
text.end());
431 : fSelectedDrawable(0),
435 fForegroundProcess(false),
437 fDisplayShapeChanged(true)
440 "TGCocoa, gSystem is eihter null or has a wrong type");
451 CGDisplayRegisterReconfigurationCallback (DisplayReconfigurationCallback, 0);
457 fSelectedDrawable(0),
461 fForegroundProcess(false),
463 fDisplayShapeChanged(true)
466 "TGCocoa, gSystem is eihter null or has a wrong type");
477 CGDisplayRegisterReconfigurationCallback (DisplayReconfigurationCallback, 0);
484 CGDisplayRemoveReconfigurationCallback (DisplayReconfigurationCallback, 0);
503 if (CGMainDisplayID() == kCGNullDirectDisplay)
559 return CGDisplayScreenSize(CGMainDisplayID()).width;
570 NSArray *
const screens = [NSScreen screens];
571 assert(screens != nil &&
"screens array is nil");
573 NSScreen *
const mainScreen = [screens objectAtIndex : 0];
574 assert(mainScreen != nil &&
"screen with index 0 is nil");
576 return NSBitsPerPixelFromDepth([mainScreen depth]);
590 }
else if (
mode > 0) {
613 NSArray *
const screens = [NSScreen screens];
614 assert(screens != nil && screens.count != 0 &&
"GetDisplayGeometry, no screens found");
616 NSRect frame = [(NSScreen *)[screens objectAtIndex : 0] frame];
617 CGFloat xMin = frame.origin.x, xMax = xMin + frame.size.width;
618 CGFloat yMin = frame.origin.y, yMax = yMin + frame.size.height;
620 for (NSUInteger i = 1,
e = screens.count; i <
e; ++i) {
621 frame = [(NSScreen *)[screens objectAtIndex : i] frame];
622 xMin = std::min(xMin, frame.origin.x);
623 xMax = std::max(xMax, frame.origin.x + frame.size.width);
624 yMin = std::min(yMin, frame.origin.y);
625 yMax = std::max(yMax, frame.origin.y + frame.size.height);
639#pragma mark - Window management part.
645 return fPimpl->GetRootWindowID();
661 assert(parentID != 0 &&
"InitWindow, parameter 'parentID' is 0");
665 if (
fPimpl->IsRootWindow(parentID))
668 [
fPimpl->GetWindow(parentID) getAttributes : &
attr];
670 return CreateWindow(parentID, 0, 0,
attr.fWidth,
attr.fHeight, 0,
attr.fDepth,
attr.fClass, 0, 0, 0);
694 auto drawable =
fPimpl->GetDrawable(
wid);
710 [drawable setDrawMode :
mode];
718 return [drawable getDrawMode];
726 if (drawable.fIsPixmap) {
732 assert(pixmapCtx != 0 &&
"ClearWindow, pixmap's context is null");
737 CGContextClearRect(pixmapCtx, CGRectMake(0, 0, drawable.fWidth, drawable.fHeight));
750 if (window.fIsPixmap == YES)
754 assert([window.fContentView isKindOfClass : [
QuartzView class]] &&
"UpdateWindow, content view is not a QuartzView");
757 if (dstView.fIsOverlapped)
760 if (dstView.fContext) {
762 const X11::Rectangle copyArea(0, 0, pixmap.fWidth, pixmap.fHeight);
763 [dstView copy : pixmap area : copyArea withMask : nil clipOrigin :
X11::Point() toPoint :
X11::Point()];
766 fPimpl->fX11CommandBuffer.AddUpdateWindow(dstView);
779 "ClearWindow, fSelectedDrawable is invalid");
794 if (windowID < 0 || fPimpl->IsRootWindow(windowID)) {
808 h = drawable.fHeight;
810 if (!drawable.fIsPixmap) {
812 NSPoint srcPoint = {};
815 NSView<X11Window> *
const view = window.fContentView.fParentView ? window.fContentView.fParentView : window.fContentView;
832 assert(!
fPimpl->IsRootWindow(windowID) &&
"MoveWindow, called for root window");
837 [
fPimpl->GetWindow(windowID) setX :
x Y :
y];
857 assert(!
fPimpl->IsRootWindow(windowID) &&
858 "ResizeWindow, parameter 'windowID' is a root window's id");
863 if (window.fBackBuffer) {
883 "UpdateWindow, fSelectedDrawable is not a valid window id");
932 if (
fPimpl->IsRootWindow(parentID)) {
935 depth, clss, visual,
attr, wtype);
941 [newWindow setAcceptsMouseMovedEvents : YES];
947 assert([parentWin.fContentView isKindOfClass : [
QuartzView class]] &&
948 "CreateWindow, parent view must be QuartzView");
952 x,
y,
w,
h, border, depth, clss, visual,
attr, wtype);
956 [parentWin addChild : childView];
986 BOOL needFocusChange = NO;
991 fPimpl->fX11EventTranslator.CheckUnmappedView(
wid);
993 assert(
fPimpl->GetDrawable(
wid).fIsPixmap == NO &&
994 "DestroyWindow, can not be called for QuartzPixmap or QuartzImage object");
997 if (
fPimpl->fX11CommandBuffer.BufferSize())
998 fPimpl->fX11CommandBuffer.RemoveOperationsForDrawable(
wid);
1001 if ((needFocusChange = window == window.fQuartzWindow && window.fQuartzWindow.fHasFocus))
1002 window.fHasFocus = NO;
1006 fPimpl->fX11EventTranslator.GenerateDestroyNotify(
wid);
1016 if (needFocusChange)
1037 assert(
fPimpl->GetDrawable(
wid).fIsPixmap == NO &&
1038 "DestroySubwindows, can not be called for QuartzPixmap or QuartzImage object");
1075 assert(!
fPimpl->IsRootWindow(
wid) &&
"ChangeWindowAttributes, called for root window");
1076 assert(
attr != 0 &&
"ChangeWindowAttributes, parameter 'attr' is null");
1093 if (windowID <= fPimpl->GetRootWindowID())
1098 window.fEventMask = eventMask;
1107 assert(!
fPimpl->IsRootWindow(
wid) &&
"ReparentChild, can not re-parent root window");
1112 if (
fPimpl->IsRootWindow(pid)) {
1115 [view removeFromSuperview];
1116 view.fParentView = nil;
1118 NSRect frame = view.frame;
1119 frame.origin = NSPoint();
1121 NSUInteger styleMask = kClosableWindowMask | kMiniaturizableWindowMask | kResizableWindowMask;
1122 if (!view.fOverrideRedirect)
1123 styleMask |= kTitledWindowMask;
1126 styleMask : styleMask
1127 backing : NSBackingStoreBuffered
1129 [view setX :
x Y :
y];
1130 [newTopLevel addChild : view];
1132 fPimpl->ReplaceDrawable(
wid, newTopLevel);
1135 [newTopLevel release];
1138 [view removeFromSuperview];
1141 assert(newParent.fIsPixmap == NO &&
"ReparentChild, pixmap can not be a new parent");
1142 [view setX :
x Y :
y];
1143 [newParent addChild : view];
1154 if (
fPimpl->IsRootWindow(pid))
1161 [contentView retain];
1162 [contentView removeFromSuperview];
1163 [topLevel setContentView : nil];
1164 fPimpl->ReplaceDrawable(
wid, contentView);
1165 [contentView setX :
x Y :
y];
1166 [
fPimpl->GetWindow(pid) addChild : contentView];
1167 [contentView release];
1178 assert(!
fPimpl->IsRootWindow(
wid) &&
"ReparentWindow, can not re-parent root window");
1181 if (view.fParentView)
1194 assert(!
fPimpl->IsRootWindow(
wid) &&
"MapWindow, called for root window");
1214 assert(!
fPimpl->IsRootWindow(
wid) &&
"MapSubwindows, called for 'root' window");
1229 assert(!
fPimpl->IsRootWindow(
wid) &&
"MapRaised, called for root window");
1250 assert(!
fPimpl->IsRootWindow(
wid) &&
"UnmapWindow, called for root window");
1255 fPimpl->fX11EventTranslator.CheckUnmappedView(
wid);
1260 if (
win ==
win.fQuartzWindow &&
win.fQuartzWindow.fHasFocus)
1282 assert(!
fPimpl->IsRootWindow(
wid) &&
"RaiseWindow, called for root window");
1284 if (!
fPimpl->GetWindow(
wid).fParentView)
1299 assert(!
fPimpl->IsRootWindow(
wid) &&
"LowerWindow, called for root window");
1301 if (!
fPimpl->GetWindow(
wid).fParentView)
1320 assert(!
fPimpl->IsRootWindow(
wid) &&
"MoveWindow, called for root window");
1339 assert(!
fPimpl->IsRootWindow(
wid) &&
"MoveResizeWindow, called for 'root' window");
1351 assert(!
fPimpl->IsRootWindow(
wid) &&
"ResizeWindow, called for 'root' window");
1356 const UInt_t siMax = std::numeric_limits<Int_t>::max();
1357 if (
w > siMax ||
h > siMax)
1360 NSSize newSize = {};
1364 [
fPimpl->GetWindow(
wid) setDrawableSize : newSize];
1374 assert(!
fPimpl->IsRootWindow(
wid) &&
"IconifyWindow, can not iconify the root window");
1375 assert(
fPimpl->GetWindow(
wid).fIsPixmap == NO &&
"IconifyWindow, invalid window id");
1378 assert(
win.fQuartzWindow ==
win &&
"IconifyWindow, can be called only for a top level window");
1380 fPimpl->fX11EventTranslator.CheckUnmappedView(
wid);
1383 if (
fPimpl->fX11CommandBuffer.BufferSize())
1384 fPimpl->fX11CommandBuffer.RemoveOperationsForDrawable(
wid);
1386 if (window.fQuartzWindow.fHasFocus) {
1388 window.fQuartzWindow.fHasFocus = NO;
1391 [
win.fQuartzWindow miniaturize :
win.fQuartzWindow];
1406 if (!srcWin || !dstWin)
1409 const bool srcIsRoot =
fPimpl->IsRootWindow(srcWin);
1410 const bool dstIsRoot =
fPimpl->IsRootWindow(dstWin);
1412 if (srcIsRoot && dstIsRoot) {
1424 NSPoint srcPoint = {};
1428 NSPoint dstPoint = {};
1434 }
else if (srcIsRoot) {
1438 if ([dstView superview]) {
1442 dstPoint = [[dstView superview] convertPoint : dstPoint fromView : dstView];
1444 if (view != dstView && view.fMapState ==
kIsViewable)
1453 if ([dstView superview]) {
1457 const NSPoint
pt = [[dstView superview] convertPoint : dstPoint fromView : dstView];
1459 if (view != dstView && view.fMapState ==
kIsViewable)
1492 if (!window.fIsPixmap) {
1512 assert(!
fPimpl->IsRootWindow(
wid) &&
"SetWindowBackground, can not set color for root window");
1514 fPimpl->GetWindow(
wid).fBackgroundPixel = color;
1527 assert(!
fPimpl->IsRootWindow(windowID) &&
1528 "SetWindowBackgroundPixmap, can not set background for a root window");
1529 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
1530 "SetWindowBackgroundPixmap, invalid window id");
1533 if (pixmapID ==
kNone) {
1534 window.fBackgroundPixmap = nil;
1538 assert(pixmapID >
fPimpl->GetRootWindowID() &&
1539 "SetWindowBackgroundPixmap, parameter 'pixmapID' is not a valid pixmap id");
1540 assert(
fPimpl->GetDrawable(pixmapID).fIsPixmap == YES &&
1541 "SetWindowBackgroundPixmap, bad drawable");
1548 if ([pixmapOrImage isKindOfClass : [
QuartzPixmap class]]) {
1550 if (backgroundImage.
Get())
1551 window.fBackgroundPixmap = backgroundImage.
Get();
1554 if (backgroundImage.
Get())
1555 window.fBackgroundPixmap = backgroundImage.
Get();
1558 if (!backgroundImage.
Get())
1560 Error(
"SetWindowBackgroundPixmap",
"QuartzImage initialization failed");
1569 if (windowID <= fPimpl->GetRootWindowID())
1573 return view.fParentView ? view.fParentView.fID :
fPimpl->GetRootWindowID();
1587 NSString *
const windowTitle = [NSString stringWithCString :
name encoding : NSASCIIStringEncoding];
1588 [(
NSWindow *)drawable setTitle : windowTitle];
1618 assert(!
fPimpl->IsRootWindow(windowID) &&
1619 "ShapeCombineMask, windowID parameter is a 'root' window");
1620 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
1621 "ShapeCombineMask, windowID parameter is a bad window id");
1623 "ShapeCombineMask, pixmapID parameter must point to QuartzImage object");
1625 if (
fPimpl->GetWindow(windowID).fContentView.fParentView)
1629 assert(srcImage.
fIsStippleMask == YES &&
"ShapeCombineMask, source image is not a stipple mask");
1637 [qw setOpaque : NO];
1638 [qw setBackgroundColor : [NSColor clearColor]];
1642#pragma mark - "Window manager hints" set of functions.
1650 assert(!
fPimpl->IsRootWindow(
wid) &&
"SetMWMHints, called for 'root' window");
1653 NSUInteger newMask = 0;
1655 if ([qw styleMask] & kTitledWindowMask) {
1656 newMask |= kTitledWindowMask;
1657 newMask |= kClosableWindowMask;
1661 newMask |= kMiniaturizableWindowMask | kResizableWindowMask;
1664 newMask |= kMiniaturizableWindowMask;
1666 newMask |= kResizableWindowMask;
1669 [qw setStyleMask : newMask];
1673 [[qw standardWindowButton : NSWindowZoomButton] setEnabled : YES];
1674 [[qw standardWindowButton : NSWindowMiniaturizeButton] setEnabled : YES];
1701 assert(!
fPimpl->IsRootWindow(
wid) &&
"SetWMSizeHints, called for root window");
1703 const NSUInteger styleMask = kTitledWindowMask | kClosableWindowMask | kMiniaturizableWindowMask | kResizableWindowMask;
1704 const NSRect minRect = [
NSWindow frameRectForContentRect : NSMakeRect(0., 0., wMin, hMin) styleMask : styleMask];
1705 const NSRect maxRect = [
NSWindow frameRectForContentRect : NSMakeRect(0., 0., wMax, hMax) styleMask : styleMask];
1708 [qw setMinSize : minRect.size];
1709 [qw setMaxSize : maxRect.size];
1730 assert(
wid >
fPimpl->GetRootWindowID() &&
"SetWMTransientHint, wid parameter is not a valid window id");
1732 if (
fPimpl->IsRootWindow(mainWid))
1737 if (![mainWindow isVisible])
1742 if (mainWindow != transientWindow) {
1745 Error(
"SetWMTransientHint",
"window is already transient for other window");
1747 [[transientWindow standardWindowButton : NSWindowZoomButton] setEnabled : NO];
1748 [mainWindow addTransientWindow : transientWindow];
1751 Warning(
"SetWMTransientHint",
"transient and main windows are the same window");
1754#pragma mark - GUI-rendering part.
1760 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawLineAux, called for root window");
1764 assert(ctx != 0 &&
"DrawLineAux, context is null");
1777 CGContextSetAllowsAntialiasing(ctx,
false);
1779 if (!drawable.fIsPixmap)
1780 CGContextTranslateCTM(ctx, 0.5, 0.5);
1787 SetStrokeParametersFromX11Context(ctx, gcVals);
1788 CGContextBeginPath(ctx);
1789 CGContextMoveToPoint(ctx,
x1,
y1);
1790 CGContextAddLineToPoint(ctx,
x2,
y2);
1791 CGContextStrokePath(ctx);
1793 CGContextSetAllowsAntialiasing(ctx,
true);
1808 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawLine, called for root window");
1809 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"DrawLine, invalid context index");
1814 if (!drawable.fIsPixmap) {
1817 const ViewFixer fixer(view,
wid);
1836 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawSegmentsAux, called for root window");
1837 assert(segments != 0 &&
"DrawSegmentsAux, segments parameter is null");
1838 assert(nSegments > 0 &&
"DrawSegmentsAux, nSegments <= 0");
1840 for (
Int_t i = 0; i < nSegments; ++i)
1841 DrawLineAux(
wid, gcVals, segments[i].fX1, segments[i].fY1 - 3, segments[i].fX2, segments[i].fY2 - 3);
1853 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawSegments, called for root window");
1854 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"DrawSegments, invalid context index");
1855 assert(segments != 0 &&
"DrawSegments, parameter 'segments' is null");
1856 assert(nSegments > 0 &&
"DrawSegments, number of segments <= 0");
1861 if (!drawable.fIsPixmap) {
1863 const ViewFixer fixer(view,
wid);
1867 fPimpl->fX11CommandBuffer.AddDrawSegments(
wid, gcVals, segments, nSegments);
1873 fPimpl->fX11CommandBuffer.AddDrawSegments(
wid, gcVals, segments, nSegments);
1883 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawRectangleAux, called for root window");
1887 if (!drawable.fIsPixmap) {
1900 assert(ctx &&
"DrawRectangleAux, context is null");
1903 CGContextSetAllowsAntialiasing(ctx,
false);
1905 SetStrokeParametersFromX11Context(ctx, gcVals);
1907 const CGRect
rect = CGRectMake(
x,
y,
w,
h);
1908 CGContextStrokeRect(ctx,
rect);
1910 CGContextSetAllowsAntialiasing(ctx,
true);
1922 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawRectangle, called for root window");
1923 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"DrawRectangle, invalid context index");
1929 if (!drawable.fIsPixmap) {
1932 const ViewFixer fixer(view,
wid);
1936 fPimpl->fX11CommandBuffer.AddDrawRectangle(
wid, gcVals,
x,
y,
w,
h);
1942 fPimpl->fX11CommandBuffer.AddDrawRectangle(
wid, gcVals,
x,
y,
w,
h);
1958 assert(!
fPimpl->IsRootWindow(
wid) &&
"FillRectangleAux, called for root window");
1962 CGSize patternPhase = {};
1964 if (drawable.fIsPixmap) {
1969 const CGRect fillRect = CGRectMake(
x,
y,
w,
h);
1971 if (!drawable.fIsPixmap) {
1974 const NSPoint origin = [view.
fParentView convertPoint : view.frame.origin toView : nil];
1975 patternPhase.width = origin.x;
1976 patternPhase.height = origin.y;
1982 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals) || HasFillTiledStyle(gcVals)) {
1983 std::unique_ptr<PatternContext> patternContext(
new PatternContext(gcVals.
fMask, gcVals.
fFillStyle,
1984 0, 0, nil, patternPhase));
1985 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals)) {
1987 "FillRectangleAux, fill_style is FillStippled/FillOpaqueStippled,"
1988 " but no stipple is set in a context");
1993 if (HasFillOpaqueStippledStyle(gcVals))
1997 "FillRectangleAux, fill_style is FillTiled, but not tile is set in a context");
1999 patternContext->SetImage(
fPimpl->GetDrawable(gcVals.
fTile));
2002 SetFillPattern(ctx, patternContext.get());
2003 patternContext.release();
2004 CGContextFillRect(ctx, fillRect);
2009 SetFilledAreaColorFromX11Context(ctx, gcVals);
2010 CGContextFillRect(ctx, fillRect);
2023 assert(!
fPimpl->IsRootWindow(
wid) &&
"FillRectangle, called for root window");
2024 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"FillRectangle, invalid context index");
2029 if (!drawable.fIsPixmap) {
2032 const ViewFixer fixer(view,
wid);
2035 fPimpl->fX11CommandBuffer.AddFillRectangle(
wid, gcVals,
x,
y,
w,
h);
2052 assert(!
fPimpl->IsRootWindow(
wid) &&
"FillPolygonAux, called for root window");
2053 assert(polygon != 0 &&
"FillPolygonAux, parameter 'polygon' is null");
2054 assert(nPoints > 0 &&
"FillPolygonAux, number of points must be positive");
2059 CGSize patternPhase = {};
2061 if (!drawable.fIsPixmap) {
2063 const NSPoint origin = [view convertPoint : view.frame.origin toView : nil];
2064 patternPhase.width = origin.x;
2065 patternPhase.height = origin.y;
2070 CGContextSetAllowsAntialiasing(ctx,
false);
2072 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals) || HasFillTiledStyle(gcVals)) {
2073 std::unique_ptr<PatternContext> patternContext(
new PatternContext(gcVals.
fMask, gcVals.
fFillStyle, 0, 0, nil, patternPhase));
2075 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals)) {
2077 "FillRectangleAux, fill style is FillStippled/FillOpaqueStippled,"
2078 " but no stipple is set in a context");
2083 if (HasFillOpaqueStippledStyle(gcVals))
2087 "FillRectangleAux, fill_style is FillTiled, but not tile is set in a context");
2089 patternContext->SetImage(
fPimpl->GetDrawable(gcVals.
fTile));
2092 SetFillPattern(ctx, patternContext.get());
2093 patternContext.release();
2095 SetFilledAreaColorFromX11Context(ctx, gcVals);
2100 CGContextBeginPath(ctx);
2101 if (!drawable.fIsPixmap) {
2102 CGContextMoveToPoint(ctx, polygon[0].fX, polygon[0].fY - 2);
2103 for (
Int_t i = 1; i < nPoints; ++i)
2104 CGContextAddLineToPoint(ctx, polygon[i].fX, polygon[i].fY - 2);
2107 for (
Int_t i = 1; i < nPoints; ++i)
2111 CGContextFillPath(ctx);
2112 CGContextSetAllowsAntialiasing(ctx,
true);
2135 assert(polygon != 0 &&
"FillPolygon, parameter 'polygon' is null");
2136 assert(nPoints > 0 &&
"FillPolygon, number of points must be positive");
2137 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"FillPolygon, invalid context index");
2142 if (!drawable.fIsPixmap) {
2144 const ViewFixer fixer(view,
wid);
2148 fPimpl->fX11CommandBuffer.AddFillPolygon(
wid, gcVals, polygon, nPoints);
2154 fPimpl->fX11CommandBuffer.AddFillPolygon(
wid, gcVals, polygon, nPoints);
2168 assert(!
fPimpl->IsRootWindow(
src) &&
"CopyAreaAux, src parameter is root window");
2169 assert(!
fPimpl->IsRootWindow(
dst) &&
"CopyAreaAux, dst parameter is root window");
2184 "CopyArea, mask is not a pixmap");
2194 [dstDrawable copy : srcDrawable area : copyArea withMask :
mask clipOrigin : clipOrigin toPoint : dstPoint];
2204 assert(!
fPimpl->IsRootWindow(
src) &&
"CopyArea, src parameter is root window");
2205 assert(!
fPimpl->IsRootWindow(
dst) &&
"CopyArea, dst parameter is root window");
2206 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"CopyArea, invalid context index");
2211 if (!drawable.fIsPixmap) {
2213 const ViewFixer fixer(view,
dst);
2222 if (
fPimpl->GetDrawable(
src).fIsPixmap) {
2238 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawStringAux, called for root window");
2242 assert(ctx != 0 &&
"DrawStringAux, context is null");
2246 CGContextSetTextMatrix(ctx, CGAffineTransformIdentity);
2249 if (!drawable.fIsPixmap) {
2250 CGContextTranslateCTM(ctx, 0., drawable.fHeight);
2251 CGContextScaleCTM(ctx, 1., -1.);
2255 CGContextSetAllowsAntialiasing(ctx,
true);
2257 assert(gcVals.
fMask &
kGCFont &&
"DrawString, font is not set in a context");
2262 CGFloat textColor[4] = {0., 0., 0., 1.};
2267 CGContextSetRGBFillColor(ctx, textColor[0], textColor[1], textColor[2], textColor[3]);
2272 std::vector<UniChar> unichars((
unsigned char *)
text, (
unsigned char *)
text +
len);
2285 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawString, called for root window");
2286 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"DrawString, invalid context index");
2290 assert(gcVals.
fMask &
kGCFont &&
"DrawString, font is not set in a context");
2292 if (!drawable.fIsPixmap) {
2294 const ViewFixer fixer(view,
wid);
2314 assert(!
fPimpl->IsRootWindow(windowID) &&
"ClearAreaAux, called for root window");
2317 assert(view.
fContext != 0 &&
"ClearAreaAux, view.fContext is null");
2327 CGFloat rgb[3] = {};
2331 CGContextSetRGBFillColor(view.
fContext, rgb[0], rgb[1], rgb[2], 1.);
2332 CGContextFillRect(view.
fContext, CGRectMake(
x,
y,
w,
h));
2334 const CGRect fillRect = CGRectMake(
x,
y,
w,
h);
2336 CGSize patternPhase = {};
2338 const NSPoint origin = [view.
fParentView convertPoint : view.frame.origin toView : nil];
2339 patternPhase.width = origin.x;
2340 patternPhase.height = origin.y;
2344 std::unique_ptr<PatternContext> patternContext(
new PatternContext({}, 0, 0, 0, view.
fBackgroundPixmap, patternPhase));
2345 SetFillPattern(view.
fContext, patternContext.get());
2346 patternContext.release();
2347 CGContextFillRect(view.
fContext, fillRect);
2361 assert(!
fPimpl->IsRootWindow(
wid) &&
"ClearArea, called for root window");
2365 if (ParentRendersToChild(view))
2388#pragma mark - Pixmap management.
2394 NSSize newSize = {};
2399 scaleFactor : [[NSScreen mainScreen] backingScaleFactor]]);
2401 pixmap.
Get().fID =
fPimpl->RegisterDrawable(pixmap.
Get());
2405 Error(
"OpenPixmap",
"QuartzPixmap initialization failed");
2413 assert(!
fPimpl->IsRootWindow(
wid) &&
"ResizePixmap, called for root window");
2416 assert(drawable.fIsPixmap == YES &&
"ResizePixmap, invalid drawable");
2422 if ([pixmap resizeW :
w H :
h scaleFactor : [[NSScreen mainScreen] backingScaleFactor]])
2431 assert(pixmapID > (
Int_t)
fPimpl->GetRootWindowID() &&
2432 "SelectPixmap, parameter 'pixmapID' is not a valid id");
2441 "CopyPixmap, fSelectedDrawable is not a valid window id");
2449 assert(pixmapID > (
Int_t)
fPimpl->GetRootWindowID() &&
2450 "CopyPixmapW, parameter 'pixmapID' is not a valid id");
2453 assert([source isKindOfClass : [
QuartzPixmap class]] &&
2454 "CopyPixmap, source is not a pixmap");
2460 if (drawable.fIsPixmap) {
2461 destination = drawable;
2464 if (window.fBackBuffer) {
2465 destination = window.fBackBuffer;
2467 Warning(
"CopyPixmapW",
"Operation skipped, since destination"
2468 " window is not double buffered");
2473 const X11::Rectangle copyArea(0, 0, pixmap.fWidth, pixmap.fHeight);
2476 [destination copy : pixmap area : copyArea withMask : nil clipOrigin :
X11::Point() toPoint : dstPoint];
2484 assert(
fPimpl->GetDrawable(
fSelectedDrawable).fIsPixmap == YES &&
"ClosePixmap, selected drawable is not a pixmap");
2490#pragma mark - Different functions to create pixmap from different data sources. Used by GUI.
2491#pragma mark - These functions implement TVirtualX interface, some of them dupilcate others.
2507 assert(
bitmap != 0 &&
"CreatePixmap, parameter 'bitmap' is null");
2508 assert(
width > 0 &&
"CreatePixmap, parameter 'width' is 0");
2509 assert(
height > 0 &&
"CreatePixmap, parameter 'height' is 0");
2514 backgroundPixel, depth, &imageData[0]);
2525 Error(
"CreatePixmap",
"QuartzImage initialization failed");
2529 image.
Get().fID =
fPimpl->RegisterDrawable(image.
Get());
2530 return image.
Get().fID;
2537 assert(bits != 0 &&
"CreatePixmapFromData, data parameter is null");
2538 assert(
width != 0 &&
"CreatePixmapFromData, width parameter is 0");
2539 assert(
height != 0 &&
"CreatePixmapFromData, height parameter is 0");
2543 std::vector<unsigned char> imageData(bits, bits +
width *
height * 4);
2546 unsigned char *
p = &imageData[0];
2548 std::swap(
p[0],
p[2]);
2556 Error(
"CreatePixmapFromData",
"QuartzImage initialziation failed");
2560 image.
Get().fID =
fPimpl->RegisterDrawable(image.
Get());
2561 return image.
Get().fID;
2568 assert(std::numeric_limits<unsigned char>::digits == 8 &&
"CreateBitmap, ASImage requires octets");
2576 std::vector<unsigned char> imageData(
width *
height);
2579 for (
unsigned i = 0, j = 0,
e =
width / 8 *
height; i <
e; ++i) {
2580 for(
unsigned bit = 0; bit < 8; ++bit, ++j) {
2581 if (
bitmap[i] & (1 << bit))
2590 H :
height bitmapMask : &imageData[0]]);
2593 Error(
"CreateBitmap",
"QuartzImage initialization failed");
2597 image.
Get().fID =
fPimpl->RegisterDrawable(image.
Get());
2598 return image.
Get().fID;
2604 fPimpl->DeleteDrawable(pixmapID);
2611 assert(
fPimpl->GetDrawable(pixmapID).fIsPixmap == YES &&
"DeletePixmap, object is not a pixmap");
2612 fPimpl->fX11CommandBuffer.AddDeletePixmap(pixmapID);
2629 Warning(
"GetColorBits",
"Called for root window");
2631 assert(
x >= 0 &&
"GetColorBits, parameter 'x' is negative");
2632 assert(
y >= 0 &&
"GetColorBits, parameter 'y' is negative");
2633 assert(
w != 0 &&
"GetColorBits, parameter 'w' is 0");
2634 assert(
h != 0 &&
"GetColorBits, parameter 'h' is 0");
2637 return [
fPimpl->GetDrawable(
wid) readColorBits : area];
2643#pragma mark - XImage emulation.
2659 assert(
wid >
fPimpl->GetRootWindowID() &&
"GetImageSize, parameter 'wid' is invalid");
2662 width = drawable.fWidth;
2663 height = drawable.fHeight;
2677 "PutPixel, parameter 'imageID' is a bad pixmap id");
2678 assert(
x >= 0 &&
"PutPixel, parameter 'x' is negative");
2679 assert(
y >= 0 &&
"PutPixel, parameter 'y' is negative");
2683 unsigned char rgb[3] = {};
2685 [pixmap putPixel : rgb
X :
x Y :
y];
2704 "DeleteImage, imageID parameter is not a valid image id");
2708#pragma mark - Mouse related code.
2726 assert(!
fPimpl->IsRootWindow(
wid) &&
"GrabButton, called for 'root' window");
2731 widget.fPassiveGrabOwnerEvents = YES;
2732 widget.fPassiveGrabButton =
button;
2733 widget.fPassiveGrabEventMask = eventMask;
2734 widget.fPassiveGrabKeyModifiers = keyModifiers;
2737 widget.fPassiveGrabOwnerEvents = NO;
2738 widget.fPassiveGrabButton = -1;
2739 widget.fPassiveGrabEventMask = 0;
2740 widget.fPassiveGrabKeyModifiers = 0;
2754 assert(!
fPimpl->IsRootWindow(
wid) &&
"GrabPointer, called for 'root' window");
2757 fPimpl->fX11EventTranslator.SetPointerGrab(view, eventMask, ownerEvents);
2761 fPimpl->fX11EventTranslator.CancelPointerGrab();
2812 assert(!
fPimpl->IsRootWindow(
wid) &&
"GrabKey, called for root window");
2818 [view addPassiveKeyGrab : keyCode modifiers : cocoaKeyModifiers];
2820 [view removePassiveKeyGrab : keyCode modifiers : cocoaKeyModifiers];
2839 return fPimpl->fX11EventTranslator.GetInputFocus();
2846 assert(!
fPimpl->IsRootWindow(
wid) &&
"SetInputFocus, called for root window");
2849 fPimpl->fX11EventTranslator.SetInputFocus(nil);
2851 fPimpl->fX11EventTranslator.SetInputFocus(
fPimpl->GetWindow(
wid).fContentView);
2867 assert(buf != 0 &&
"LookupString, parameter 'buf' is null");
2868 assert(
length >= 2 &&
"LookupString, parameter 'length' - not enough memory to return null-terminated ASCII string");
2873#pragma mark - Font management.
2880 assert(fontName != 0 &&
"LoadQueryFont, fontName is null");
2883 if (ParseXLFDName(fontName, xlfd)) {
2889 return fPimpl->fFontManager.LoadFont(xlfd);
2904 fPimpl->fFontManager.UnloadFont(
fs);
2918 return fPimpl->fFontManager.GetTextWidth(font, s,
len);
2925 fPimpl->fFontManager.GetFontProperties(font, maxAscent, maxDescent);
2952 if (fontName && fontName[0]) {
2955 return fPimpl->fFontManager.ListFonts(xlfd, maxNames, count);
2968 fPimpl->fFontManager.FreeFontNames(fontList);
2971#pragma mark - Color management.
2979 return fPimpl->fX11ColorParser.ParseColor(colorName, color);
2985 const unsigned red = unsigned(
double(color.
fRed) / 0xFFFF * 0xFF);
2986 const unsigned green = unsigned(
double(color.
fGreen) / 0xFFFF * 0xFF);
2987 const unsigned blue = unsigned(
double(color.
fBlue) / 0xFFFF * 0xFF);
2988 color.
fPixel = red << 16 | green << 8 | blue;
2996 color.
fRed = (color.
fPixel >> 16 & 0xFF) * 0xFFFF / 0xFF;
2997 color.
fGreen = (color.
fPixel >> 8 & 0xFF) * 0xFFFF / 0xFF;
2998 color.
fBlue = (color.
fPixel & 0xFF) * 0xFFFF / 0xFF;
3012 Float_t red = 0.f, green = 0.f, blue = 0.f;
3013 color->GetRGB(red, green, blue);
3014 pixel = unsigned(red * 255) << 16;
3015 pixel |= unsigned(green * 255) << 8;
3016 pixel |= unsigned(blue * 255);
3050#pragma mark - Graphical context management.
3070 assert(
gc <=
fX11Contexts.size() &&
gc > 0 &&
"ChangeGC, invalid context id");
3081 assert(
gc <=
fX11Contexts.size() &&
gc > 0 &&
"ChangeGC, invalid context id");
3082 assert(
gval != 0 &&
"ChangeGC, gval parameter is null");
3136 const unsigned nDashes =
sizeof x11Context.
fDashes /
sizeof x11Context.
fDashes[0];
3137 for (
unsigned i = 0; i < nDashes; ++i)
3170#pragma mark - Cursor management.
3192 assert(!
fPimpl->IsRootWindow(
wid) &&
"SetCursor, called for root window");
3195 view.fCurrentCursor =
cursor;
3215 const NSPoint screenPoint = [
NSEvent mouseLocation];
3231 rootWinID =
fPimpl->GetRootWindowID();
3233 NSPoint screenPoint = [
NSEvent mouseLocation];
3236 rootX = screenPoint.x;
3237 rootY = screenPoint.y;
3240 if (winID >
fPimpl->GetRootWindowID()) {
3246 winX = screenPoint.x;
3247 winY = screenPoint.y;
3252 childWinID = childWin.fID;
3260#pragma mark - OpenGL management.
3268 return [[NSScreen mainScreen] backingScaleFactor];
3273 const std::vector<std::pair<UInt_t, Int_t> > &formatComponents)
3277 typedef std::pair<UInt_t, Int_t> component_type;
3278 typedef std::vector<component_type>::size_type size_type;
3281 std::vector<NSOpenGLPixelFormatAttribute> attribs;
3282 for (size_type i = 0,
e = formatComponents.size(); i <
e; ++i) {
3283 const component_type &comp = formatComponents[i];
3286 attribs.push_back(NSOpenGLPFADoubleBuffer);
3288 attribs.push_back(NSOpenGLPFADepthSize);
3289 attribs.push_back(comp.second > 0 ? comp.second : 32);
3291 attribs.push_back(NSOpenGLPFAAccumSize);
3292 attribs.push_back(comp.second > 0 ? comp.second : 1);
3294 attribs.push_back(NSOpenGLPFAStencilSize);
3295 attribs.push_back(comp.second > 0 ? comp.second : 8);
3297 attribs.push_back(NSOpenGLPFAMultisample);
3298 attribs.push_back(NSOpenGLPFASampleBuffers);
3299 attribs.push_back(1);
3300 attribs.push_back(NSOpenGLPFASamples);
3301 attribs.push_back(comp.second ? comp.second : 8);
3305 attribs.push_back(0);
3307 NSOpenGLPixelFormat *
const pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes : &attribs[0]];
3311 if (!
fPimpl->IsRootWindow(parentID)) {
3312 parentView =
fPimpl->GetWindow(parentID).fContentView;
3313 assert([parentView isKindOfClass : [
QuartzView class]] &&
3314 "CreateOpenGLWindow, parent view must be QuartzView");
3317 NSRect viewFrame = {};
3318 viewFrame.size.width =
width;
3319 viewFrame.size.height =
height;
3327 [parentView addChild : glView];
3328 glID =
fPimpl->RegisterDrawable(glView);
3338 Error(
"CreateOpenGLWindow",
"QuartzWindow allocation/initialization"
3339 " failed for a top-level GL widget");
3343 glID =
fPimpl->RegisterDrawable(parent);
3353 assert(!
fPimpl->IsRootWindow(windowID) &&
3354 "CreateOpenGLContext, parameter 'windowID' is a root window");
3356 "CreateOpenGLContext, view is not an OpenGL view");
3358 NSOpenGLContext *
const sharedContext =
fPimpl->GetGLContextForHandle(sharedID);
3362 newContext([[NSOpenGLContext alloc] initWithFormat : glView.
pixelFormat shareContext : sharedContext]);
3380 assert(ctxID > 0 &&
"MakeOpenGLContextCurrent, invalid context id");
3382 NSOpenGLContext *
const glContext =
fPimpl->GetGLContextForHandle(ctxID);
3384 Error(
"MakeOpenGLContextCurrent",
"No OpenGL context found for id %d",
int(ctxID));
3392 if ([glContext view] != glView)
3393 [glContext setView : glView];
3401 [glContext makeCurrentContext];
3419 const UInt_t width = std::max(glView.frame.size.width, CGFloat(100));
3420 const UInt_t height = std::max(glView.frame.size.height, CGFloat(100));
3422 NSRect viewFrame = {};
3423 viewFrame.size.width =
width;
3424 viewFrame.size.height =
height;
3426 const NSUInteger styleMask = kTitledWindowMask | kClosableWindowMask |
3427 kMiniaturizableWindowMask | kResizableWindowMask;
3430 fakeWindow = [[
QuartzWindow alloc] initWithContentRect : viewFrame styleMask : styleMask
3431 backing : NSBackingStoreBuffered defer : NO windowAttributes : &
attr];
3435 [fakeView setHidden : NO];
3437 fPimpl->SetFakeGLWindow(fakeWindow);
3441 [fakeView setHidden : NO];
3445 [glContext setView : fakeView];
3446 [glContext makeCurrentContext];
3455 NSOpenGLContext *
const currentContext = [NSOpenGLContext currentContext];
3456 if (!currentContext) {
3457 Error(
"GetCurrentOpenGLContext",
"The current OpenGL context is null");
3461 const Handle_t contextID =
fPimpl->GetHandleForGLContext(currentContext);
3463 Error(
"GetCurrentOpenGLContext",
"The current OpenGL context was"
3464 " not created/registered by TGCocoa");
3472 assert(ctxID > 0 &&
"FlushOpenGLBuffer, invalid context id");
3474 NSOpenGLContext *
const glContext =
fPimpl->GetGLContextForHandle(ctxID);
3475 assert(glContext != nil &&
"FlushOpenGLBuffer, bad context id");
3477 if (glContext != [NSOpenGLContext currentContext])
3481 [glContext flushBuffer];
3490 NSOpenGLContext *
const glContext =
fPimpl->GetGLContextForHandle(ctxID);
3491 if (
NSView *
const v = [glContext view]) {
3495 [glContext clearDrawable];
3498 if (glContext == [NSOpenGLContext currentContext])
3499 [NSOpenGLContext clearCurrentContext];
3501 fPimpl->DeleteGLContext(ctxID);
3504#pragma mark - Off-screen rendering for TPad/TCanvas.
3510 assert(windowID > (
Int_t)
fPimpl->GetRootWindowID() &&
"SetDoubleBuffer called for root window");
3515 if (!
fPimpl->HasDrawable(windowID))
3518 if (windowID == 999) {
3519 Warning(
"SetDoubleBuffer",
"called with wid == 999");
3533 "SetDoubleBufferON, called, but no correct window was selected before");
3536 if (!window)
return;
3538 assert(window.fIsPixmap == NO &&
3539 "SetDoubleBufferON, selected drawable is a pixmap, can not attach pixmap to pixmap");
3541 [window setDirectDraw : YES];
3551 "SetDoubleBufferON, called, but no correct window was selected before");
3554 if (!window)
return;
3556 assert(window.fIsPixmap == NO &&
3557 "SetDoubleBufferON, selected drawable is a pixmap, can not attach pixmap to pixmap");
3559 [window setDirectDraw : NO];
3561 const unsigned currW = window.fWidth;
3562 const unsigned currH = window.fHeight;
3564 if (
QuartzPixmap *
const currentPixmap = window.fBackBuffer) {
3565 if (currH == currentPixmap.fHeight && currW == currentPixmap.fWidth)
3570 H : currH scaleFactor : [[NSScreen mainScreen] backingScaleFactor]]);
3572 window.fBackBuffer = pixmap.
Get();
3575 Error(
"SetDoubleBufferON",
"QuartzPixmap initialization failed");
3583 auto windows = NSApplication.sharedApplication.windows;
3584 for (
NSWindow *candidate : windows) {
3592#pragma mark - Event management part.
3606 fPimpl->fX11EventTranslator.fEventQueue.push_back(newEvent);
3612 assert(
fPimpl->fX11EventTranslator.fEventQueue.size() > 0 &&
"NextEvent, event queue is empty");
3614 event =
fPimpl->fX11EventTranslator.fEventQueue.front();
3615 fPimpl->fX11EventTranslator.fEventQueue.pop_front();
3621 return (
Int_t)
fPimpl->fX11EventTranslator.fEventQueue.size();
3628 typedef X11::EventQueue_t::iterator iterator_type;
3630 iterator_type it =
fPimpl->fX11EventTranslator.fEventQueue.begin();
3631 iterator_type eIt =
fPimpl->fX11EventTranslator.fEventQueue.end();
3633 for (; it != eIt; ++it) {
3634 const Event_t &queuedEvent = *it;
3636 event = queuedEvent;
3637 fPimpl->fX11EventTranslator.fEventQueue.erase(it);
3653#pragma mark - "Drag and drop", "Copy and paste", X11 properties.
3660 assert(
name != 0 &&
"InternAtom, parameter 'name' is null");
3677 assert(!
fPimpl->IsRootWindow(windowID) &&
3678 "SetPrimarySelectionOwner, windowID parameter is a 'root' window");
3679 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3680 "SetPrimarySelectionOwner, windowID parameter is not a valid window");
3682 const Atom_t primarySelectionAtom =
FindAtom(
"XA_PRIMARY",
false);
3683 assert(primarySelectionAtom !=
kNone &&
3684 "SetPrimarySelectionOwner, predefined XA_PRIMARY atom was not found");
3702 assert(!
fPimpl->IsRootWindow(windowID) &&
3703 "SetSelectionOwner, windowID parameter is a 'root' window'");
3704 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3705 "SetSelectionOwner, windowID parameter is not a valid window");
3720 const Atom_t primarySelectionAtom =
FindAtom(
"XA_PRIMARY",
false);
3721 assert(primarySelectionAtom !=
kNone &&
3722 "GetPrimarySelectionOwner, predefined XA_PRIMARY atom was not found");
3745 assert(!
fPimpl->IsRootWindow(windowID) &&
3746 "ConvertPrimarySelection, parameter 'windowID' is root window");
3747 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3748 "ConvertPrimarySelection, parameter windowID parameter is not a window id");
3751 assert(primarySelectionAtom !=
kNone &&
3752 "ConvertPrimarySelection, XA_PRIMARY predefined atom not found");
3755 assert(stringAtom !=
kNone &&
3756 "ConvertPrimarySelection, XA_STRING predefined atom not found");
3774 assert(!
fPimpl->IsRootWindow(windowID) &&
3775 "ConvertSelection, parameter 'windowID' is root window'");
3776 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3777 "ConvertSelection, parameter 'windowID' is not a window id");
3788 newEvent.
fUser[0] = windowID;
3789 newEvent.
fUser[1] = selection;
3799 ULong_t *bytesAfterReturn,
unsigned char **propertyReturn)
3808 if (
fPimpl->IsRootWindow(windowID))
3811 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3812 "GetProperty, parameter 'windowID' is not a valid window id");
3813 assert(propertyID > 0 && propertyID <=
fAtomToName.size() &&
3814 "GetProperty, parameter 'propertyID' is not a valid atom");
3815 assert(actualType != 0 &&
"GetProperty, parameter 'actualType' is null");
3816 assert(actualFormat != 0 &&
"GetProperty, parameter 'actualFormat' is null");
3817 assert(bytesAfterReturn != 0 &&
"GetProperty, parameter 'bytesAfterReturn' is null");
3818 assert(propertyReturn != 0 &&
"GetProperty, parameter 'propertyReturn' is null");
3822 *bytesAfterReturn = 0;
3823 *propertyReturn = 0;
3826 const std::string &atomName =
fAtomToName[propertyID - 1];
3829 if (![window hasProperty : atomName.c_str()]) {
3830 Error(
"GetProperty",
"Unknown property %s requested", atomName.c_str());
3834 unsigned tmpFormat = 0, tmpElements = 0;
3835 *propertyReturn = [window getProperty : atomName.c_str() returnType : actualType
3836 returnFormat : &tmpFormat nElements : &tmpElements];
3837 *actualFormat = (
Int_t)tmpFormat;
3838 *nItems = tmpElements;
3857 assert(!
fPimpl->IsRootWindow(windowID) &&
3858 "GetPasteBuffer, parameter 'windowID' is root window");
3859 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3860 "GetPasteBuffer, parameter 'windowID' is not a valid window");
3861 assert(propertyID && propertyID <=
fAtomToName.size() &&
3862 "GetPasteBuffer, parameter 'propertyID' is not a valid atom");
3866 const std::string &atomString =
fAtomToName[propertyID - 1];
3869 if (![window hasProperty : atomString.c_str()]) {
3870 Error(
"GetPasteBuffer",
"No property %s on a window", atomString.c_str());
3875 unsigned tmpFormat = 0, nElements = 0;
3878 propertyData((
char *)[window getProperty : atomString.c_str()
3879 returnType : &tmpType returnFormat : &tmpFormat
3880 nElements : &nElements]);
3882 assert(tmpFormat == 8 &&
"GetPasteBuffer, property has wrong format");
3884 text.Insert(0, propertyData.
Get(), nElements);
3885 nChars = (
Int_t)nElements;
3890 [window removeProperty : atomString.c_str()];
3921 assert(!
fPimpl->IsRootWindow(windowID) &&
3922 "ChangeProperty, parameter 'windowID' is root window");
3923 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3924 "ChangeProperty, parameter 'windowID' is not a valid window id");
3925 assert(propertyID && propertyID <=
fAtomToName.size() &&
3926 "ChangeProperty, parameter 'propertyID' is not a valid atom");
3930 const std::string &atomString =
fAtomToName[propertyID - 1];
3955 assert(!
fPimpl->IsRootWindow(windowID) &&
3956 "ChangeProperties, parameter 'windowID' is root window");
3957 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3958 "ChangeProperties, parameter 'windowID' is not a valid window id");
3959 assert(propertyID && propertyID <=
fAtomToName.size() &&
3960 "ChangeProperties, parameter 'propertyID' is not a valid atom");
3964 const std::string &atomName =
fAtomToName[propertyID - 1];
3967 [window setProperty : atomName.c_str()
data :
data
3985 assert(!
fPimpl->IsRootWindow(windowID) &&
3986 "DeleteProperty, parameter 'windowID' is root window");
3987 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3988 "DeleteProperty, parameter 'windowID' is not a valid window");
3989 assert(propertyID && propertyID <=
fAtomToName.size() &&
3990 "DeleteProperty, parameter 'propertyID' is not a valid atom");
3992 const std::string &atomString =
fAtomToName[propertyID - 1];
3993 [
fPimpl->GetWindow(windowID) removeProperty : atomString.c_str()];
4009 assert(windowID >
fPimpl->GetRootWindowID() &&
4010 "SetDNDAware, parameter 'windowID' is not a valid window id");
4011 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
4012 "SetDNDAware, parameter 'windowID' is not a window");
4017 NSArray *
const supportedTypes = [NSArray arrayWithObjects : NSFilenamesPboardType, nil];
4021 [view registerForDraggedTypes : supportedTypes];
4028 assert(xaAtomAtom == 4 &&
"SetDNDAware, XA_ATOM is not defined");
4033 assert(
sizeof(
unsigned) == 4 &&
"SetDNDAware, sizeof(unsigned) must be 4");
4035 std::vector<unsigned> propertyData;
4036 propertyData.push_back(4);
4039 for (
unsigned i = 0; typeList[i]; ++i)
4040 propertyData.push_back(
unsigned(typeList[i]));
4043 [view setProperty :
"XdndAware" data : (
unsigned char *)&propertyData[0]
4044 size : propertyData.size() forType : xaAtomAtom
format : 32];
4052 if (windowID <= fPimpl->GetRootWindowID())
4055 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
4056 "IsDNDAware, windowID parameter is not a window");
4067 ::Warning(
"SetTypeList",
"Not implemented");
4091 fPimpl->IsRootWindow(winID) ? nil :
fPimpl->GetWindow(winID).fContentView,
4092 dragWinID, inputWinID,
x,
y, maxDepth);
4094 return testView.fID;
4099#pragma mark - Noops.
4224 NSPoint newCursorPosition = {};
4225 newCursorPosition.x = ix;
4226 newCursorPosition.y = iy;
4228 if (
fPimpl->GetRootWindowID() == winID) {
4232 assert(
fPimpl->GetDrawable(winID).fIsPixmap == NO &&
4233 "Warp, drawable is not a window");
4238 CGWarpMouseCursorPosition(NSPointToCGPoint(newCursorPosition));
4470#pragma mark - Details and aux. functions.
4475 return &
fPimpl->fX11EventTranslator;
4481 return &
fPimpl->fX11CommandBuffer;
4493 assert(
fCocoaDraw > 0 &&
"CocoaDrawOFF, was already off");
4507 if (!drawable.fIsPixmap) {
4508 Error(
"GetCurrentContext",
"TCanvas/TPad's internal error,"
4509 " selected drawable is not a pixmap!");
4513 return drawable.fContext;
4526 ProcessSerialNumber psn = {0, kCurrentProcess};
4528 const OSStatus res1 = TransformProcessType(&psn, kProcessTransformToForegroundApplication);
4533 if (res1 != noErr && res1 != paramErr) {
4534 Error(
"MakeProcessForeground",
"TransformProcessType failed with code %d",
int(res1));
4537#ifdef MAC_OS_X_VERSION_10_9
4539 [[NSApplication sharedApplication] activateIgnoringOtherApps : YES];
4541 const OSErr res2 = SetFrontProcess(&psn);
4542 if (res2 != noErr) {
4543 Error(
"MakeProcessForeground",
"SetFrontProcess failed with code %d", res2);
4550#ifdef MAC_OS_X_VERSION_10_9
4552 [[NSApplication sharedApplication] activateIgnoringOtherApps : YES];
4554 ProcessSerialNumber psn = {};
4556 OSErr res = GetCurrentProcess(&psn);
4558 Error(
"MakeProcessForeground",
"GetCurrentProcess failed with code %d", res);
4562 res = SetFrontProcess(&psn);
4564 Error(
"MapProcessForeground",
"SetFrontProcess failed with code %d", res);
4576 const std::map<std::string, Atom_t>::const_iterator it =
fNameToAtom.find(atomName);
4580 else if (addIfNotFound) {
4596 if (iconDirectoryPath) {
4598 if (fileName.
Get()) {
4601 NSString *cocoaStr = [NSString stringWithCString : fileName.
Get() encoding : NSASCIIStringEncoding];
4602 NSImage *image = [[[NSImage alloc] initWithContentsOfFile : cocoaStr] autorelease];
4603 [NSApp setApplicationIconImage : image];
Handle_t Region_t
Region handle.
Handle_t WinContext_t
Window drawing context.
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
int Int_t
Signed integer 4 bytes (int)
short Color_t
Color number (short)
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char)
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
float Float_t
Float 4 bytes (float)
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
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)
EDrawMode GetDrawModeW(WinContext_t wctxt) override
Returns window draw mode.
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 UpdateWindowW(WinContext_t wctxt, Int_t mode) override
Update specified window.
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.
void SetWMSizeHints(Window_t winID, UInt_t wMin, UInt_t hMin, UInt_t wMax, UInt_t hMax, UInt_t wInc, UInt_t hInc) override
Gives the window manager minimum and maximum size hints of the window "id".
void LookupString(Event_t *event, char *buf, Int_t buflen, UInt_t &keysym) override
Converts the keycode from the event structure to a key symbol (according to the modifiers specified i...
Cursor_t CreateCursor(ECursor cursor) override
Creates the specified cursor.
Window_t GetCurrentWindow() const override
pointer to the current internal window used in canvas graphics
void IntersectRegion(Region_t rega, Region_t regb, Region_t result) override
Computes the intersection of two regions.
std::unique_ptr< ROOT::MacOSX::Details::CocoaPrivate > fPimpl
!
void SetWindowName(Window_t wid, char *name) override
Sets the window name.
void Warp(Int_t ix, Int_t iy, Window_t wid) override
Sets the pointer position.
void IconifyWindow(Window_t wid) override
Iconifies the window "id".
Int_t ResizePixmap(Int_t wid, UInt_t w, UInt_t h) override
Resizes the specified pixmap "wid".
void * GetCurrentContext()
Window_t GetInputFocus() override
Returns the window id of the window having the input focus.
Colormap_t GetColormap() const override
Returns handle to colormap.
void DrawRectangle(Drawable_t wid, GContext_t gc, Int_t x, Int_t y, UInt_t w, UInt_t h) override
Draws rectangle outlines of [x,y] [x+w,y] [x+w,y+h] [x,y+h].
void FreeColor(Colormap_t cmap, ULong_t pixel) override
Frees color cell with specified pixel value.
Bool_t NeedRedraw(ULong_t tgwindow, Bool_t force) override
Notify the low level GUI layer ROOT requires "tgwindow" to be updated.
void DeleteGC(GContext_t gc) override
Deletes the specified GC "gc".
void ClearWindowW(WinContext_t wctxt) override
Clear specified window.
void SetDNDAware(Window_t, Atom_t *) override
Add XdndAware property and the list of drag and drop types to the Window win.
Int_t AddPixmap(ULong_t pixid, UInt_t w, UInt_t h) override
Registers a pixmap created by TGLManager as a ROOT pixmap.
void DestroyWindow(Window_t wid) override
Destroys the window "id" as well as all of its subwindows.
void ShapeCombineMask(Window_t wid, Int_t x, Int_t y, Pixmap_t mask) override
The Non-rectangular Window Shape Extension adds non-rectangular windows to the System.
void GetPlanes(Int_t &nplanes) override
Returns the maximum number of planes.
void UpdateWindow(Int_t mode) override
Updates or synchronises client and server once (not permanent).
Int_t SupportsExtension(const char *extensionName) const override
Returns 1 if window system server supports extension given by the argument, returns 0 in case extensi...
Int_t GetScreen() const override
Returns screen number.
Bool_t HasTTFonts() const override
Returns True when TrueType fonts are used.
void SetWindowBackground(Window_t wid, ULong_t color) override
Sets the background of the window "id" to the specified color value "color".
Bool_t ReadPictureDataFromFile(const char *filename, char ***ret_data) override
Reads picture data from file "filename" and store it in "ret_data".
void DestroyRegion(Region_t reg) override
Destroys the region "reg".
void GetRGB(Int_t index, Float_t &r, Float_t &g, Float_t &b) override
Returns RGB values for color "index".
void CopyPixmapW(WinContext_t wctxt, Int_t wid, Int_t xpos, Int_t ypos) override
Copy pixmap to specified window.
unsigned char * GetColorBits(Drawable_t wid, Int_t x, Int_t y, UInt_t w, UInt_t h) override
Returns an array of pixels created from a part of drawable (defined by x, y, w, h) in format:
void SendEvent(Window_t wid, Event_t *ev) override
Specifies the event "ev" is to be sent to the window "id".
Int_t KeysymToKeycode(UInt_t keysym) override
Converts the "keysym" to the appropriate keycode.
void QueryColor(Colormap_t cmap, ColorStruct_t &color) override
Returns the current RGB value for the pixel in the "color" structure.
void MoveWindow(Int_t wid, Int_t x, Int_t y) override
Moves the window "wid" to the specified x and y coordinates.
void SelectInput(Window_t wid, UInt_t evmask) override
Defines which input events the window is interested in.
void ClearWindow() override
Clears the entire area of the current window.
void SetClipRectangles(GContext_t gc, Int_t x, Int_t y, Rectangle_t *recs, Int_t n) override
Sets clipping rectangles in graphics context.
Bool_t CreatePictureFromData(Drawable_t wid, char **data, Pixmap_t &pict, Pixmap_t &pict_mask, PictureAttributes_t &attr) override
Creates a picture pict from data in bitmap format.
void DrawString(Drawable_t wid, GContext_t gc, Int_t x, Int_t y, const char *s, Int_t len) override
Each character image, as defined by the font in the GC, is treated as an additional mask for a fill o...
std::vector< std::string > fAtomToName
void XorRegion(Region_t rega, Region_t regb, Region_t result) override
Calculates the difference between the union and intersection of two regions.
void SetTextMagnitude(Float_t mgn) override
Sets the current text magnification factor to "mgn".
FontStruct_t GetFontStruct(FontH_t fh) override
Retrieves the associated font structure of the font specified font handle "fh".
void SetMWMHints(Window_t winID, UInt_t value, UInt_t decorators, UInt_t inputMode) override
Sets decoration style.
Handle_t GetCurrentOpenGLContext() override
Asks OpenGL subsystem about the current OpenGL context.
Bool_t MakeOpenGLContextCurrent(Handle_t ctx, Window_t windowID) override
Makes context ctx current OpenGL context.
void SetPrimarySelectionOwner(Window_t wid) override
Makes the window "id" the current owner of the primary selection.
void GetGCValues(GContext_t gc, GCValues_t &gval) override
Returns the components specified by the mask in "gval" for the specified GC "gc" (see also the GCValu...
void SetRGB(Int_t cindex, Float_t r, Float_t g, Float_t b) override
Sets color intensities the specified color index "cindex".
void MapRaised(Window_t wid) override
Maps the window "id" and all of its subwindows that have had map requests on the screen and put this ...
Pixmap_t CreatePixmapFromData(unsigned char *bits, UInt_t width, UInt_t height) override
create pixmap from RGB data.
void SetClipOFF(Int_t wid) override
Turns off the clipping for the window "wid".
void GetWindowAttributes(Window_t wid, WindowAttributes_t &attr) override
The WindowAttributes_t structure is set to default.
Int_t RequestString(Int_t x, Int_t y, char *text) override
Requests string: text is displayed and can be edited with Emacs-like keybinding.
void ChangeActivePointerGrab(Window_t, UInt_t, Cursor_t) override
Changes the specified dynamic parameters if the pointer is actively grabbed by the client and if the ...
Bool_t CheckEvent(Window_t wid, EGEventType type, Event_t &ev) override
Check if there is for window "id" an event of type "type".
Int_t OpenDisplay(const char *displayName) override
Opens connection to display server (if such a thing exist on the current platform).
static Atom_t fgDeleteWindowAtom
void QueryPointer(Int_t &x, Int_t &y) override
Returns the pointer position.
void SetDrawMode(EDrawMode mode) override
Sets the drawing mode.
Bool_t ParseColor(Colormap_t cmap, const char *cname, ColorStruct_t &color) override
Looks up the string name of a color "cname" with respect to the screen associated with the specified ...
void GetImageSize(Drawable_t wid, UInt_t &width, UInt_t &height) override
Returns the width and height of the image id.
Int_t InitWindow(ULong_t window) override
Creates a new window and return window number.
void CloseDisplay() override
Closes connection to display server and destroys all windows.
void ClearArea(Window_t wid, Int_t x, Int_t y, UInt_t w, UInt_t h) override
Paints a rectangular area in the specified window "id" according to the specified dimensions with the...
void DeletePixmap(Pixmap_t pixmapID) override
Explicitly deletes the pixmap resource "pmap".
void MapSubwindows(Window_t wid) override
Maps all subwindows for the specified window "id" in top-to-bottom stacking order.
void ReparentWindow(Window_t wid, Window_t pid, Int_t x, Int_t y) override
If the specified window is mapped, ReparentWindow automatically performs an UnmapWindow request on it...
Window_t GetDefaultRootWindow() const override
Returns handle to the default root window created when calling XOpenDisplay().
void SetDoubleBuffer(Int_t wid, Int_t mode) override
Sets the double buffer on/off on the window "wid".
void GetGeometry(Int_t wid, Int_t &x, Int_t &y, UInt_t &w, UInt_t &h) override
Returns position and size of window "wid".
WinContext_t GetWindowContext(Int_t wid) override
Get window drawing context Should remain valid until window exists.
void RemoveWindow(ULong_t qwid) override
Removes the created by Qt window "qwid".
Bool_t CreatePictureFromFile(Drawable_t wid, const char *filename, Pixmap_t &pict, Pixmap_t &pict_mask, PictureAttributes_t &attr) override
Creates a picture pict from data in file "filename".
void DrawStringAux(Drawable_t wid, const GCValues_t &gc, Int_t x, Int_t y, const char *s, Int_t len)
void GetPasteBuffer(Window_t wid, Atom_t atom, TString &text, Int_t &nchar, Bool_t del) override
Gets contents of the paste buffer "atom" into the string "text".
Drawable_t CreateImage(UInt_t width, UInt_t height) override
Allocates the memory needed for an drawable.
void Update(Int_t mode) override
Flushes (mode = 0, default) or synchronizes (mode = 1) X output buffer.
Atom_t InternAtom(const char *atom_name, Bool_t only_if_exist) override
Returns the atom identifier associated with the specified "atom_name" string.
Handle_t CreateOpenGLContext(Window_t windowID, Handle_t sharedContext) override
Creates OpenGL context for window "windowID".
void ChangeWindowAttributes(Window_t wid, SetWindowAttributes_t *attr) override
Changes the attributes of the specified window "id" according the values provided in "attr".
GContext_t CreateGC(Drawable_t wid, GCValues_t *gval) override
Creates a graphics context using the provided GCValues_t *gval structure.
Int_t AddWindow(ULong_t qwid, UInt_t w, UInt_t h) override
Registers a window created by Qt as a ROOT window.
void UnmapWindow(Window_t wid) override
Unmaps the specified window "id".
void ClearAreaAux(Window_t wid, Int_t x, Int_t y, UInt_t w, UInt_t h)
void GrabButton(Window_t wid, EMouseButton button, UInt_t modifier, UInt_t evmask, Window_t confine, Cursor_t cursor, Bool_t grab=kTRUE) override
Establishes a passive grab on a certain mouse button.
Bool_t EmptyRegion(Region_t reg) override
Returns kTRUE if the region reg is empty.
void ConvertSelection(Window_t, Atom_t &, Atom_t &, Atom_t &, Time_t &) override
Requests that the specified selection be converted to the specified target type.
void ReconfigureDisplay()
void RaiseWindow(Window_t wid) override
Raises the specified window to the top of the stack so that no sibling window obscures it.
void DrawSegments(Drawable_t wid, GContext_t gc, Segment_t *segments, Int_t nSegments) override
Draws multiple line segments.
ROOT::MacOSX::X11::Rectangle GetDisplayGeometry() const
void MapWindow(Window_t wid) override
Maps the window "id" and all of its subwindows that have had map requests.
void SetWMSize(Window_t winID, UInt_t w, UInt_t h) override
Tells window manager the desired size of window "id".
WinContext_t GetSelectedContext()
void SetDashes(GContext_t gc, Int_t offset, const char *dash_list, Int_t n) override
Sets the dash-offset and dash-list attributes for dashed line styles in the specified GC.
void SetClipRegion(Int_t wid, Int_t x, Int_t y, UInt_t w, UInt_t h) override
Sets clipping region for the window "wid".
Bool_t PointInRegion(Int_t x, Int_t y, Region_t reg) override
Returns kTRUE if the point [x, y] is contained in the region reg.
Window_t FindRWindow(Window_t win, Window_t dragwin, Window_t input, int x, int y, int maxd) override
Recursively search in the children of Window for a Window which is at location x, y and is DND aware,...
void RescaleWindow(Int_t wid, UInt_t w, UInt_t h) override
Rescales the window "wid".
char ** ListFonts(const char *fontname, Int_t max, Int_t &count) override
Returns list of font names matching fontname regexp, like "-*-times-*".
void WritePixmap(Int_t wid, UInt_t w, UInt_t h, char *pxname) override
Writes the pixmap "wid" in the bitmap file "pxname".
void CopyGC(GContext_t org, GContext_t dest, Mask_t mask) override
Copies the specified components from the source GC "org" to the destination GC "dest".
ROOT::MacOSX::X11::EventTranslator * GetEventTranslator() const
void ReparentChild(Window_t wid, Window_t pid, Int_t x, Int_t y)
void DrawSegmentsAux(Drawable_t wid, const GCValues_t &gcVals, const Segment_t *segments, Int_t nSegments)
void GrabKey(Window_t wid, Int_t keycode, UInt_t modifier, Bool_t grab=kTRUE) override
Establishes a passive grab on the keyboard.
void DeletePictureData(void *data) override
Delete picture data created by the function ReadPictureDataFromFile.
Int_t EventsPending() override
Returns the number of events that have been received from the X server but have not been removed from...
void SelectWindow(Int_t wid) override
Selects the window "wid" to which subsequent output is directed.
void UnionRectWithRegion(Rectangle_t *rect, Region_t src, Region_t dest) override
Updates the destination region from a union of the specified rectangle and the specified source regio...
Display_t GetDisplay() const override
Returns handle to display (might be useful in some cases where direct X11 manipulation outside of TVi...
void FlushOpenGLBuffer(Handle_t ctxID) override
Flushes OpenGL buffer.
void NextEvent(Event_t &event) override
The "event" is set to default event.
void SetIconName(Window_t wid, char *name) override
Sets the window icon name.
Bool_t Init(void *display) override
Initializes the X system.
void DeletePixmapAux(Pixmap_t pixmapID)
void ClosePixmap() override
Deletes current pixmap.
Pixmap_t CreateBitmap(Drawable_t wid, const char *bitmap, UInt_t width, UInt_t height) override
Creates a bitmap (i.e.
void SetKeyAutoRepeat(Bool_t on=kTRUE) override
Turns key auto repeat on (kTRUE) or off (kFALSE).
void FreeFontNames(char **fontlist) override
Frees the specified the array of strings "fontlist".
void UnionRegion(Region_t rega, Region_t regb, Region_t result) override
Computes the union of two regions.
Window_t GetPrimarySelectionOwner() override
Returns the window id of the current owner of the primary selection.
void SetWMPosition(Window_t winID, Int_t x, Int_t y) override
Tells the window manager the desired position [x,y] of window "id".
void SetWMTransientHint(Window_t winID, Window_t mainWinID) override
Tells window manager that the window "id" is a transient window of the window "main_id".
void SetIconPixmap(Window_t wid, Pixmap_t pix) override
Sets the icon name pixmap.
Pixmap_t ReadGIF(Int_t x0, Int_t y0, const char *file, Window_t wid) override
If id is NULL - loads the specified gif file at position [x0,y0] in the current window.
void LowerWindow(Window_t wid) override
Lowers the specified window "id" to the bottom of the stack so that it does not obscure any sibling w...
Bool_t SetSelectionOwner(Window_t windowID, Atom_t &selectionID) override
Changes the owner and last-change time for the specified selection.
Handle_t GetNativeEvent() const override
Returns the current native event handle.
void SubtractRegion(Region_t rega, Region_t regb, Region_t result) override
Subtracts regb from rega and stores the results in result.
void FillRectangle(Drawable_t wid, GContext_t gc, Int_t x, Int_t y, UInt_t w, UInt_t h) override
Fills the specified rectangle defined by [x,y] [x+w,y] [x+w,y+h] [x,y+h].
Region_t CreateRegion() override
Creates a new empty region.
void SelectPixmap(Int_t qpixid) override
Selects the pixmap "qpixid".
void ConvertPrimarySelection(Window_t wid, Atom_t clipboard, Time_t when) override
Causes a SelectionRequest event to be sent to the current primary selection owner.
void GetFontProperties(FontStruct_t font, Int_t &max_ascent, Int_t &max_descent) override
Returns the font properties.
void DrawLine(Drawable_t wid, GContext_t gc, Int_t x1, Int_t y1, Int_t x2, Int_t y2) override
Uses the components of the specified GC to draw a line between the specified set of points (x1,...
void ChangeProperty(Window_t wid, Atom_t property, Atom_t type, UChar_t *data, Int_t len) override
Alters the property for the specified window and causes the X server to generate a PropertyNotify eve...
void SetTypeList(Window_t win, Atom_t prop, Atom_t *typelist) override
Add the list of drag and drop types to the Window win.
Region_t PolygonRegion(Point_t *points, Int_t np, Bool_t winding) override
Returns a region for the polygon defined by the points array.
Int_t GetDoubleBuffer(Int_t wid) override
Queries the double buffer value for the window "wid".
void SetClassHints(Window_t wid, char *className, char *resourceName) override
Sets the windows class and resource name.
Window_t CreateWindow(Window_t parent, Int_t x, Int_t y, UInt_t w, UInt_t h, UInt_t border, Int_t depth, UInt_t clss, void *visual, SetWindowAttributes_t *attr, UInt_t wtype) override
Creates an unmapped subwindow for a specified parent window and returns the created window.
Int_t RequestLocator(Int_t mode, Int_t ctyp, Int_t &x, Int_t &y) override
Requests Locator position.
void SetInputFocus(Window_t wid) override
Changes the input focus to specified window "id".
Visual_t GetVisual() const override
Returns handle to visual.
void MoveResizeWindow(Window_t wid, Int_t x, Int_t y, UInt_t w, UInt_t h) override
Changes the size and location of the specified window "id" without raising it.
void FillPolygonAux(Window_t wid, const GCValues_t &gcVals, const Point_t *polygon, Int_t nPoints)
Int_t GetDepth() const override
Returns depth of screen (number of bit planes).
FontStruct_t LoadQueryFont(const char *font_name) override
Provides the most common way for accessing a font: opens (loads) the specified font and returns a poi...
bool MakeProcessForeground()
Window_t CreateOpenGLWindow(Window_t parentID, UInt_t width, UInt_t height, const std::vector< std::pair< UInt_t, Int_t > > &format) override
Create window with special pixel format. Noop everywhere except Cocoa.
std::map< Atom_t, Window_t > fSelectionOwners
void DeleteProperty(Window_t, Atom_t &) override
Deletes the specified property only if the property was defined on the specified window and causes th...
std::map< std::string, Atom_t > fNameToAtom
UInt_t ExecCommand(TGWin32Command *code) override
Executes the command "code" coming from the other threads (Win32)
void SetCursor(Window_t wid, Cursor_t curid) override
Sets the cursor "curid" to be used when the pointer is in the window "id".
void SetForeground(GContext_t gc, ULong_t foreground) override
Sets the foreground color for the specified GC (shortcut for ChangeGC with only foreground mask set).
FontH_t GetFontHandle(FontStruct_t fs) override
Returns the font handle of the specified font structure "fs".
void DeleteImage(Drawable_t img) override
Deallocates the memory associated with the image img.
Drawable_t fSelectedDrawable
void SetDrawModeW(WinContext_t wctxt, EDrawMode mode) override
Set window draw mode.
void CloseWindow() override
Deletes current window.
void FillPolygon(Window_t wid, GContext_t gc, Point_t *polygon, Int_t nPoints) override
Fills the region closed by the specified path.
ROOT::MacOSX::X11::Rectangle fDisplayRect
void WMDeleteNotify(Window_t wid) override
Tells WM to send message when window is closed via WM.
void PutImage(Drawable_t wid, GContext_t gc, Drawable_t img, Int_t dx, Int_t dy, Int_t x, Int_t y, UInt_t w, UInt_t h) override
Combines an image with a rectangle of the specified drawable.
void CopyArea(Drawable_t src, Drawable_t dst, GContext_t gc, Int_t srcX, Int_t srcY, UInt_t width, UInt_t height, Int_t dstX, Int_t dstY) override
Combines the specified rectangle of "src" with the specified rectangle of "dest" according to the "gc...
void Sync(Int_t mode) override
Set synchronisation on or off.
ULong_t GetPixel(Color_t cindex) override
Returns pixel value associated to specified ROOT color number "cindex".
std::map< Atom_t, Window_t >::iterator selection_iterator
const char * DisplayName(const char *) override
Returns hostname on which the display is opened.
void ChangeProperties(Window_t wid, Atom_t property, Atom_t type, Int_t format, UChar_t *data, Int_t len) override
Alters the property for the specified window and causes the X server to generate a PropertyNotify eve...
bool CocoaInitialized() const
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
static const TString & GetIconPath()
Get the icon path in the installation. Static utility function.
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
Semi-Abstract base class defining a generic interface to the underlying, low level,...
static void ConfigureColorsHandler()
Protected method to configure handler when color is modified and need to be updated system dependent ...
ROOT::MacOSX::Util::CFScopeGuard< CGImageRef > fImage
QuartzImage * fBackgroundPixmap
unsigned long fBackgroundPixel
NSView< X11Window > * fContentView
QuartzWindow * fMainWindow
QuartzView * fContentView
QuartzImage * fShapeCombineMask
NSOpenGLContext * fOpenGLContext
NSOpenGLPixelFormat * pixelFormat()
bool GLViewIsValidDrawable(ROOTOpenGLView *glView)
Int_t MapKeySymToKeyCode(Int_t keySym)
bool ViewIsHtmlViewFrame(NSView< X11Window > *view, bool checkParent)
int GlobalYCocoaToROOT(CGFloat yCocoa)
void PixelToRGB(Pixel_t pixelColor, CGFloat *rgb)
void MapUnicharToKeySym(unichar key, char *buf, Int_t len, UInt_t &rootKeySym)
void FillPixmapBuffer(const unsigned char *bitmap, unsigned width, unsigned height, ULong_t foregroundPixel, ULong_t backgroundPixel, unsigned depth, unsigned char *imageData)
NSPoint TranslateToScreen(NSView< X11Window > *from, NSPoint point)
NSView< X11Window > * FindDNDAwareViewInPoint(NSView *parentView, Window_t dragWinID, Window_t inputWinID, Int_t x, Int_t y, Int_t maxDepth)
QuartzWindow * FindWindowInPoint(Int_t x, Int_t y)
int GlobalXCocoaToROOT(CGFloat xCocoa)
void WindowLostFocus(Window_t winID)
int LocalYROOTToCocoa(NSView< X11Window > *parentView, CGFloat yROOT)
bool ParseXLFDName(const std::string &xlfdName, XLFDName &dst)
NSPoint TranslateCoordinates(NSView< X11Window > *fromView, NSView< X11Window > *toView, NSPoint sourcePoint)
QuartzWindow * CreateTopLevelWindow(Int_t x, Int_t y, UInt_t w, UInt_t h, UInt_t border, Int_t depth, UInt_t clss, void *visual, SetWindowAttributes_t *attr, UInt_t)
int GlobalXROOTToCocoa(CGFloat xROOT)
QuartzView * CreateChildView(QuartzView *parent, Int_t x, Int_t y, UInt_t w, UInt_t h, UInt_t border, Int_t depth, UInt_t clss, void *visual, SetWindowAttributes_t *attr, UInt_t wtype)
void GetRootWindowAttributes(WindowAttributes_t *attr)
void InitWithPredefinedAtoms(std::map< std::string, Atom_t > &nameToAtom, std::vector< std::string > &atomNames)
bool ViewIsTextViewFrame(NSView< X11Window > *view, bool checkParent)
NSPoint TranslateFromScreen(NSPoint point, NSView< X11Window > *to)
NSUInteger GetCocoaKeyModifiersFromROOTKeyModifiers(UInt_t rootKeyModifiers)
void DrawTextLineNoKerning(CGContextRef ctx, CTFontRef font, const std::vector< UniChar > &text, Int_t x, Int_t y)
void DrawPattern(void *data, CGContextRef ctx)
bool SetFillPattern(CGContextRef ctx, const unsigned *patternIndex, Color_t attrFillColor)
ULong_t fPixel
color pixel value (index in color table)
UShort_t fRed
red component (0..65535)
UShort_t fGreen
green component (0..65535)
UShort_t fBlue
blue component (0..65535)
EGEventType fType
of event (see EGEventType)
Window_t fWindow
window reported event is relative to
Longptr_t fUser[5]
5 longs can be used by client message events NOTE: only [0], [1] and [2] may be used.
Graphics context structure.
ULong_t fBackground
background pixel
Int_t fFillRule
kEvenOddRule, kWindingRule
Pixmap_t fClipMask
bitmap clipping; other calls for rects
Int_t fDashOffset
patterned/dashed line information
Int_t fClipXOrigin
origin for clipping
Int_t fLineWidth
line width
Pixmap_t fStipple
stipple 1 plane pixmap for stippling
Mask_t fMask
bit mask specifying which fields are valid
Int_t fLineStyle
kLineSolid, kLineOnOffDash, kLineDoubleDash
Pixmap_t fTile
tile pixmap for tiling operations
Bool_t fGraphicsExposures
boolean, should exposures be generated
Int_t fJoinStyle
kJoinMiter, kJoinRound, kJoinBevel
Char_t fDashes[8]
dash pattern list (dash length per byte)
ULong_t fForeground
foreground pixel
ULong_t fPlaneMask
plane mask
Int_t fFillStyle
kFillSolid, kFillTiled, kFillStippled, kFillOpaeueStippled
FontH_t fFont
default text font for text operations
Int_t fTsXOrigin
offset for tile or stipple operations
EGraphicsFunction fFunction
logical operation
Int_t fDashLen
number of dashes in fDashes
Int_t fCapStyle
kCapNotLast, kCapButt, kCapRound, kCapProjecting
Int_t fArcMode
kArcChord, kArcPieSlice
Int_t fSubwindowMode
kClipByChildren, kIncludeInferiors
Point structure (maps to the X11 XPoint structure)
Rectangle structure (maps to the X11 XRectangle structure)
Used for drawing line segments (maps to the X11 XSegments structure)
Attributes that can be used when creating or changing a window.
Window attributes that can be inquired.