20#include "TGLIncludes.h"
46#include <ApplicationServices/ApplicationServices.h>
47#include <OpenGL/OpenGL.h>
48#include <Cocoa/Cocoa.h>
88#pragma mark - Display configuration management.
91void DisplayReconfigurationCallback(CGDirectDisplayID , CGDisplayChangeSummaryFlags flags,
void * )
93 if (flags & kCGDisplayBeginConfigurationFlag)
96 if (flags & kCGDisplayDesktopShapeChangedFlag) {
97 assert(
dynamic_cast<TGCocoa *
>(
gVirtualX) != 0 &&
"DisplayReconfigurationCallback, gVirtualX"
98 " is either null or has a wrong type");
104#pragma mark - Aux. functions called from GUI-rendering part.
109 assert(ctx != 0 &&
"SetStrokeForegroundColorFromX11Context, parameter 'ctx' is null");
115 ::Warning(
"SetStrokeForegroundColorFromX11Context",
116 "x11 context does not have line color information");
118 CGContextSetRGBStrokeColor(ctx, rgb[0], rgb[1], rgb[2], 1.);
125 assert(ctx != 0 &&
"SetStrokeDashFromX11Context, ctx parameter is null");
127 SetStrokeForegroundColorFromX11Context(ctx, gcVals);
129 static const std::size_t maxLength =
sizeof gcVals.
fDashes /
sizeof gcVals.
fDashes[0];
130 assert(maxLength >= std::size_t(gcVals.
fDashLen) &&
131 "SetStrokeDashFromX11Context, x11 context has bad dash length > sizeof(fDashes)");
133 CGFloat dashes[maxLength] = {};
144 ::Warning(
"SetStrokeDoubleDashFromX11Context",
"Not implemented yet, kick tpochep!");
152 assert(ctx != 0 &&
"SetStrokeParametersFromX11Context, parameter 'ctx' is null");
156 CGContextSetLineWidth(ctx, gcVals.
fLineWidth);
158 CGContextSetLineWidth(ctx, 1.);
160 CGContextSetLineDash(ctx, 0., 0, 0);
164 SetStrokeForegroundColorFromX11Context(ctx, gcVals);
166 SetStrokeDashFromX11Context(ctx, gcVals);
168 SetStrokeDoubleDashFromX11Context(ctx ,gcVals);
170 ::Warning(
"SetStrokeParametersFromX11Context",
"line style bit is set,"
171 " but line style is unknown");
172 SetStrokeForegroundColorFromX11Context(ctx, gcVals);
175 SetStrokeForegroundColorFromX11Context(ctx, gcVals);
183 assert(ctx != 0 &&
"SetFilledAreaColorFromX11Context, parameter 'ctx' is null");
189 ::Warning(
"SetFilledAreaColorFromX11Context",
"no fill color found in x11 context");
191 CGContextSetRGBFillColor(ctx, rgb[0], rgb[1], rgb[2], 1.);
194struct PatternContext {
197 : fMask(
mask), fFillStyle(fillStyle), fForeground(
foreground), fBackground(background), fPhase(phase)
199 fImage = [image retain];
206 PatternContext(
const PatternContext &) =
delete;
207 PatternContext(PatternContext &&) =
delete;
208 PatternContext &
operator = (
const PatternContext &) =
delete;
209 PatternContext &
operator = (PatternContext &&) =
delete;
213 if (image != fImage) {
215 fImage = [image retain];
220 Int_t fFillStyle = 0;
235bool HasFillTiledStyle(
const GCValues_t &gcVals)
247bool HasFillStippledStyle(
const GCValues_t &gcVals)
259bool HasFillOpaqueStippledStyle(
const GCValues_t &gcVals)
267 assert(patternImage != nil &&
"DrawTile, parameter 'patternImage' is nil");
268 assert(ctx != 0 &&
"DrawTile, ctx parameter is null");
270 const CGRect patternRect = CGRectMake(0, 0, patternImage.fWidth, patternImage.fHeight);
271 if ([patternImage isKindOfClass : [
QuartzImage class]]) {
272 CGContextDrawImage(ctx, patternRect, ((
QuartzImage *)patternImage).fImage);
273 }
else if ([patternImage isKindOfClass : [
QuartzPixmap class]]){
275 assert(imageFromPixmap.Get() != 0 &&
"DrawTile, createImageFromPixmap failed");
276 CGContextDrawImage(ctx, patternRect, imageFromPixmap.Get());
278 assert(0 &&
"DrawTile, pattern is neither a QuartzImage, nor a QuartzPixmap");
288 assert(info != 0 &&
"DrawPattern, parameter 'info' is null");
289 assert(ctx != 0 &&
"DrawPattern, parameter 'ctx' is null");
291 const PatternContext *
const patternContext = (PatternContext *)info;
293 const Int_t fillStyle = patternContext->fFillStyle;
296 assert(patternImage != nil &&
"DrawPattern, pattern (stipple) image is nil");
297 const CGRect patternRect = CGRectMake(0, 0, patternImage.fWidth, patternImage.fHeight);
299 if (HasFillTiledStyle(
mask, fillStyle)) {
300 DrawTile(patternImage, ctx);
301 }
else if (HasFillStippledStyle(
mask, fillStyle) || HasFillOpaqueStippledStyle(
mask, fillStyle)) {
302 assert([patternImage isKindOfClass : [
QuartzImage class]] &&
303 "DrawPattern, stipple must be a QuartzImage object");
305 assert(image.
fIsStippleMask == YES &&
"DrawPattern, image is not a stipple mask");
309 if (HasFillOpaqueStippledStyle(
mask,fillStyle)) {
312 "DrawPattern, fill style is FillOpaqueStippled, but background color is not set in a context");
314 CGContextSetRGBFillColor(ctx, rgb[0], rgb[1], rgb[2], 1.);
315 CGContextFillRect(ctx, patternRect);
321 CGContextSetRGBFillColor(ctx, rgb[0], rgb[1], rgb[2], 1.);
322 CGContextClipToMask(ctx, patternRect, image.
fImage);
323 CGContextFillRect(ctx, patternRect);
326 DrawTile(patternImage, ctx);
331void PatternRelease(
void *info)
333 delete static_cast<PatternContext *
>(info);
343 assert(ctx != 0 &&
"SetFillPattern, parameter 'ctx' is null");
344 assert(patternContext != 0 &&
"SetFillPattern, parameter 'patternContext' is null");
345 assert(patternContext->fImage != nil &&
"SetFillPattern, pattern image is nil");
348 CGContextSetFillColorSpace(ctx, patternColorSpace.Get());
350 CGPatternCallbacks callbacks = {};
352 callbacks.releaseInfo = PatternRelease;
353 const CGRect patternRect = CGRectMake(0, 0, patternContext->fImage.fWidth, patternContext->fImage.fHeight);
355 patternContext->fImage.fWidth, patternContext->fImage.fHeight,
356 kCGPatternTilingNoDistortion,
true, &callbacks));
357 const CGFloat alpha = 1.;
358 CGContextSetFillPattern(ctx, pattern.Get(), &alpha);
359 CGContextSetPatternPhase(ctx, patternContext->fPhase);
365 assert(
child != nil &&
"ParentRendersToChild, parameter 'child' is nil");
369class ViewFixer final {
374 const auto origin = viewToFix.frame.origin;
376 widToFix = viewToFix.
fID;
377 if ((context = viewToFix.
fContext)) {
378 CGContextSaveGState(context);
379 CGContextTranslateCTM(context, origin.x, origin.y);
386 CGContextRestoreGState(context);
388 ViewFixer(
const ViewFixer &rhs) =
delete;
389 ViewFixer &
operator = (
const ViewFixer &) =
delete;
396bool IsNonPrintableAsciiCharacter(UniChar
c)
398 if (
c == 9 || (
c >= 32 &&
c < 127))
405void FixAscii(std::vector<UniChar> &
text)
422 std::replace(
text.begin(),
text.end(), UniChar(16), UniChar(
' '));
425 text.erase(std::remove_if(
text.begin(),
text.end(), IsNonPrintableAsciiCharacter),
text.end());
436 : fSelectedDrawable(0),
440 fForegroundProcess(false),
442 fDisplayShapeChanged(true)
445 "TGCocoa, gSystem is eihter null or has a wrong type");
456 CGDisplayRegisterReconfigurationCallback (DisplayReconfigurationCallback, 0);
462 fSelectedDrawable(0),
466 fForegroundProcess(false),
468 fDisplayShapeChanged(true)
471 "TGCocoa, gSystem is eihter null or has a wrong type");
482 CGDisplayRegisterReconfigurationCallback (DisplayReconfigurationCallback, 0);
489 CGDisplayRemoveReconfigurationCallback (DisplayReconfigurationCallback, 0);
508 if (CGMainDisplayID() == kCGNullDirectDisplay)
561 return CGDisplayScreenSize(CGMainDisplayID()).width;
572 NSArray *
const screens = [NSScreen screens];
573 assert(screens != nil &&
"screens array is nil");
575 NSScreen *
const mainScreen = [screens objectAtIndex : 0];
576 assert(mainScreen != nil &&
"screen with index 0 is nil");
578 return NSBitsPerPixelFromDepth([mainScreen depth]);
587 assert(
gClient != 0 &&
"Update, gClient is null");
589 }
else if (
mode > 0) {
608 NSArray *
const screens = [NSScreen screens];
609 assert(screens != nil && screens.count != 0 &&
"GetDisplayGeometry, no screens found");
611 NSRect frame = [(NSScreen *)[screens objectAtIndex : 0] frame];
612 CGFloat xMin = frame.origin.x, xMax = xMin + frame.size.width;
613 CGFloat yMin = frame.origin.y, yMax = yMin + frame.size.height;
615 for (NSUInteger i = 1,
e = screens.count; i <
e; ++i) {
616 frame = [(NSScreen *)[screens objectAtIndex : i] frame];
617 xMin = std::min(xMin, frame.origin.x);
618 xMax = std::max(xMax, frame.origin.x + frame.size.width);
619 yMin = std::min(yMin, frame.origin.y);
620 yMax = std::max(yMax, frame.origin.y + frame.size.height);
634#pragma mark - Window management part.
640 return fPimpl->GetRootWindowID();
656 assert(parentID != 0 &&
"InitWindow, parameter 'parentID' is 0");
660 if (
fPimpl->IsRootWindow(parentID))
663 [
fPimpl->GetWindow(parentID) getAttributes : &
attr];
665 return CreateWindow(parentID, 0, 0,
attr.fWidth,
attr.fHeight, 0,
attr.fDepth,
attr.fClass, 0, 0, 0);
689 "ClearWindow, fSelectedDrawable is invalid");
692 if (drawable.fIsPixmap) {
698 assert(pixmapCtx != 0 &&
"ClearWindow, pixmap's context is null");
703 CGContextClearRect(pixmapCtx, CGRectMake(0, 0, drawable.fWidth, drawable.fHeight));
720 if (windowID < 0 || fPimpl->IsRootWindow(windowID)) {
734 h = drawable.fHeight;
736 if (!drawable.fIsPixmap) {
738 NSPoint srcPoint = {};
741 NSView<X11Window> *
const view = window.fContentView.fParentView ? window.fContentView.fParentView : window.fContentView;
758 assert(!
fPimpl->IsRootWindow(windowID) &&
"MoveWindow, called for root window");
763 [
fPimpl->GetWindow(windowID) setX :
x Y :
y];
783 assert(!
fPimpl->IsRootWindow(windowID) &&
784 "ResizeWindow, parameter 'windowID' is a root window's id");
789 if (window.fBackBuffer) {
809 "UpdateWindow, fSelectedDrawable is not a valid window id");
818 assert([window.fContentView isKindOfClass : [
QuartzView class]] &&
"UpdateWindow, content view is not a QuartzView");
821 if (dstView.fIsOverlapped)
824 if (dstView.fContext) {
826 const X11::Rectangle copyArea(0, 0, pixmap.fWidth, pixmap.fHeight);
827 [dstView copy : pixmap area : copyArea withMask : nil clipOrigin :
X11::Point() toPoint :
X11::Point()];
830 fPimpl->fX11CommandBuffer.AddUpdateWindow(dstView);
876 if (
fPimpl->IsRootWindow(parentID)) {
879 depth, clss, visual,
attr, wtype);
885 [newWindow setAcceptsMouseMovedEvents : YES];
891 assert([parentWin.fContentView isKindOfClass : [
QuartzView class]] &&
892 "CreateWindow, parent view must be QuartzView");
896 x,
y,
w,
h, border, depth, clss, visual,
attr, wtype);
900 [parentWin addChild : childView];
930 BOOL needFocusChange = NO;
935 fPimpl->fX11EventTranslator.CheckUnmappedView(
wid);
937 assert(
fPimpl->GetDrawable(
wid).fIsPixmap == NO &&
938 "DestroyWindow, can not be called for QuartzPixmap or QuartzImage object");
941 if (
fPimpl->fX11CommandBuffer.BufferSize())
942 fPimpl->fX11CommandBuffer.RemoveOperationsForDrawable(
wid);
945 if ((needFocusChange = window == window.fQuartzWindow && window.fQuartzWindow.fHasFocus))
946 window.fHasFocus = NO;
950 fPimpl->fX11EventTranslator.GenerateDestroyNotify(
wid);
981 assert(
fPimpl->GetDrawable(
wid).fIsPixmap == NO &&
982 "DestroySubwindows, can not be called for QuartzPixmap or QuartzImage object");
1019 assert(!
fPimpl->IsRootWindow(
wid) &&
"ChangeWindowAttributes, called for root window");
1020 assert(
attr != 0 &&
"ChangeWindowAttributes, parameter 'attr' is null");
1037 if (windowID <= fPimpl->GetRootWindowID())
1042 window.fEventMask = eventMask;
1051 assert(!
fPimpl->IsRootWindow(
wid) &&
"ReparentChild, can not re-parent root window");
1056 if (
fPimpl->IsRootWindow(pid)) {
1059 [view removeFromSuperview];
1060 view.fParentView = nil;
1062 NSRect frame = view.frame;
1063 frame.origin = NSPoint();
1065 NSUInteger styleMask = kClosableWindowMask | kMiniaturizableWindowMask | kResizableWindowMask;
1066 if (!view.fOverrideRedirect)
1067 styleMask |= kTitledWindowMask;
1070 styleMask : styleMask
1071 backing : NSBackingStoreBuffered
1073 [view setX :
x Y :
y];
1074 [newTopLevel addChild : view];
1076 fPimpl->ReplaceDrawable(
wid, newTopLevel);
1079 [newTopLevel release];
1082 [view removeFromSuperview];
1085 assert(newParent.fIsPixmap == NO &&
"ReparentChild, pixmap can not be a new parent");
1086 [view setX :
x Y :
y];
1087 [newParent addChild : view];
1098 if (
fPimpl->IsRootWindow(pid))
1105 [contentView retain];
1106 [contentView removeFromSuperview];
1107 [topLevel setContentView : nil];
1108 fPimpl->ReplaceDrawable(
wid, contentView);
1109 [contentView setX :
x Y :
y];
1110 [
fPimpl->GetWindow(pid) addChild : contentView];
1111 [contentView release];
1122 assert(!
fPimpl->IsRootWindow(
wid) &&
"ReparentWindow, can not re-parent root window");
1125 if (view.fParentView)
1138 assert(!
fPimpl->IsRootWindow(
wid) &&
"MapWindow, called for root window");
1158 assert(!
fPimpl->IsRootWindow(
wid) &&
"MapSubwindows, called for 'root' window");
1173 assert(!
fPimpl->IsRootWindow(
wid) &&
"MapRaised, called for root window");
1194 assert(!
fPimpl->IsRootWindow(
wid) &&
"UnmapWindow, called for root window");
1199 fPimpl->fX11EventTranslator.CheckUnmappedView(
wid);
1204 if (
win ==
win.fQuartzWindow &&
win.fQuartzWindow.fHasFocus)
1226 assert(!
fPimpl->IsRootWindow(
wid) &&
"RaiseWindow, called for root window");
1228 if (!
fPimpl->GetWindow(
wid).fParentView)
1243 assert(!
fPimpl->IsRootWindow(
wid) &&
"LowerWindow, called for root window");
1245 if (!
fPimpl->GetWindow(
wid).fParentView)
1264 assert(!
fPimpl->IsRootWindow(
wid) &&
"MoveWindow, called for root window");
1283 assert(!
fPimpl->IsRootWindow(
wid) &&
"MoveResizeWindow, called for 'root' window");
1295 assert(!
fPimpl->IsRootWindow(
wid) &&
"ResizeWindow, called for 'root' window");
1300 const UInt_t siMax = std::numeric_limits<Int_t>::max();
1301 if (
w > siMax ||
h > siMax)
1304 NSSize newSize = {};
1308 [
fPimpl->GetWindow(
wid) setDrawableSize : newSize];
1318 assert(!
fPimpl->IsRootWindow(
wid) &&
"IconifyWindow, can not iconify the root window");
1319 assert(
fPimpl->GetWindow(
wid).fIsPixmap == NO &&
"IconifyWindow, invalid window id");
1322 assert(
win.fQuartzWindow ==
win &&
"IconifyWindow, can be called only for a top level window");
1324 fPimpl->fX11EventTranslator.CheckUnmappedView(
wid);
1327 if (
fPimpl->fX11CommandBuffer.BufferSize())
1328 fPimpl->fX11CommandBuffer.RemoveOperationsForDrawable(
wid);
1330 if (window.fQuartzWindow.fHasFocus) {
1332 window.fQuartzWindow.fHasFocus = NO;
1335 [
win.fQuartzWindow miniaturize :
win.fQuartzWindow];
1350 if (!srcWin || !dstWin)
1353 const bool srcIsRoot =
fPimpl->IsRootWindow(srcWin);
1354 const bool dstIsRoot =
fPimpl->IsRootWindow(dstWin);
1356 if (srcIsRoot && dstIsRoot) {
1368 NSPoint srcPoint = {};
1372 NSPoint dstPoint = {};
1378 }
else if (srcIsRoot) {
1382 if ([dstView superview]) {
1386 dstPoint = [[dstView superview] convertPoint : dstPoint fromView : dstView];
1388 if (view != dstView && view.fMapState ==
kIsViewable)
1397 if ([dstView superview]) {
1401 const NSPoint
pt = [[dstView superview] convertPoint : dstPoint fromView : dstView];
1403 if (view != dstView && view.fMapState ==
kIsViewable)
1436 if (!window.fIsPixmap) {
1456 assert(!
fPimpl->IsRootWindow(
wid) &&
"SetWindowBackground, can not set color for root window");
1458 fPimpl->GetWindow(
wid).fBackgroundPixel = color;
1471 assert(!
fPimpl->IsRootWindow(windowID) &&
1472 "SetWindowBackgroundPixmap, can not set background for a root window");
1473 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
1474 "SetWindowBackgroundPixmap, invalid window id");
1477 if (pixmapID ==
kNone) {
1478 window.fBackgroundPixmap = nil;
1482 assert(pixmapID >
fPimpl->GetRootWindowID() &&
1483 "SetWindowBackgroundPixmap, parameter 'pixmapID' is not a valid pixmap id");
1484 assert(
fPimpl->GetDrawable(pixmapID).fIsPixmap == YES &&
1485 "SetWindowBackgroundPixmap, bad drawable");
1492 if ([pixmapOrImage isKindOfClass : [
QuartzPixmap class]]) {
1494 if (backgroundImage.
Get())
1495 window.fBackgroundPixmap = backgroundImage.
Get();
1498 if (backgroundImage.
Get())
1499 window.fBackgroundPixmap = backgroundImage.
Get();
1502 if (!backgroundImage.
Get())
1504 Error(
"SetWindowBackgroundPixmap",
"QuartzImage initialization failed");
1513 if (windowID <= fPimpl->GetRootWindowID())
1517 return view.fParentView ? view.fParentView.fID :
fPimpl->GetRootWindowID();
1531 NSString *
const windowTitle = [NSString stringWithCString :
name encoding : NSASCIIStringEncoding];
1532 [(
NSWindow *)drawable setTitle : windowTitle];
1562 assert(!
fPimpl->IsRootWindow(windowID) &&
1563 "ShapeCombineMask, windowID parameter is a 'root' window");
1564 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
1565 "ShapeCombineMask, windowID parameter is a bad window id");
1567 "ShapeCombineMask, pixmapID parameter must point to QuartzImage object");
1569 if (
fPimpl->GetWindow(windowID).fContentView.fParentView)
1573 assert(srcImage.
fIsStippleMask == YES &&
"ShapeCombineMask, source image is not a stipple mask");
1581 [qw setOpaque : NO];
1582 [qw setBackgroundColor : [NSColor clearColor]];
1586#pragma mark - "Window manager hints" set of functions.
1594 assert(!
fPimpl->IsRootWindow(
wid) &&
"SetMWMHints, called for 'root' window");
1597 NSUInteger newMask = 0;
1599 if ([qw styleMask] & kTitledWindowMask) {
1600 newMask |= kTitledWindowMask;
1601 newMask |= kClosableWindowMask;
1605 newMask |= kMiniaturizableWindowMask | kResizableWindowMask;
1608 newMask |= kMiniaturizableWindowMask;
1610 newMask |= kResizableWindowMask;
1613 [qw setStyleMask : newMask];
1617 [[qw standardWindowButton : NSWindowZoomButton] setEnabled : YES];
1618 [[qw standardWindowButton : NSWindowMiniaturizeButton] setEnabled : YES];
1645 assert(!
fPimpl->IsRootWindow(
wid) &&
"SetWMSizeHints, called for root window");
1647 const NSUInteger styleMask = kTitledWindowMask | kClosableWindowMask | kMiniaturizableWindowMask | kResizableWindowMask;
1648 const NSRect minRect = [
NSWindow frameRectForContentRect : NSMakeRect(0., 0., wMin, hMin) styleMask : styleMask];
1649 const NSRect maxRect = [
NSWindow frameRectForContentRect : NSMakeRect(0., 0., wMax, hMax) styleMask : styleMask];
1652 [qw setMinSize : minRect.size];
1653 [qw setMaxSize : maxRect.size];
1674 assert(
wid >
fPimpl->GetRootWindowID() &&
"SetWMTransientHint, wid parameter is not a valid window id");
1676 if (
fPimpl->IsRootWindow(mainWid))
1681 if (![mainWindow isVisible])
1686 if (mainWindow != transientWindow) {
1689 Error(
"SetWMTransientHint",
"window is already transient for other window");
1691 [[transientWindow standardWindowButton : NSWindowZoomButton] setEnabled : NO];
1692 [mainWindow addTransientWindow : transientWindow];
1695 Warning(
"SetWMTransientHint",
"transient and main windows are the same window");
1698#pragma mark - GUI-rendering part.
1704 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawLineAux, called for root window");
1708 assert(ctx != 0 &&
"DrawLineAux, context is null");
1721 CGContextSetAllowsAntialiasing(ctx,
false);
1723 if (!drawable.fIsPixmap)
1724 CGContextTranslateCTM(ctx, 0.5, 0.5);
1731 SetStrokeParametersFromX11Context(ctx, gcVals);
1732 CGContextBeginPath(ctx);
1733 CGContextMoveToPoint(ctx,
x1,
y1);
1734 CGContextAddLineToPoint(ctx,
x2,
y2);
1735 CGContextStrokePath(ctx);
1737 CGContextSetAllowsAntialiasing(ctx,
true);
1752 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawLine, called for root window");
1753 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"DrawLine, invalid context index");
1758 if (!drawable.fIsPixmap) {
1761 const ViewFixer fixer(view,
wid);
1780 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawSegmentsAux, called for root window");
1781 assert(segments != 0 &&
"DrawSegmentsAux, segments parameter is null");
1782 assert(nSegments > 0 &&
"DrawSegmentsAux, nSegments <= 0");
1784 for (
Int_t i = 0; i < nSegments; ++i)
1785 DrawLineAux(
wid, gcVals, segments[i].fX1, segments[i].fY1 - 3, segments[i].fX2, segments[i].fY2 - 3);
1797 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawSegments, called for root window");
1798 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"DrawSegments, invalid context index");
1799 assert(segments != 0 &&
"DrawSegments, parameter 'segments' is null");
1800 assert(nSegments > 0 &&
"DrawSegments, number of segments <= 0");
1805 if (!drawable.fIsPixmap) {
1807 const ViewFixer fixer(view,
wid);
1811 fPimpl->fX11CommandBuffer.AddDrawSegments(
wid, gcVals, segments, nSegments);
1817 fPimpl->fX11CommandBuffer.AddDrawSegments(
wid, gcVals, segments, nSegments);
1827 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawRectangleAux, called for root window");
1831 if (!drawable.fIsPixmap) {
1844 assert(ctx &&
"DrawRectangleAux, context is null");
1847 CGContextSetAllowsAntialiasing(ctx,
false);
1849 SetStrokeParametersFromX11Context(ctx, gcVals);
1851 const CGRect
rect = CGRectMake(
x,
y,
w,
h);
1852 CGContextStrokeRect(ctx,
rect);
1854 CGContextSetAllowsAntialiasing(ctx,
true);
1866 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawRectangle, called for root window");
1867 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"DrawRectangle, invalid context index");
1873 if (!drawable.fIsPixmap) {
1876 const ViewFixer fixer(view,
wid);
1880 fPimpl->fX11CommandBuffer.AddDrawRectangle(
wid, gcVals,
x,
y,
w,
h);
1886 fPimpl->fX11CommandBuffer.AddDrawRectangle(
wid, gcVals,
x,
y,
w,
h);
1902 assert(!
fPimpl->IsRootWindow(
wid) &&
"FillRectangleAux, called for root window");
1906 CGSize patternPhase = {};
1908 if (drawable.fIsPixmap) {
1913 const CGRect fillRect = CGRectMake(
x,
y,
w,
h);
1915 if (!drawable.fIsPixmap) {
1918 const NSPoint origin = [view.
fParentView convertPoint : view.frame.origin toView : nil];
1919 patternPhase.width = origin.x;
1920 patternPhase.height = origin.y;
1926 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals) || HasFillTiledStyle(gcVals)) {
1927 std::unique_ptr<PatternContext> patternContext(
new PatternContext(gcVals.
fMask, gcVals.
fFillStyle,
1928 0, 0, nil, patternPhase));
1929 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals)) {
1931 "FillRectangleAux, fill_style is FillStippled/FillOpaqueStippled,"
1932 " but no stipple is set in a context");
1937 if (HasFillOpaqueStippledStyle(gcVals))
1941 "FillRectangleAux, fill_style is FillTiled, but not tile is set in a context");
1943 patternContext->SetImage(
fPimpl->GetDrawable(gcVals.
fTile));
1946 SetFillPattern(ctx, patternContext.get());
1947 patternContext.release();
1948 CGContextFillRect(ctx, fillRect);
1953 SetFilledAreaColorFromX11Context(ctx, gcVals);
1954 CGContextFillRect(ctx, fillRect);
1967 assert(!
fPimpl->IsRootWindow(
wid) &&
"FillRectangle, called for root window");
1968 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"FillRectangle, invalid context index");
1973 if (!drawable.fIsPixmap) {
1976 const ViewFixer fixer(view,
wid);
1979 fPimpl->fX11CommandBuffer.AddFillRectangle(
wid, gcVals,
x,
y,
w,
h);
1996 assert(!
fPimpl->IsRootWindow(
wid) &&
"FillPolygonAux, called for root window");
1997 assert(polygon != 0 &&
"FillPolygonAux, parameter 'polygon' is null");
1998 assert(nPoints > 0 &&
"FillPolygonAux, number of points must be positive");
2003 CGSize patternPhase = {};
2005 if (!drawable.fIsPixmap) {
2007 const NSPoint origin = [view convertPoint : view.frame.origin toView : nil];
2008 patternPhase.width = origin.x;
2009 patternPhase.height = origin.y;
2014 CGContextSetAllowsAntialiasing(ctx,
false);
2016 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals) || HasFillTiledStyle(gcVals)) {
2017 std::unique_ptr<PatternContext> patternContext(
new PatternContext(gcVals.
fMask, gcVals.
fFillStyle, 0, 0, nil, patternPhase));
2019 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals)) {
2021 "FillRectangleAux, fill style is FillStippled/FillOpaqueStippled,"
2022 " but no stipple is set in a context");
2027 if (HasFillOpaqueStippledStyle(gcVals))
2031 "FillRectangleAux, fill_style is FillTiled, but not tile is set in a context");
2033 patternContext->SetImage(
fPimpl->GetDrawable(gcVals.
fTile));
2036 SetFillPattern(ctx, patternContext.get());
2037 patternContext.release();
2039 SetFilledAreaColorFromX11Context(ctx, gcVals);
2044 CGContextBeginPath(ctx);
2045 if (!drawable.fIsPixmap) {
2046 CGContextMoveToPoint(ctx, polygon[0].fX, polygon[0].fY - 2);
2047 for (
Int_t i = 1; i < nPoints; ++i)
2048 CGContextAddLineToPoint(ctx, polygon[i].fX, polygon[i].fY - 2);
2051 for (
Int_t i = 1; i < nPoints; ++i)
2055 CGContextFillPath(ctx);
2056 CGContextSetAllowsAntialiasing(ctx,
true);
2079 assert(polygon != 0 &&
"FillPolygon, parameter 'polygon' is null");
2080 assert(nPoints > 0 &&
"FillPolygon, number of points must be positive");
2081 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"FillPolygon, invalid context index");
2086 if (!drawable.fIsPixmap) {
2088 const ViewFixer fixer(view,
wid);
2092 fPimpl->fX11CommandBuffer.AddFillPolygon(
wid, gcVals, polygon, nPoints);
2098 fPimpl->fX11CommandBuffer.AddFillPolygon(
wid, gcVals, polygon, nPoints);
2112 assert(!
fPimpl->IsRootWindow(
src) &&
"CopyAreaAux, src parameter is root window");
2113 assert(!
fPimpl->IsRootWindow(dst) &&
"CopyAreaAux, dst parameter is root window");
2128 "CopyArea, mask is not a pixmap");
2138 [dstDrawable copy : srcDrawable area : copyArea withMask :
mask clipOrigin : clipOrigin toPoint : dstPoint];
2148 assert(!
fPimpl->IsRootWindow(
src) &&
"CopyArea, src parameter is root window");
2149 assert(!
fPimpl->IsRootWindow(dst) &&
"CopyArea, dst parameter is root window");
2150 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"CopyArea, invalid context index");
2155 if (!drawable.fIsPixmap) {
2157 const ViewFixer fixer(view, dst);
2161 fPimpl->fX11CommandBuffer.AddCopyArea(
src, dst, gcVals, srcX, srcY,
width,
height, dstX, dstY);
2166 if (
fPimpl->GetDrawable(
src).fIsPixmap) {
2171 fPimpl->fX11CommandBuffer.AddCopyArea(
src, dst, gcVals, srcX, srcY,
width,
height, dstX, dstY);
2182 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawStringAux, called for root window");
2186 assert(ctx != 0 &&
"DrawStringAux, context is null");
2190 CGContextSetTextMatrix(ctx, CGAffineTransformIdentity);
2193 if (!drawable.fIsPixmap) {
2194 CGContextTranslateCTM(ctx, 0., drawable.fHeight);
2195 CGContextScaleCTM(ctx, 1., -1.);
2199 CGContextSetAllowsAntialiasing(ctx,
true);
2201 assert(gcVals.
fMask &
kGCFont &&
"DrawString, font is not set in a context");
2206 CGFloat textColor[4] = {0., 0., 0., 1.};
2211 CGContextSetRGBFillColor(ctx, textColor[0], textColor[1], textColor[2], textColor[3]);
2216 std::vector<UniChar> unichars((
unsigned char *)
text, (
unsigned char *)
text +
len);
2229 assert(!
fPimpl->IsRootWindow(
wid) &&
"DrawString, called for root window");
2230 assert(
gc > 0 &&
gc <=
fX11Contexts.size() &&
"DrawString, invalid context index");
2234 assert(gcVals.
fMask &
kGCFont &&
"DrawString, font is not set in a context");
2236 if (!drawable.fIsPixmap) {
2238 const ViewFixer fixer(view,
wid);
2258 assert(!
fPimpl->IsRootWindow(windowID) &&
"ClearAreaAux, called for root window");
2261 assert(view.
fContext != 0 &&
"ClearAreaAux, view.fContext is null");
2271 CGFloat rgb[3] = {};
2275 CGContextSetRGBFillColor(view.
fContext, rgb[0], rgb[1], rgb[2], 1.);
2276 CGContextFillRect(view.
fContext, CGRectMake(
x,
y,
w,
h));
2278 const CGRect fillRect = CGRectMake(
x,
y,
w,
h);
2280 CGSize patternPhase = {};
2282 const NSPoint origin = [view.
fParentView convertPoint : view.frame.origin toView : nil];
2283 patternPhase.width = origin.x;
2284 patternPhase.height = origin.y;
2288 std::unique_ptr<PatternContext> patternContext(
new PatternContext({}, 0, 0, 0, view.
fBackgroundPixmap, patternPhase));
2289 SetFillPattern(view.
fContext, patternContext.get());
2290 patternContext.release();
2291 CGContextFillRect(view.
fContext, fillRect);
2305 assert(!
fPimpl->IsRootWindow(
wid) &&
"ClearArea, called for root window");
2309 if (ParentRendersToChild(view))
2332#pragma mark - Pixmap management.
2338 NSSize newSize = {};
2343 scaleFactor : [[NSScreen mainScreen] backingScaleFactor]]);
2345 pixmap.
Get().fID =
fPimpl->RegisterDrawable(pixmap.
Get());
2349 Error(
"OpenPixmap",
"QuartzPixmap initialization failed");
2357 assert(!
fPimpl->IsRootWindow(
wid) &&
"ResizePixmap, called for root window");
2360 assert(drawable.fIsPixmap == YES &&
"ResizePixmap, invalid drawable");
2366 if ([pixmap resizeW :
w H :
h scaleFactor : [[NSScreen mainScreen] backingScaleFactor]])
2375 assert(pixmapID > (
Int_t)
fPimpl->GetRootWindowID() &&
2376 "SelectPixmap, parameter 'pixmapID' is not a valid id");
2384 assert(pixmapID > (
Int_t)
fPimpl->GetRootWindowID() &&
2385 "CopyPixmap, parameter 'pixmapID' is not a valid id");
2387 "CopyPixmap, fSelectedDrawable is not a valid window id");
2390 assert([source isKindOfClass : [
QuartzPixmap class]] &&
2391 "CopyPixmap, source is not a pixmap");
2397 if (drawable.fIsPixmap) {
2398 destination = drawable;
2401 if (window.fBackBuffer) {
2402 destination = window.fBackBuffer;
2404 Warning(
"CopyPixmap",
"Operation skipped, since destination"
2405 " window is not double buffered");
2410 const X11::Rectangle copyArea(0, 0, pixmap.fWidth, pixmap.fHeight);
2413 [destination copy : pixmap area : copyArea withMask : nil clipOrigin :
X11::Point() toPoint : dstPoint];
2421 assert(
fPimpl->GetDrawable(
fSelectedDrawable).fIsPixmap == YES &&
"ClosePixmap, selected drawable is not a pixmap");
2427#pragma mark - Different functions to create pixmap from different data sources. Used by GUI.
2428#pragma mark - These functions implement TVirtualX interface, some of them dupilcate others.
2444 assert(
bitmap != 0 &&
"CreatePixmap, parameter 'bitmap' is null");
2445 assert(
width > 0 &&
"CreatePixmap, parameter 'width' is 0");
2446 assert(
height > 0 &&
"CreatePixmap, parameter 'height' is 0");
2451 backgroundPixel, depth, &imageData[0]);
2462 Error(
"CreatePixmap",
"QuartzImage initialization failed");
2466 image.
Get().fID =
fPimpl->RegisterDrawable(image.
Get());
2467 return image.
Get().fID;
2474 assert(bits != 0 &&
"CreatePixmapFromData, data parameter is null");
2475 assert(
width != 0 &&
"CreatePixmapFromData, width parameter is 0");
2476 assert(
height != 0 &&
"CreatePixmapFromData, height parameter is 0");
2480 std::vector<unsigned char> imageData(bits, bits +
width *
height * 4);
2483 unsigned char *
p = &imageData[0];
2485 std::swap(
p[0],
p[2]);
2493 Error(
"CreatePixmapFromData",
"QuartzImage initialziation failed");
2497 image.
Get().fID =
fPimpl->RegisterDrawable(image.
Get());
2498 return image.
Get().fID;
2505 assert(std::numeric_limits<unsigned char>::digits == 8 &&
"CreateBitmap, ASImage requires octets");
2513 std::vector<unsigned char> imageData(
width *
height);
2516 for (
unsigned i = 0, j = 0,
e =
width / 8 *
height; i <
e; ++i) {
2517 for(
unsigned bit = 0; bit < 8; ++bit, ++j) {
2518 if (
bitmap[i] & (1 << bit))
2527 H :
height bitmapMask : &imageData[0]]);
2530 Error(
"CreateBitmap",
"QuartzImage initialization failed");
2534 image.
Get().fID =
fPimpl->RegisterDrawable(image.
Get());
2535 return image.
Get().fID;
2541 fPimpl->DeleteDrawable(pixmapID);
2548 assert(
fPimpl->GetDrawable(pixmapID).fIsPixmap == YES &&
"DeletePixmap, object is not a pixmap");
2549 fPimpl->fX11CommandBuffer.AddDeletePixmap(pixmapID);
2566 Warning(
"GetColorBits",
"Called for root window");
2568 assert(
x >= 0 &&
"GetColorBits, parameter 'x' is negative");
2569 assert(
y >= 0 &&
"GetColorBits, parameter 'y' is negative");
2570 assert(
w != 0 &&
"GetColorBits, parameter 'w' is 0");
2571 assert(
h != 0 &&
"GetColorBits, parameter 'h' is 0");
2574 return [
fPimpl->GetDrawable(
wid) readColorBits : area];
2580#pragma mark - XImage emulation.
2596 assert(
wid >
fPimpl->GetRootWindowID() &&
"GetImageSize, parameter 'wid' is invalid");
2599 width = drawable.fWidth;
2600 height = drawable.fHeight;
2614 "PutPixel, parameter 'imageID' is a bad pixmap id");
2615 assert(
x >= 0 &&
"PutPixel, parameter 'x' is negative");
2616 assert(
y >= 0 &&
"PutPixel, parameter 'y' is negative");
2620 unsigned char rgb[3] = {};
2622 [pixmap putPixel : rgb X :
x Y :
y];
2641 "DeleteImage, imageID parameter is not a valid image id");
2645#pragma mark - Mouse related code.
2663 assert(!
fPimpl->IsRootWindow(
wid) &&
"GrabButton, called for 'root' window");
2668 widget.fPassiveGrabOwnerEvents = YES;
2669 widget.fPassiveGrabButton =
button;
2670 widget.fPassiveGrabEventMask = eventMask;
2671 widget.fPassiveGrabKeyModifiers = keyModifiers;
2674 widget.fPassiveGrabOwnerEvents = NO;
2675 widget.fPassiveGrabButton = -1;
2676 widget.fPassiveGrabEventMask = 0;
2677 widget.fPassiveGrabKeyModifiers = 0;
2691 assert(!
fPimpl->IsRootWindow(
wid) &&
"GrabPointer, called for 'root' window");
2694 fPimpl->fX11EventTranslator.SetPointerGrab(view, eventMask, ownerEvents);
2698 fPimpl->fX11EventTranslator.CancelPointerGrab();
2749 assert(!
fPimpl->IsRootWindow(
wid) &&
"GrabKey, called for root window");
2755 [view addPassiveKeyGrab : keyCode modifiers : cocoaKeyModifiers];
2757 [view removePassiveKeyGrab : keyCode modifiers : cocoaKeyModifiers];
2776 return fPimpl->fX11EventTranslator.GetInputFocus();
2783 assert(!
fPimpl->IsRootWindow(
wid) &&
"SetInputFocus, called for root window");
2786 fPimpl->fX11EventTranslator.SetInputFocus(nil);
2788 fPimpl->fX11EventTranslator.SetInputFocus(
fPimpl->GetWindow(
wid).fContentView);
2804 assert(buf != 0 &&
"LookupString, parameter 'buf' is null");
2805 assert(
length >= 2 &&
"LookupString, parameter 'length' - not enough memory to return null-terminated ASCII string");
2810#pragma mark - Font management.
2817 assert(fontName != 0 &&
"LoadQueryFont, fontName is null");
2820 if (ParseXLFDName(fontName, xlfd)) {
2826 return fPimpl->fFontManager.LoadFont(xlfd);
2841 fPimpl->fFontManager.UnloadFont(
fs);
2856 return fPimpl->fFontManager.GetTextWidth(font, s,
len);
2863 fPimpl->fFontManager.GetFontProperties(font, maxAscent, maxDescent);
2890 if (fontName && fontName[0]) {
2893 return fPimpl->fFontManager.ListFonts(xlfd, maxNames, count);
2906 fPimpl->fFontManager.FreeFontNames(fontList);
2909#pragma mark - Color management.
2917 return fPimpl->fX11ColorParser.ParseColor(colorName, color);
2923 const unsigned red = unsigned(
double(color.
fRed) / 0xFFFF * 0xFF);
2924 const unsigned green = unsigned(
double(color.
fGreen) / 0xFFFF * 0xFF);
2925 const unsigned blue = unsigned(
double(color.
fBlue) / 0xFFFF * 0xFF);
2926 color.
fPixel = red << 16 | green << 8 | blue;
2934 color.
fRed = (color.
fPixel >> 16 & 0xFF) * 0xFFFF / 0xFF;
2935 color.
fGreen = (color.
fPixel >> 8 & 0xFF) * 0xFFFF / 0xFF;
2936 color.
fBlue = (color.
fPixel & 0xFF) * 0xFFFF / 0xFF;
2950 Float_t red = 0.f, green = 0.f, blue = 0.f;
2951 color->GetRGB(red, green, blue);
2952 pixel = unsigned(red * 255) << 16;
2953 pixel |= unsigned(green * 255) << 8;
2954 pixel |= unsigned(blue * 255);
2988#pragma mark - Graphical context management.
3008 assert(
gc <=
fX11Contexts.size() &&
gc > 0 &&
"ChangeGC, invalid context id");
3019 assert(
gc <=
fX11Contexts.size() &&
gc > 0 &&
"ChangeGC, invalid context id");
3020 assert(
gval != 0 &&
"ChangeGC, gval parameter is null");
3074 const unsigned nDashes =
sizeof x11Context.
fDashes /
sizeof x11Context.
fDashes[0];
3075 for (
unsigned i = 0; i < nDashes; ++i)
3085 assert(dst <=
fX11Contexts.size() && dst > 0 &&
"CopyGC, bad destination context");
3108#pragma mark - Cursor management.
3130 assert(!
fPimpl->IsRootWindow(
wid) &&
"SetCursor, called for root window");
3133 view.fCurrentCursor =
cursor;
3153 const NSPoint screenPoint = [
NSEvent mouseLocation];
3169 rootWinID =
fPimpl->GetRootWindowID();
3171 NSPoint screenPoint = [
NSEvent mouseLocation];
3174 rootX = screenPoint.x;
3175 rootY = screenPoint.y;
3178 if (winID >
fPimpl->GetRootWindowID()) {
3184 winX = screenPoint.x;
3185 winY = screenPoint.y;
3190 childWinID = childWin.fID;
3198#pragma mark - OpenGL management.
3206 return [[NSScreen mainScreen] backingScaleFactor];
3211 const std::vector<std::pair<UInt_t, Int_t> > &formatComponents)
3215 typedef std::pair<UInt_t, Int_t> component_type;
3216 typedef std::vector<component_type>::size_type size_type;
3219 std::vector<NSOpenGLPixelFormatAttribute> attribs;
3220 for (size_type i = 0,
e = formatComponents.size(); i <
e; ++i) {
3221 const component_type &comp = formatComponents[i];
3224 attribs.push_back(NSOpenGLPFADoubleBuffer);
3226 attribs.push_back(NSOpenGLPFADepthSize);
3227 attribs.push_back(comp.second > 0 ? comp.second : 32);
3229 attribs.push_back(NSOpenGLPFAAccumSize);
3230 attribs.push_back(comp.second > 0 ? comp.second : 1);
3232 attribs.push_back(NSOpenGLPFAStencilSize);
3233 attribs.push_back(comp.second > 0 ? comp.second : 8);
3235 attribs.push_back(NSOpenGLPFAMultisample);
3236 attribs.push_back(NSOpenGLPFASampleBuffers);
3237 attribs.push_back(1);
3238 attribs.push_back(NSOpenGLPFASamples);
3239 attribs.push_back(comp.second ? comp.second : 8);
3243 attribs.push_back(0);
3245 NSOpenGLPixelFormat *
const pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes : &attribs[0]];
3249 if (!
fPimpl->IsRootWindow(parentID)) {
3250 parentView =
fPimpl->GetWindow(parentID).fContentView;
3251 assert([parentView isKindOfClass : [
QuartzView class]] &&
3252 "CreateOpenGLWindow, parent view must be QuartzView");
3255 NSRect viewFrame = {};
3256 viewFrame.size.width =
width;
3257 viewFrame.size.height =
height;
3265 [parentView addChild : glView];
3266 glID =
fPimpl->RegisterDrawable(glView);
3276 Error(
"CreateOpenGLWindow",
"QuartzWindow allocation/initialization"
3277 " failed for a top-level GL widget");
3281 glID =
fPimpl->RegisterDrawable(parent);
3291 assert(!
fPimpl->IsRootWindow(windowID) &&
3292 "CreateOpenGLContext, parameter 'windowID' is a root window");
3294 "CreateOpenGLContext, view is not an OpenGL view");
3296 NSOpenGLContext *
const sharedContext =
fPimpl->GetGLContextForHandle(sharedID);
3300 newContext([[NSOpenGLContext alloc] initWithFormat : glView.
pixelFormat shareContext : sharedContext]);
3318 assert(ctxID > 0 &&
"MakeOpenGLContextCurrent, invalid context id");
3320 NSOpenGLContext *
const glContext =
fPimpl->GetGLContextForHandle(ctxID);
3322 Error(
"MakeOpenGLContextCurrent",
"No OpenGL context found for id %d",
int(ctxID));
3330 if ([glContext view] != glView)
3331 [glContext setView : glView];
3339 [glContext makeCurrentContext];
3357 const UInt_t width = std::max(glView.frame.size.width, CGFloat(100));
3358 const UInt_t height = std::max(glView.frame.size.height, CGFloat(100));
3360 NSRect viewFrame = {};
3361 viewFrame.size.width =
width;
3362 viewFrame.size.height =
height;
3364 const NSUInteger styleMask = kTitledWindowMask | kClosableWindowMask |
3365 kMiniaturizableWindowMask | kResizableWindowMask;
3368 fakeWindow = [[
QuartzWindow alloc] initWithContentRect : viewFrame styleMask : styleMask
3369 backing : NSBackingStoreBuffered defer : NO windowAttributes : &
attr];
3373 [fakeView setHidden : NO];
3375 fPimpl->SetFakeGLWindow(fakeWindow);
3379 [fakeView setHidden : NO];
3383 [glContext setView : fakeView];
3384 [glContext makeCurrentContext];
3393 NSOpenGLContext *
const currentContext = [NSOpenGLContext currentContext];
3394 if (!currentContext) {
3395 Error(
"GetCurrentOpenGLContext",
"The current OpenGL context is null");
3399 const Handle_t contextID =
fPimpl->GetHandleForGLContext(currentContext);
3401 Error(
"GetCurrentOpenGLContext",
"The current OpenGL context was"
3402 " not created/registered by TGCocoa");
3410 assert(ctxID > 0 &&
"FlushOpenGLBuffer, invalid context id");
3412 NSOpenGLContext *
const glContext =
fPimpl->GetGLContextForHandle(ctxID);
3413 assert(glContext != nil &&
"FlushOpenGLBuffer, bad context id");
3415 if (glContext != [NSOpenGLContext currentContext])
3419 [glContext flushBuffer];
3428 NSOpenGLContext *
const glContext =
fPimpl->GetGLContextForHandle(ctxID);
3429 if (
NSView *
const v = [glContext view]) {
3433 [glContext clearDrawable];
3436 if (glContext == [NSOpenGLContext currentContext])
3437 [NSOpenGLContext clearCurrentContext];
3439 fPimpl->DeleteGLContext(ctxID);
3442#pragma mark - Off-screen rendering for TPad/TCanvas.
3448 assert(windowID > (
Int_t)
fPimpl->GetRootWindowID() &&
"SetDoubleBuffer called for root window");
3450 if (windowID == 999) {
3451 Warning(
"SetDoubleBuffer",
"called with wid == 999");
3472 "SetDoubleBufferON, called, but no correct window was selected before");
3476 if (!window)
return;
3478 assert(window.fIsPixmap == NO &&
3479 "SetDoubleBufferON, selected drawable is a pixmap, can not attach pixmap to pixmap");
3481 const unsigned currW = window.fWidth;
3482 const unsigned currH = window.fHeight;
3484 if (
QuartzPixmap *
const currentPixmap = window.fBackBuffer) {
3485 if (currH == currentPixmap.fHeight && currW == currentPixmap.fWidth)
3490 H : currH scaleFactor : [[NSScreen mainScreen] backingScaleFactor]]);
3492 window.fBackBuffer = pixmap.
Get();
3495 Error(
"SetDoubleBufferON",
"QuartzPixmap initialization failed");
3506 auto windows = NSApplication.sharedApplication.windows;
3507 for (
NSWindow *candidate : windows) {
3511 fPimpl->fX11CommandBuffer.ClearXOROperations();
3517#pragma mark - Event management part.
3531 fPimpl->fX11EventTranslator.fEventQueue.push_back(newEvent);
3537 assert(
fPimpl->fX11EventTranslator.fEventQueue.size() > 0 &&
"NextEvent, event queue is empty");
3539 event =
fPimpl->fX11EventTranslator.fEventQueue.front();
3540 fPimpl->fX11EventTranslator.fEventQueue.pop_front();
3546 return (
Int_t)
fPimpl->fX11EventTranslator.fEventQueue.size();
3553 typedef X11::EventQueue_t::iterator iterator_type;
3555 iterator_type it =
fPimpl->fX11EventTranslator.fEventQueue.begin();
3556 iterator_type eIt =
fPimpl->fX11EventTranslator.fEventQueue.end();
3558 for (; it != eIt; ++it) {
3559 const Event_t &queuedEvent = *it;
3561 event = queuedEvent;
3562 fPimpl->fX11EventTranslator.fEventQueue.erase(it);
3578#pragma mark - "Drag and drop", "Copy and paste", X11 properties.
3585 assert(
name != 0 &&
"InternAtom, parameter 'name' is null");
3602 assert(!
fPimpl->IsRootWindow(windowID) &&
3603 "SetPrimarySelectionOwner, windowID parameter is a 'root' window");
3604 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3605 "SetPrimarySelectionOwner, windowID parameter is not a valid window");
3607 const Atom_t primarySelectionAtom =
FindAtom(
"XA_PRIMARY",
false);
3608 assert(primarySelectionAtom !=
kNone &&
3609 "SetPrimarySelectionOwner, predefined XA_PRIMARY atom was not found");
3627 assert(!
fPimpl->IsRootWindow(windowID) &&
3628 "SetSelectionOwner, windowID parameter is a 'root' window'");
3629 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3630 "SetSelectionOwner, windowID parameter is not a valid window");
3645 const Atom_t primarySelectionAtom =
FindAtom(
"XA_PRIMARY",
false);
3646 assert(primarySelectionAtom !=
kNone &&
3647 "GetPrimarySelectionOwner, predefined XA_PRIMARY atom was not found");
3670 assert(!
fPimpl->IsRootWindow(windowID) &&
3671 "ConvertPrimarySelection, parameter 'windowID' is root window");
3672 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3673 "ConvertPrimarySelection, parameter windowID parameter is not a window id");
3676 assert(primarySelectionAtom !=
kNone &&
3677 "ConvertPrimarySelection, XA_PRIMARY predefined atom not found");
3680 assert(stringAtom !=
kNone &&
3681 "ConvertPrimarySelection, XA_STRING predefined atom not found");
3699 assert(!
fPimpl->IsRootWindow(windowID) &&
3700 "ConvertSelection, parameter 'windowID' is root window'");
3701 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3702 "ConvertSelection, parameter 'windowID' is not a window id");
3713 newEvent.
fUser[0] = windowID;
3714 newEvent.
fUser[1] = selection;
3724 ULong_t *bytesAfterReturn,
unsigned char **propertyReturn)
3733 if (
fPimpl->IsRootWindow(windowID))
3736 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3737 "GetProperty, parameter 'windowID' is not a valid window id");
3738 assert(propertyID > 0 && propertyID <=
fAtomToName.size() &&
3739 "GetProperty, parameter 'propertyID' is not a valid atom");
3740 assert(actualType != 0 &&
"GetProperty, parameter 'actualType' is null");
3741 assert(actualFormat != 0 &&
"GetProperty, parameter 'actualFormat' is null");
3742 assert(bytesAfterReturn != 0 &&
"GetProperty, parameter 'bytesAfterReturn' is null");
3743 assert(propertyReturn != 0 &&
"GetProperty, parameter 'propertyReturn' is null");
3747 *bytesAfterReturn = 0;
3748 *propertyReturn = 0;
3751 const std::string &atomName =
fAtomToName[propertyID - 1];
3754 if (![window hasProperty : atomName.c_str()]) {
3755 Error(
"GetProperty",
"Unknown property %s requested", atomName.c_str());
3759 unsigned tmpFormat = 0, tmpElements = 0;
3760 *propertyReturn = [window getProperty : atomName.c_str() returnType : actualType
3761 returnFormat : &tmpFormat nElements : &tmpElements];
3762 *actualFormat = (
Int_t)tmpFormat;
3763 *nItems = tmpElements;
3782 assert(!
fPimpl->IsRootWindow(windowID) &&
3783 "GetPasteBuffer, parameter 'windowID' is root window");
3784 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3785 "GetPasteBuffer, parameter 'windowID' is not a valid window");
3786 assert(propertyID && propertyID <=
fAtomToName.size() &&
3787 "GetPasteBuffer, parameter 'propertyID' is not a valid atom");
3791 const std::string &atomString =
fAtomToName[propertyID - 1];
3794 if (![window hasProperty : atomString.c_str()]) {
3795 Error(
"GetPasteBuffer",
"No property %s on a window", atomString.c_str());
3800 unsigned tmpFormat = 0, nElements = 0;
3803 propertyData((
char *)[window getProperty : atomString.c_str()
3804 returnType : &tmpType returnFormat : &tmpFormat
3805 nElements : &nElements]);
3807 assert(tmpFormat == 8 &&
"GetPasteBuffer, property has wrong format");
3809 text.Insert(0, propertyData.
Get(), nElements);
3810 nChars = (
Int_t)nElements;
3815 [window removeProperty : atomString.c_str()];
3846 assert(!
fPimpl->IsRootWindow(windowID) &&
3847 "ChangeProperty, parameter 'windowID' is root window");
3848 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3849 "ChangeProperty, parameter 'windowID' is not a valid window id");
3850 assert(propertyID && propertyID <=
fAtomToName.size() &&
3851 "ChangeProperty, parameter 'propertyID' is not a valid atom");
3855 const std::string &atomString =
fAtomToName[propertyID - 1];
3880 assert(!
fPimpl->IsRootWindow(windowID) &&
3881 "ChangeProperties, parameter 'windowID' is root window");
3882 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3883 "ChangeProperties, parameter 'windowID' is not a valid window id");
3884 assert(propertyID && propertyID <=
fAtomToName.size() &&
3885 "ChangeProperties, parameter 'propertyID' is not a valid atom");
3889 const std::string &atomName =
fAtomToName[propertyID - 1];
3892 [window setProperty : atomName.c_str()
data :
data
3910 assert(!
fPimpl->IsRootWindow(windowID) &&
3911 "DeleteProperty, parameter 'windowID' is root window");
3912 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3913 "DeleteProperty, parameter 'windowID' is not a valid window");
3914 assert(propertyID && propertyID <=
fAtomToName.size() &&
3915 "DeleteProperty, parameter 'propertyID' is not a valid atom");
3917 const std::string &atomString =
fAtomToName[propertyID - 1];
3918 [
fPimpl->GetWindow(windowID) removeProperty : atomString.c_str()];
3934 assert(windowID >
fPimpl->GetRootWindowID() &&
3935 "SetDNDAware, parameter 'windowID' is not a valid window id");
3936 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3937 "SetDNDAware, parameter 'windowID' is not a window");
3942 NSArray *
const supportedTypes = [NSArray arrayWithObjects : NSFilenamesPboardType, nil];
3946 [view registerForDraggedTypes : supportedTypes];
3953 assert(xaAtomAtom == 4 &&
"SetDNDAware, XA_ATOM is not defined");
3958 assert(
sizeof(
unsigned) == 4 &&
"SetDNDAware, sizeof(unsigned) must be 4");
3960 std::vector<unsigned> propertyData;
3961 propertyData.push_back(4);
3964 for (
unsigned i = 0; typeList[i]; ++i)
3965 propertyData.push_back(
unsigned(typeList[i]));
3968 [view setProperty :
"XdndAware" data : (
unsigned char *)&propertyData[0]
3969 size : propertyData.size() forType : xaAtomAtom
format : 32];
3977 if (windowID <= fPimpl->GetRootWindowID())
3980 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3981 "IsDNDAware, windowID parameter is not a window");
3992 ::Warning(
"SetTypeList",
"Not implemented");
4016 fPimpl->IsRootWindow(winID) ? nil :
fPimpl->GetWindow(winID).fContentView,
4017 dragWinID, inputWinID,
x,
y, maxDepth);
4019 return testView.fID;
4024#pragma mark - Noops.
4149 NSPoint newCursorPosition = {};
4150 newCursorPosition.x = ix;
4151 newCursorPosition.y = iy;
4153 if (
fPimpl->GetRootWindowID() == winID) {
4157 assert(
fPimpl->GetDrawable(winID).fIsPixmap == NO &&
4158 "Warp, drawable is not a window");
4163 CGWarpMouseCursorPosition(NSPointToCGPoint(newCursorPosition));
4395#pragma mark - Details and aux. functions.
4400 return &
fPimpl->fX11EventTranslator;
4406 return &
fPimpl->fX11CommandBuffer;
4418 assert(
fCocoaDraw > 0 &&
"CocoaDrawOFF, was already off");
4432 if (!drawable.fIsPixmap) {
4433 Error(
"GetCurrentContext",
"TCanvas/TPad's internal error,"
4434 " selected drawable is not a pixmap!");
4438 return drawable.fContext;
4451 ProcessSerialNumber psn = {0, kCurrentProcess};
4453 const OSStatus res1 = TransformProcessType(&psn, kProcessTransformToForegroundApplication);
4458 if (res1 != noErr && res1 != paramErr) {
4459 Error(
"MakeProcessForeground",
"TransformProcessType failed with code %d",
int(res1));
4462#ifdef MAC_OS_X_VERSION_10_9
4464 [[NSApplication sharedApplication] activateIgnoringOtherApps : YES];
4466 const OSErr res2 = SetFrontProcess(&psn);
4467 if (res2 != noErr) {
4468 Error(
"MakeProcessForeground",
"SetFrontProcess failed with code %d", res2);
4475#ifdef MAC_OS_X_VERSION_10_9
4477 [[NSApplication sharedApplication] activateIgnoringOtherApps : YES];
4479 ProcessSerialNumber psn = {};
4481 OSErr res = GetCurrentProcess(&psn);
4483 Error(
"MakeProcessForeground",
"GetCurrentProcess failed with code %d", res);
4487 res = SetFrontProcess(&psn);
4489 Error(
"MapProcessForeground",
"SetFrontProcess failed with code %d", res);
4501 const std::map<std::string, Atom_t>::const_iterator it =
fNameToAtom.find(atomName);
4505 else if (addIfNotFound) {
4521 if (iconDirectoryPath) {
4523 if (fileName.
Get()) {
4526 NSString *cocoaStr = [NSString stringWithCString : fileName.
Get() encoding : NSASCIIStringEncoding];
4527 NSImage *image = [[[NSImage alloc] initWithContentsOfFile : cocoaStr] autorelease];
4528 [NSApp setApplicationIconImage : image];
Handle_t Region_t
Region handle.
const Mask_t kGCDashOffset
const Mask_t kGCBackground
const Mask_t kGCForeground
const Mask_t kGCLineStyle
const Mask_t kGCSubwindowMode
const Mask_t kGCLineWidth
Handle_t Pixmap_t
Pixmap handle.
const Mask_t kGCClipXOrigin
Handle_t FontH_t
Font handle (as opposed to Font_t which is an index)
Handle_t Visual_t
Visual handle.
const Mask_t kGCFillStyle
Handle_t Window_t
Window handle.
const Mask_t kGCJoinStyle
Handle_t Display_t
Display handle.
ULong_t Time_t
Event time.
Handle_t GContext_t
Graphics context handle.
EInitialState
Initial window mapping state.
const Mask_t kGCTileStipXOrigin
Handle_t Drawable_t
Drawable handle.
Handle_t Cursor_t
Cursor handle.
const Mask_t kStructureNotifyMask
const Mask_t kGCPlaneMask
const Mask_t kGCGraphicsExposures
const Mask_t kGCClipYOrigin
const Mask_t kGCTileStipYOrigin
EMouseButton
Button names.
Handle_t Colormap_t
Colormap handle.
ULongptr_t Handle_t
Generic resource handle.
Handle_t FontStruct_t
Pointer to font structure.
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void chupy
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t mask
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t cursor
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void pixel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize wid
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void clipboard
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize DestroySubwindows
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t rect
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t child
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void chupx
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t CopyArea
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void foreground
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char bitmap
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void funcs
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t win
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t attr
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t format
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void SetCursor
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t grab
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void when
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize fs
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t gval
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t property
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list ConvertSelection
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void gc
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t button
Option_t Option_t TPoint TPoint const char text
Option_t Option_t TPoint TPoint const char y1
Binding & operator=(OUT(*fun)(void))
R__EXTERN TVirtualMutex * gROOTMutex
R__EXTERN TSystem * gSystem
#define R__LOCKGUARD(mutex)
DerivedType * Get() const
void Reset(NSObject *object)
The color creation and management class.
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
This class implements TVirtualX interface for MacOS X, using Cocoa and Quartz 2D.
virtual void SetClipRectangles(GContext_t gc, Int_t x, Int_t y, Rectangle_t *recs, Int_t n)
Sets clipping rectangles in graphics context.
virtual const char * DisplayName(const char *)
Returns hostname on which the display is opened.
virtual void SetRGB(Int_t cindex, Float_t r, Float_t g, Float_t b)
Sets color intensities the specified color index "cindex".
virtual void LowerWindow(Window_t wid)
Lowers the specified window "id" to the bottom of the stack so that it does not obscure any sibling w...
virtual void FlushOpenGLBuffer(Handle_t ctxID)
Flushes OpenGL buffer.
virtual Window_t GetWindowID(Int_t wid)
Returns the X11 window identifier.
virtual Int_t GetDoubleBuffer(Int_t wid)
Queries the double buffer value for the window "wid".
virtual void GetGeometry(Int_t wid, Int_t &x, Int_t &y, UInt_t &w, UInt_t &h)
Returns position and size of window "wid".
std::vector< GCValues_t > fX11Contexts
virtual void XorRegion(Region_t rega, Region_t regb, Region_t result)
Calculates the difference between the union and intersection of two regions.
void DrawLineAux(Drawable_t wid, const GCValues_t &gcVals, Int_t x1, Int_t y1, Int_t x2, Int_t y2)
virtual void GetWindowSize(Drawable_t wid, Int_t &x, Int_t &y, UInt_t &w, UInt_t &h)
Returns the location and the size of window "id".
virtual Handle_t CreateOpenGLContext(Window_t windowID, Handle_t sharedContext)
Creates OpenGL context for window "windowID".
virtual Pixmap_t ReadGIF(Int_t x0, Int_t y0, const char *file, Window_t wid)
If id is NULL - loads the specified gif file at position [x0,y0] in the current window.
virtual UInt_t ScreenWidthMM() const
Returns the width of the screen in millimeters.
void ReparentTopLevel(Window_t wid, Window_t pid, Int_t x, Int_t y)
Bool_t IsCocoaDraw() const
void SetApplicationIcon()
bool fDisplayShapeChanged
virtual Bool_t EqualRegion(Region_t rega, Region_t regb)
Returns kTRUE if the two regions have the same offset, size, and shape.
virtual Pixmap_t CreatePixmap(Drawable_t wid, UInt_t w, UInt_t h)
Creates a pixmap of the specified width and height and returns a pixmap ID that identifies it.
virtual void ClosePixmap()
Deletes current pixmap.
virtual Region_t PolygonRegion(Point_t *points, Int_t np, Bool_t winding)
Returns a region for the polygon defined by the points array.
virtual void GetFontProperties(FontStruct_t font, Int_t &max_ascent, Int_t &max_descent)
Returns the font properties.
virtual void MapSubwindows(Window_t wid)
Maps all subwindows for the specified window "id" in top-to-bottom stacking order.
virtual Pixmap_t CreatePixmapFromData(unsigned char *bits, UInt_t width, UInt_t height)
create pixmap from RGB data.
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)
virtual void SetDoubleBufferON()
Turns double buffer mode on.
ROOT::MacOSX::X11::CommandBuffer * GetCommandBuffer() const
virtual void SubtractRegion(Region_t rega, Region_t regb, Region_t result)
Subtracts regb from rega and stores the results in result.
virtual void GetGCValues(GContext_t gc, GCValues_t &gval)
Returns the components specified by the mask in "gval" for the specified GC "gc" (see also the GCValu...
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)
virtual void GrabPointer(Window_t wid, UInt_t evmask, Window_t confine, Cursor_t cursor, Bool_t grab=kTRUE, Bool_t owner_events=kTRUE)
Establishes an active pointer grab.
void DrawRectangleAux(Drawable_t wid, const GCValues_t &gcVals, Int_t x, Int_t y, UInt_t w, UInt_t h)
virtual void GetCharacterUp(Float_t &chupx, Float_t &chupy)
Returns character up vector.
virtual void DrawLine(Drawable_t wid, GContext_t gc, Int_t x1, Int_t y1, Int_t x2, Int_t y2)
Uses the components of the specified GC to draw a line between the specified set of points (x1,...
virtual FontStruct_t LoadQueryFont(const char *font_name)
Provides the most common way for accessing a font: opens (loads) the specified font and returns a poi...
virtual char ** ListFonts(const char *fontname, Int_t max, Int_t &count)
Returns list of font names matching fontname regexp, like "-*-times-*".
virtual void CopyPixmap(Int_t wid, Int_t xpos, Int_t ypos)
Copies the pixmap "wid" at the position [xpos,ypos] in the current window.
virtual void FreeColor(Colormap_t cmap, ULong_t pixel)
Frees color cell with specified pixel value.
virtual void ShapeCombineMask(Window_t wid, Int_t x, Int_t y, Pixmap_t mask)
The Non-rectangular Window Shape Extension adds non-rectangular windows to the System.
virtual Int_t TextWidth(FontStruct_t font, const char *s, Int_t len)
Return length of the string "s" in pixels. Size depends on font.
std::unique_ptr< ROOT::MacOSX::Details::CocoaPrivate > fPimpl
virtual void SetWMSizeHints(Window_t winID, UInt_t wMin, UInt_t hMin, UInt_t wMax, UInt_t hMax, UInt_t wInc, UInt_t hInc)
Gives the window manager minimum and maximum size hints of the window "id".
virtual void QueryColor(Colormap_t cmap, ColorStruct_t &color)
Returns the current RGB value for the pixel in the "color" structure.
virtual void SetWMTransientHint(Window_t winID, Window_t mainWinID)
Tells window manager that the window "id" is a transient window of the window "main_id".
virtual Int_t EventsPending()
Returns the number of events that have been received from the X server but have not been removed from...
void * GetCurrentContext()
virtual void ConvertSelection(Window_t, Atom_t &, Atom_t &, Atom_t &, Time_t &)
Requests that the specified selection be converted to the specified target type.
virtual Window_t CreateOpenGLWindow(Window_t parentID, UInt_t width, UInt_t height, const std::vector< std::pair< UInt_t, Int_t > > &format)
Create window with special pixel format. Noop everywhere except Cocoa.
virtual 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)
Translates coordinates in one window to the coordinate space of another window.
virtual Bool_t Init(void *display)
Initializes the X system.
virtual void RaiseWindow(Window_t wid)
Raises the specified window to the top of the stack so that no sibling window obscures it.
virtual ULong_t GetPixel(Color_t cindex)
Returns pixel value associated to specified ROOT color number "cindex".
virtual void SetCharacterUp(Float_t chupx, Float_t chupy)
Sets character up vector.
virtual void LookupString(Event_t *event, char *buf, Int_t buflen, UInt_t &keysym)
Converts the keycode from the event structure to a key symbol (according to the modifiers specified i...
virtual Int_t OpenPixmap(UInt_t w, UInt_t h)
Creates a pixmap of the width "w" and height "h" you specified.
virtual Int_t GetDepth() const
Returns depth of screen (number of bit planes).
virtual Drawable_t CreateImage(UInt_t width, UInt_t height)
Allocates the memory needed for an drawable.
virtual void UnionRectWithRegion(Rectangle_t *rect, Region_t src, Region_t dest)
Updates the destination region from a union of the specified rectangle and the specified source regio...
virtual Bool_t ReadPictureDataFromFile(const char *filename, char ***ret_data)
Reads picture data from file "filename" and store it in "ret_data".
virtual void CopyGC(GContext_t org, GContext_t dest, Mask_t mask)
Copies the specified components from the source GC "org" to the destination GC "dest".
virtual void DeleteFont(FontStruct_t fs)
Explicitly deletes the font structure "fs" obtained via LoadQueryFont().
virtual void PutPixel(Drawable_t wid, Int_t x, Int_t y, ULong_t pixel)
Overwrites the pixel in the image with the specified pixel value.
virtual void MoveWindow(Int_t wid, Int_t x, Int_t y)
Moves the window "wid" to the specified x and y coordinates.
virtual void SetTypeList(Window_t win, Atom_t prop, Atom_t *typelist)
Add the list of drag and drop types to the Window win.
virtual Atom_t InternAtom(const char *atom_name, Bool_t only_if_exist)
Returns the atom identifier associated with the specified "atom_name" string.
virtual Double_t GetOpenGLScalingFactor()
On a HiDPI resolution it can be > 1., this means glViewport should use scaled width and height.
virtual Int_t InitWindow(ULong_t window)
Creates a new window and return window number.
virtual void FreeFontNames(char **fontlist)
Frees the specified the array of strings "fontlist".
std::vector< std::string > fAtomToName
virtual 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)
Combines the specified rectangle of "src" with the specified rectangle of "dest" according to the "gc...
virtual void GetPlanes(Int_t &nplanes)
Returns the maximum number of planes.
virtual Bool_t ParseColor(Colormap_t cmap, const char *cname, ColorStruct_t &color)
Looks up the string name of a color "cname" with respect to the screen associated with the specified ...
virtual void UpdateWindow(Int_t mode)
Updates or synchronises client and server once (not permanent).
virtual Int_t RequestLocator(Int_t mode, Int_t ctyp, Int_t &x, Int_t &y)
Requests Locator position.
virtual void MapWindow(Window_t wid)
Maps the window "id" and all of its subwindows that have had map requests.
virtual void GetWindowAttributes(Window_t wid, WindowAttributes_t &attr)
The WindowAttributes_t structure is set to default.
virtual void WritePixmap(Int_t wid, UInt_t w, UInt_t h, char *pxname)
Writes the pixmap "wid" in the bitmap file "pxname".
virtual Int_t RequestString(Int_t x, Int_t y, char *text)
Requests string: text is displayed and can be edited with Emacs-like keybinding.
virtual void DeleteGC(GContext_t gc)
Deletes the specified GC "gc".
virtual Pixmap_t CreateBitmap(Drawable_t wid, const char *bitmap, UInt_t width, UInt_t height)
Creates a bitmap (i.e.
virtual Visual_t GetVisual() const
Returns handle to visual.
virtual void SetWindowName(Window_t wid, char *name)
Sets the window name.
static Atom_t fgDeleteWindowAtom
virtual void ChangeProperties(Window_t wid, Atom_t property, Atom_t type, Int_t format, UChar_t *data, Int_t len)
Alters the property for the specified window and causes the X server to generate a PropertyNotify eve...
virtual Bool_t CheckEvent(Window_t wid, EGEventType type, Event_t &ev)
Check if there is for window "id" an event of type "type".
virtual void MapRaised(Window_t wid)
Maps the window "id" and all of its subwindows that have had map requests on the screen and put this ...
virtual void SetTextMagnitude(Float_t mgn)
Sets the current text magnification factor to "mgn".
virtual Window_t GetInputFocus()
Returns the window id of the window having the input focus.
virtual void WMDeleteNotify(Window_t wid)
Tells WM to send message when window is closed via WM.
virtual void SetWMState(Window_t winID, EInitialState state)
Sets the initial state of the window "id": either kNormalState or kIconicState.
virtual Int_t ResizePixmap(Int_t wid, UInt_t w, UInt_t h)
Resizes the specified pixmap "wid".
virtual void NextEvent(Event_t &event)
The "event" is set to default event.
virtual Bool_t PointInRegion(Int_t x, Int_t y, Region_t reg)
Returns kTRUE if the point [x, y] is contained in the region reg.
virtual void FreeFontStruct(FontStruct_t fs)
Frees the font structure "fs".
void DrawStringAux(Drawable_t wid, const GCValues_t &gc, Int_t x, Int_t y, const char *s, Int_t len)
virtual Bool_t CreatePictureFromData(Drawable_t wid, char **data, Pixmap_t &pict, Pixmap_t &pict_mask, PictureAttributes_t &attr)
Creates a picture pict from data in bitmap format.
virtual void Bell(Int_t percent)
Sets the sound bell. Percent is loudness from -100% to 100%.
virtual Int_t GetScreen() const
Returns screen number.
virtual void SetForeground(GContext_t gc, ULong_t foreground)
Sets the foreground color for the specified GC (shortcut for ChangeGC with only foreground mask set).
virtual unsigned char * GetColorBits(Drawable_t wid, Int_t x, Int_t y, UInt_t w, UInt_t h)
Returns an array of pixels created from a part of drawable (defined by x, y, w, h) in format:
virtual Window_t GetParent(Window_t wid) const
Returns the parent of the window "id".
virtual void SetCursor(Window_t wid, Cursor_t curid)
Sets the cursor "curid" to be used when the pointer is in the window "id".
void ClearAreaAux(Window_t wid, Int_t x, Int_t y, UInt_t w, UInt_t h)
virtual Bool_t IsDNDAware(Window_t win, Atom_t *typelist)
Checks if the Window is DND aware, and knows any of the DND formats passed in argument.
void ReconfigureDisplay()
virtual void SetPrimarySelectionOwner(Window_t wid)
Makes the window "id" the current owner of the primary selection.
ROOT::MacOSX::X11::Rectangle GetDisplayGeometry() const
virtual UInt_t ExecCommand(TGWin32Command *code)
Executes the command "code" coming from the other threads (Win32)
virtual void SetDoubleBufferOFF()
Turns double buffer mode off.
virtual void SetDrawMode(EDrawMode mode)
Sets the drawing mode.
virtual void UnmapWindow(Window_t wid)
Unmaps the specified window "id".
virtual Bool_t NeedRedraw(ULong_t tgwindow, Bool_t force)
Notify the low level GUI layer ROOT requires "tgwindow" to be updated.
virtual Region_t CreateRegion()
Creates a new empty region.
virtual void Sync(Int_t mode)
Set synchronisation on or off.
virtual Colormap_t GetColormap() const
Returns handle to colormap.
virtual void SetClipOFF(Int_t wid)
Turns off the clipping for the window "wid".
virtual void GrabKey(Window_t wid, Int_t keycode, UInt_t modifier, Bool_t grab=kTRUE)
Establishes a passive grab on the keyboard.
virtual void SetDNDAware(Window_t, Atom_t *)
Add XdndAware property and the list of drag and drop types to the Window win.
virtual void SetClassHints(Window_t wid, char *className, char *resourceName)
Sets the windows class and resource name.
virtual FontStruct_t GetFontStruct(FontH_t fh)
Retrieves the associated font structure of the font specified font handle "fh".
virtual void FillRectangle(Drawable_t wid, GContext_t gc, Int_t x, Int_t y, UInt_t w, UInt_t h)
Fills the specified rectangle defined by [x,y] [x+w,y] [x+w,y+h] [x,y+h].
ROOT::MacOSX::X11::EventTranslator * GetEventTranslator() const
virtual void GetRGB(Int_t index, Float_t &r, Float_t &g, Float_t &b)
Returns RGB values for color "index".
void ReparentChild(Window_t wid, Window_t pid, Int_t x, Int_t y)
virtual void MoveResizeWindow(Window_t wid, Int_t x, Int_t y, UInt_t w, UInt_t h)
Changes the size and location of the specified window "id" without raising it.
void DrawSegmentsAux(Drawable_t wid, const GCValues_t &gcVals, const Segment_t *segments, Int_t nSegments)
virtual void SetDoubleBuffer(Int_t wid, Int_t mode)
Sets the double buffer on/off on the window "wid".
virtual void SetIconPixmap(Window_t wid, Pixmap_t pix)
Sets the icon name pixmap.
virtual void DestroySubwindows(Window_t wid)
The DestroySubwindows function destroys all inferior windows of the specified window,...
virtual FontH_t GetFontHandle(FontStruct_t fs)
Returns the font handle of the specified font structure "fs".
virtual void SetDashes(GContext_t gc, Int_t offset, const char *dash_list, Int_t n)
Sets the dash-offset and dash-list attributes for dashed line styles in the specified GC.
virtual void SetWMPosition(Window_t winID, Int_t x, Int_t y)
Tells the window manager the desired position [x,y] of window "id".
virtual Window_t GetDefaultRootWindow() const
Returns handle to the default root window created when calling XOpenDisplay().
virtual Window_t GetCurrentWindow() const
pointer to the current internal window used in canvas graphics
virtual void ChangeActivePointerGrab(Window_t, UInt_t, Cursor_t)
Changes the specified dynamic parameters if the pointer is actively grabbed by the client and if the ...
virtual void ChangeProperty(Window_t wid, Atom_t property, Atom_t type, UChar_t *data, Int_t len)
Alters the property for the specified window and causes the X server to generate a PropertyNotify eve...
virtual void IconifyWindow(Window_t wid)
Iconifies the window "id".
virtual void ChangeWindowAttributes(Window_t wid, SetWindowAttributes_t *attr)
Changes the attributes of the specified window "id" according the values provided in "attr".
virtual 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)
Creates an unmapped subwindow for a specified parent window and returns the created window.
virtual void RescaleWindow(Int_t wid, UInt_t w, UInt_t h)
Rescales the window "wid".
virtual void CloseDisplay()
Closes connection to display server and destroys all windows.
virtual Bool_t AllocColor(Colormap_t cmap, ColorStruct_t &color)
Allocates a read-only colormap entry corresponding to the closest RGB value supported by the hardware...
virtual void DeletePictureData(void *data)
Delete picture data created by the function ReadPictureDataFromFile.
virtual Bool_t MakeOpenGLContextCurrent(Handle_t ctx, Window_t windowID)
Makes context ctx current OpenGL context.
virtual void ConvertPrimarySelection(Window_t wid, Atom_t clipboard, Time_t when)
Causes a SelectionRequest event to be sent to the current primary selection owner.
void DeletePixmapAux(Pixmap_t pixmapID)
virtual GContext_t CreateGC(Drawable_t wid, GCValues_t *gval)
Creates a graphics context using the provided GCValues_t *gval structure.
virtual void SetClipRegion(Int_t wid, Int_t x, Int_t y, UInt_t w, UInt_t h)
Sets clipping region for the window "wid".
virtual void CloseWindow()
Deletes current window.
virtual void DeleteImage(Drawable_t img)
Deallocates the memory associated with the image img.
virtual Int_t WriteGIF(char *name)
Writes the current window into GIF file.
virtual void QueryPointer(Int_t &x, Int_t &y)
Returns the pointer position.
virtual void ChangeGC(GContext_t gc, GCValues_t *gval)
Changes the components specified by the mask in gval for the specified GC.
virtual void ClearArea(Window_t wid, Int_t x, Int_t y, UInt_t w, UInt_t h)
Paints a rectangular area in the specified window "id" according to the specified dimensions with the...
virtual Int_t AddWindow(ULong_t qwid, UInt_t w, UInt_t h)
Registers a window created by Qt as a ROOT window.
virtual void DestroyRegion(Region_t reg)
Destroys the region "reg".
virtual Handle_t GetNativeEvent() const
Returns the current native event handle.
virtual void SetWindowBackgroundPixmap(Window_t wid, Pixmap_t pxm)
Sets the background pixmap of the window "id" to the specified pixmap "pxm".
virtual void SetMWMHints(Window_t winID, UInt_t value, UInt_t decorators, UInt_t inputMode)
Sets decoration style.
virtual void SelectInput(Window_t wid, UInt_t evmask)
Defines which input events the window is interested in.
virtual Window_t FindRWindow(Window_t win, Window_t dragwin, Window_t input, int x, int y, int maxd)
Recursively search in the children of Window for a Window which is at location x, y and is DND aware,...
ROOT::MacOSX::X11::name_to_atom_map fNameToAtom
virtual void GetRegionBox(Region_t reg, Rectangle_t *rect)
Returns smallest enclosing rectangle.
virtual void Update(Int_t mode)
Flushes (mode = 0, default) or synchronizes (mode = 1) X output buffer.
virtual void UnionRegion(Region_t rega, Region_t regb, Region_t result)
Computes the union of two regions.
virtual Handle_t GetCurrentOpenGLContext()
Asks OpenGL subsystem about the current OpenGL context.
virtual void RemoveWindow(ULong_t qwid)
Removes the created by Qt window "qwid".
virtual void GetPasteBuffer(Window_t wid, Atom_t atom, TString &text, Int_t &nchar, Bool_t del)
Gets contents of the paste buffer "atom" into the string "text".
virtual void GrabButton(Window_t wid, EMouseButton button, UInt_t modifier, UInt_t evmask, Window_t confine, Cursor_t cursor, Bool_t grab=kTRUE)
Establishes a passive grab on a certain mouse button.
virtual void SetInputFocus(Window_t wid)
Changes the input focus to specified window "id".
virtual void ResizeWindow(Int_t wid)
Resizes the window "wid" if necessary.
virtual Bool_t HasTTFonts() const
Returns True when TrueType fonts are used.
virtual void GetImageSize(Drawable_t wid, UInt_t &width, UInt_t &height)
Returns the width and height of the image id.
virtual Int_t OpenDisplay(const char *displayName)
Opens connection to display server (if such a thing exist on the current platform).
virtual void DeletePixmap(Pixmap_t pixmapID)
Explicitly deletes the pixmap resource "pmap".
virtual void SetWMSize(Window_t winID, UInt_t w, UInt_t h)
Tells window manager the desired size of window "id".
virtual void SendEvent(Window_t wid, Event_t *ev)
Specifies the event "ev" is to be sent to the window "id".
virtual void SetKeyAutoRepeat(Bool_t on=kTRUE)
Turns key auto repeat on (kTRUE) or off (kFALSE).
virtual Bool_t EmptyRegion(Region_t reg)
Returns kTRUE if the region reg is empty.
virtual void FillPolygon(Window_t wid, GContext_t gc, Point_t *polygon, Int_t nPoints)
Fills the region closed by the specified path.
virtual void SetWindowBackground(Window_t wid, ULong_t color)
Sets the background of the window "id" to the specified color value "color".
virtual Int_t SupportsExtension(const char *extensionName) const
Returns 1 if window system server supports extension given by the argument, returns 0 in case extensi...
virtual Cursor_t CreateCursor(ECursor cursor)
Creates the specified cursor.
virtual void ReparentWindow(Window_t wid, Window_t pid, Int_t x, Int_t y)
If the specified window is mapped, ReparentWindow automatically performs an UnmapWindow request on it...
void FillPolygonAux(Window_t wid, const GCValues_t &gcVals, const Point_t *polygon, Int_t nPoints)
virtual Int_t AddPixmap(ULong_t pixid, UInt_t w, UInt_t h)
Registers a pixmap created by TGLManager as a ROOT pixmap.
virtual void DeleteOpenGLContext(Int_t ctxID)
Deletes OpenGL context for window "wid".
bool MakeProcessForeground()
virtual 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)
Combines an image with a rectangle of the specified drawable.
virtual Bool_t SetSelectionOwner(Window_t windowID, Atom_t &selectionID)
Changes the owner and last-change time for the specified selection.
std::map< Atom_t, Window_t > fSelectionOwners
virtual Bool_t CreatePictureFromFile(Drawable_t wid, const char *filename, Pixmap_t &pict, Pixmap_t &pict_mask, PictureAttributes_t &attr)
Creates a picture pict from data in file "filename".
virtual 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 **)
Returns the actual type of the property; the actual format of the property; the number of 8-bit,...
virtual void SelectWindow(Int_t wid)
Selects the window "wid" to which subsequent output is directed.
virtual void DrawSegments(Drawable_t wid, GContext_t gc, Segment_t *segments, Int_t nSegments)
Draws multiple line segments.
virtual void ClearWindow()
Clears the entire area of the current window.
virtual void SetIconName(Window_t wid, char *name)
Sets the window icon name.
Drawable_t fSelectedDrawable
virtual void DestroyWindow(Window_t wid)
Destroys the window "id" as well as all of its subwindows.
virtual Window_t GetPrimarySelectionOwner()
Returns the window id of the current owner of the primary selection.
ROOT::MacOSX::X11::Rectangle fDisplayRect
virtual void DeleteProperty(Window_t, Atom_t &)
Deletes the specified property only if the property was defined on the specified window and causes th...
virtual void DrawRectangle(Drawable_t wid, GContext_t gc, Int_t x, Int_t y, UInt_t w, UInt_t h)
Draws rectangle outlines of [x,y] [x+w,y] [x+w,y+h] [x,y+h].
virtual void SelectPixmap(Int_t qpixid)
Selects the pixmap "qpixid".
virtual void Warp(Int_t ix, Int_t iy, Window_t wid)
Sets the pointer position.
std::map< Atom_t, Window_t >::iterator selection_iterator
virtual void IntersectRegion(Region_t rega, Region_t regb, Region_t result)
Computes the intersection of two regions.
virtual Display_t GetDisplay() const
Returns handle to display (might be useful in some cases where direct X11 manipulation outside of TVi...
virtual Int_t KeysymToKeycode(UInt_t keysym)
Converts the "keysym" to the appropriate keycode.
virtual void DrawString(Drawable_t wid, GContext_t gc, Int_t x, Int_t y, const char *s, Int_t len)
Each character image, as defined by the font in the GC, is treated as an additional mask for a fill o...
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,...
ROOT::MacOSX::Util::CFScopeGuard< CGImageRef > fImage
QuartzImage * fBackgroundPixmap
unsigned long fBackgroundPixel
NSView< X11Window > * fContentView
QuartzWindow * fQuartzWindow
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)
bool ViewIsTextViewFrame(NSView< X11Window > *view, bool checkParent)
NSPoint TranslateFromScreen(NSPoint point, NSView< X11Window > *to)
NSUInteger GetCocoaKeyModifiersFromROOTKeyModifiers(UInt_t rootKeyModifiers)
void InitWithPredefinedAtoms(name_to_atom_map &nameToAtom, std::vector< std::string > &atomNames)
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)
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.