47#include <ApplicationServices/ApplicationServices.h>
48#include <OpenGL/OpenGL.h>
49#include <Cocoa/Cocoa.h>
89#pragma mark - Display configuration management.
92void DisplayReconfigurationCallback(CGDirectDisplayID , CGDisplayChangeSummaryFlags flags,
void * )
94 if (flags & kCGDisplayBeginConfigurationFlag)
97 if (flags & kCGDisplayDesktopShapeChangedFlag) {
98 assert(
dynamic_cast<TGCocoa *
>(
gVirtualX) != 0 &&
"DisplayReconfigurationCallback, gVirtualX"
99 " is either null or has a wrong type");
105#pragma mark - Aux. functions called from GUI-rendering part.
108void SetStrokeForegroundColorFromX11Context(CGContextRef ctx,
const GCValues_t &gcVals)
110 assert(ctx != 0 &&
"SetStrokeForegroundColorFromX11Context, parameter 'ctx' is null");
116 ::Warning(
"SetStrokeForegroundColorFromX11Context",
117 "x11 context does not have line color information");
119 CGContextSetRGBStrokeColor(ctx, rgb[0], rgb[1], rgb[2], 1.);
123void SetStrokeDashFromX11Context(CGContextRef ctx,
const GCValues_t &gcVals)
126 assert(ctx != 0 &&
"SetStrokeDashFromX11Context, ctx parameter is null");
128 SetStrokeForegroundColorFromX11Context(ctx, gcVals);
130 static const std::size_t maxLength =
sizeof gcVals.
fDashes /
sizeof gcVals.
fDashes[0];
131 assert(maxLength >= std::size_t(gcVals.
fDashLen) &&
132 "SetStrokeDashFromX11Context, x11 context has bad dash length > sizeof(fDashes)");
134 CGFloat dashes[maxLength] = {};
142void SetStrokeDoubleDashFromX11Context(CGContextRef ,
const GCValues_t & )
145 ::Warning(
"SetStrokeDoubleDashFromX11Context",
"Not implemented yet, kick tpochep!");
149void SetStrokeParametersFromX11Context(CGContextRef ctx,
const GCValues_t &gcVals)
153 assert(ctx != 0 &&
"SetStrokeParametersFromX11Context, parameter 'ctx' is null");
157 CGContextSetLineWidth(ctx, gcVals.
fLineWidth);
159 CGContextSetLineWidth(ctx, 1.);
161 CGContextSetLineDash(ctx, 0., 0, 0);
165 SetStrokeForegroundColorFromX11Context(ctx, gcVals);
167 SetStrokeDashFromX11Context(ctx, gcVals);
169 SetStrokeDoubleDashFromX11Context(ctx ,gcVals);
171 ::Warning(
"SetStrokeParametersFromX11Context",
"line style bit is set,"
172 " but line style is unknown");
173 SetStrokeForegroundColorFromX11Context(ctx, gcVals);
176 SetStrokeForegroundColorFromX11Context(ctx, gcVals);
180void SetFilledAreaColorFromX11Context(CGContextRef ctx,
const GCValues_t &gcVals)
184 assert(ctx != 0 &&
"SetFilledAreaColorFromX11Context, parameter 'ctx' is null");
190 ::Warning(
"SetFilledAreaColorFromX11Context",
"no fill color found in x11 context");
192 CGContextSetRGBFillColor(ctx, rgb[0], rgb[1], rgb[2], 1.);
195struct PatternContext {
200 NSObject<X11Drawable> *fImage;
206bool HasFillTiledStyle(
Mask_t mask,
Int_t fillStyle)
212bool HasFillTiledStyle(
const GCValues_t &gcVals)
218bool HasFillStippledStyle(
Mask_t mask,
Int_t fillStyle)
224bool HasFillStippledStyle(
const GCValues_t &gcVals)
230bool HasFillOpaqueStippledStyle(
Mask_t mask,
Int_t fillStyle)
236bool HasFillOpaqueStippledStyle(
const GCValues_t &gcVals)
242void DrawTile(NSObject<X11Drawable> *patternImage, CGContextRef ctx)
244 assert(patternImage != nil &&
"DrawTile, parameter 'patternImage' is nil");
245 assert(ctx != 0 &&
"DrawTile, ctx parameter is null");
247 const CGRect patternRect = CGRectMake(0, 0, patternImage.fWidth, patternImage.fHeight);
248 if ([patternImage isKindOfClass : [
QuartzImage class]]) {
249 CGContextDrawImage(ctx, patternRect, ((
QuartzImage *)patternImage).fImage);
250 }
else if ([patternImage isKindOfClass : [
QuartzPixmap class]]){
252 assert(imageFromPixmap.Get() != 0 &&
"DrawTile, createImageFromPixmap failed");
253 CGContextDrawImage(ctx, patternRect, imageFromPixmap.Get());
255 assert(0 &&
"DrawTile, pattern is neither a QuartzImage, nor a QuartzPixmap");
265 assert(info != 0 &&
"DrawPattern, parameter 'info' is null");
266 assert(ctx != 0 &&
"DrawPattern, parameter 'ctx' is null");
268 const PatternContext *
const patternContext = (PatternContext *)info;
269 const Mask_t mask = patternContext->fMask;
270 const Int_t fillStyle = patternContext->fFillStyle;
272 NSObject<X11Drawable> *
const patternImage = patternContext->fImage;
273 assert(patternImage != nil &&
"DrawPattern, pattern (stipple) image is nil");
274 const CGRect patternRect = CGRectMake(0, 0, patternImage.fWidth, patternImage.fHeight);
276 if (HasFillTiledStyle(mask, fillStyle)) {
277 DrawTile(patternImage, ctx);
278 }
else if (HasFillStippledStyle(mask, fillStyle) || HasFillOpaqueStippledStyle(mask, fillStyle)) {
279 assert([patternImage isKindOfClass : [
QuartzImage class]] &&
280 "DrawPattern, stipple must be a QuartzImage object");
282 assert(image.
fIsStippleMask == YES &&
"DrawPattern, image is not a stipple mask");
286 if (HasFillOpaqueStippledStyle(mask,fillStyle)) {
289 "DrawPattern, fill style is FillOpaqueStippled, but background color is not set in a context");
291 CGContextSetRGBFillColor(ctx, rgb[0], rgb[1], rgb[2], 1.);
292 CGContextFillRect(ctx, patternRect);
296 assert((mask &
kGCForeground) &&
"DrawPattern, foreground color is not set");
298 CGContextSetRGBFillColor(ctx, rgb[0], rgb[1], rgb[2], 1.);
299 CGContextClipToMask(ctx, patternRect, image.
fImage);
300 CGContextFillRect(ctx, patternRect);
303 DrawTile(patternImage, ctx);
308void SetFillPattern(CGContextRef ctx,
const PatternContext *patternContext)
314 assert(ctx != 0 &&
"SetFillPattern, parameter 'ctx' is null");
315 assert(patternContext != 0 &&
"SetFillPattern, parameter 'patternContext' is null");
316 assert(patternContext->fImage != nil &&
"SetFillPattern, pattern image is nil");
319 CGContextSetFillColorSpace(ctx, patternColorSpace.Get());
321 CGPatternCallbacks callbacks = {};
323 const CGRect patternRect = CGRectMake(0, 0, patternContext->fImage.fWidth, patternContext->fImage.fHeight);
325 patternContext->fImage.fWidth, patternContext->fImage.fHeight,
326 kCGPatternTilingNoDistortion,
true, &callbacks));
327 const CGFloat alpha = 1.;
328 CGContextSetFillPattern(ctx, pattern.Get(), &alpha);
329 CGContextSetPatternPhase(ctx, patternContext->fPhase);
333bool ParentRendersToChild(NSView<X11Window> *child)
335 assert(child != nil &&
"ParentRendersToChild, parameter 'child' is nil");
339 child.fMapState ==
kIsViewable && child.fParentView.fContext &&
340 !child.fIsOverlapped;
343class ViewFixer final {
348 const auto origin = viewToFix.frame.origin;
350 widToFix = viewToFix.
fID;
351 if ((context = viewToFix.
fContext)) {
352 CGContextSaveGState(context);
353 CGContextTranslateCTM(context, origin.x, origin.y);
360 CGContextRestoreGState(context);
362 ViewFixer(
const ViewFixer &rhs) =
delete;
363 ViewFixer &
operator = (
const ViewFixer &) =
delete;
366 CGContextRef context =
nullptr;
370bool IsNonPrintableAsciiCharacter(UniChar
c)
372 if (
c == 9 || (
c >= 32 &&
c < 127))
379void FixAscii(std::vector<UniChar> &
text)
396 std::replace(
text.begin(),
text.end(), UniChar(16), UniChar(
' '));
399 text.erase(std::remove_if(
text.begin(),
text.end(), IsNonPrintableAsciiCharacter),
text.end());
410 : fSelectedDrawable(0),
414 fForegroundProcess(false),
416 fDisplayShapeChanged(true)
419 "TGCocoa, gSystem is eihter null or has a wrong type");
430 CGDisplayRegisterReconfigurationCallback (DisplayReconfigurationCallback, 0);
436 fSelectedDrawable(0),
440 fForegroundProcess(false),
442 fDisplayShapeChanged(true)
445 "TGCocoa, gSystem is eihter null or has a wrong type");
456 CGDisplayRegisterReconfigurationCallback (DisplayReconfigurationCallback, 0);
463 CGDisplayRemoveReconfigurationCallback (DisplayReconfigurationCallback, 0);
532 return CGDisplayScreenSize(CGMainDisplayID()).width;
543 NSArray *
const screens = [NSScreen screens];
544 assert(screens != nil &&
"screens array is nil");
546 NSScreen *
const mainScreen = [screens objectAtIndex : 0];
547 assert(mainScreen != nil &&
"screen with index 0 is nil");
549 return NSBitsPerPixelFromDepth([mainScreen depth]);
558 assert(
gClient != 0 &&
"Update, gClient is null");
560 }
else if (mode > 0) {
579 NSArray *
const screens = [NSScreen screens];
580 assert(screens != nil && screens.count != 0 &&
"GetDisplayGeometry, no screens found");
582 NSRect frame = [(NSScreen *)[screens objectAtIndex : 0] frame];
583 CGFloat xMin = frame.origin.x, xMax = xMin + frame.size.width;
584 CGFloat yMin = frame.origin.y, yMax = yMin + frame.size.height;
586 for (NSUInteger i = 1,
e = screens.count; i <
e; ++i) {
587 frame = [(NSScreen *)[screens objectAtIndex : i] frame];
588 xMin = std::min(xMin, frame.origin.x);
589 xMax = std::max(xMax, frame.origin.x + frame.size.width);
590 yMin = std::min(yMin, frame.origin.y);
591 yMax = std::max(yMax, frame.origin.y + frame.size.height);
605#pragma mark - Window management part.
611 return fPimpl->GetRootWindowID();
627 assert(parentID != 0 &&
"InitWindow, parameter 'parentID' is 0");
631 if (
fPimpl->IsRootWindow(parentID))
634 [
fPimpl->GetWindow(parentID) getAttributes : &attr];
636 return CreateWindow(parentID, 0, 0, attr.
fWidth, attr.
fHeight, 0, attr.
fDepth, attr.
fClass, 0, 0, 0);
660 "ClearWindow, fSelectedDrawable is invalid");
663 if (drawable.fIsPixmap) {
668 CGContextRef pixmapCtx = drawable.fContext;
669 assert(pixmapCtx != 0 &&
"ClearWindow, pixmap's context is null");
674 CGContextClearRect(pixmapCtx, CGRectMake(0, 0, drawable.fWidth, drawable.fHeight));
691 if (windowID < 0 || fPimpl->IsRootWindow(windowID)) {
701 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(windowID);
705 h = drawable.fHeight;
707 if (!drawable.fIsPixmap) {
708 NSObject<X11Window> *
const window = (NSObject<X11Window> *)drawable;
709 NSPoint srcPoint = {};
712 NSView<X11Window> *
const view = window.fContentView.fParentView ? window.fContentView.fParentView : window.fContentView;
729 assert(!
fPimpl->IsRootWindow(windowID) &&
"MoveWindow, called for root window");
734 [
fPimpl->GetWindow(windowID) setX :
x Y :
y];
754 assert(!
fPimpl->IsRootWindow(windowID) &&
755 "ResizeWindow, parameter 'windowID' is a root window's id");
759 NSObject<X11Window> *
const window =
fPimpl->GetWindow(windowID);
760 if (window.fBackBuffer) {
780 "UpdateWindow, fSelectedDrawable is not a valid window id");
789 assert([window.fContentView isKindOfClass : [
QuartzView class]] &&
"UpdateWindow, content view is not a QuartzView");
797 const X11::Rectangle copyArea(0, 0, pixmap.fWidth, pixmap.fHeight);
798 [dstView copy : pixmap area : copyArea withMask : nil clipOrigin :
X11::Point() toPoint :
X11::Point()];
801 fPimpl->fX11CommandBuffer.AddUpdateWindow(dstView);
847 if (
fPimpl->IsRootWindow(parentID)) {
850 depth, clss, visual, attr, wtype);
855 newWindow.
fID = result;
856 [newWindow setAcceptsMouseMovedEvents : YES];
860 NSObject<X11Window> *
const parentWin =
fPimpl->GetWindow(parentID);
862 assert([parentWin.fContentView isKindOfClass : [
QuartzView class]] &&
863 "CreateWindow, parent view must be QuartzView");
867 x,
y, w,
h, border, depth, clss, visual, attr, wtype);
870 childView.
fID = result;
871 [parentWin addChild : childView];
898 if (
fPimpl->IsRootWindow(wid))
901 BOOL needFocusChange = NO;
906 fPimpl->fX11EventTranslator.CheckUnmappedView(wid);
908 assert(
fPimpl->GetDrawable(wid).fIsPixmap == NO &&
909 "DestroyWindow, can not be called for QuartzPixmap or QuartzImage object");
911 NSObject<X11Window> *
const window =
fPimpl->GetWindow(wid);
912 if (
fPimpl->fX11CommandBuffer.BufferSize())
913 fPimpl->fX11CommandBuffer.RemoveOperationsForDrawable(wid);
916 if ((needFocusChange = window == window.fQuartzWindow && window.fQuartzWindow.fHasFocus))
917 window.fHasFocus = NO;
921 fPimpl->fX11EventTranslator.GenerateDestroyNotify(wid);
927 fPimpl->DeleteDrawable(wid);
947 if (
fPimpl->IsRootWindow(wid))
952 assert(
fPimpl->GetDrawable(wid).fIsPixmap == NO &&
953 "DestroySubwindows, can not be called for QuartzPixmap or QuartzImage object");
955 NSObject<X11Window> *window =
fPimpl->GetWindow(wid);
962 for (NSView<X11Window> *child in children.
Get())
974 if (
fPimpl->IsRootWindow(wid))
977 [
fPimpl->GetWindow(wid) getAttributes : &attr];
990 assert(!
fPimpl->IsRootWindow(wid) &&
"ChangeWindowAttributes, called for root window");
991 assert(attr != 0 &&
"ChangeWindowAttributes, parameter 'attr' is null");
993 [
fPimpl->GetWindow(wid) setAttributes : attr];
1008 if (windowID <= fPimpl->GetRootWindowID())
1011 NSObject<X11Window> *
const window =
fPimpl->GetWindow(windowID);
1013 window.fEventMask = eventMask;
1022 assert(!
fPimpl->IsRootWindow(wid) &&
"ReparentChild, can not re-parent root window");
1026 NSView<X11Window> *
const view =
fPimpl->GetWindow(wid).fContentView;
1027 if (
fPimpl->IsRootWindow(pid)) {
1030 [view removeFromSuperview];
1031 view.fParentView = nil;
1033 NSRect frame = view.frame;
1034 frame.origin = NSPoint();
1037 if (!view.fOverrideRedirect)
1041 styleMask : styleMask
1042 backing : NSBackingStoreBuffered
1044 [view setX :
x Y :
y];
1045 [newTopLevel addChild : view];
1047 fPimpl->ReplaceDrawable(wid, newTopLevel);
1050 [newTopLevel release];
1053 [view removeFromSuperview];
1055 NSObject<X11Window> *
const newParent =
fPimpl->GetWindow(pid);
1056 assert(newParent.fIsPixmap == NO &&
"ReparentChild, pixmap can not be a new parent");
1057 [view setX :
x Y :
y];
1058 [newParent addChild : view];
1069 if (
fPimpl->IsRootWindow(pid))
1074 NSView<X11Window> *
const contentView =
fPimpl->GetWindow(wid).fContentView;
1076 [contentView retain];
1077 [contentView removeFromSuperview];
1078 [topLevel setContentView : nil];
1079 fPimpl->ReplaceDrawable(wid, contentView);
1080 [contentView setX :
x Y :
y];
1081 [
fPimpl->GetWindow(pid) addChild : contentView];
1082 [contentView release];
1093 assert(!
fPimpl->IsRootWindow(wid) &&
"ReparentWindow, can not re-parent root window");
1095 NSView<X11Window> *
const view =
fPimpl->GetWindow(wid).fContentView;
1096 if (view.fParentView)
1109 assert(!
fPimpl->IsRootWindow(wid) &&
"MapWindow, called for root window");
1114 [
fPimpl->GetWindow(wid) mapWindow];
1129 assert(!
fPimpl->IsRootWindow(wid) &&
"MapSubwindows, called for 'root' window");
1134 [
fPimpl->GetWindow(wid) mapSubwindows];
1144 assert(!
fPimpl->IsRootWindow(wid) &&
"MapRaised, called for root window");
1149 [
fPimpl->GetWindow(wid) mapRaised];
1165 assert(!
fPimpl->IsRootWindow(wid) &&
"UnmapWindow, called for root window");
1170 fPimpl->fX11EventTranslator.CheckUnmappedView(wid);
1172 NSObject<X11Window> *
const win =
fPimpl->GetWindow(wid);
1175 if (win == win.fQuartzWindow && win.fQuartzWindow.fHasFocus)
1197 assert(!
fPimpl->IsRootWindow(wid) &&
"RaiseWindow, called for root window");
1199 if (!
fPimpl->GetWindow(wid).fParentView)
1202 [
fPimpl->GetWindow(wid) raiseWindow];
1214 assert(!
fPimpl->IsRootWindow(wid) &&
"LowerWindow, called for root window");
1216 if (!
fPimpl->GetWindow(wid).fParentView)
1219 [
fPimpl->GetWindow(wid) lowerWindow];
1235 assert(!
fPimpl->IsRootWindow(wid) &&
"MoveWindow, called for root window");
1237 [
fPimpl->GetWindow(wid) setX :
x Y :
y];
1254 assert(!
fPimpl->IsRootWindow(wid) &&
"MoveResizeWindow, called for 'root' window");
1266 assert(!
fPimpl->IsRootWindow(wid) &&
"ResizeWindow, called for 'root' window");
1271 const UInt_t siMax = std::numeric_limits<Int_t>::max();
1272 if (w > siMax ||
h > siMax)
1275 NSSize newSize = {};
1279 [
fPimpl->GetWindow(wid) setDrawableSize : newSize];
1289 assert(!
fPimpl->IsRootWindow(wid) &&
"IconifyWindow, can not iconify the root window");
1290 assert(
fPimpl->GetWindow(wid).fIsPixmap == NO &&
"IconifyWindow, invalid window id");
1292 NSObject<X11Window> *
const win =
fPimpl->GetWindow(wid);
1293 assert(win.fQuartzWindow == win &&
"IconifyWindow, can be called only for a top level window");
1295 fPimpl->fX11EventTranslator.CheckUnmappedView(wid);
1297 NSObject<X11Window> *
const window =
fPimpl->GetWindow(wid);
1298 if (
fPimpl->fX11CommandBuffer.BufferSize())
1299 fPimpl->fX11CommandBuffer.RemoveOperationsForDrawable(wid);
1301 if (window.fQuartzWindow.fHasFocus) {
1303 window.fQuartzWindow.fHasFocus = NO;
1306 [win.fQuartzWindow miniaturize : win.fQuartzWindow];
1321 if (!srcWin || !dstWin)
1324 const bool srcIsRoot =
fPimpl->IsRootWindow(srcWin);
1325 const bool dstIsRoot =
fPimpl->IsRootWindow(dstWin);
1327 if (srcIsRoot && dstIsRoot) {
1339 NSPoint srcPoint = {};
1343 NSPoint dstPoint = {};
1347 NSView<X11Window> *
const srcView =
fPimpl->GetWindow(srcWin).fContentView;
1349 }
else if (srcIsRoot) {
1350 NSView<X11Window> *
const dstView =
fPimpl->GetWindow(dstWin).fContentView;
1353 if ([dstView superview]) {
1357 dstPoint = [[dstView superview] convertPoint : dstPoint fromView : dstView];
1358 if (NSView<X11Window> *
const view = (NSView<X11Window> *)[dstView hitTest : dstPoint]) {
1359 if (view != dstView && view.fMapState ==
kIsViewable)
1364 NSView<X11Window> *
const srcView =
fPimpl->GetWindow(srcWin).fContentView;
1365 NSView<X11Window> *
const dstView =
fPimpl->GetWindow(dstWin).fContentView;
1368 if ([dstView superview]) {
1372 const NSPoint
pt = [[dstView superview] convertPoint : dstPoint fromView : dstView];
1373 if (NSView<X11Window> *
const view = (NSView<X11Window> *)[dstView hitTest :
pt]) {
1374 if (view != dstView && view.fMapState ==
kIsViewable)
1397 if (
fPimpl->IsRootWindow(wid)) {
1405 NSObject<X11Drawable> *window =
fPimpl->GetDrawable(wid);
1407 if (!window.fIsPixmap) {
1427 assert(!
fPimpl->IsRootWindow(wid) &&
"SetWindowBackground, can not set color for root window");
1429 fPimpl->GetWindow(wid).fBackgroundPixel = color;
1442 assert(!
fPimpl->IsRootWindow(windowID) &&
1443 "SetWindowBackgroundPixmap, can not set background for a root window");
1444 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
1445 "SetWindowBackgroundPixmap, invalid window id");
1447 NSObject<X11Window> *
const window =
fPimpl->GetWindow(windowID);
1448 if (pixmapID ==
kNone) {
1449 window.fBackgroundPixmap = nil;
1453 assert(pixmapID >
fPimpl->GetRootWindowID() &&
1454 "SetWindowBackgroundPixmap, parameter 'pixmapID' is not a valid pixmap id");
1455 assert(
fPimpl->GetDrawable(pixmapID).fIsPixmap == YES &&
1456 "SetWindowBackgroundPixmap, bad drawable");
1458 NSObject<X11Drawable> *
const pixmapOrImage =
fPimpl->GetDrawable(pixmapID);
1463 if ([pixmapOrImage isKindOfClass : [
QuartzPixmap class]]) {
1465 if (backgroundImage.
Get())
1466 window.fBackgroundPixmap = backgroundImage.
Get();
1469 if (backgroundImage.
Get())
1470 window.fBackgroundPixmap = backgroundImage.
Get();
1473 if (!backgroundImage.
Get())
1475 Error(
"SetWindowBackgroundPixmap",
"QuartzImage initialization failed");
1484 if (windowID <= fPimpl->GetRootWindowID())
1487 NSView<X11Window> *view =
fPimpl->GetWindow(windowID).fContentView;
1488 return view.fParentView ? view.fParentView.fID :
fPimpl->GetRootWindowID();
1499 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1501 if ([(NSObject *)drawable isKindOfClass : [NSWindow
class]]) {
1502 NSString *
const windowTitle = [NSString stringWithCString :
name encoding : NSASCIIStringEncoding];
1503 [(NSWindow *)drawable setTitle : windowTitle];
1533 assert(!
fPimpl->IsRootWindow(windowID) &&
1534 "ShapeCombineMask, windowID parameter is a 'root' window");
1535 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
1536 "ShapeCombineMask, windowID parameter is a bad window id");
1538 "ShapeCombineMask, pixmapID parameter must point to QuartzImage object");
1540 if (
fPimpl->GetWindow(windowID).fContentView.fParentView)
1544 assert(srcImage.
fIsStippleMask == YES &&
"ShapeCombineMask, source image is not a stipple mask");
1552 [qw setOpaque : NO];
1553 [qw setBackgroundColor : [NSColor clearColor]];
1557#pragma mark - "Window manager hints" set of functions.
1565 assert(!
fPimpl->IsRootWindow(wid) &&
"SetMWMHints, called for 'root' window");
1568 NSUInteger newMask = 0;
1584 [qw setStyleMask : newMask];
1588 [[qw standardWindowButton : NSWindowZoomButton] setEnabled : YES];
1589 [[qw standardWindowButton : NSWindowMiniaturizeButton] setEnabled : YES];
1593 [[qw standardWindowButton : NSWindowZoomButton] setEnabled : funcs &
kMWMDecorMaximize];
1594 [[qw standardWindowButton : NSWindowMiniaturizeButton] setEnabled : funcs &
kMWMDecorMinimize];
1616 assert(!
fPimpl->IsRootWindow(wid) &&
"SetWMSizeHints, called for root window");
1619 const NSRect minRect = [NSWindow frameRectForContentRect : NSMakeRect(0., 0., wMin, hMin) styleMask : styleMask];
1620 const NSRect maxRect = [NSWindow frameRectForContentRect : NSMakeRect(0., 0., wMax, hMax) styleMask : styleMask];
1623 [qw setMinSize : minRect.size];
1624 [qw setMaxSize : maxRect.size];
1645 assert(wid >
fPimpl->GetRootWindowID() &&
"SetWMTransientHint, wid parameter is not a valid window id");
1647 if (
fPimpl->IsRootWindow(mainWid))
1652 if (![mainWindow isVisible])
1657 if (mainWindow != transientWindow) {
1660 Error(
"SetWMTransientHint",
"window is already transient for other window");
1662 [[transientWindow standardWindowButton : NSWindowZoomButton] setEnabled : NO];
1663 [mainWindow addTransientWindow : transientWindow];
1666 Warning(
"SetWMTransientHint",
"transient and main windows are the same window");
1669#pragma mark - GUI-rendering part.
1675 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawLineAux, called for root window");
1677 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1678 CGContextRef ctx = drawable.fContext;
1679 assert(ctx != 0 &&
"DrawLineAux, context is null");
1692 CGContextSetAllowsAntialiasing(ctx,
false);
1694 if (!drawable.fIsPixmap)
1695 CGContextTranslateCTM(ctx, 0.5, 0.5);
1702 SetStrokeParametersFromX11Context(ctx, gcVals);
1703 CGContextBeginPath(ctx);
1704 CGContextMoveToPoint(ctx,
x1, y1);
1705 CGContextAddLineToPoint(ctx,
x2, y2);
1706 CGContextStrokePath(ctx);
1708 CGContextSetAllowsAntialiasing(ctx,
true);
1723 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawLine, called for root window");
1724 assert(gc > 0 && gc <=
fX11Contexts.size() &&
"DrawLine, invalid context index");
1728 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1729 if (!drawable.fIsPixmap) {
1730 NSObject<X11Window> *
const window = (NSObject<X11Window> *)drawable;
1732 const ViewFixer fixer(view, wid);
1735 fPimpl->fX11CommandBuffer.AddDrawLine(wid, gcVals,
x1, y1,
x2, y2);
1741 fPimpl->fX11CommandBuffer.AddDrawLine(wid, gcVals,
x1, y1,
x2, y2);
1751 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawSegmentsAux, called for root window");
1752 assert(segments != 0 &&
"DrawSegmentsAux, segments parameter is null");
1753 assert(nSegments > 0 &&
"DrawSegmentsAux, nSegments <= 0");
1755 for (
Int_t i = 0; i < nSegments; ++i)
1756 DrawLineAux(wid, gcVals, segments[i].fX1, segments[i].fY1 - 3, segments[i].fX2, segments[i].fY2 - 3);
1768 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawSegments, called for root window");
1769 assert(gc > 0 && gc <=
fX11Contexts.size() &&
"DrawSegments, invalid context index");
1770 assert(segments != 0 &&
"DrawSegments, parameter 'segments' is null");
1771 assert(nSegments > 0 &&
"DrawSegments, number of segments <= 0");
1773 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1776 if (!drawable.fIsPixmap) {
1778 const ViewFixer fixer(view, wid);
1782 fPimpl->fX11CommandBuffer.AddDrawSegments(wid, gcVals, segments, nSegments);
1788 fPimpl->fX11CommandBuffer.AddDrawSegments(wid, gcVals, segments, nSegments);
1798 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawRectangleAux, called for root window");
1800 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1802 if (!drawable.fIsPixmap) {
1814 CGContextRef ctx =
fPimpl->GetDrawable(wid).fContext;
1815 assert(ctx &&
"DrawRectangleAux, context is null");
1818 CGContextSetAllowsAntialiasing(ctx,
false);
1820 SetStrokeParametersFromX11Context(ctx, gcVals);
1822 const CGRect rect = CGRectMake(
x,
y, w,
h);
1823 CGContextStrokeRect(ctx, rect);
1825 CGContextSetAllowsAntialiasing(ctx,
true);
1837 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawRectangle, called for root window");
1838 assert(gc > 0 && gc <=
fX11Contexts.size() &&
"DrawRectangle, invalid context index");
1842 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1844 if (!drawable.fIsPixmap) {
1845 NSObject<X11Window> *
const window = (NSObject<X11Window> *)drawable;
1847 const ViewFixer fixer(view, wid);
1851 fPimpl->fX11CommandBuffer.AddDrawRectangle(wid, gcVals,
x,
y, w,
h);
1857 fPimpl->fX11CommandBuffer.AddDrawRectangle(wid, gcVals,
x,
y, w,
h);
1873 assert(!
fPimpl->IsRootWindow(wid) &&
"FillRectangleAux, called for root window");
1875 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1876 CGContextRef ctx = drawable.fContext;
1877 CGSize patternPhase = {};
1879 if (drawable.fIsPixmap) {
1884 const CGRect fillRect = CGRectMake(
x,
y, w,
h);
1886 if (!drawable.fIsPixmap) {
1889 const NSPoint origin = [view.
fParentView convertPoint : view.frame.origin toView : nil];
1890 patternPhase.width = origin.x;
1891 patternPhase.height = origin.y;
1897 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals) || HasFillTiledStyle(gcVals)) {
1898 PatternContext patternContext = {gcVals.
fMask, gcVals.
fFillStyle, 0, 0, nil, patternPhase};
1900 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals)) {
1902 "FillRectangleAux, fill_style is FillStippled/FillOpaqueStippled,"
1903 " but no stipple is set in a context");
1908 if (HasFillOpaqueStippledStyle(gcVals))
1912 "FillRectangleAux, fill_style is FillTiled, but not tile is set in a context");
1914 patternContext.fImage =
fPimpl->GetDrawable(gcVals.
fTile);
1918 CGContextFillRect(ctx, fillRect);
1923 SetFilledAreaColorFromX11Context(ctx, gcVals);
1924 CGContextFillRect(ctx, fillRect);
1937 assert(!
fPimpl->IsRootWindow(wid) &&
"FillRectangle, called for root window");
1938 assert(gc > 0 && gc <=
fX11Contexts.size() &&
"FillRectangle, invalid context index");
1941 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1943 if (!drawable.fIsPixmap) {
1944 NSObject<X11Window> *
const window = (NSObject<X11Window> *)drawable;
1946 const ViewFixer fixer(view, wid);
1949 fPimpl->fX11CommandBuffer.AddFillRectangle(wid, gcVals,
x,
y, w,
h);
1966 assert(!
fPimpl->IsRootWindow(wid) &&
"FillPolygonAux, called for root window");
1967 assert(polygon != 0 &&
"FillPolygonAux, parameter 'polygon' is null");
1968 assert(nPoints > 0 &&
"FillPolygonAux, number of points must be positive");
1970 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1971 CGContextRef ctx = drawable.fContext;
1973 CGSize patternPhase = {};
1975 if (!drawable.fIsPixmap) {
1977 const NSPoint origin = [view convertPoint : view.frame.origin toView : nil];
1978 patternPhase.width = origin.x;
1979 patternPhase.height = origin.y;
1984 CGContextSetAllowsAntialiasing(ctx,
false);
1986 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals) || HasFillTiledStyle(gcVals)) {
1987 PatternContext patternContext = {gcVals.
fMask, gcVals.
fFillStyle, 0, 0, nil, patternPhase};
1989 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals)) {
1991 "FillRectangleAux, fill style is FillStippled/FillOpaqueStippled,"
1992 " but no stipple is set in a context");
1997 if (HasFillOpaqueStippledStyle(gcVals))
2001 "FillRectangleAux, fill_style is FillTiled, but not tile is set in a context");
2003 patternContext.fImage =
fPimpl->GetDrawable(gcVals.
fTile);
2008 SetFilledAreaColorFromX11Context(ctx, gcVals);
2013 CGContextBeginPath(ctx);
2014 if (!drawable.fIsPixmap) {
2015 CGContextMoveToPoint(ctx, polygon[0].fX, polygon[0].fY - 2);
2016 for (
Int_t i = 1; i < nPoints; ++i)
2017 CGContextAddLineToPoint(ctx, polygon[i].fX, polygon[i].fY - 2);
2020 for (
Int_t i = 1; i < nPoints; ++i)
2024 CGContextFillPath(ctx);
2025 CGContextSetAllowsAntialiasing(ctx,
true);
2048 assert(polygon != 0 &&
"FillPolygon, parameter 'polygon' is null");
2049 assert(nPoints > 0 &&
"FillPolygon, number of points must be positive");
2050 assert(gc > 0 && gc <=
fX11Contexts.size() &&
"FillPolygon, invalid context index");
2052 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
2055 if (!drawable.fIsPixmap) {
2057 const ViewFixer fixer(view, wid);
2061 fPimpl->fX11CommandBuffer.AddFillPolygon(wid, gcVals, polygon, nPoints);
2067 fPimpl->fX11CommandBuffer.AddFillPolygon(wid, gcVals, polygon, nPoints);
2081 assert(!
fPimpl->IsRootWindow(src) &&
"CopyAreaAux, src parameter is root window");
2082 assert(!
fPimpl->IsRootWindow(dst) &&
"CopyAreaAux, dst parameter is root window");
2088 NSObject<X11Drawable> *
const srcDrawable =
fPimpl->GetDrawable(src);
2089 NSObject<X11Drawable> *
const dstDrawable =
fPimpl->GetDrawable(dst);
2097 "CopyArea, mask is not a pixmap");
2107 [dstDrawable copy : srcDrawable area : copyArea withMask : mask clipOrigin : clipOrigin toPoint : dstPoint];
2117 assert(!
fPimpl->IsRootWindow(src) &&
"CopyArea, src parameter is root window");
2118 assert(!
fPimpl->IsRootWindow(dst) &&
"CopyArea, dst parameter is root window");
2119 assert(gc > 0 && gc <=
fX11Contexts.size() &&
"CopyArea, invalid context index");
2121 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(dst);
2124 if (!drawable.fIsPixmap) {
2126 const ViewFixer fixer(view, dst);
2130 fPimpl->fX11CommandBuffer.AddCopyArea(src, dst, gcVals, srcX, srcY,
width, height, dstX, dstY);
2135 if (
fPimpl->GetDrawable(src).fIsPixmap) {
2140 fPimpl->fX11CommandBuffer.AddCopyArea(src, dst, gcVals, srcX, srcY,
width, height, dstX, dstY);
2151 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawStringAux, called for root window");
2153 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
2154 CGContextRef ctx = drawable.fContext;
2155 assert(ctx != 0 &&
"DrawStringAux, context is null");
2159 CGContextSetTextMatrix(ctx, CGAffineTransformIdentity);
2162 if (!drawable.fIsPixmap) {
2163 CGContextTranslateCTM(ctx, 0., drawable.fHeight);
2164 CGContextScaleCTM(ctx, 1., -1.);
2168 CGContextSetAllowsAntialiasing(ctx,
true);
2170 assert(gcVals.
fMask &
kGCFont &&
"DrawString, font is not set in a context");
2173 len = std::strlen(
text);
2175 CGFloat textColor[4] = {0., 0., 0., 1.};
2180 CGContextSetRGBFillColor(ctx, textColor[0], textColor[1], textColor[2], textColor[3]);
2185 std::vector<UniChar> unichars((
unsigned char *)
text, (
unsigned char *)
text + len);
2198 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawString, called for root window");
2199 assert(gc > 0 && gc <=
fX11Contexts.size() &&
"DrawString, invalid context index");
2201 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
2203 assert(gcVals.
fMask &
kGCFont &&
"DrawString, font is not set in a context");
2205 if (!drawable.fIsPixmap) {
2207 const ViewFixer fixer(view, wid);
2211 fPimpl->fX11CommandBuffer.AddDrawString(wid, gcVals,
x,
y,
text, len);
2218 fPimpl->fX11CommandBuffer.AddDrawString(wid, gcVals,
x,
y,
text, len);
2227 assert(!
fPimpl->IsRootWindow(windowID) &&
"ClearAreaAux, called for root window");
2230 assert(view.
fContext != 0 &&
"ClearAreaAux, view.fContext is null");
2240 CGFloat rgb[3] = {};
2244 CGContextSetRGBFillColor(view.
fContext, rgb[0], rgb[1], rgb[2], 1.);
2245 CGContextFillRect(view.
fContext, CGRectMake(
x,
y, w,
h));
2247 const CGRect fillRect = CGRectMake(
x,
y, w,
h);
2249 CGSize patternPhase = {};
2251 const NSPoint origin = [view.
fParentView convertPoint : view.frame.origin toView : nil];
2252 patternPhase.width = origin.x;
2253 patternPhase.height = origin.y;
2259 CGContextFillRect(view.
fContext, fillRect);
2273 assert(!
fPimpl->IsRootWindow(wid) &&
"ClearArea, called for root window");
2277 if (ParentRendersToChild(view))
2282 fPimpl->fX11CommandBuffer.AddClearArea(wid,
x,
y, w,
h);
2300#pragma mark - Pixmap management.
2306 NSSize newSize = {};
2311 scaleFactor : [[NSScreen mainScreen] backingScaleFactor]]);
2313 pixmap.
Get().fID =
fPimpl->RegisterDrawable(pixmap.
Get());
2317 Error(
"OpenPixmap",
"QuartzPixmap initialization failed");
2325 assert(!
fPimpl->IsRootWindow(wid) &&
"ResizePixmap, called for root window");
2327 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
2328 assert(drawable.fIsPixmap == YES &&
"ResizePixmap, invalid drawable");
2334 if ([pixmap resizeW : w
H :
h scaleFactor : [[NSScreen mainScreen] backingScaleFactor]])
2343 assert(pixmapID > (
Int_t)
fPimpl->GetRootWindowID() &&
2344 "SelectPixmap, parameter 'pixmapID' is not a valid id");
2352 assert(pixmapID > (
Int_t)
fPimpl->GetRootWindowID() &&
2353 "CopyPixmap, parameter 'pixmapID' is not a valid id");
2355 "CopyPixmap, fSelectedDrawable is not a valid window id");
2357 NSObject<X11Drawable> *
const source =
fPimpl->GetDrawable(pixmapID);
2358 assert([source isKindOfClass : [
QuartzPixmap class]] &&
2359 "CopyPixmap, source is not a pixmap");
2363 NSObject<X11Drawable> * destination = nil;
2365 if (drawable.fIsPixmap) {
2366 destination = drawable;
2369 if (window.fBackBuffer) {
2370 destination = window.fBackBuffer;
2372 Warning(
"CopyPixmap",
"Operation skipped, since destination"
2373 " window is not double buffered");
2381 [destination copy : pixmap area : copyArea withMask : nil clipOrigin :
X11::Point() toPoint : dstPoint];
2389 assert(
fPimpl->GetDrawable(
fSelectedDrawable).fIsPixmap == YES &&
"ClosePixmap, selected drawable is not a pixmap");
2395#pragma mark - Different functions to create pixmap from different data sources. Used by GUI.
2396#pragma mark - These functions implement TVirtualX interface, some of them dupilcate others.
2412 assert(bitmap != 0 &&
"CreatePixmap, parameter 'bitmap' is null");
2413 assert(
width > 0 &&
"CreatePixmap, parameter 'width' is 0");
2414 assert(height > 0 &&
"CreatePixmap, parameter 'height' is 0");
2416 std::vector<unsigned char> imageData (depth > 1 ?
width * height * 4 :
width * height);
2419 backgroundPixel, depth, &imageData[0]);
2430 Error(
"CreatePixmap",
"QuartzImage initialization failed");
2434 image.
Get().fID =
fPimpl->RegisterDrawable(image.
Get());
2435 return image.
Get().fID;
2442 assert(bits != 0 &&
"CreatePixmapFromData, data parameter is null");
2443 assert(
width != 0 &&
"CreatePixmapFromData, width parameter is 0");
2444 assert(height != 0 &&
"CreatePixmapFromData, height parameter is 0");
2448 std::vector<unsigned char> imageData(bits, bits +
width * height * 4);
2451 unsigned char *p = &imageData[0];
2452 for (
unsigned i = 0,
e =
width * height; i <
e; ++i, p += 4)
2457 H : height data : &imageData[0]]);
2461 Error(
"CreatePixmapFromData",
"QuartzImage initialziation failed");
2465 image.
Get().fID =
fPimpl->RegisterDrawable(image.
Get());
2466 return image.
Get().fID;
2473 assert(std::numeric_limits<unsigned char>::digits == 8 &&
"CreateBitmap, ASImage requires octets");
2481 std::vector<unsigned char> imageData(
width * height);
2484 for (
unsigned i = 0, j = 0,
e =
width / 8 * height; i <
e; ++i) {
2485 for(
unsigned bit = 0; bit < 8; ++bit, ++j) {
2486 if (bitmap[i] & (1 << bit))
2495 H : height bitmapMask : &imageData[0]]);
2498 Error(
"CreateBitmap",
"QuartzImage initialization failed");
2502 image.
Get().fID =
fPimpl->RegisterDrawable(image.
Get());
2503 return image.
Get().fID;
2509 fPimpl->DeleteDrawable(pixmapID);
2516 assert(
fPimpl->GetDrawable(pixmapID).fIsPixmap == YES &&
"DeletePixmap, object is not a pixmap");
2517 fPimpl->fX11CommandBuffer.AddDeletePixmap(pixmapID);
2533 if (
fPimpl->IsRootWindow(wid)) {
2534 Warning(
"GetColorBits",
"Called for root window");
2536 assert(
x >= 0 &&
"GetColorBits, parameter 'x' is negative");
2537 assert(
y >= 0 &&
"GetColorBits, parameter 'y' is negative");
2538 assert(w != 0 &&
"GetColorBits, parameter 'w' is 0");
2539 assert(
h != 0 &&
"GetColorBits, parameter 'h' is 0");
2542 return [
fPimpl->GetDrawable(wid) readColorBits : area];
2548#pragma mark - XImage emulation.
2564 assert(wid >
fPimpl->GetRootWindowID() &&
"GetImageSize, parameter 'wid' is invalid");
2566 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
2567 width = drawable.fWidth;
2568 height = drawable.fHeight;
2582 "PutPixel, parameter 'imageID' is a bad pixmap id");
2583 assert(
x >= 0 &&
"PutPixel, parameter 'x' is negative");
2584 assert(
y >= 0 &&
"PutPixel, parameter 'y' is negative");
2588 unsigned char rgb[3] = {};
2590 [pixmap putPixel : rgb X :
x Y :
y];
2601 CopyArea(imageID, drawableID, gc, srcX, srcY,
width, height, dstX, dstY);
2609 "DeleteImage, imageID parameter is not a valid image id");
2613#pragma mark - Mouse related code.
2631 assert(!
fPimpl->IsRootWindow(wid) &&
"GrabButton, called for 'root' window");
2633 NSObject<X11Window> *
const widget =
fPimpl->GetWindow(wid);
2636 widget.fPassiveGrabOwnerEvents = YES;
2637 widget.fPassiveGrabButton = button;
2638 widget.fPassiveGrabEventMask = eventMask;
2639 widget.fPassiveGrabKeyModifiers = keyModifiers;
2642 widget.fPassiveGrabOwnerEvents = NO;
2643 widget.fPassiveGrabButton = -1;
2644 widget.fPassiveGrabEventMask = 0;
2645 widget.fPassiveGrabKeyModifiers = 0;
2658 NSView<X11Window> *
const view =
fPimpl->GetWindow(wid).fContentView;
2659 assert(!
fPimpl->IsRootWindow(wid) &&
"GrabPointer, called for 'root' window");
2662 fPimpl->fX11EventTranslator.SetPointerGrab(view, eventMask, ownerEvents);
2666 fPimpl->fX11EventTranslator.CancelPointerGrab();
2717 assert(!
fPimpl->IsRootWindow(wid) &&
"GrabKey, called for root window");
2719 NSView<X11Window> *
const view =
fPimpl->GetWindow(wid).fContentView;
2723 [view addPassiveKeyGrab : keyCode modifiers : cocoaKeyModifiers];
2725 [view removePassiveKeyGrab : keyCode modifiers : cocoaKeyModifiers];
2744 return fPimpl->fX11EventTranslator.GetInputFocus();
2751 assert(!
fPimpl->IsRootWindow(wid) &&
"SetInputFocus, called for root window");
2754 fPimpl->fX11EventTranslator.SetInputFocus(nil);
2756 fPimpl->fX11EventTranslator.SetInputFocus(
fPimpl->GetWindow(wid).fContentView);
2772 assert(buf != 0 &&
"LookupString, parameter 'buf' is null");
2773 assert(length >= 2 &&
"LookupString, parameter 'length' - not enough memory to return null-terminated ASCII string");
2778#pragma mark - Font management.
2785 assert(fontName != 0 &&
"LoadQueryFont, fontName is null");
2794 return fPimpl->fFontManager.LoadFont(xlfd);
2809 fPimpl->fFontManager.UnloadFont(fs);
2824 return fPimpl->fFontManager.GetTextWidth(font,
s, len);
2831 fPimpl->fFontManager.GetFontProperties(font, maxAscent, maxDescent);
2858 if (fontName && fontName[0]) {
2861 return fPimpl->fFontManager.ListFonts(xlfd, maxNames, count);
2874 fPimpl->fFontManager.FreeFontNames(fontList);
2877#pragma mark - Color management.
2885 return fPimpl->fX11ColorParser.ParseColor(colorName, color);
2891 const unsigned red = unsigned(
double(color.
fRed) / 0xFFFF * 0xFF);
2892 const unsigned green = unsigned(
double(color.
fGreen) / 0xFFFF * 0xFF);
2893 const unsigned blue = unsigned(
double(color.
fBlue) / 0xFFFF * 0xFF);
2894 color.
fPixel = red << 16 | green << 8 | blue;
2902 color.
fRed = (color.
fPixel >> 16 & 0xFF) * 0xFFFF / 0xFF;
2903 color.
fGreen = (color.
fPixel >> 8 & 0xFF) * 0xFFFF / 0xFF;
2904 color.
fBlue = (color.
fPixel & 0xFF) * 0xFFFF / 0xFF;
2917 if (
const TColor *
const color =
gROOT->GetColor(rootColorIndex)) {
2918 Float_t red = 0.f, green = 0.f, blue = 0.f;
2919 color->GetRGB(red, green, blue);
2920 pixel = unsigned(red * 255) << 16;
2921 pixel |= unsigned(green * 255) << 8;
2922 pixel |= unsigned(blue * 255);
2956#pragma mark - Graphical context management.
2976 assert(gc <=
fX11Contexts.size() && gc > 0 &&
"ChangeGC, invalid context id");
2987 assert(gc <=
fX11Contexts.size() && gc > 0 &&
"ChangeGC, invalid context id");
2988 assert(gval != 0 &&
"ChangeGC, gval parameter is null");
2992 x11Context.
fMask |= mask;
3042 const unsigned nDashes =
sizeof x11Context.
fDashes /
sizeof x11Context.
fDashes[0];
3043 for (
unsigned i = 0; i < nDashes; ++i)
3052 assert(src <=
fX11Contexts.size() && src > 0 &&
"CopyGC, bad source context");
3053 assert(dst <=
fX11Contexts.size() && dst > 0 &&
"CopyGC, bad destination context");
3056 srcContext.
fMask = mask;
3076#pragma mark - Cursor management.
3098 assert(!
fPimpl->IsRootWindow(wid) &&
"SetCursor, called for root window");
3100 NSView<X11Window> *
const view =
fPimpl->GetWindow(wid).fContentView;
3101 view.fCurrentCursor = cursor;
3121 const NSPoint screenPoint = [NSEvent mouseLocation];
3137 rootWinID =
fPimpl->GetRootWindowID();
3139 NSPoint screenPoint = [NSEvent mouseLocation];
3142 rootX = screenPoint.x;
3143 rootY = screenPoint.y;
3146 if (winID >
fPimpl->GetRootWindowID()) {
3147 NSObject<X11Window> *
const window =
fPimpl->GetWindow(winID);
3152 winX = screenPoint.x;
3153 winY = screenPoint.y;
3158 childWinID = childWin.fID;
3166#pragma mark - OpenGL management.
3174 return [[NSScreen mainScreen] backingScaleFactor];
3179 const std::vector<std::pair<UInt_t, Int_t> > &formatComponents)
3183 typedef std::pair<UInt_t, Int_t> component_type;
3184 typedef std::vector<component_type>::size_type size_type;
3187 std::vector<NSOpenGLPixelFormatAttribute> attribs;
3188 for (size_type i = 0,
e = formatComponents.size(); i <
e; ++i) {
3189 const component_type &comp = formatComponents[i];
3192 attribs.push_back(NSOpenGLPFADoubleBuffer);
3194 attribs.push_back(NSOpenGLPFADepthSize);
3195 attribs.push_back(comp.second > 0 ? comp.second : 32);
3197 attribs.push_back(NSOpenGLPFAAccumSize);
3198 attribs.push_back(comp.second > 0 ? comp.second : 1);
3200 attribs.push_back(NSOpenGLPFAStencilSize);
3201 attribs.push_back(comp.second > 0 ? comp.second : 8);
3203 attribs.push_back(NSOpenGLPFAMultisample);
3204 attribs.push_back(NSOpenGLPFASampleBuffers);
3205 attribs.push_back(1);
3206 attribs.push_back(NSOpenGLPFASamples);
3207 attribs.push_back(comp.second ? comp.second : 8);
3211 attribs.push_back(0);
3213 NSOpenGLPixelFormat *
const pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes : &attribs[0]];
3216 NSView<X11Window> *parentView = nil;
3217 if (!
fPimpl->IsRootWindow(parentID)) {
3218 parentView =
fPimpl->GetWindow(parentID).fContentView;
3219 assert([parentView isKindOfClass : [
QuartzView class]] &&
3220 "CreateOpenGLWindow, parent view must be QuartzView");
3223 NSRect viewFrame = {};
3224 viewFrame.size.width =
width;
3225 viewFrame.size.height = height;
3233 [parentView addChild : glView];
3234 glID =
fPimpl->RegisterDrawable(glView);
3244 Error(
"CreateOpenGLWindow",
"QuartzWindow allocation/initialization"
3245 " failed for a top-level GL widget");
3249 glID =
fPimpl->RegisterDrawable(parent);
3259 assert(!
fPimpl->IsRootWindow(windowID) &&
3260 "CreateOpenGLContext, parameter 'windowID' is a root window");
3262 "CreateOpenGLContext, view is not an OpenGL view");
3264 NSOpenGLContext *
const sharedContext =
fPimpl->GetGLContextForHandle(sharedID);
3268 newContext([[NSOpenGLContext alloc] initWithFormat : glView.
pixelFormat shareContext : sharedContext]);
3286 assert(ctxID > 0 &&
"MakeOpenGLContextCurrent, invalid context id");
3288 NSOpenGLContext *
const glContext =
fPimpl->GetGLContextForHandle(ctxID);
3290 Error(
"MakeOpenGLContextCurrent",
"No OpenGL context found for id %d",
int(ctxID));
3298 if ([glContext view] != glView)
3299 [glContext setView : glView];
3307 [glContext makeCurrentContext];
3318 NSView *fakeView = nil;
3325 const UInt_t width = std::max(glView.frame.size.width, CGFloat(100));
3326 const UInt_t height = std::max(glView.frame.size.height, CGFloat(100));
3328 NSRect viewFrame = {};
3329 viewFrame.size.width =
width;
3330 viewFrame.size.height = height;
3336 fakeWindow = [[
QuartzWindow alloc] initWithContentRect : viewFrame styleMask : styleMask
3337 backing : NSBackingStoreBuffered defer : NO windowAttributes : &attr];
3341 [fakeView setHidden : NO];
3343 fPimpl->SetFakeGLWindow(fakeWindow);
3347 [fakeView setHidden : NO];
3351 [glContext setView : fakeView];
3352 [glContext makeCurrentContext];
3361 NSOpenGLContext *
const currentContext = [NSOpenGLContext currentContext];
3362 if (!currentContext) {
3363 Error(
"GetCurrentOpenGLContext",
"The current OpenGL context is null");
3367 const Handle_t contextID =
fPimpl->GetHandleForGLContext(currentContext);
3369 Error(
"GetCurrentOpenGLContext",
"The current OpenGL context was"
3370 " not created/registered by TGCocoa");
3378 assert(ctxID > 0 &&
"FlushOpenGLBuffer, invalid context id");
3380 NSOpenGLContext *
const glContext =
fPimpl->GetGLContextForHandle(ctxID);
3381 assert(glContext != nil &&
"FlushOpenGLBuffer, bad context id");
3383 if (glContext != [NSOpenGLContext currentContext])
3387 [glContext flushBuffer];
3396 NSOpenGLContext *
const glContext =
fPimpl->GetGLContextForHandle(ctxID);
3397 if (NSView *
const v = [glContext view]) {
3401 [glContext clearDrawable];
3404 if (glContext == [NSOpenGLContext currentContext])
3405 [NSOpenGLContext clearCurrentContext];
3407 fPimpl->DeleteGLContext(ctxID);
3410#pragma mark - Off-screen rendering for TPad/TCanvas.
3416 assert(windowID > (
Int_t)
fPimpl->GetRootWindowID() &&
"SetDoubleBuffer called for root window");
3418 if (windowID == 999) {
3419 Warning(
"SetDoubleBuffer",
"called with wid == 999");
3440 "SetDoubleBufferON, called, but no correct window was selected before");
3444 assert(window.fIsPixmap == NO &&
3445 "SetDoubleBufferON, selected drawable is a pixmap, can not attach pixmap to pixmap");
3447 const unsigned currW = window.fWidth;
3448 const unsigned currH = window.fHeight;
3450 if (
QuartzPixmap *
const currentPixmap = window.fBackBuffer) {
3451 if (currH == currentPixmap.fHeight && currW == currentPixmap.fWidth)
3456 H : currH scaleFactor : [[NSScreen mainScreen] backingScaleFactor]]);
3458 window.fBackBuffer = pixmap.
Get();
3461 Error(
"SetDoubleBufferON",
"QuartzPixmap initialization failed");
3473#pragma mark - Event management part.
3478 if (
fPimpl->IsRootWindow(wid))
3487 fPimpl->fX11EventTranslator.fEventQueue.push_back(newEvent);
3493 assert(
fPimpl->fX11EventTranslator.fEventQueue.size() > 0 &&
"NextEvent, event queue is empty");
3495 event =
fPimpl->fX11EventTranslator.fEventQueue.front();
3496 fPimpl->fX11EventTranslator.fEventQueue.pop_front();
3502 return (
Int_t)
fPimpl->fX11EventTranslator.fEventQueue.size();
3509 typedef X11::EventQueue_t::iterator iterator_type;
3511 iterator_type it =
fPimpl->fX11EventTranslator.fEventQueue.begin();
3512 iterator_type eIt =
fPimpl->fX11EventTranslator.fEventQueue.end();
3514 for (; it != eIt; ++it) {
3515 const Event_t &queuedEvent = *it;
3517 event = queuedEvent;
3518 fPimpl->fX11EventTranslator.fEventQueue.erase(it);
3534#pragma mark - "Drag and drop", "Copy and paste", X11 properties.
3541 assert(
name != 0 &&
"InternAtom, parameter 'name' is null");
3558 assert(!
fPimpl->IsRootWindow(windowID) &&
3559 "SetPrimarySelectionOwner, windowID parameter is a 'root' window");
3560 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3561 "SetPrimarySelectionOwner, windowID parameter is not a valid window");
3563 const Atom_t primarySelectionAtom =
FindAtom(
"XA_PRIMARY",
false);
3564 assert(primarySelectionAtom !=
kNone &&
3565 "SetPrimarySelectionOwner, predefined XA_PRIMARY atom was not found");
3583 assert(!
fPimpl->IsRootWindow(windowID) &&
3584 "SetSelectionOwner, windowID parameter is a 'root' window'");
3585 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3586 "SetSelectionOwner, windowID parameter is not a valid window");
3601 const Atom_t primarySelectionAtom =
FindAtom(
"XA_PRIMARY",
false);
3602 assert(primarySelectionAtom !=
kNone &&
3603 "GetPrimarySelectionOwner, predefined XA_PRIMARY atom was not found");
3626 assert(!
fPimpl->IsRootWindow(windowID) &&
3627 "ConvertPrimarySelection, parameter 'windowID' is root window");
3628 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3629 "ConvertPrimarySelection, parameter windowID parameter is not a window id");
3632 assert(primarySelectionAtom !=
kNone &&
3633 "ConvertPrimarySelection, XA_PRIMARY predefined atom not found");
3636 assert(stringAtom !=
kNone &&
3637 "ConvertPrimarySelection, XA_STRING predefined atom not found");
3639 ConvertSelection(windowID, primarySelectionAtom, stringAtom, clipboard, when);
3655 assert(!
fPimpl->IsRootWindow(windowID) &&
3656 "ConvertSelection, parameter 'windowID' is root window'");
3657 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3658 "ConvertSelection, parameter 'windowID' is not a window id");
3669 newEvent.
fUser[0] = windowID;
3670 newEvent.
fUser[1] = selection;
3671 newEvent.
fUser[2] = target;
3672 newEvent.
fUser[3] = property;
3680 ULong_t *bytesAfterReturn,
unsigned char **propertyReturn)
3689 if (
fPimpl->IsRootWindow(windowID))
3692 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3693 "GetProperty, parameter 'windowID' is not a valid window id");
3694 assert(propertyID > 0 && propertyID <=
fAtomToName.size() &&
3695 "GetProperty, parameter 'propertyID' is not a valid atom");
3696 assert(actualType != 0 &&
"GetProperty, parameter 'actualType' is null");
3697 assert(actualFormat != 0 &&
"GetProperty, parameter 'actualFormat' is null");
3698 assert(bytesAfterReturn != 0 &&
"GetProperty, parameter 'bytesAfterReturn' is null");
3699 assert(propertyReturn != 0 &&
"GetProperty, parameter 'propertyReturn' is null");
3703 *bytesAfterReturn = 0;
3704 *propertyReturn = 0;
3707 const std::string &atomName =
fAtomToName[propertyID - 1];
3708 NSObject<X11Window> *window =
fPimpl->GetWindow(windowID);
3710 if (![window hasProperty : atomName.c_str()]) {
3711 Error(
"GetProperty",
"Unknown property %s requested", atomName.c_str());
3715 unsigned tmpFormat = 0, tmpElements = 0;
3716 *propertyReturn = [window getProperty : atomName.c_str() returnType : actualType
3717 returnFormat : &tmpFormat nElements : &tmpElements];
3718 *actualFormat = (
Int_t)tmpFormat;
3719 *nItems = tmpElements;
3738 assert(!
fPimpl->IsRootWindow(windowID) &&
3739 "GetPasteBuffer, parameter 'windowID' is root window");
3740 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3741 "GetPasteBuffer, parameter 'windowID' is not a valid window");
3742 assert(propertyID && propertyID <=
fAtomToName.size() &&
3743 "GetPasteBuffer, parameter 'propertyID' is not a valid atom");
3747 const std::string &atomString =
fAtomToName[propertyID - 1];
3748 NSObject<X11Window> *window =
fPimpl->GetWindow(windowID);
3750 if (![window hasProperty : atomString.c_str()]) {
3751 Error(
"GetPasteBuffer",
"No property %s on a window", atomString.c_str());
3756 unsigned tmpFormat = 0, nElements = 0;
3759 propertyData((
char *)[window getProperty : atomString.c_str()
3760 returnType : &tmpType returnFormat : &tmpFormat
3761 nElements : &nElements]);
3763 assert(tmpFormat == 8 &&
"GetPasteBuffer, property has wrong format");
3765 text.Insert(0, propertyData.
Get(), nElements);
3766 nChars = (
Int_t)nElements;
3771 [window removeProperty : atomString.c_str()];
3802 assert(!
fPimpl->IsRootWindow(windowID) &&
3803 "ChangeProperty, parameter 'windowID' is root window");
3804 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3805 "ChangeProperty, parameter 'windowID' is not a valid window id");
3806 assert(propertyID && propertyID <=
fAtomToName.size() &&
3807 "ChangeProperty, parameter 'propertyID' is not a valid atom");
3811 const std::string &atomString =
fAtomToName[propertyID - 1];
3813 NSObject<X11Window> *
const window =
fPimpl->GetWindow(windowID);
3814 [window setProperty : atomString.c_str() data : data size : len forType :
type format : 8];
3836 assert(!
fPimpl->IsRootWindow(windowID) &&
3837 "ChangeProperties, parameter 'windowID' is root window");
3838 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3839 "ChangeProperties, parameter 'windowID' is not a valid window id");
3840 assert(propertyID && propertyID <=
fAtomToName.size() &&
3841 "ChangeProperties, parameter 'propertyID' is not a valid atom");
3845 const std::string &atomName =
fAtomToName[propertyID - 1];
3847 NSObject<X11Window> *
const window =
fPimpl->GetWindow(windowID);
3848 [window setProperty : atomName.c_str() data : data
3849 size : len forType :
type format : format];
3866 assert(!
fPimpl->IsRootWindow(windowID) &&
3867 "DeleteProperty, parameter 'windowID' is root window");
3868 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3869 "DeleteProperty, parameter 'windowID' is not a valid window");
3870 assert(propertyID && propertyID <=
fAtomToName.size() &&
3871 "DeleteProperty, parameter 'propertyID' is not a valid atom");
3873 const std::string &atomString =
fAtomToName[propertyID - 1];
3874 [
fPimpl->GetWindow(windowID) removeProperty : atomString.c_str()];
3890 assert(windowID >
fPimpl->GetRootWindowID() &&
3891 "SetDNDAware, parameter 'windowID' is not a valid window id");
3892 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3893 "SetDNDAware, parameter 'windowID' is not a window");
3898 NSArray *
const supportedTypes = [NSArray arrayWithObjects : NSFilenamesPboardType, nil];
3902 [view registerForDraggedTypes : supportedTypes];
3909 assert(xaAtomAtom == 4 &&
"SetDNDAware, XA_ATOM is not defined");
3914 assert(
sizeof(
unsigned) == 4 &&
"SetDNDAware, sizeof(unsigned) must be 4");
3916 std::vector<unsigned> propertyData;
3917 propertyData.push_back(4);
3920 for (
unsigned i = 0; typeList[i]; ++i)
3921 propertyData.push_back(
unsigned(typeList[i]));
3924 [view setProperty :
"XdndAware" data : (
unsigned char *)&propertyData[0]
3925 size : propertyData.size() forType : xaAtomAtom format : 32];
3933 if (windowID <= fPimpl->GetRootWindowID())
3936 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3937 "IsDNDAware, windowID parameter is not a window");
3948 ::Warning(
"SetTypeList",
"Not implemented");
3972 fPimpl->IsRootWindow(winID) ? nil :
fPimpl->GetWindow(winID).fContentView,
3973 dragWinID, inputWinID,
x,
y, maxDepth);
3975 return testView.fID;
3980#pragma mark - Noops.
4000 chupx = chupy = 0.f;
4105 NSPoint newCursorPosition = {};
4106 newCursorPosition.x = ix;
4107 newCursorPosition.y = iy;
4109 if (
fPimpl->GetRootWindowID() == winID) {
4113 assert(
fPimpl->GetDrawable(winID).fIsPixmap == NO &&
4114 "Warp, drawable is not a window");
4119 CGWarpMouseCursorPosition(NSPointToCGPoint(newCursorPosition));
4351#pragma mark - Details and aux. functions.
4356 return &
fPimpl->fX11EventTranslator;
4362 return &
fPimpl->fX11CommandBuffer;
4374 assert(
fCocoaDraw > 0 &&
"CocoaDrawOFF, was already off");
4388 if (!drawable.fIsPixmap) {
4389 Error(
"GetCurrentContext",
"TCanvas/TPad's internal error,"
4390 " selected drawable is not a pixmap!");
4394 return drawable.fContext;
4407 ProcessSerialNumber psn = {0, kCurrentProcess};
4409 const OSStatus res1 = TransformProcessType(&psn, kProcessTransformToForegroundApplication);
4414 if (res1 != noErr && res1 != paramErr) {
4415 Error(
"MakeProcessForeground",
"TransformProcessType failed with code %d",
int(res1));
4418#ifdef MAC_OS_X_VERSION_10_9
4420 [[NSApplication sharedApplication] activateIgnoringOtherApps : YES];
4422 const OSErr res2 = SetFrontProcess(&psn);
4423 if (res2 != noErr) {
4424 Error(
"MakeProcessForeground",
"SetFrontProcess failed with code %d", res2);
4431#ifdef MAC_OS_X_VERSION_10_9
4433 [[NSApplication sharedApplication] activateIgnoringOtherApps : YES];
4435 ProcessSerialNumber psn = {};
4437 OSErr res = GetCurrentProcess(&psn);
4439 Error(
"MakeProcessForeground",
"GetCurrentProcess failed with code %d", res);
4443 res = SetFrontProcess(&psn);
4445 Error(
"MapProcessForeground",
"SetFrontProcess failed with code %d", res);
4457 const std::map<std::string, Atom_t>::const_iterator it =
fNameToAtom.find(atomName);
4461 else if (addIfNotFound) {
4477 if (iconDirectoryPath) {
4479 if (fileName.
Get()) {
4482 NSString *cocoaStr = [NSString stringWithCString : fileName.
Get() encoding : NSASCIIStringEncoding];
4483 NSImage *image = [[[NSImage alloc] initWithContentsOfFile : cocoaStr] autorelease];
4484 [NSApp setApplicationIconImage : image];
const Mask_t kGCDashOffset
const Mask_t kGCBackground
const Mask_t kGCForeground
const Mask_t kGCLineStyle
const Mask_t kGCSubwindowMode
const Mask_t kGCLineWidth
const Mask_t kGCClipXOrigin
const Mask_t kGCFillStyle
const Mask_t kGCJoinStyle
const Mask_t kGCTileStipXOrigin
const Mask_t kStructureNotifyMask
const Mask_t kGCPlaneMask
const Mask_t kGCGraphicsExposures
const Mask_t kGCClipYOrigin
const Mask_t kGCTileStipYOrigin
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
static const double x2[5]
static const double x1[5]
include TDocParser_001 C image html pict1_TDocParser_001 png width
void Warning(const char *location, const char *msgfmt,...)
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.
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
QuartzView * fContentView
QuartzWindow * fMainWindow
QuartzImage * fShapeCombineMask
NSOpenGLContext * fOpenGLContext
NSOpenGLPixelFormat * pixelFormat()
void swap(RDirectoryEntry &e1, RDirectoryEntry &e2) noexcept
const NSUInteger kMiniaturizableWindowMask
const NSUInteger kTitledWindowMask
const NSUInteger kResizableWindowMask
const NSUInteger kClosableWindowMask
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)
static constexpr double s
Bool_t fGraphicsExposures
EGraphicsFunction fFunction