47 #include <ApplicationServices/ApplicationServices.h> 48 #include <OpenGL/OpenGL.h> 49 #include <Cocoa/Cocoa.h> 89 #pragma mark - Display configuration management. 92 void 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. 108 void 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.);
123 void 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] = {};
142 void SetStrokeDoubleDashFromX11Context(CGContextRef ,
const GCValues_t & )
145 ::Warning(
"SetStrokeDoubleDashFromX11Context",
"Not implemented yet, kick tpochep!");
149 void 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);
180 void 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.);
195 struct PatternContext {
200 NSObject<X11Drawable> *fImage;
206 bool HasFillTiledStyle(
Mask_t mask,
Int_t fillStyle)
212 bool HasFillTiledStyle(
const GCValues_t &gcVals)
218 bool HasFillStippledStyle(
Mask_t mask,
Int_t fillStyle)
224 bool HasFillStippledStyle(
const GCValues_t &gcVals)
230 bool HasFillOpaqueStippledStyle(
Mask_t mask,
Int_t fillStyle)
236 bool HasFillOpaqueStippledStyle(
const GCValues_t &gcVals)
242 void 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]]){
251 const Util::CFScopeGuard<CGImageRef> imageFromPixmap([((QuartzPixmap *)patternImage) createImageFromPixmap]);
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");
281 QuartzImage *
const image = (QuartzImage *)patternImage;
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);
308 void 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");
318 const Util::CFScopeGuard<CGColorSpaceRef> patternColorSpace(CGColorSpaceCreatePattern(0));
319 CGContextSetFillColorSpace(ctx, patternColorSpace.Get());
321 CGPatternCallbacks callbacks = {};
323 const CGRect patternRect = CGRectMake(0, 0, patternContext->fImage.fWidth, patternContext->fImage.fHeight);
324 const Util::CFScopeGuard<CGPatternRef> pattern(CGPatternCreate((
void *)patternContext, patternRect, CGAffineTransformIdentity,
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);
333 bool ParentRendersToChild(NSView<X11Window> *child)
335 assert(child != nil &&
"ParentRendersToChild, parameter 'child' is nil");
339 child.fMapState ==
kIsViewable && child.fParentView.fContext &&
340 !child.fIsOverlapped;
344 bool IsNonPrintableAsciiCharacter(UniChar c)
346 if (c == 9 || (c >= 32 && c < 127))
353 void FixAscii(std::vector<UniChar> &
text)
370 std::replace(text.begin(), text.end(), UniChar(16), UniChar(
' '));
373 text.erase(std::remove_if(text.begin(), text.end(), IsNonPrintableAsciiCharacter), text.end());
384 : fSelectedDrawable(0),
388 fForegroundProcess(false),
390 fDisplayShapeChanged(true)
392 assert(dynamic_cast<TMacOSXSystem *>(
gSystem) !=
nullptr &&
393 "TGCocoa, gSystem is eihter null or has a wrong type");
404 CGDisplayRegisterReconfigurationCallback (DisplayReconfigurationCallback, 0);
418 assert(dynamic_cast<TMacOSXSystem *>(
gSystem) !=
nullptr &&
419 "TGCocoa, gSystem is eihter null or has a wrong type");
430 CGDisplayRegisterReconfigurationCallback (DisplayReconfigurationCallback, 0);
437 CGDisplayRemoveReconfigurationCallback (DisplayReconfigurationCallback, 0);
506 return CGDisplayScreenSize(CGMainDisplayID()).width;
517 NSArray *
const screens = [NSScreen screens];
518 assert(screens != nil &&
"screens array is nil");
520 NSScreen *
const mainScreen = [screens objectAtIndex : 0];
521 assert(mainScreen != nil &&
"screen with index 0 is nil");
523 return NSBitsPerPixelFromDepth([mainScreen depth]);
532 assert(
gClient != 0 &&
"Update, gClient is null");
534 }
else if (mode > 0) {
553 NSArray *
const screens = [NSScreen screens];
554 assert(screens != nil && screens.count != 0 &&
"GetDisplayGeometry, no screens found");
556 NSRect frame = [(NSScreen *)[screens objectAtIndex : 0] frame];
557 CGFloat xMin = frame.origin.x, xMax = xMin + frame.size.width;
558 CGFloat yMin = frame.origin.y, yMax = yMin + frame.size.height;
560 for (NSUInteger i = 1,
e = screens.count; i <
e; ++i) {
561 frame = [(NSScreen *)[screens objectAtIndex : i] frame];
562 xMin = std::min(xMin, frame.origin.x);
563 xMax = std::max(xMax, frame.origin.x + frame.size.width);
564 yMin = std::min(yMin, frame.origin.y);
565 yMax = std::max(yMax, frame.origin.y + frame.size.height);
579 #pragma mark - Window management part. 585 return fPimpl->GetRootWindowID();
601 assert(parentID != 0 &&
"InitWindow, parameter 'parentID' is 0");
605 if (
fPimpl->IsRootWindow(parentID))
608 [
fPimpl->GetWindow(parentID) getAttributes : &attr];
610 return CreateWindow(parentID, 0, 0, attr.
fWidth, attr.
fHeight, 0, attr.
fDepth, attr.
fClass, 0, 0, 0);
634 "ClearWindow, fSelectedDrawable is invalid");
637 if (drawable.fIsPixmap) {
642 CGContextRef pixmapCtx = drawable.fContext;
643 assert(pixmapCtx != 0 &&
"ClearWindow, pixmap's context is null");
648 CGContextClearRect(pixmapCtx, CGRectMake(0, 0, drawable.fWidth, drawable.fHeight));
665 if (windowID < 0 || fPimpl->IsRootWindow(windowID)) {
675 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(windowID);
679 h = drawable.fHeight;
681 if (!drawable.fIsPixmap) {
682 NSObject<X11Window> *
const window = (NSObject<X11Window> *)drawable;
683 NSPoint srcPoint = {};
686 NSView<X11Window> *
const view = window.fContentView.fParentView ? window.fContentView.fParentView : window.fContentView;
703 assert(!
fPimpl->IsRootWindow(windowID) &&
"MoveWindow, called for root window");
708 [
fPimpl->GetWindow(windowID) setX : x Y :
y];
728 assert(!
fPimpl->IsRootWindow(windowID) &&
729 "ResizeWindow, parameter 'windowID' is a root window's id");
731 const Util::AutoreleasePool pool;
733 NSObject<X11Window> *
const window =
fPimpl->GetWindow(windowID);
734 if (window.fBackBuffer) {
754 "UpdateWindow, fSelectedDrawable is not a valid window id");
762 if (QuartzPixmap *
const pixmap = window.fBackBuffer) {
763 assert([window.fContentView isKindOfClass : [
QuartzView class]] &&
"UpdateWindow, content view is not a QuartzView");
771 const X11::Rectangle copyArea(0, 0, pixmap.fWidth, pixmap.fHeight);
772 [dstView copy : pixmap area : copyArea withMask : nil clipOrigin :
X11::Point() toPoint :
X11::Point()];
775 fPimpl->fX11CommandBuffer.AddUpdateWindow(dstView);
819 const Util::AutoreleasePool pool;
821 if (
fPimpl->IsRootWindow(parentID)) {
824 depth, clss, visual, attr, wtype);
827 const Util::NSScopeGuard<QuartzWindow> winGuard(newWindow);
829 newWindow.fID = result;
830 [newWindow setAcceptsMouseMovedEvents : YES];
834 NSObject<X11Window> *
const parentWin =
fPimpl->GetWindow(parentID);
836 assert([parentWin.fContentView isKindOfClass : [
QuartzView class]] &&
837 "CreateWindow, parent view must be QuartzView");
841 x, y, w, h, border, depth, clss, visual, attr, wtype);
842 const Util::NSScopeGuard<QuartzView> viewGuard(childView);
844 childView.
fID = result;
845 [parentWin addChild : childView];
872 if (
fPimpl->IsRootWindow(wid))
875 BOOL needFocusChange = NO;
878 const Util::AutoreleasePool pool;
880 fPimpl->fX11EventTranslator.CheckUnmappedView(wid);
882 assert(
fPimpl->GetDrawable(wid).fIsPixmap == NO &&
883 "DestroyWindow, can not be called for QuartzPixmap or QuartzImage object");
885 NSObject<X11Window> *
const window =
fPimpl->GetWindow(wid);
886 if (
fPimpl->fX11CommandBuffer.BufferSize())
887 fPimpl->fX11CommandBuffer.RemoveOperationsForDrawable(wid);
890 if ((needFocusChange = window == window.fQuartzWindow && window.fQuartzWindow.fHasFocus))
891 window.fHasFocus = NO;
895 fPimpl->fX11EventTranslator.GenerateDestroyNotify(wid);
901 fPimpl->DeleteDrawable(wid);
921 if (
fPimpl->IsRootWindow(wid))
924 const Util::AutoreleasePool pool;
926 assert(
fPimpl->GetDrawable(wid).fIsPixmap == NO &&
927 "DestroySubwindows, can not be called for QuartzPixmap or QuartzImage object");
929 NSObject<X11Window> *window =
fPimpl->GetWindow(wid);
934 const Util::NSScopeGuard<NSArray> children([[window.fContentView subviews] copy]);
936 for (NSView<X11Window> *child in children.Get())
948 if (
fPimpl->IsRootWindow(wid))
951 [
fPimpl->GetWindow(wid) getAttributes : &attr];
962 const Util::AutoreleasePool pool;
964 assert(!
fPimpl->IsRootWindow(wid) &&
"ChangeWindowAttributes, called for root window");
965 assert(attr != 0 &&
"ChangeWindowAttributes, parameter 'attr' is null");
967 [
fPimpl->GetWindow(wid) setAttributes : attr];
982 if (windowID <= fPimpl->GetRootWindowID())
985 NSObject<X11Window> *
const window =
fPimpl->GetWindow(windowID);
987 window.fEventMask = eventMask;
996 assert(!
fPimpl->IsRootWindow(wid) &&
"ReparentChild, can not re-parent root window");
998 const Util::AutoreleasePool pool;
1000 NSView<X11Window> *
const view =
fPimpl->GetWindow(wid).fContentView;
1001 if (
fPimpl->IsRootWindow(pid)) {
1004 [view removeFromSuperview];
1005 view.fParentView = nil;
1007 NSRect frame = view.frame;
1008 frame.origin = NSPoint();
1011 if (!view.fOverrideRedirect)
1015 styleMask : styleMask
1016 backing : NSBackingStoreBuffered
1018 [view setX : x Y :
y];
1019 [newTopLevel addChild : view];
1021 fPimpl->ReplaceDrawable(wid, newTopLevel);
1024 [newTopLevel release];
1027 [view removeFromSuperview];
1029 NSObject<X11Window> *
const newParent =
fPimpl->GetWindow(pid);
1030 assert(newParent.fIsPixmap == NO &&
"ReparentChild, pixmap can not be a new parent");
1031 [view setX : x Y :
y];
1032 [newParent addChild : view];
1043 if (
fPimpl->IsRootWindow(pid))
1046 const Util::AutoreleasePool pool;
1048 NSView<X11Window> *
const contentView =
fPimpl->GetWindow(wid).fContentView;
1050 [contentView retain];
1051 [contentView removeFromSuperview];
1052 [topLevel setContentView : nil];
1053 fPimpl->ReplaceDrawable(wid, contentView);
1054 [contentView setX : x Y :
y];
1055 [
fPimpl->GetWindow(pid) addChild : contentView];
1056 [contentView release];
1067 assert(!
fPimpl->IsRootWindow(wid) &&
"ReparentWindow, can not re-parent root window");
1069 NSView<X11Window> *
const view =
fPimpl->GetWindow(wid).fContentView;
1070 if (view.fParentView)
1083 assert(!
fPimpl->IsRootWindow(wid) &&
"MapWindow, called for root window");
1085 const Util::AutoreleasePool pool;
1088 [
fPimpl->GetWindow(wid) mapWindow];
1103 assert(!
fPimpl->IsRootWindow(wid) &&
"MapSubwindows, called for 'root' window");
1105 const Util::AutoreleasePool pool;
1108 [
fPimpl->GetWindow(wid) mapSubwindows];
1118 assert(!
fPimpl->IsRootWindow(wid) &&
"MapRaised, called for root window");
1120 const Util::AutoreleasePool pool;
1123 [
fPimpl->GetWindow(wid) mapRaised];
1139 assert(!
fPimpl->IsRootWindow(wid) &&
"UnmapWindow, called for root window");
1141 const Util::AutoreleasePool pool;
1144 fPimpl->fX11EventTranslator.CheckUnmappedView(wid);
1146 NSObject<X11Window> *
const win =
fPimpl->GetWindow(wid);
1149 if (win == win.fQuartzWindow && win.fQuartzWindow.fHasFocus)
1171 assert(!
fPimpl->IsRootWindow(wid) &&
"RaiseWindow, called for root window");
1173 if (!
fPimpl->GetWindow(wid).fParentView)
1176 [
fPimpl->GetWindow(wid) raiseWindow];
1188 assert(!
fPimpl->IsRootWindow(wid) &&
"LowerWindow, called for root window");
1190 if (!
fPimpl->GetWindow(wid).fParentView)
1193 [
fPimpl->GetWindow(wid) lowerWindow];
1209 assert(!
fPimpl->IsRootWindow(wid) &&
"MoveWindow, called for root window");
1210 const Util::AutoreleasePool pool;
1211 [
fPimpl->GetWindow(wid) setX : x Y :
y];
1228 assert(!
fPimpl->IsRootWindow(wid) &&
"MoveResizeWindow, called for 'root' window");
1230 const Util::AutoreleasePool pool;
1231 [
fPimpl->GetWindow(wid) setX : x Y : y width : w height :
h];
1240 assert(!
fPimpl->IsRootWindow(wid) &&
"ResizeWindow, called for 'root' window");
1242 const Util::AutoreleasePool pool;
1245 const UInt_t siMax = std::numeric_limits<Int_t>::max();
1246 if (w > siMax || h > siMax)
1249 NSSize newSize = {};
1253 [
fPimpl->GetWindow(wid) setDrawableSize : newSize];
1263 assert(!
fPimpl->IsRootWindow(wid) &&
"IconifyWindow, can not iconify the root window");
1264 assert(
fPimpl->GetWindow(wid).fIsPixmap == NO &&
"IconifyWindow, invalid window id");
1266 NSObject<X11Window> *
const win =
fPimpl->GetWindow(wid);
1267 assert(win.fQuartzWindow == win &&
"IconifyWindow, can be called only for a top level window");
1269 fPimpl->fX11EventTranslator.CheckUnmappedView(wid);
1271 NSObject<X11Window> *
const window =
fPimpl->GetWindow(wid);
1272 if (
fPimpl->fX11CommandBuffer.BufferSize())
1273 fPimpl->fX11CommandBuffer.RemoveOperationsForDrawable(wid);
1275 if (window.fQuartzWindow.fHasFocus) {
1277 window.fQuartzWindow.fHasFocus = NO;
1280 [win.fQuartzWindow miniaturize : win.fQuartzWindow];
1295 if (!srcWin || !dstWin)
1298 const bool srcIsRoot =
fPimpl->IsRootWindow(srcWin);
1299 const bool dstIsRoot =
fPimpl->IsRootWindow(dstWin);
1301 if (srcIsRoot && dstIsRoot) {
1313 NSPoint srcPoint = {};
1317 NSPoint dstPoint = {};
1321 NSView<X11Window> *
const srcView =
fPimpl->GetWindow(srcWin).fContentView;
1323 }
else if (srcIsRoot) {
1324 NSView<X11Window> *
const dstView =
fPimpl->GetWindow(dstWin).fContentView;
1327 if ([dstView superview]) {
1331 dstPoint = [[dstView superview] convertPoint : dstPoint fromView : dstView];
1332 if (NSView<X11Window> *
const view = (NSView<X11Window> *)[dstView hitTest : dstPoint]) {
1333 if (view != dstView && view.fMapState ==
kIsViewable)
1338 NSView<X11Window> *
const srcView =
fPimpl->GetWindow(srcWin).fContentView;
1339 NSView<X11Window> *
const dstView =
fPimpl->GetWindow(dstWin).fContentView;
1342 if ([dstView superview]) {
1346 const NSPoint
pt = [[dstView superview] convertPoint : dstPoint fromView : dstView];
1347 if (NSView<X11Window> *
const view = (NSView<X11Window> *)[dstView hitTest : pt]) {
1348 if (view != dstView && view.fMapState ==
kIsViewable)
1371 if (
fPimpl->IsRootWindow(wid)) {
1379 NSObject<X11Drawable> *window =
fPimpl->GetDrawable(wid);
1381 if (!window.fIsPixmap) {
1401 assert(!
fPimpl->IsRootWindow(wid) &&
"SetWindowBackground, can not set color for root window");
1403 fPimpl->GetWindow(wid).fBackgroundPixel = color;
1416 assert(!
fPimpl->IsRootWindow(windowID) &&
1417 "SetWindowBackgroundPixmap, can not set background for a root window");
1418 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
1419 "SetWindowBackgroundPixmap, invalid window id");
1421 NSObject<X11Window> *
const window =
fPimpl->GetWindow(windowID);
1422 if (pixmapID ==
kNone) {
1423 window.fBackgroundPixmap = nil;
1427 assert(pixmapID >
fPimpl->GetRootWindowID() &&
1428 "SetWindowBackgroundPixmap, parameter 'pixmapID' is not a valid pixmap id");
1429 assert(
fPimpl->GetDrawable(pixmapID).fIsPixmap == YES &&
1430 "SetWindowBackgroundPixmap, bad drawable");
1432 NSObject<X11Drawable> *
const pixmapOrImage =
fPimpl->GetDrawable(pixmapID);
1435 Util::NSScopeGuard<QuartzImage> backgroundImage;
1437 if ([pixmapOrImage isKindOfClass : [QuartzPixmap
class]]) {
1438 backgroundImage.Reset([[QuartzImage alloc] initFromPixmap : (QuartzPixmap *)pixmapOrImage]);
1439 if (backgroundImage.Get())
1440 window.fBackgroundPixmap = backgroundImage.Get();
1442 backgroundImage.Reset([[QuartzImage alloc] initFromImage : (QuartzImage *)pixmapOrImage]);
1443 if (backgroundImage.Get())
1444 window.fBackgroundPixmap = backgroundImage.Get();
1447 if (!backgroundImage.Get())
1449 Error(
"SetWindowBackgroundPixmap",
"QuartzImage initialization failed");
1458 if (windowID <= fPimpl->GetRootWindowID())
1461 NSView<X11Window> *view =
fPimpl->GetWindow(windowID).fContentView;
1462 return view.fParentView ? view.fParentView.fID :
fPimpl->GetRootWindowID();
1471 const Util::AutoreleasePool pool;
1473 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1475 if ([(NSObject *)drawable isKindOfClass : [NSWindow
class]]) {
1476 NSString *
const windowTitle = [NSString stringWithCString : name encoding : NSASCIIStringEncoding];
1477 [(NSWindow *)drawable setTitle : windowTitle];
1507 assert(!
fPimpl->IsRootWindow(windowID) &&
1508 "ShapeCombineMask, windowID parameter is a 'root' window");
1509 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
1510 "ShapeCombineMask, windowID parameter is a bad window id");
1511 assert([
fPimpl->GetDrawable(pixmapID) isKindOfClass : [QuartzImage
class]] &&
1512 "ShapeCombineMask, pixmapID parameter must point to QuartzImage object");
1514 if (
fPimpl->GetWindow(windowID).fContentView.fParentView)
1517 QuartzImage *
const srcImage = (QuartzImage *)
fPimpl->GetDrawable(pixmapID);
1518 assert(srcImage.
fIsStippleMask == YES &&
"ShapeCombineMask, source image is not a stipple mask");
1522 const Util::NSScopeGuard<QuartzImage> image([[QuartzImage alloc] initFromImageFlipped : srcImage]);
1526 [qw setOpaque : NO];
1527 [qw setBackgroundColor : [NSColor clearColor]];
1531 #pragma mark - "Window manager hints" set of functions. 1539 assert(!
fPimpl->IsRootWindow(wid) &&
"SetMWMHints, called for 'root' window");
1542 NSUInteger newMask = 0;
1558 [qw setStyleMask : newMask];
1561 if (!qw.fMainWindow) {
1562 [[qw standardWindowButton : NSWindowZoomButton] setEnabled : YES];
1563 [[qw standardWindowButton : NSWindowMiniaturizeButton] setEnabled : YES];
1566 if (!qw.fMainWindow) {
1567 [[qw standardWindowButton : NSWindowZoomButton] setEnabled : funcs &
kMWMDecorMaximize];
1568 [[qw standardWindowButton : NSWindowMiniaturizeButton] setEnabled : funcs &
kMWMDecorMinimize];
1590 assert(!
fPimpl->IsRootWindow(wid) &&
"SetWMSizeHints, called for root window");
1593 const NSRect minRect = [NSWindow frameRectForContentRect : NSMakeRect(0., 0., wMin, hMin) styleMask : styleMask];
1594 const NSRect maxRect = [NSWindow frameRectForContentRect : NSMakeRect(0., 0., wMax, hMax) styleMask : styleMask];
1597 [qw setMinSize : minRect.size];
1598 [qw setMaxSize : maxRect.size];
1619 assert(wid >
fPimpl->GetRootWindowID() &&
"SetWMTransientHint, wid parameter is not a valid window id");
1621 if (
fPimpl->IsRootWindow(mainWid))
1626 if (![mainWindow isVisible])
1631 if (mainWindow != transientWindow) {
1634 Error(
"SetWMTransientHint",
"window is already transient for other window");
1636 [[transientWindow standardWindowButton : NSWindowZoomButton] setEnabled : NO];
1637 [mainWindow addTransientWindow : transientWindow];
1640 Warning(
"SetWMTransientHint",
"transient and main windows are the same window");
1643 #pragma mark - GUI-rendering part. 1649 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawLineAux, called for root window");
1651 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1652 CGContextRef ctx = drawable.fContext;
1653 assert(ctx != 0 &&
"DrawLineAux, context is null");
1666 CGContextSetAllowsAntialiasing(ctx,
false);
1668 if (!drawable.fIsPixmap)
1669 CGContextTranslateCTM(ctx, 0.5, 0.5);
1676 SetStrokeParametersFromX11Context(ctx, gcVals);
1677 CGContextBeginPath(ctx);
1678 CGContextMoveToPoint(ctx, x1, y1);
1679 CGContextAddLineToPoint(ctx, x2, y2);
1680 CGContextStrokePath(ctx);
1682 CGContextSetAllowsAntialiasing(ctx,
true);
1697 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawLine, called for root window");
1698 assert(gc > 0 && gc <=
fX11Contexts.size() &&
"DrawLine, invalid context index");
1702 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1703 if (!drawable.fIsPixmap) {
1704 NSObject<X11Window> *
const window = (NSObject<X11Window> *)drawable;
1707 if (ParentRendersToChild(view)) {
1717 fPimpl->fX11CommandBuffer.AddDrawLine(wid, gcVals, x1, y1, x2, y2);
1723 fPimpl->fX11CommandBuffer.AddDrawLine(wid, gcVals, x1, y1, x2, y2);
1733 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawSegmentsAux, called for root window");
1734 assert(segments != 0 &&
"DrawSegmentsAux, segments parameter is null");
1735 assert(nSegments > 0 &&
"DrawSegmentsAux, nSegments <= 0");
1737 for (
Int_t i = 0; i < nSegments; ++i)
1738 DrawLineAux(wid, gcVals, segments[i].fX1, segments[i].fY1 - 3, segments[i].fX2, segments[i].fY2 - 3);
1750 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawSegments, called for root window");
1751 assert(gc > 0 && gc <=
fX11Contexts.size() &&
"DrawSegments, invalid context index");
1752 assert(segments != 0 &&
"DrawSegments, parameter 'segments' is null");
1753 assert(nSegments > 0 &&
"DrawSegments, number of segments <= 0");
1755 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1758 if (!drawable.fIsPixmap) {
1761 if (ParentRendersToChild(view)) {
1771 fPimpl->fX11CommandBuffer.AddDrawSegments(wid, gcVals, segments, nSegments);
1777 fPimpl->fX11CommandBuffer.AddDrawSegments(wid, gcVals, segments, nSegments);
1787 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawRectangleAux, called for root window");
1789 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1791 if (!drawable.fIsPixmap) {
1803 CGContextRef ctx =
fPimpl->GetDrawable(wid).fContext;
1804 assert(ctx &&
"DrawRectangleAux, context is null");
1807 CGContextSetAllowsAntialiasing(ctx,
false);
1809 SetStrokeParametersFromX11Context(ctx, gcVals);
1811 const CGRect rect = CGRectMake(x, y, w, h);
1812 CGContextStrokeRect(ctx, rect);
1814 CGContextSetAllowsAntialiasing(ctx,
true);
1826 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawRectangle, called for root window");
1827 assert(gc > 0 && gc <=
fX11Contexts.size() &&
"DrawRectangle, invalid context index");
1831 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1833 if (!drawable.fIsPixmap) {
1834 NSObject<X11Window> *
const window = (NSObject<X11Window> *)drawable;
1837 if (ParentRendersToChild(view)) {
1847 fPimpl->fX11CommandBuffer.AddDrawRectangle(wid, gcVals, x, y, w, h);
1853 fPimpl->fX11CommandBuffer.AddDrawRectangle(wid, gcVals, x, y, w, h);
1869 assert(!
fPimpl->IsRootWindow(wid) &&
"FillRectangleAux, called for root window");
1871 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1872 CGContextRef ctx = drawable.fContext;
1873 CGSize patternPhase = {};
1875 if (drawable.fIsPixmap) {
1880 const CGRect fillRect = CGRectMake(x, y, w, h);
1882 if (!drawable.fIsPixmap) {
1885 const NSPoint origin = [view.
fParentView convertPoint : view.frame.origin toView : nil];
1886 patternPhase.width = origin.x;
1887 patternPhase.height = origin.y;
1893 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals) || HasFillTiledStyle(gcVals)) {
1894 PatternContext patternContext = {gcVals.
fMask, gcVals.
fFillStyle, 0, 0, nil, patternPhase};
1896 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals)) {
1898 "FillRectangleAux, fill_style is FillStippled/FillOpaqueStippled," 1899 " but no stipple is set in a context");
1904 if (HasFillOpaqueStippledStyle(gcVals))
1908 "FillRectangleAux, fill_style is FillTiled, but not tile is set in a context");
1910 patternContext.fImage =
fPimpl->GetDrawable(gcVals.
fTile);
1914 CGContextFillRect(ctx, fillRect);
1919 SetFilledAreaColorFromX11Context(ctx, gcVals);
1920 CGContextFillRect(ctx, fillRect);
1933 assert(!
fPimpl->IsRootWindow(wid) &&
"FillRectangle, called for root window");
1934 assert(gc > 0 && gc <=
fX11Contexts.size() &&
"FillRectangle, invalid context index");
1937 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1939 if (!drawable.fIsPixmap) {
1940 NSObject<X11Window> *
const window = (NSObject<X11Window> *)drawable;
1943 if (ParentRendersToChild(view)) {
1953 fPimpl->fX11CommandBuffer.AddFillRectangle(wid, gcVals, x, y, w, h);
1970 assert(!
fPimpl->IsRootWindow(wid) &&
"FillPolygonAux, called for root window");
1971 assert(polygon != 0 &&
"FillPolygonAux, parameter 'polygon' is null");
1972 assert(nPoints > 0 &&
"FillPolygonAux, number of points must be positive");
1974 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1975 CGContextRef ctx = drawable.fContext;
1977 CGSize patternPhase = {};
1979 if (!drawable.fIsPixmap) {
1981 const NSPoint origin = [view convertPoint : view.frame.origin toView : nil];
1982 patternPhase.width = origin.x;
1983 patternPhase.height = origin.y;
1988 CGContextSetAllowsAntialiasing(ctx,
false);
1990 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals) || HasFillTiledStyle(gcVals)) {
1991 PatternContext patternContext = {gcVals.
fMask, gcVals.
fFillStyle, 0, 0, nil, patternPhase};
1993 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals)) {
1995 "FillRectangleAux, fill style is FillStippled/FillOpaqueStippled," 1996 " but no stipple is set in a context");
2001 if (HasFillOpaqueStippledStyle(gcVals))
2005 "FillRectangleAux, fill_style is FillTiled, but not tile is set in a context");
2007 patternContext.fImage =
fPimpl->GetDrawable(gcVals.
fTile);
2012 SetFilledAreaColorFromX11Context(ctx, gcVals);
2017 CGContextBeginPath(ctx);
2018 if (!drawable.fIsPixmap) {
2019 CGContextMoveToPoint(ctx, polygon[0].fX, polygon[0].fY - 2);
2020 for (
Int_t i = 1; i < nPoints; ++i)
2021 CGContextAddLineToPoint(ctx, polygon[i].fX, polygon[i].fY - 2);
2024 for (
Int_t i = 1; i < nPoints; ++i)
2028 CGContextFillPath(ctx);
2029 CGContextSetAllowsAntialiasing(ctx,
true);
2052 assert(polygon != 0 &&
"FillPolygon, parameter 'polygon' is null");
2053 assert(nPoints > 0 &&
"FillPolygon, number of points must be positive");
2054 assert(gc > 0 && gc <=
fX11Contexts.size() &&
"FillPolygon, invalid context index");
2056 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
2059 if (!drawable.fIsPixmap) {
2062 if (ParentRendersToChild(view)) {
2072 fPimpl->fX11CommandBuffer.AddFillPolygon(wid, gcVals, polygon, nPoints);
2078 fPimpl->fX11CommandBuffer.AddFillPolygon(wid, gcVals, polygon, nPoints);
2092 assert(!
fPimpl->IsRootWindow(src) &&
"CopyAreaAux, src parameter is root window");
2093 assert(!
fPimpl->IsRootWindow(dst) &&
"CopyAreaAux, dst parameter is root window");
2097 const Util::AutoreleasePool pool;
2099 NSObject<X11Drawable> *
const srcDrawable =
fPimpl->GetDrawable(src);
2100 NSObject<X11Drawable> *
const dstDrawable =
fPimpl->GetDrawable(dst);
2105 QuartzImage *mask = nil;
2108 "CopyArea, mask is not a pixmap");
2118 [dstDrawable copy : srcDrawable area : copyArea withMask : mask clipOrigin : clipOrigin toPoint : dstPoint];
2128 assert(!
fPimpl->IsRootWindow(src) &&
"CopyArea, src parameter is root window");
2129 assert(!
fPimpl->IsRootWindow(dst) &&
"CopyArea, dst parameter is root window");
2130 assert(gc > 0 && gc <=
fX11Contexts.size() &&
"CopyArea, invalid context index");
2132 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(dst);
2135 if (!drawable.fIsPixmap) {
2138 if (ParentRendersToChild(view)) {
2140 CopyAreaAux(src, dst, gcVals, srcX, srcY, width, height, dstX, dstY);
2148 fPimpl->fX11CommandBuffer.AddCopyArea(src, dst, gcVals, srcX, srcY, width, height, dstX, dstY);
2150 CopyAreaAux(src, dst, gcVals, srcX, srcY, width, height, dstX, dstY);
2153 if (
fPimpl->GetDrawable(src).fIsPixmap) {
2155 CopyAreaAux(src, dst, gcVals, srcX, srcY, width, height, dstX, dstY);
2158 fPimpl->fX11CommandBuffer.AddCopyArea(src, dst, gcVals, srcX, srcY, width, height, dstX, dstY);
2160 CopyAreaAux(src, dst, gcVals, srcX, srcY, width, height, dstX, dstY);
2169 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawStringAux, called for root window");
2171 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
2172 CGContextRef ctx = drawable.fContext;
2173 assert(ctx != 0 &&
"DrawStringAux, context is null");
2177 CGContextSetTextMatrix(ctx, CGAffineTransformIdentity);
2180 if (!drawable.fIsPixmap) {
2181 CGContextTranslateCTM(ctx, 0., drawable.fHeight);
2182 CGContextScaleCTM(ctx, 1., -1.);
2186 CGContextSetAllowsAntialiasing(ctx,
true);
2188 assert(gcVals.
fMask &
kGCFont &&
"DrawString, font is not set in a context");
2191 len = std::strlen(text);
2193 CGFloat textColor[4] = {0., 0., 0., 1.};
2198 CGContextSetRGBFillColor(ctx, textColor[0], textColor[1], textColor[2], textColor[3]);
2203 std::vector<UniChar> unichars((
unsigned char *)text, (
unsigned char *)text + len);
2216 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawString, called for root window");
2217 assert(gc > 0 && gc <=
fX11Contexts.size() &&
"DrawString, invalid context index");
2219 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
2221 assert(gcVals.
fMask &
kGCFont &&
"DrawString, font is not set in a context");
2223 if (!drawable.fIsPixmap) {
2226 if (ParentRendersToChild(view)) {
2231 }
catch (
const std::exception &) {
2243 fPimpl->fX11CommandBuffer.AddDrawString(wid, gcVals, x, y, text, len);
2250 fPimpl->fX11CommandBuffer.AddDrawString(wid, gcVals, x, y, text, len);
2259 assert(!
fPimpl->IsRootWindow(windowID) &&
"ClearAreaAux, called for root window");
2262 assert(view.fContext != 0 &&
"ClearAreaAux, view.fContext is null");
2270 if (!view.fBackgroundPixmap) {
2272 CGFloat rgb[3] = {};
2276 CGContextSetRGBFillColor(view.fContext, rgb[0], rgb[1], rgb[2], 1.);
2277 CGContextFillRect(view.fContext, CGRectMake(x, y, w, h));
2279 const CGRect fillRect = CGRectMake(x, y, w, h);
2281 CGSize patternPhase = {};
2282 if (view.fParentView) {
2283 const NSPoint origin = [view.fParentView convertPoint : view.frame.origin toView : nil];
2284 patternPhase.width = origin.x;
2285 patternPhase.height = origin.y;
2289 PatternContext patternContext = {
Mask_t(), 0, 0, 0, view.fBackgroundPixmap, patternPhase};
2291 CGContextFillRect(view.fContext, fillRect);
2305 assert(!
fPimpl->IsRootWindow(wid) &&
"ClearArea, called for root window");
2310 if (ParentRendersToChild(view)) {
2318 if (!view.fIsOverlapped && view.fMapState ==
kIsViewable) {
2320 fPimpl->fX11CommandBuffer.AddClearArea(wid, x, y, w, h);
2338 #pragma mark - Pixmap management. 2344 NSSize newSize = {};
2348 Util::NSScopeGuard<QuartzPixmap> pixmap([[QuartzPixmap alloc] initWithW : w
H : h
2349 scaleFactor : [[NSScreen mainScreen] backingScaleFactor]]);
2351 pixmap.Get().fID =
fPimpl->RegisterDrawable(pixmap.Get());
2352 return (
Int_t)pixmap.Get().fID;
2355 Error(
"OpenPixmap",
"QuartzPixmap initialization failed");
2363 assert(!
fPimpl->IsRootWindow(wid) &&
"ResizePixmap, called for root window");
2365 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
2366 assert(drawable.fIsPixmap == YES &&
"ResizePixmap, invalid drawable");
2368 QuartzPixmap *pixmap = (QuartzPixmap *)drawable;
2372 if ([pixmap resizeW : w
H : h scaleFactor : [[NSScreen mainScreen] backingScaleFactor]])
2381 assert(pixmapID > (
Int_t)
fPimpl->GetRootWindowID() &&
2382 "SelectPixmap, parameter 'pixmapID' is not a valid id");
2390 assert(pixmapID > (
Int_t)
fPimpl->GetRootWindowID() &&
2391 "CopyPixmap, parameter 'pixmapID' is not a valid id");
2393 "CopyPixmap, fSelectedDrawable is not a valid window id");
2395 NSObject<X11Drawable> *
const source =
fPimpl->GetDrawable(pixmapID);
2396 assert([source isKindOfClass : [QuartzPixmap
class]] &&
2397 "CopyPixmap, source is not a pixmap");
2398 QuartzPixmap *
const pixmap = (QuartzPixmap *)source;
2401 NSObject<X11Drawable> * destination = nil;
2403 if (drawable.fIsPixmap) {
2404 destination = drawable;
2407 if (window.fBackBuffer) {
2408 destination = window.fBackBuffer;
2410 Warning(
"CopyPixmap",
"Operation skipped, since destination" 2411 " window is not double buffered");
2419 [destination copy : pixmap area : copyArea withMask : nil clipOrigin :
X11::Point() toPoint : dstPoint];
2427 assert(
fPimpl->GetDrawable(
fSelectedDrawable).fIsPixmap == YES &&
"ClosePixmap, selected drawable is not a pixmap");
2433 #pragma mark - Different functions to create pixmap from different data sources. Used by GUI. 2434 #pragma mark - These functions implement TVirtualX interface, some of them dupilcate others. 2450 assert(bitmap != 0 &&
"CreatePixmap, parameter 'bitmap' is null");
2451 assert(width > 0 &&
"CreatePixmap, parameter 'width' is 0");
2452 assert(height > 0 &&
"CreatePixmap, parameter 'height' is 0");
2454 std::vector<unsigned char> imageData (depth > 1 ? width * height * 4 : width * height);
2457 backgroundPixel, depth, &imageData[0]);
2460 Util::NSScopeGuard<QuartzImage> image;
2463 image.Reset([[QuartzImage alloc] initWithW : width
H : height
data: &imageData[0]]);
2465 image.Reset([[QuartzImage alloc] initMaskWithW : width
H : height bitmapMask : &imageData[0]]);
2468 Error(
"CreatePixmap",
"QuartzImage initialization failed");
2472 image.Get().fID =
fPimpl->RegisterDrawable(image.Get());
2473 return image.Get().fID;
2480 assert(bits != 0 &&
"CreatePixmapFromData, data parameter is null");
2481 assert(width != 0 &&
"CreatePixmapFromData, width parameter is 0");
2482 assert(height != 0 &&
"CreatePixmapFromData, height parameter is 0");
2486 std::vector<unsigned char> imageData(bits, bits + width * height * 4);
2489 unsigned char *p = &imageData[0];
2490 for (
unsigned i = 0,
e = width * height; i <
e; ++i, p += 4)
2494 Util::NSScopeGuard<QuartzImage> image([[QuartzImage alloc] initWithW : width
2495 H : height
data : &imageData[0]]);
2499 Error(
"CreatePixmapFromData",
"QuartzImage initialziation failed");
2503 image.Get().fID =
fPimpl->RegisterDrawable(image.Get());
2504 return image.Get().fID;
2511 assert(std::numeric_limits<unsigned char>::digits == 8 &&
"CreateBitmap, ASImage requires octets");
2519 std::vector<unsigned char> imageData(width * height);
2522 for (
unsigned i = 0, j = 0,
e = width / 8 * height; i <
e; ++i) {
2523 for(
unsigned bit = 0; bit < 8; ++bit, ++j) {
2524 if (bitmap[i] & (1 << bit))
2532 Util::NSScopeGuard<QuartzImage> image([[QuartzImage alloc] initMaskWithW : width
2533 H : height bitmapMask : &imageData[0]]);
2536 Error(
"CreateBitmap",
"QuartzImage initialization failed");
2540 image.Get().fID =
fPimpl->RegisterDrawable(image.Get());
2541 return image.Get().fID;
2547 fPimpl->DeleteDrawable(pixmapID);
2554 assert(
fPimpl->GetDrawable(pixmapID).fIsPixmap == YES &&
"DeletePixmap, object is not a pixmap");
2555 fPimpl->fX11CommandBuffer.AddDeletePixmap(pixmapID);
2571 if (
fPimpl->IsRootWindow(wid)) {
2572 Warning(
"GetColorBits",
"Called for root window");
2574 assert(x >= 0 &&
"GetColorBits, parameter 'x' is negative");
2575 assert(y >= 0 &&
"GetColorBits, parameter 'y' is negative");
2576 assert(w != 0 &&
"GetColorBits, parameter 'w' is 0");
2577 assert(h != 0 &&
"GetColorBits, parameter 'h' is 0");
2580 return [
fPimpl->GetDrawable(wid) readColorBits : area];
2586 #pragma mark - XImage emulation. 2602 assert(wid >
fPimpl->GetRootWindowID() &&
"GetImageSize, parameter 'wid' is invalid");
2604 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
2605 width = drawable.fWidth;
2606 height = drawable.fHeight;
2619 assert([
fPimpl->GetDrawable(imageID) isKindOfClass : [QuartzPixmap
class]] &&
2620 "PutPixel, parameter 'imageID' is a bad pixmap id");
2621 assert(x >= 0 &&
"PutPixel, parameter 'x' is negative");
2622 assert(y >= 0 &&
"PutPixel, parameter 'y' is negative");
2624 QuartzPixmap *
const pixmap = (QuartzPixmap *)
fPimpl->GetDrawable(imageID);
2626 unsigned char rgb[3] = {};
2628 [pixmap putPixel : rgb X : x Y :
y];
2639 CopyArea(imageID, drawableID, gc, srcX, srcY, width, height, dstX, dstY);
2646 assert([
fPimpl->GetDrawable(imageID) isKindOfClass : [QuartzPixmap
class]] &&
2647 "DeleteImage, imageID parameter is not a valid image id");
2651 #pragma mark - Mouse related code. 2669 assert(!
fPimpl->IsRootWindow(wid) &&
"GrabButton, called for 'root' window");
2671 NSObject<X11Window> *
const widget =
fPimpl->GetWindow(wid);
2674 widget.fPassiveGrabOwnerEvents = YES;
2675 widget.fPassiveGrabButton = button;
2676 widget.fPassiveGrabEventMask = eventMask;
2677 widget.fPassiveGrabKeyModifiers = keyModifiers;
2680 widget.fPassiveGrabOwnerEvents = NO;
2681 widget.fPassiveGrabButton = -1;
2682 widget.fPassiveGrabEventMask = 0;
2683 widget.fPassiveGrabKeyModifiers = 0;
2696 NSView<X11Window> *
const view =
fPimpl->GetWindow(wid).fContentView;
2697 assert(!
fPimpl->IsRootWindow(wid) &&
"GrabPointer, called for 'root' window");
2700 fPimpl->fX11EventTranslator.SetPointerGrab(view, eventMask, ownerEvents);
2704 fPimpl->fX11EventTranslator.CancelPointerGrab();
2755 assert(!
fPimpl->IsRootWindow(wid) &&
"GrabKey, called for root window");
2757 NSView<X11Window> *
const view =
fPimpl->GetWindow(wid).fContentView;
2761 [view addPassiveKeyGrab : keyCode modifiers : cocoaKeyModifiers];
2763 [view removePassiveKeyGrab : keyCode modifiers : cocoaKeyModifiers];
2782 return fPimpl->fX11EventTranslator.GetInputFocus();
2789 assert(!
fPimpl->IsRootWindow(wid) &&
"SetInputFocus, called for root window");
2792 fPimpl->fX11EventTranslator.SetInputFocus(nil);
2794 fPimpl->fX11EventTranslator.SetInputFocus(
fPimpl->GetWindow(wid).fContentView);
2810 assert(buf != 0 &&
"LookupString, parameter 'buf' is null");
2811 assert(length >= 2 &&
"LookupString, parameter 'length' - not enough memory to return null-terminated ASCII string");
2816 #pragma mark - Font management. 2823 assert(fontName != 0 &&
"LoadQueryFont, fontName is null");
2832 return fPimpl->fFontManager.LoadFont(xlfd);
2847 fPimpl->fFontManager.UnloadFont(fs);
2862 return fPimpl->fFontManager.GetTextWidth(font, s, len);
2869 fPimpl->fFontManager.GetFontProperties(font, maxAscent, maxDescent);
2896 if (fontName && fontName[0]) {
2899 return fPimpl->fFontManager.ListFonts(xlfd, maxNames, count);
2912 fPimpl->fFontManager.FreeFontNames(fontList);
2915 #pragma mark - Color management. 2923 return fPimpl->fX11ColorParser.ParseColor(colorName, color);
2929 const unsigned red = unsigned(
double(color.
fRed) / 0xFFFF * 0xFF);
2930 const unsigned green = unsigned(
double(color.
fGreen) / 0xFFFF * 0xFF);
2931 const unsigned blue = unsigned(
double(color.
fBlue) / 0xFFFF * 0xFF);
2932 color.
fPixel = red << 16 | green << 8 | blue;
2940 color.
fRed = (color.
fPixel >> 16 & 0xFF) * 0xFFFF / 0xFF;
2941 color.
fGreen = (color.
fPixel >> 8 & 0xFF) * 0xFFFF / 0xFF;
2942 color.
fBlue = (color.
fPixel & 0xFF) * 0xFFFF / 0xFF;
2955 if (
const TColor *
const color =
gROOT->GetColor(rootColorIndex)) {
2956 Float_t red = 0.f, green = 0.f, blue = 0.f;
2957 color->GetRGB(red, green, blue);
2958 pixel = unsigned(red * 255) << 16;
2959 pixel |= unsigned(green * 255) << 8;
2960 pixel |= unsigned(blue * 255);
2994 #pragma mark - Graphical context management. 3014 assert(gc <=
fX11Contexts.size() && gc > 0 &&
"ChangeGC, invalid context id");
3018 x11Context.fForeground = foreground;
3025 assert(gc <=
fX11Contexts.size() && gc > 0 &&
"ChangeGC, invalid context id");
3026 assert(gval != 0 &&
"ChangeGC, gval parameter is null");
3030 x11Context.
fMask |= mask;
3043 if (mask & kGCLineWidth)
3045 if (mask & kGCLineStyle)
3080 const unsigned nDashes =
sizeof x11Context.
fDashes /
sizeof x11Context.
fDashes[0];
3081 for (
unsigned i = 0; i < nDashes; ++i)
3090 assert(src <=
fX11Contexts.size() && src > 0 &&
"CopyGC, bad source context");
3091 assert(dst <=
fX11Contexts.size() && dst > 0 &&
"CopyGC, bad destination context");
3094 srcContext.fMask = mask;
3114 #pragma mark - Cursor management. 3136 assert(!
fPimpl->IsRootWindow(wid) &&
"SetCursor, called for root window");
3138 NSView<X11Window> *
const view =
fPimpl->GetWindow(wid).fContentView;
3139 view.fCurrentCursor = cursor;
3159 const NSPoint screenPoint = [NSEvent mouseLocation];
3175 rootWinID =
fPimpl->GetRootWindowID();
3177 NSPoint screenPoint = [NSEvent mouseLocation];
3180 rootX = screenPoint.x;
3181 rootY = screenPoint.y;
3184 if (winID >
fPimpl->GetRootWindowID()) {
3185 NSObject<X11Window> *
const window =
fPimpl->GetWindow(winID);
3190 winX = screenPoint.x;
3191 winY = screenPoint.y;
3196 childWinID = childWin.fID;
3204 #pragma mark - OpenGL management. 3212 return [[NSScreen mainScreen] backingScaleFactor];
3217 const std::vector<std::pair<UInt_t, Int_t> > &formatComponents)
3221 typedef std::pair<UInt_t, Int_t> component_type;
3222 typedef std::vector<component_type>::size_type size_type;
3225 std::vector<NSOpenGLPixelFormatAttribute> attribs;
3226 for (size_type i = 0,
e = formatComponents.size(); i <
e; ++i) {
3227 const component_type &comp = formatComponents[i];
3230 attribs.push_back(NSOpenGLPFADoubleBuffer);
3232 attribs.push_back(NSOpenGLPFADepthSize);
3233 attribs.push_back(comp.second > 0 ? comp.second : 32);
3235 attribs.push_back(NSOpenGLPFAAccumSize);
3236 attribs.push_back(comp.second > 0 ? comp.second : 1);
3238 attribs.push_back(NSOpenGLPFAStencilSize);
3239 attribs.push_back(comp.second > 0 ? comp.second : 8);
3241 attribs.push_back(NSOpenGLPFAMultisample);
3242 attribs.push_back(NSOpenGLPFASampleBuffers);
3243 attribs.push_back(1);
3244 attribs.push_back(NSOpenGLPFASamples);
3245 attribs.push_back(comp.second ? comp.second : 8);
3249 attribs.push_back(0);
3251 NSOpenGLPixelFormat *
const pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes : &attribs[0]];
3252 const Util::NSScopeGuard<NSOpenGLPixelFormat> formatGuard(pixelFormat);
3254 NSView<X11Window> *parentView = nil;
3255 if (!
fPimpl->IsRootWindow(parentID)) {
3256 parentView =
fPimpl->GetWindow(parentID).fContentView;
3257 assert([parentView isKindOfClass : [
QuartzView class]] &&
3258 "CreateOpenGLWindow, parent view must be QuartzView");
3261 NSRect viewFrame = {};
3262 viewFrame.size.width = width;
3263 viewFrame.size.height = height;
3266 const Util::NSScopeGuard<ROOTOpenGLView> viewGuard(glView);
3271 [parentView addChild : glView];
3272 glID =
fPimpl->RegisterDrawable(glView);
3278 const Util::NSScopeGuard<QuartzWindow> winGuard(parent);
3282 Error(
"CreateOpenGLWindow",
"QuartzWindow allocation/initialization" 3283 " failed for a top-level GL widget");
3287 glID =
fPimpl->RegisterDrawable(parent);
3297 assert(!
fPimpl->IsRootWindow(windowID) &&
3298 "CreateOpenGLContext, parameter 'windowID' is a root window");
3300 "CreateOpenGLContext, view is not an OpenGL view");
3302 NSOpenGLContext *
const sharedContext =
fPimpl->GetGLContextForHandle(sharedID);
3305 const Util::NSScopeGuard<NSOpenGLContext>
3306 newContext([[NSOpenGLContext alloc] initWithFormat : glView.
pixelFormat shareContext : sharedContext]);
3308 const Handle_t ctxID =
fPimpl->RegisterGLContext(newContext.Get());
3324 assert(ctxID > 0 &&
"MakeOpenGLContextCurrent, invalid context id");
3326 NSOpenGLContext *
const glContext =
fPimpl->GetGLContextForHandle(ctxID);
3328 Error(
"MakeOpenGLContextCurrent",
"No OpenGL context found for id %d",
int(ctxID));
3336 if ([glContext view] != glView)
3337 [glContext setView : glView];
3345 [glContext makeCurrentContext];
3356 NSView *fakeView = nil;
3363 const UInt_t width = std::max(glView.frame.size.width, CGFloat(100));
3364 const UInt_t height = std::max(glView.frame.size.height, CGFloat(100));
3366 NSRect viewFrame = {};
3367 viewFrame.size.width = width;
3368 viewFrame.size.height = height;
3374 fakeWindow = [[
QuartzWindow alloc] initWithContentRect : viewFrame styleMask : styleMask
3375 backing : NSBackingStoreBuffered defer : NO windowAttributes : &attr];
3376 Util::NSScopeGuard<QuartzWindow> winGuard(fakeWindow);
3379 [fakeView setHidden : NO];
3381 fPimpl->SetFakeGLWindow(fakeWindow);
3385 [fakeView setHidden : NO];
3389 [glContext setView : fakeView];
3390 [glContext makeCurrentContext];
3399 NSOpenGLContext *
const currentContext = [NSOpenGLContext currentContext];
3400 if (!currentContext) {
3401 Error(
"GetCurrentOpenGLContext",
"The current OpenGL context is null");
3405 const Handle_t contextID =
fPimpl->GetHandleForGLContext(currentContext);
3407 Error(
"GetCurrentOpenGLContext",
"The current OpenGL context was" 3408 " not created/registered by TGCocoa");
3416 assert(ctxID > 0 &&
"FlushOpenGLBuffer, invalid context id");
3418 NSOpenGLContext *
const glContext =
fPimpl->GetGLContextForHandle(ctxID);
3419 assert(glContext != nil &&
"FlushOpenGLBuffer, bad context id");
3421 if (glContext != [NSOpenGLContext currentContext])
3425 [glContext flushBuffer];
3434 NSOpenGLContext *
const glContext =
fPimpl->GetGLContextForHandle(ctxID);
3435 if (NSView *
const v = [glContext view]) {
3437 ((ROOTOpenGLView *)
v).fOpenGLContext = nil;
3439 [glContext clearDrawable];
3442 if (glContext == [NSOpenGLContext currentContext])
3443 [NSOpenGLContext clearCurrentContext];
3445 fPimpl->DeleteGLContext(ctxID);
3448 #pragma mark - Off-screen rendering for TPad/TCanvas. 3454 assert(windowID > (
Int_t)
fPimpl->GetRootWindowID() &&
"SetDoubleBuffer called for root window");
3456 if (windowID == 999) {
3457 Warning(
"SetDoubleBuffer",
"called with wid == 999");
3478 "SetDoubleBufferON, called, but no correct window was selected before");
3482 assert(window.fIsPixmap == NO &&
3483 "SetDoubleBufferON, selected drawable is a pixmap, can not attach pixmap to pixmap");
3485 const unsigned currW = window.fWidth;
3486 const unsigned currH = window.fHeight;
3488 if (QuartzPixmap *
const currentPixmap = window.fBackBuffer) {
3489 if (currH == currentPixmap.fHeight && currW == currentPixmap.fWidth)
3493 Util::NSScopeGuard<QuartzPixmap> pixmap([[QuartzPixmap alloc] initWithW : currW
3494 H : currH scaleFactor : [[NSScreen mainScreen] backingScaleFactor]]);
3496 window.fBackBuffer = pixmap.Get();
3499 Error(
"SetDoubleBufferON",
"QuartzPixmap initialization failed");
3511 #pragma mark - Event management part. 3516 if (
fPimpl->IsRootWindow(wid))
3525 fPimpl->fX11EventTranslator.fEventQueue.push_back(newEvent);
3531 assert(
fPimpl->fX11EventTranslator.fEventQueue.size() > 0 &&
"NextEvent, event queue is empty");
3533 event =
fPimpl->fX11EventTranslator.fEventQueue.front();
3534 fPimpl->fX11EventTranslator.fEventQueue.pop_front();
3540 return (
Int_t)
fPimpl->fX11EventTranslator.fEventQueue.size();
3547 typedef X11::EventQueue_t::iterator iterator_type;
3549 iterator_type it =
fPimpl->fX11EventTranslator.fEventQueue.begin();
3550 iterator_type eIt =
fPimpl->fX11EventTranslator.fEventQueue.end();
3552 for (; it != eIt; ++it) {
3553 const Event_t &queuedEvent = *it;
3554 if (queuedEvent.
fWindow == windowID && queuedEvent.
fType == type) {
3555 event = queuedEvent;
3556 fPimpl->fX11EventTranslator.fEventQueue.erase(it);
3572 #pragma mark - "Drag and drop", "Copy and paste", X11 properties. 3579 assert(name != 0 &&
"InternAtom, parameter 'name' is null");
3580 return FindAtom(name, !onlyIfExist);
3596 assert(!
fPimpl->IsRootWindow(windowID) &&
3597 "SetPrimarySelectionOwner, windowID parameter is a 'root' window");
3598 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3599 "SetPrimarySelectionOwner, windowID parameter is not a valid window");
3601 const Atom_t primarySelectionAtom =
FindAtom(
"XA_PRIMARY",
false);
3602 assert(primarySelectionAtom !=
kNone &&
3603 "SetPrimarySelectionOwner, predefined XA_PRIMARY atom was not found");
3621 assert(!
fPimpl->IsRootWindow(windowID) &&
3622 "SetSelectionOwner, windowID parameter is a 'root' window'");
3623 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3624 "SetSelectionOwner, windowID parameter is not a valid window");
3639 const Atom_t primarySelectionAtom =
FindAtom(
"XA_PRIMARY",
false);
3640 assert(primarySelectionAtom !=
kNone &&
3641 "GetPrimarySelectionOwner, predefined XA_PRIMARY atom was not found");
3664 assert(!
fPimpl->IsRootWindow(windowID) &&
3665 "ConvertPrimarySelection, parameter 'windowID' is root window");
3666 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3667 "ConvertPrimarySelection, parameter windowID parameter is not a window id");
3670 assert(primarySelectionAtom !=
kNone &&
3671 "ConvertPrimarySelection, XA_PRIMARY predefined atom not found");
3674 assert(stringAtom !=
kNone &&
3675 "ConvertPrimarySelection, XA_STRING predefined atom not found");
3677 ConvertSelection(windowID, primarySelectionAtom, stringAtom, clipboard, when);
3693 assert(!
fPimpl->IsRootWindow(windowID) &&
3694 "ConvertSelection, parameter 'windowID' is root window'");
3695 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3696 "ConvertSelection, parameter 'windowID' is not a window id");
3706 newEvent.fWindow = windowID;
3707 newEvent.fUser[0] = windowID;
3708 newEvent.fUser[1] = selection;
3709 newEvent.fUser[2] = target;
3710 newEvent.fUser[3] = property;
3718 ULong_t *bytesAfterReturn,
unsigned char **propertyReturn)
3727 if (
fPimpl->IsRootWindow(windowID))
3730 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3731 "GetProperty, parameter 'windowID' is not a valid window id");
3732 assert(propertyID > 0 && propertyID <=
fAtomToName.size() &&
3733 "GetProperty, parameter 'propertyID' is not a valid atom");
3734 assert(actualType != 0 &&
"GetProperty, parameter 'actualType' is null");
3735 assert(actualFormat != 0 &&
"GetProperty, parameter 'actualFormat' is null");
3736 assert(bytesAfterReturn != 0 &&
"GetProperty, parameter 'bytesAfterReturn' is null");
3737 assert(propertyReturn != 0 &&
"GetProperty, parameter 'propertyReturn' is null");
3739 const Util::AutoreleasePool pool;
3741 *bytesAfterReturn = 0;
3742 *propertyReturn = 0;
3745 const std::string &atomName =
fAtomToName[propertyID - 1];
3746 NSObject<X11Window> *window =
fPimpl->GetWindow(windowID);
3748 if (![window hasProperty : atomName.c_str()]) {
3749 Error(
"GetProperty",
"Unknown property %s requested", atomName.c_str());
3753 unsigned tmpFormat = 0, tmpElements = 0;
3754 *propertyReturn = [window getProperty : atomName.c_str() returnType : actualType
3755 returnFormat : &tmpFormat nElements : &tmpElements];
3756 *actualFormat = (
Int_t)tmpFormat;
3757 *nItems = tmpElements;
3776 assert(!
fPimpl->IsRootWindow(windowID) &&
3777 "GetPasteBuffer, parameter 'windowID' is root window");
3778 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3779 "GetPasteBuffer, parameter 'windowID' is not a valid window");
3780 assert(propertyID && propertyID <=
fAtomToName.size() &&
3781 "GetPasteBuffer, parameter 'propertyID' is not a valid atom");
3783 const Util::AutoreleasePool pool;
3785 const std::string &atomString =
fAtomToName[propertyID - 1];
3786 NSObject<X11Window> *window =
fPimpl->GetWindow(windowID);
3788 if (![window hasProperty : atomString.c_str()]) {
3789 Error(
"GetPasteBuffer",
"No property %s on a window", atomString.c_str());
3794 unsigned tmpFormat = 0, nElements = 0;
3796 const Util::ScopedArray<char>
3797 propertyData((
char *)[window getProperty : atomString.c_str()
3798 returnType : &tmpType returnFormat : &tmpFormat
3799 nElements : &nElements]);
3801 assert(tmpFormat == 8 &&
"GetPasteBuffer, property has wrong format");
3803 text.
Insert(0, propertyData.Get(), nElements);
3804 nChars = (
Int_t)nElements;
3809 [window removeProperty : atomString.c_str()];
3840 assert(!
fPimpl->IsRootWindow(windowID) &&
3841 "ChangeProperty, parameter 'windowID' is root window");
3842 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3843 "ChangeProperty, parameter 'windowID' is not a valid window id");
3844 assert(propertyID && propertyID <=
fAtomToName.size() &&
3845 "ChangeProperty, parameter 'propertyID' is not a valid atom");
3847 const Util::AutoreleasePool pool;
3849 const std::string &atomString =
fAtomToName[propertyID - 1];
3851 NSObject<X11Window> *
const window =
fPimpl->GetWindow(windowID);
3852 [window setProperty : atomString.c_str()
data : data size : len forType : type format : 8];
3874 assert(!
fPimpl->IsRootWindow(windowID) &&
3875 "ChangeProperties, parameter 'windowID' is root window");
3876 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3877 "ChangeProperties, parameter 'windowID' is not a valid window id");
3878 assert(propertyID && propertyID <=
fAtomToName.size() &&
3879 "ChangeProperties, parameter 'propertyID' is not a valid atom");
3881 const Util::AutoreleasePool pool;
3883 const std::string &atomName =
fAtomToName[propertyID - 1];
3885 NSObject<X11Window> *
const window =
fPimpl->GetWindow(windowID);
3886 [window setProperty : atomName.c_str()
data : data
3887 size : len forType : type format : format];
3904 assert(!
fPimpl->IsRootWindow(windowID) &&
3905 "DeleteProperty, parameter 'windowID' is root window");
3906 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3907 "DeleteProperty, parameter 'windowID' is not a valid window");
3908 assert(propertyID && propertyID <=
fAtomToName.size() &&
3909 "DeleteProperty, parameter 'propertyID' is not a valid atom");
3911 const std::string &atomString =
fAtomToName[propertyID - 1];
3912 [
fPimpl->GetWindow(windowID) removeProperty : atomString.c_str()];
3928 assert(windowID >
fPimpl->GetRootWindowID() &&
3929 "SetDNDAware, parameter 'windowID' is not a valid window id");
3930 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3931 "SetDNDAware, parameter 'windowID' is not a window");
3933 const Util::AutoreleasePool pool;
3936 NSArray *
const supportedTypes = [NSArray arrayWithObjects : NSFilenamesPboardType, nil];
3940 [view registerForDraggedTypes : supportedTypes];
3947 assert(xaAtomAtom == 4 &&
"SetDNDAware, XA_ATOM is not defined");
3952 assert(
sizeof(
unsigned) == 4 &&
"SetDNDAware, sizeof(unsigned) must be 4");
3954 std::vector<unsigned> propertyData;
3955 propertyData.push_back(4);
3958 for (
unsigned i = 0; typeList[i]; ++i)
3959 propertyData.push_back(
unsigned(typeList[i]));
3962 [view setProperty :
"XdndAware" data : (
unsigned char *)&propertyData[0]
3963 size : propertyData.size() forType : xaAtomAtom format : 32];
3971 if (windowID <= fPimpl->GetRootWindowID())
3974 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3975 "IsDNDAware, windowID parameter is not a window");
3978 return view.fIsDNDAware;
3986 ::Warning(
"SetTypeList",
"Not implemented");
4010 fPimpl->IsRootWindow(winID) ? nil :
fPimpl->GetWindow(winID).fContentView,
4011 dragWinID, inputWinID,
x,
y, maxDepth);
4013 return testView.fID;
4018 #pragma mark - Noops. 4038 chupx = chupy = 0.f;
4143 NSPoint newCursorPosition = {};
4144 newCursorPosition.x = ix;
4145 newCursorPosition.y = iy;
4147 if (
fPimpl->GetRootWindowID() == winID) {
4151 assert(
fPimpl->GetDrawable(winID).fIsPixmap == NO &&
4152 "Warp, drawable is not a window");
4157 CGWarpMouseCursorPosition(NSPointToCGPoint(newCursorPosition));
4389 #pragma mark - Details and aux. functions. 4394 return &
fPimpl->fX11EventTranslator;
4400 return &
fPimpl->fX11CommandBuffer;
4412 assert(
fCocoaDraw > 0 &&
"CocoaDrawOFF, was already off");
4426 if (!drawable.fIsPixmap) {
4427 Error(
"GetCurrentContext",
"TCanvas/TPad's internal error," 4428 " selected drawable is not a pixmap!");
4432 return drawable.fContext;
4445 ProcessSerialNumber psn = {0, kCurrentProcess};
4447 const OSStatus res1 = TransformProcessType(&psn, kProcessTransformToForegroundApplication);
4452 if (res1 != noErr && res1 != paramErr) {
4453 Error(
"MakeProcessForeground",
"TransformProcessType failed with code %d",
int(res1));
4456 #ifdef MAC_OS_X_VERSION_10_9 4458 [[NSApplication sharedApplication] activateIgnoringOtherApps : YES];
4460 const OSErr res2 = SetFrontProcess(&psn);
4461 if (res2 != noErr) {
4462 Error(
"MakeProcessForeground",
"SetFrontProcess failed with code %d", res2);
4469 #ifdef MAC_OS_X_VERSION_10_9 4471 [[NSApplication sharedApplication] activateIgnoringOtherApps : YES];
4473 ProcessSerialNumber psn = {};
4475 OSErr res = GetCurrentProcess(&psn);
4477 Error(
"MakeProcessForeground",
"GetCurrentProcess failed with code %d", res);
4481 res = SetFrontProcess(&psn);
4483 Error(
"MapProcessForeground",
"SetFrontProcess failed with code %d", res);
4495 const std::map<std::string, Atom_t>::const_iterator it =
fNameToAtom.find(atomName);
4499 else if (addIfNotFound) {
4515 if (iconDirectoryPath) {
4517 if (fileName.Get()) {
4518 const Util::AutoreleasePool pool;
4520 NSString *cocoaStr = [NSString stringWithCString : fileName.Get() encoding : NSASCIIStringEncoding];
4521 NSImage *image = [[[NSImage alloc] initWithContentsOfFile : cocoaStr] autorelease];
4522 [NSApp setApplicationIconImage : image];
NSUInteger GetCocoaKeyModifiersFromROOTKeyModifiers(UInt_t rootKeyModifiers)
bool ParseXLFDName(const std::string &xlfdName, XLFDName &dst)
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 Int_t GetDepth() const
Returns depth of screen (number of bit planes).
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...
int GlobalXCocoaToROOT(CGFloat xCocoa)
virtual Window_t GetInputFocus()
Returns the window id of the window having the input focus.
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 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.
virtual void DeletePixmap(Pixmap_t pixmapID)
Explicitly deletes the pixmap resource "pmap".
virtual Int_t KeysymToKeycode(UInt_t keysym)
Converts the "keysym" to the appropriate keycode.
virtual void SetWindowBackground(Window_t wid, ULong_t color)
Sets the background of the window "id" to the specified color value "color".
virtual Drawable_t CreateImage(UInt_t width, UInt_t height)
Allocates the memory needed for an drawable.
Semi-Abstract base class defining a generic interface to the underlying, low level, native graphics backend (X11, Win32, MacOS, OpenGL...).
std::unique_ptr< ROOT::MacOSX::Details::CocoaPrivate > fPimpl
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)
virtual GContext_t CreateGC(Drawable_t wid, GCValues_t *gval)
Creates a graphics context using the provided GCValues_t *gval structure.
void GetRootWindowAttributes(WindowAttributes_t *attr)
virtual void ChangeWindowAttributes(Window_t wid, SetWindowAttributes_t *attr)
Changes the attributes of the specified window "id" according the values provided in "attr"...
bool fDisplayShapeChanged
std::vector< GCValues_t > fX11Contexts
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 DrawSegmentsAux(Drawable_t wid, const GCValues_t &gcVals, const Segment_t *segments, Int_t nSegments)
void ReparentTopLevel(Window_t wid, Window_t pid, Int_t x, Int_t y)
void InitWithPredefinedAtoms(name_to_atom_map &nameToAtom, std::vector< std::string > &atomNames)
virtual void GetRegionBox(Region_t reg, Rectangle_t *rect)
Returns smallest enclosing rectangle.
virtual Int_t AddWindow(ULong_t qwid, UInt_t w, UInt_t h)
Registers a window created by Qt as a ROOT window.
bool LockFocus(NSView< X11Window > *view)
ROOT::MacOSX::Util::CFScopeGuard< CGImageRef > fImage
Int_t MapKeySymToKeyCode(Int_t keySym)
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 FontStruct_t GetFontStruct(FontH_t fh)
Retrieves the associated font structure of the font specified font handle "fh".
virtual Int_t AddPixmap(ULong_t pixid, UInt_t w, UInt_t h)
Registers a pixmap created by TGLManager as a ROOT pixmap.
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 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 Handle_t CreateOpenGLContext(Window_t windowID, Handle_t sharedContext)
Creates OpenGL context for window "windowID".
void swap(TDirectoryEntry &e1, TDirectoryEntry &e2) noexcept
QuartzWindow * FindWindowInPoint(Int_t x, Int_t y)
static const TString & GetIconPath()
Get the icon path in the installation. Static utility function.
const Mask_t kGCDashOffset
virtual Region_t CreateRegion()
Creates a new empty region.
NSView< X11Window > * FindDNDAwareViewInPoint(NSView *parentView, Window_t dragWinID, Window_t inputWinID, Int_t x, Int_t y, Int_t maxDepth)
virtual void SetWMSize(Window_t winID, UInt_t w, UInt_t h)
Tells window manager the desired size of window "id".
virtual void SetDrawMode(EDrawMode mode)
Sets the drawing mode.
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...
virtual void SetIconPixmap(Window_t wid, Pixmap_t pix)
Sets the icon name pixmap.
void DrawRectangleAux(Drawable_t wid, const GCValues_t &gcVals, Int_t x, Int_t y, UInt_t w, UInt_t h)
virtual Bool_t SetSelectionOwner(Window_t windowID, Atom_t &selectionID)
Changes the owner and last-change time for the specified selection.
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...
void MapUnicharToKeySym(unichar key, char *buf, Int_t len, UInt_t &rootKeySym)
virtual Window_t GetWindowID(Int_t wid)
Returns the X11 window identifier.
virtual void CloseDisplay()
Closes connection to display server and destroys all windows.
virtual void UpdateWindow(Int_t mode)
Updates or synchronises client and server once (not permanent).
virtual Window_t GetDefaultRootWindow() const
Returns handle to the default root window created when calling XOpenDisplay().
virtual void DeleteOpenGLContext(Int_t ctxID)
Deletes OpenGL context for window "wid".
virtual void SetDoubleBufferON()
Turns double buffer mode on.
void DeletePixmapAux(Pixmap_t pixmapID)
virtual void Bell(Int_t percent)
Sets the sound bell. Percent is loudness from -100% to 100%.
QuartzImage * fShapeCombineMask
bool GLViewIsValidDrawable(ROOTOpenGLView *glView)
virtual void FreeFontNames(char **fontlist)
Frees the specified the array of strings "fontlist".
virtual void GetPlanes(Int_t &nplanes)
Returns the maximum number of planes.
const Mask_t kGCLineStyle
virtual Int_t RequestLocator(Int_t mode, Int_t ctyp, Int_t &x, Int_t &y)
Requests Locator position.
R__EXTERN TVirtualMutex * gROOTMutex
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
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 ...
NSView< X11Window > * fContentView
std::map< Atom_t, Window_t >::iterator selection_iterator
virtual void RaiseWindow(Window_t wid)
Raises the specified window to the top of the stack so that no sibling window obscures it...
Atom_t FindAtom(const std::string &atomName, bool addIfNotFound)
virtual void IconifyWindow(Window_t wid)
Iconifies the window "id".
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.
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 void QueryColor(Colormap_t cmap, ColorStruct_t &color)
Returns the current RGB value for the pixel in the "color" structure.
ROOT::MacOSX::X11::name_to_atom_map fNameToAtom
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 void SetIconName(Window_t wid, char *name)
Sets the window icon name.
bool CocoaInitialized() const
const NSUInteger kTitledWindowMask
TString & Insert(Ssiz_t pos, const char *s)
virtual void GrabKey(Window_t wid, Int_t keycode, UInt_t modifier, Bool_t grab=kTRUE)
Establishes a passive grab on the keyboard.
void SetApplicationIcon()
virtual void SetWMState(Window_t winID, EInitialState state)
Sets the initial state of the window "id": either kNormalState or kIconicState.
bool SetFillPattern(CGContextRef ctx, const unsigned *patternIndex)
void ClearAreaAux(Window_t wid, Int_t x, Int_t y, UInt_t w, UInt_t h)
EGraphicsFunction fFunction
const NSUInteger kResizableWindowMask
NSOpenGLPixelFormat * pixelFormat()
virtual void SelectWindow(Int_t wid)
Selects the window "wid" to which subsequent output is directed.
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 FillPixmapBuffer(const unsigned char *bitmap, unsigned width, unsigned height, ULong_t foregroundPixel, ULong_t backgroundPixel, unsigned depth, unsigned char *imageData)
virtual void GetImageSize(Drawable_t wid, UInt_t &width, UInt_t &height)
Returns the width and height of the image id.
virtual void UnmapWindow(Window_t wid)
Unmaps the specified window "id".
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 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 MapSubwindows(Window_t wid)
Maps all subwindows for the specified window "id" in top-to-bottom stacking order.
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".
static const double x2[5]
virtual Bool_t ReadPictureDataFromFile(const char *filename, char ***ret_data)
Reads picture data from file "filename" and store it in "ret_data".
virtual void ResizeWindow(Int_t wid)
Resizes the window "wid" if necessary.
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 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 MapWindow(Window_t wid)
Maps the window "id" and all of its subwindows that have had map requests.
virtual void MoveWindow(Int_t wid, Int_t x, Int_t y)
Moves the window "wid" to the specified x and y coordinates.
NSPoint TranslateCoordinates(NSView< X11Window > *fromView, NSView< X11Window > *toView, NSPoint sourcePoint)
virtual Int_t ResizePixmap(Int_t wid, UInt_t w, UInt_t h)
Resizes the specified pixmap "wid".
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 FillPolygon(Window_t wid, GContext_t gc, Point_t *polygon, Int_t nPoints)
Fills the region closed by the specified path.
virtual void ClearWindow()
Clears the entire area of the current window.
virtual Bool_t NeedRedraw(ULong_t tgwindow, Bool_t force)
Notify the low level GUI layer ROOT requires "tgwindow" to be updated.
void DrawLineAux(Drawable_t wid, const GCValues_t &gcVals, Int_t x1, Int_t y1, Int_t x2, Int_t y2)
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 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 Sync(Int_t mode)
Set synchronisation on or off.
virtual void DestroyWindow(Window_t wid)
Destroys the window "id" as well as all of its subwindows.
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 Double_t GetOpenGLScalingFactor()
On a HiDPI resolution it can be > 1., this means glViewport should use scaled width and height...
const Mask_t kGCLineWidth
void FillRectangleAux(Drawable_t wid, const GCValues_t &gcVals, Int_t x, Int_t y, UInt_t w, UInt_t h)
ROOT::MacOSX::X11::Rectangle GetDisplayGeometry() const
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 Int_t EventsPending()
Returns the number of events that have been received from the X server but have not been removed from...
virtual void DeleteImage(Drawable_t img)
Deallocates the memory associated with the image img.
const Mask_t kGCGraphicsExposures
virtual Int_t OpenDisplay(const char *displayName)
Opens connection to display server (if such a thing exist on the current platform).
void ReconfigureDisplay()
void DrawPattern(void *data, CGContextRef ctx)
virtual void SelectInput(Window_t wid, UInt_t evmask)
Defines which input events the window is interested in.
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...
virtual void UnionRegion(Region_t rega, Region_t regb, Region_t result)
Computes the union of two regions.
virtual Bool_t EqualRegion(Region_t rega, Region_t regb)
Returns kTRUE if the two regions have the same offset, size, and shape.
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".
NSPoint TranslateFromScreen(NSPoint point, NSView< X11Window > *to)
const NSUInteger kClosableWindowMask
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...
const NSUInteger kMiniaturizableWindowMask
virtual void XorRegion(Region_t rega, Region_t regb, Region_t result)
Calculates the difference between the union and intersection of two regions.
virtual void SetDNDAware(Window_t, Atom_t *)
Add XdndAware property and the list of drag and drop types to the Window win.
Drawable_t fSelectedDrawable
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)
int GlobalXROOTToCocoa(CGFloat xROOT)
virtual Visual_t GetVisual() const
Returns handle to visual.
NSPoint TranslateToScreen(NSView< X11Window > *from, NSPoint point)
virtual void NextEvent(Event_t &event)
The "event" is set to default event.
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.
Bool_t fGraphicsExposures
int GlobalYCocoaToROOT(CGFloat yCocoa)
virtual void SetKeyAutoRepeat(Bool_t on=kTRUE)
Turns key auto repeat on (kTRUE) or off (kFALSE).
bool ViewIsHtmlViewFrame(NSView< X11Window > *view, bool checkParent)
virtual Bool_t Init(void *display)
Initializes the X system.
virtual void SetTextMagnitude(Float_t mgn)
Sets the current text magnification factor to "mgn".
virtual Int_t GetScreen() const
Returns screen number.
virtual void SetCharacterUp(Float_t chupx, Float_t chupy)
Sets character up vector.
virtual void SetInputFocus(Window_t wid)
Changes the input focus to specified window "id".
R__EXTERN TSystem * gSystem
void DrawStringAux(Drawable_t wid, const GCValues_t &gc, Int_t x, Int_t y, const char *s, Int_t len)
static Atom_t fgDeleteWindowAtom
virtual void GetWindowAttributes(Window_t wid, WindowAttributes_t &attr)
The WindowAttributes_t structure is set to default.
const Mask_t kGCClipXOrigin
virtual FontH_t GetFontHandle(FontStruct_t fs)
Returns the font handle of the specified font structure "fs".
virtual void SubtractRegion(Region_t rega, Region_t regb, Region_t result)
Subtracts regb from rega and stores the results in result.
bool MakeProcessForeground()
virtual char ** ListFonts(const char *fontname, Int_t max, Int_t &count)
Returns list of font names matching fontname regexp, like "-*-times-*".
std::map< Atom_t, Window_t > fSelectionOwners
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 ReparentChild(Window_t wid, Window_t pid, Int_t x, Int_t y)
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
virtual void SetClassHints(Window_t wid, char *className, char *resourceName)
Sets the windows class and resource name.
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 Error(const char *method, const char *msgfmt,...) const
Issue error message.
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.
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)
ROOT::MacOSX::X11::Rectangle fDisplayRect
virtual void RemoveWindow(ULong_t qwid)
Removes the created by Qt window "qwid".
const Mask_t kGCClipYOrigin
const Mask_t kGCJoinStyle
virtual void SetMWMHints(Window_t winID, UInt_t value, UInt_t decorators, UInt_t inputMode)
Sets decoration style.
virtual void GetFontProperties(FontStruct_t font, Int_t &max_ascent, Int_t &max_descent)
Returns the font properties.
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 IntersectRegion(Region_t rega, Region_t regb, Region_t result)
Computes the intersection of two regions.
void UnlockFocus(NSView< X11Window > *view)
virtual void Update(Int_t mode)
Flushes (mode = 0, default) or synchronizes (mode = 1) X output buffer.
void PixelToRGB(Pixel_t pixelColor, CGFloat *rgb)
void Warning(const char *location, const char *msgfmt,...)
virtual void GetCharacterUp(Float_t &chupx, Float_t &chupy)
Returns character up vector.
virtual void FreeColor(Colormap_t cmap, ULong_t pixel)
Frees color cell with specified pixel value.
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.
int LocalYROOTToCocoa(NSView< X11Window > *parentView, CGFloat yROOT)
virtual Window_t GetCurrentWindow() const
pointer to the current internal window used in canvas graphics
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].
virtual void SetDoubleBufferOFF()
Turns double buffer mode off.
virtual Display_t GetDisplay() const
Returns handle to display (might be useful in some cases where direct X11 manipulation outside of TVi...
virtual void CloseWindow()
Deletes current window.
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 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 ChangeGC(GContext_t gc, GCValues_t *gval)
Changes the components specified by the mask in gval for the specified GC.
static const double x1[5]
QuartzWindow * fMainWindow
virtual Bool_t EmptyRegion(Region_t reg)
Returns kTRUE if the region reg is empty.
const Mask_t kGCFillStyle
virtual ULong_t GetPixel(Color_t cindex)
Returns pixel value associated to specified ROOT color number "cindex".
const Mask_t kStructureNotifyMask
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 SetWindowName(Window_t wid, char *name)
Sets the window name.
virtual void ClosePixmap()
Deletes current pixmap.
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 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 Bool_t HasTTFonts() const
Returns True when TrueType fonts are used.
virtual void WritePixmap(Int_t wid, UInt_t w, UInt_t h, char *pxname)
Writes the pixmap "wid" in the bitmap file "pxname".
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 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 void DestroyRegion(Region_t reg)
Destroys the region "reg".
virtual const char * DisplayName(const char *)
Returns hostname on which the display is opened.
void WindowLostFocus(Window_t winID)
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...
static constexpr double s
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
virtual void SetWMPosition(Window_t winID, Int_t x, Int_t y)
Tells the window manager the desired position [x,y] of window "id".
#define R__LOCKGUARD(mutex)
const Mask_t kGCForeground
The color creation and management class.
virtual Pixmap_t CreatePixmapFromData(unsigned char *bits, UInt_t width, UInt_t height)
create pixmap from RGB data.
virtual void SetDoubleBuffer(Int_t wid, Int_t mode)
Sets the double buffer on/off on the window "wid".
virtual UInt_t ScreenWidthMM() const
Returns the width of the screen in millimeters.
virtual void RescaleWindow(Int_t wid, UInt_t w, UInt_t h)
Rescales the window "wid".
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 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 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".
NSOpenGLContext * fOpenGLContext
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...
ROOT::MacOSX::X11::CommandBuffer * GetCommandBuffer() const
virtual void SetWindowBackgroundPixmap(Window_t wid, Pixmap_t pxm)
Sets the background pixmap of the window "id" to the specified pixmap "pxm".
virtual void SetRGB(Int_t cindex, Float_t r, Float_t g, Float_t b)
Sets color intensities the specified color index "cindex".
virtual Int_t OpenPixmap(UInt_t w, UInt_t h)
Creates a pixmap of the width "w" and height "h" you specified.
virtual void SelectPixmap(Int_t qpixid)
Selects the pixmap "qpixid".
virtual void DeleteFont(FontStruct_t fs)
Explicitly deletes the font structure "fs" obtained via LoadQueryFont().
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.
This class implements TVirtualX interface for MacOS X, using Cocoa and Quartz 2D. ...
virtual void SetClipOFF(Int_t wid)
Turns off the clipping for the window "wid".
virtual Bool_t MakeOpenGLContextCurrent(Handle_t ctx, Window_t windowID)
Makes context ctx current OpenGL context.
QuartzView * fContentView
const Mask_t kGCTileStipYOrigin
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...
const Mask_t kGCSubwindowMode
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 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 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...
const Mask_t kGCBackground
virtual void DrawSegments(Drawable_t wid, GContext_t gc, Segment_t *segments, Int_t nSegments)
Draws multiple line segments.
const Mask_t kGCTileStipXOrigin
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 void GetRGB(Int_t index, Float_t &r, Float_t &g, Float_t &b)
Returns RGB values for color "index".
virtual void DestroySubwindows(Window_t wid)
The DestroySubwindows function destroys all inferior windows of the specified window, in bottom-to-top stacking order.
std::vector< std::string > fAtomToName
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 Colormap_t GetColormap() const
Returns handle to colormap.
virtual Cursor_t CreateCursor(ECursor cursor)
Creates the specified cursor.
virtual void FlushOpenGLBuffer(Handle_t ctxID)
Flushes OpenGL buffer.
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 void SetPrimarySelectionOwner(Window_t wid)
Makes the window "id" the current owner of the primary selection.
virtual void SendEvent(Window_t wid, Event_t *ev)
Specifies the event "ev" is to be sent to the window "id".
virtual void WMDeleteNotify(Window_t wid)
Tells WM to send message when window is closed via WM.
void FillPolygonAux(Window_t wid, const GCValues_t &gcVals, const Point_t *polygon, Int_t nPoints)
virtual void DeletePictureData(void *data)
Delete picture data created by the function ReadPictureDataFromFile.
virtual void FreeFontStruct(FontStruct_t fs)
Frees the font structure "fs".
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...
virtual void Warp(Int_t ix, Int_t iy, Window_t wid)
Sets the pointer position.
bool ViewIsTextViewFrame(NSView< X11Window > *view, bool checkParent)
virtual Handle_t GetNativeEvent() const
Returns the current native event handle.
void DrawTextLineNoKerning(CGContextRef ctx, CTFontRef font, const std::vector< UniChar > &text, Int_t x, Int_t y)
virtual Window_t GetPrimarySelectionOwner()
Returns the window id of the current owner of the primary selection.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
virtual Int_t InitWindow(ULong_t window)
Creates a new window and return window number.
virtual void DeleteGC(GContext_t gc)
Deletes the specified GC "gc".
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".
ROOT::MacOSX::X11::EventTranslator * GetEventTranslator() const
virtual Handle_t GetCurrentOpenGLContext()
Asks OpenGL subsystem about the current OpenGL context.
Bool_t IsCocoaDraw() const
virtual UInt_t ExecCommand(TGWin32Command *code)
Executes the command "code" coming from the other threads (Win32)
virtual Int_t GetDoubleBuffer(Int_t wid)
Queries the double buffer value for the window "wid".
void * GetCurrentContext()
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
const Mask_t kGCPlaneMask
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 SetForeground(GContext_t gc, ULong_t foreground)
Sets the foreground color for the specified GC (shortcut for ChangeGC with only foreground mask set)...
virtual Pixmap_t CreateBitmap(Drawable_t wid, const char *bitmap, UInt_t width, UInt_t height)
Creates a bitmap (i.e.