21 #include <ApplicationServices/ApplicationServices.h>
22 #include <OpenGL/OpenGL.h>
23 #include <Cocoa/Cocoa.h>
24 #include <OpenGL/gl.h>
72 namespace Details = ROOT::MacOSX::Details;
73 namespace Util = ROOT::MacOSX::Util;
74 namespace X11 = ROOT::MacOSX::X11;
75 namespace Quartz = ROOT::Quartz;
76 namespace OpenGL = ROOT::MacOSX::OpenGL;
80 #pragma mark - Display configuration management.
83 void DisplayReconfigurationCallback(CGDirectDisplayID , CGDisplayChangeSummaryFlags flags,
void * )
85 if (flags & kCGDisplayBeginConfigurationFlag)
88 if (flags & kCGDisplayDesktopShapeChangedFlag) {
89 assert(dynamic_cast<TGCocoa *>(
gVirtualX) != 0 &&
"DisplayReconfigurationCallback, gVirtualX"
90 " is either null or has a wrong type");
96 #pragma mark - Aux. functions called from GUI-rendering part.
99 void SetStrokeForegroundColorFromX11Context(CGContextRef ctx,
const GCValues_t &gcVals)
101 assert(ctx != 0 &&
"SetStrokeForegroundColorFromX11Context, parameter 'ctx' is null");
107 ::Warning(
"SetStrokeForegroundColorFromX11Context",
108 "x11 context does not have line color information");
110 CGContextSetRGBStrokeColor(ctx, rgb[0], rgb[1], rgb[2], 1.);
114 void SetStrokeDashFromX11Context(CGContextRef ctx,
const GCValues_t &gcVals)
117 assert(ctx != 0 &&
"SetStrokeDashFromX11Context, ctx parameter is null");
119 SetStrokeForegroundColorFromX11Context(ctx, gcVals);
123 "SetStrokeDashFromX11Context, x11 context has bad dash length > sizeof(fDashes)");
125 CGFloat dashes[maxLength] = {};
127 dashes[i] = gcVals.fDashes[i];
133 void SetStrokeDoubleDashFromX11Context(CGContextRef ,
const GCValues_t & )
136 ::Warning(
"SetStrokeDoubleDashFromX11Context",
"Not implemented yet, kick tpochep!");
140 void SetStrokeParametersFromX11Context(CGContextRef ctx,
const GCValues_t &gcVals)
144 assert(ctx != 0 &&
"SetStrokeParametersFromX11Context, parameter 'ctx' is null");
147 if ((mask & kGCLineWidth) && gcVals.
fLineWidth > 1)
148 CGContextSetLineWidth(ctx, gcVals.
fLineWidth);
150 CGContextSetLineWidth(ctx, 1.);
152 CGContextSetLineDash(ctx, 0., 0, 0);
154 if (mask & kGCLineStyle) {
156 SetStrokeForegroundColorFromX11Context(ctx, gcVals);
158 SetStrokeDashFromX11Context(ctx, gcVals);
160 SetStrokeDoubleDashFromX11Context(ctx ,gcVals);
162 ::Warning(
"SetStrokeParametersFromX11Context",
"line style bit is set,"
163 " but line style is unknown");
164 SetStrokeForegroundColorFromX11Context(ctx, gcVals);
167 SetStrokeForegroundColorFromX11Context(ctx, gcVals);
171 void SetFilledAreaColorFromX11Context(CGContextRef ctx,
const GCValues_t &gcVals)
175 assert(ctx != 0 &&
"SetFilledAreaColorFromX11Context, parameter 'ctx' is null");
181 ::Warning(
"SetFilledAreaColorFromX11Context",
"no fill color found in x11 context");
183 CGContextSetRGBFillColor(ctx, rgb[0], rgb[1], rgb[2], 1.);
186 struct PatternContext {
191 NSObject<X11Drawable> *fImage;
197 bool HasFillTiledStyle(
Mask_t mask,
Int_t fillStyle)
203 bool HasFillTiledStyle(
const GCValues_t &gcVals)
209 bool HasFillStippledStyle(
Mask_t mask,
Int_t fillStyle)
215 bool HasFillStippledStyle(
const GCValues_t &gcVals)
221 bool HasFillOpaqueStippledStyle(
Mask_t mask,
Int_t fillStyle)
227 bool HasFillOpaqueStippledStyle(
const GCValues_t &gcVals)
233 void DrawTile(NSObject<X11Drawable> *patternImage, CGContextRef ctx)
235 assert(patternImage != nil &&
"DrawTile, parameter 'patternImage' is nil");
236 assert(ctx != 0 &&
"DrawTile, ctx parameter is null");
238 const CGRect patternRect = CGRectMake(0, 0, patternImage.fWidth, patternImage.fHeight);
239 if ([patternImage isKindOfClass : [QuartzImage
class]]) {
240 CGContextDrawImage(ctx, patternRect, ((QuartzImage *)patternImage).fImage);
241 }
else if ([patternImage isKindOfClass : [QuartzPixmap
class]]){
242 const Util::CFScopeGuard<CGImageRef> imageFromPixmap([((QuartzPixmap *)patternImage) createImageFromPixmap]);
243 assert(imageFromPixmap.Get() != 0 &&
"DrawTile, createImageFromPixmap failed");
244 CGContextDrawImage(ctx, patternRect, imageFromPixmap.Get());
246 assert(0 &&
"DrawTile, pattern is neither a QuartzImage, nor a QuartzPixmap");
256 assert(info != 0 &&
"DrawPattern, parameter 'info' is null");
257 assert(ctx != 0 &&
"DrawPattern, parameter 'ctx' is null");
259 const PatternContext *
const patternContext = (PatternContext *)info;
260 const Mask_t mask = patternContext->fMask;
261 const Int_t fillStyle = patternContext->fFillStyle;
263 NSObject<X11Drawable> *
const patternImage = patternContext->fImage;
264 assert(patternImage != nil &&
"DrawPattern, pattern (stipple) image is nil");
265 const CGRect patternRect = CGRectMake(0, 0, patternImage.fWidth, patternImage.fHeight);
267 if (HasFillTiledStyle(mask, fillStyle)) {
268 DrawTile(patternImage, ctx);
269 }
else if (HasFillStippledStyle(mask, fillStyle) || HasFillOpaqueStippledStyle(mask, fillStyle)) {
270 assert([patternImage isKindOfClass : [QuartzImage
class]] &&
271 "DrawPattern, stipple must be a QuartzImage object");
272 QuartzImage *
const image = (QuartzImage *)patternImage;
277 if (HasFillOpaqueStippledStyle(mask,fillStyle)) {
280 "DrawPattern, fill style is FillOpaqueStippled, but background color is not set in a context");
282 CGContextSetRGBFillColor(ctx, rgb[0], rgb[1], rgb[2], 1.);
283 CGContextFillRect(ctx, patternRect);
289 CGContextSetRGBFillColor(ctx, rgb[0], rgb[1], rgb[2], 1.);
290 CGContextClipToMask(ctx, patternRect, image.
fImage);
291 CGContextFillRect(ctx, patternRect);
294 DrawTile(patternImage, ctx);
299 void SetFillPattern(CGContextRef ctx,
const PatternContext *patternContext)
305 assert(ctx != 0 &&
"SetFillPattern, parameter 'ctx' is null");
306 assert(patternContext != 0 &&
"SetFillPattern, parameter 'patternContext' is null");
307 assert(patternContext->fImage != nil &&
"SetFillPattern, pattern image is nil");
309 const Util::CFScopeGuard<CGColorSpaceRef> patternColorSpace(CGColorSpaceCreatePattern(0));
310 CGContextSetFillColorSpace(ctx, patternColorSpace.Get());
312 CGPatternCallbacks callbacks = {};
314 const CGRect patternRect = CGRectMake(0, 0, patternContext->fImage.fWidth, patternContext->fImage.fHeight);
315 const Util::CFScopeGuard<CGPatternRef>
pattern(CGPatternCreate((
void *)patternContext, patternRect, CGAffineTransformIdentity,
316 patternContext->fImage.fWidth, patternContext->fImage.fHeight,
317 kCGPatternTilingNoDistortion,
true, &callbacks));
318 const CGFloat alpha = 1.;
319 CGContextSetFillPattern(ctx,
pattern.Get(), &alpha);
320 CGContextSetPatternPhase(ctx, patternContext->fPhase);
324 bool ParentRendersToChild(NSView<X11Window> *child)
326 assert(child != nil &&
"ParentRendersToChild, parameter 'child' is nil");
330 child.fMapState ==
kIsViewable && child.fParentView.fContext &&
331 !child.fIsOverlapped;
335 bool IsNonPrintableAsciiCharacter(UniChar c)
337 if (c == 9 || (c >= 32 && c < 127))
344 void FixAscii(std::vector<UniChar> &text)
361 std::replace(text.begin(), text.end(), UniChar(16), UniChar(
' '));
364 text.erase(std::remove_if(text.begin(), text.end(), IsNonPrintableAsciiCharacter), text.end());
375 : fSelectedDrawable(0),
379 fForegroundProcess(false),
381 fDisplayShapeChanged(true)
384 "TGCocoa, gSystem is eihter null or has a wrong type");
393 fgDeleteWindowAtom = FindAtom(
"WM_DELETE_WINDOW",
true);
395 CGDisplayRegisterReconfigurationCallback (DisplayReconfigurationCallback, 0);
401 fSelectedDrawable(0),
405 fForegroundProcess(
false),
407 fDisplayShapeChanged(true)
410 "TGCocoa, gSystem is eihter null or has a wrong type");
421 CGDisplayRegisterReconfigurationCallback (DisplayReconfigurationCallback, 0);
428 CGDisplayRemoveReconfigurationCallback (DisplayReconfigurationCallback, 0);
497 return CGDisplayScreenSize(CGMainDisplayID()).width;
508 NSArray *
const screens = [NSScreen screens];
509 assert(screens != nil &&
"screens array is nil");
511 NSScreen *
const mainScreen = [screens objectAtIndex : 0];
512 assert(mainScreen != nil &&
"screen with index 0 is nil");
514 return NSBitsPerPixelFromDepth([mainScreen depth]);
525 }
else if (mode > 0) {
544 NSArray *
const screens = [NSScreen screens];
545 assert(screens != nil && screens.count != 0 &&
"GetDisplayGeometry, no screens found");
547 NSRect frame = [(NSScreen *)[screens objectAtIndex : 0] frame];
548 CGFloat xMin = frame.origin.x, xMax = xMin + frame.size.width;
549 CGFloat yMin = frame.origin.y, yMax = yMin + frame.size.height;
551 for (NSUInteger i = 1, e = screens.count; i < e; ++i) {
552 frame = [(NSScreen *)[screens objectAtIndex : i] frame];
553 xMin =
std::min(xMin, frame.origin.x);
554 xMax =
std::max(xMax, frame.origin.x + frame.size.width);
555 yMin =
std::min(yMin, frame.origin.y);
556 yMax =
std::max(yMax, frame.origin.y + frame.size.height);
570 #pragma mark - Window management part.
576 return fPimpl->GetRootWindowID();
592 assert(parentID != 0 &&
"InitWindow, parameter 'parentID' is 0");
596 if (
fPimpl->IsRootWindow(parentID))
599 [
fPimpl->GetWindow(parentID) getAttributes : &attr];
601 return CreateWindow(parentID, 0, 0, attr.
fWidth, attr.
fHeight, 0, attr.
fDepth, attr.
fClass, 0, 0, 0);
625 "ClearWindow, fSelectedDrawable is invalid");
628 if (drawable.fIsPixmap) {
633 CGContextRef pixmapCtx = drawable.fContext;
634 assert(pixmapCtx != 0 &&
"ClearWindow, pixmap's context is null");
639 CGContextClearRect(pixmapCtx, CGRectMake(0, 0, drawable.fWidth, drawable.fHeight));
656 if (windowID < 0 || fPimpl->IsRootWindow(windowID)) {
666 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(windowID);
670 h = drawable.fHeight;
672 if (!drawable.fIsPixmap) {
673 NSObject<X11Window> *
const window = (NSObject<X11Window> *)drawable;
674 NSPoint srcPoint = {};
677 NSView<X11Window> *
const view = window.fContentView.fParentView ? window.fContentView.fParentView : window.fContentView;
694 assert(!
fPimpl->IsRootWindow(windowID) &&
"MoveWindow, called for root window");
699 [
fPimpl->GetWindow(windowID) setX : x Y : y];
720 "ResizeWindow, parameter 'windowID' is a root window's id");
722 const Util::AutoreleasePool pool;
724 NSObject<X11Window> *
const window =
fPimpl->GetWindow(windowID);
725 if (window.fBackBuffer) {
745 "UpdateWindow, fSelectedDrawable is not a valid window id");
753 if (QuartzPixmap *
const pixmap = window.fBackBuffer) {
754 assert([window.fContentView isKindOfClass : [
QuartzView class]] &&
"UpdateWindow, content view is not a QuartzView");
762 const X11::Rectangle copyArea(0, 0, pixmap.fWidth, pixmap.fHeight);
763 [dstView copy : pixmap area : copyArea withMask : nil clipOrigin : X11::Point() toPoint : X11::Point()];
766 fPimpl->fX11CommandBuffer.AddUpdateWindow(dstView);
810 const Util::AutoreleasePool pool;
812 if (
fPimpl->IsRootWindow(parentID)) {
815 depth, clss, visual, attr, wtype);
818 const Util::NSScopeGuard<QuartzWindow> winGuard(newWindow);
821 [newWindow setAcceptsMouseMovedEvents : YES];
825 NSObject<X11Window> *
const parentWin =
fPimpl->GetWindow(parentID);
828 "CreateWindow, parent view must be QuartzView");
832 x, y, w, h, border, depth, clss, visual, attr, wtype);
833 const Util::NSScopeGuard<QuartzView> viewGuard(childView);
836 [parentWin addChild : childView];
863 if (
fPimpl->IsRootWindow(wid))
866 BOOL needFocusChange = NO;
869 const Util::AutoreleasePool pool;
871 fPimpl->fX11EventTranslator.CheckUnmappedView(wid);
874 "DestroyWindow, can not be called for QuartzPixmap or QuartzImage object");
876 NSObject<X11Window> *
const window =
fPimpl->GetWindow(wid);
877 if (
fPimpl->fX11CommandBuffer.BufferSize())
878 fPimpl->fX11CommandBuffer.RemoveOperationsForDrawable(wid);
881 if ((needFocusChange = window == window.fQuartzWindow && window.fQuartzWindow.fHasFocus))
882 window.fHasFocus = NO;
886 fPimpl->fX11EventTranslator.GenerateDestroyNotify(wid);
892 fPimpl->DeleteDrawable(wid);
912 if (
fPimpl->IsRootWindow(wid))
915 const Util::AutoreleasePool pool;
918 "DestroySubwindows, can not be called for QuartzPixmap or QuartzImage object");
920 NSObject<X11Window> *window =
fPimpl->GetWindow(wid);
925 const Util::NSScopeGuard<NSArray> children([[window.fContentView subviews] copy]);
927 for (NSView<X11Window> *child in children.Get())
939 if (
fPimpl->IsRootWindow(wid))
942 [
fPimpl->GetWindow(wid) getAttributes : &attr];
953 const Util::AutoreleasePool pool;
955 assert(!
fPimpl->IsRootWindow(wid) &&
"ChangeWindowAttributes, called for root window");
956 assert(attr != 0 &&
"ChangeWindowAttributes, parameter 'attr' is null");
958 [
fPimpl->GetWindow(wid) setAttributes : attr];
973 if (windowID <= fPimpl->GetRootWindowID())
976 NSObject<X11Window> *
const window =
fPimpl->GetWindow(windowID);
978 window.fEventMask = eventMask;
986 assert(!
fPimpl->IsRootWindow(wid) &&
"ReparentChild, can not re-parent root window");
988 const Util::AutoreleasePool pool;
990 NSView<X11Window> *
const view =
fPimpl->GetWindow(wid).fContentView;
991 if (
fPimpl->IsRootWindow(pid)) {
994 [view removeFromSuperview];
995 view.fParentView = nil;
997 NSRect frame = view.frame;
998 frame.origin = NSPoint();
1000 NSUInteger styleMask = NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask;
1001 if (!view.fOverrideRedirect)
1002 styleMask |= NSTitledWindowMask;
1005 styleMask : styleMask
1006 backing : NSBackingStoreBuffered
1008 [view setX : x Y : y];
1011 fPimpl->ReplaceDrawable(wid, newTopLevel);
1014 [newTopLevel release];
1017 [view removeFromSuperview];
1019 NSObject<X11Window> *
const newParent =
fPimpl->GetWindow(pid);
1020 assert(newParent.fIsPixmap == NO &&
"ReparentChild, pixmap can not be a new parent");
1021 [view setX : x Y : y];
1022 [newParent addChild : view];
1033 if (
fPimpl->IsRootWindow(pid))
1036 const Util::AutoreleasePool pool;
1038 NSView<X11Window> *
const contentView =
fPimpl->GetWindow(wid).fContentView;
1040 [contentView retain];
1041 [contentView removeFromSuperview];
1042 [topLevel setContentView : nil];
1043 fPimpl->ReplaceDrawable(wid, contentView);
1044 [contentView setX : x Y : y];
1045 [
fPimpl->GetWindow(pid) addChild : contentView];
1046 [contentView release];
1057 assert(!
fPimpl->IsRootWindow(wid) &&
"ReparentWindow, can not re-parent root window");
1059 NSView<X11Window> *
const view =
fPimpl->GetWindow(wid).fContentView;
1060 if (view.fParentView)
1073 assert(!
fPimpl->IsRootWindow(wid) &&
"MapWindow, called for root window");
1075 const Util::AutoreleasePool pool;
1078 [
fPimpl->GetWindow(wid) mapWindow];
1093 assert(!
fPimpl->IsRootWindow(wid) &&
"MapSubwindows, called for 'root' window");
1095 const Util::AutoreleasePool pool;
1098 [
fPimpl->GetWindow(wid) mapSubwindows];
1108 assert(!
fPimpl->IsRootWindow(wid) &&
"MapRaised, called for root window");
1110 const Util::AutoreleasePool pool;
1113 [
fPimpl->GetWindow(wid) mapRaised];
1129 assert(!
fPimpl->IsRootWindow(wid) &&
"UnmapWindow, called for root window");
1131 const Util::AutoreleasePool pool;
1134 fPimpl->fX11EventTranslator.CheckUnmappedView(wid);
1136 NSObject<X11Window> *
const win =
fPimpl->GetWindow(wid);
1139 if (win == win.fQuartzWindow && win.fQuartzWindow.fHasFocus)
1161 assert(!
fPimpl->IsRootWindow(wid) &&
"RaiseWindow, called for root window");
1163 if (!
fPimpl->GetWindow(wid).fParentView)
1166 [
fPimpl->GetWindow(wid) raiseWindow];
1178 assert(!
fPimpl->IsRootWindow(wid) &&
"LowerWindow, called for root window");
1180 if (!
fPimpl->GetWindow(wid).fParentView)
1183 [
fPimpl->GetWindow(wid) lowerWindow];
1199 assert(!
fPimpl->IsRootWindow(wid) &&
"MoveWindow, called for root window");
1200 const Util::AutoreleasePool pool;
1201 [
fPimpl->GetWindow(wid) setX : x Y : y];
1218 assert(!
fPimpl->IsRootWindow(wid) &&
"MoveResizeWindow, called for 'root' window");
1220 const Util::AutoreleasePool pool;
1221 [
fPimpl->GetWindow(wid) setX : x Y : y width : w height : h];
1230 assert(!
fPimpl->IsRootWindow(wid) &&
"ResizeWindow, called for 'root' window");
1232 const Util::AutoreleasePool pool;
1236 if (w > siMax || h > siMax)
1239 NSSize newSize = {};
1243 [
fPimpl->GetWindow(wid) setDrawableSize : newSize];
1253 assert(!
fPimpl->IsRootWindow(wid) &&
"IconifyWindow, can not iconify the root window");
1254 assert(
fPimpl->GetWindow(wid).fIsPixmap == NO &&
"IconifyWindow, invalid window id");
1256 NSObject<X11Window> *
const win =
fPimpl->GetWindow(wid);
1257 assert(win.fQuartzWindow == win &&
"IconifyWindow, can be called only for a top level window");
1259 fPimpl->fX11EventTranslator.CheckUnmappedView(wid);
1261 NSObject<X11Window> *
const window =
fPimpl->GetWindow(wid);
1262 if (
fPimpl->fX11CommandBuffer.BufferSize())
1263 fPimpl->fX11CommandBuffer.RemoveOperationsForDrawable(wid);
1265 if (window.fQuartzWindow.fHasFocus) {
1267 window.fQuartzWindow.fHasFocus = NO;
1270 [win.fQuartzWindow miniaturize : win.fQuartzWindow];
1285 if (!srcWin || !dstWin)
1288 const bool srcIsRoot =
fPimpl->IsRootWindow(srcWin);
1289 const bool dstIsRoot =
fPimpl->IsRootWindow(dstWin);
1291 if (srcIsRoot && dstIsRoot) {
1303 NSPoint srcPoint = {};
1307 NSPoint dstPoint = {};
1311 NSView<X11Window> *
const srcView =
fPimpl->GetWindow(srcWin).fContentView;
1313 }
else if (srcIsRoot) {
1314 NSView<X11Window> *
const dstView =
fPimpl->GetWindow(dstWin).fContentView;
1317 if ([dstView superview]) {
1321 dstPoint = [[dstView superview] convertPoint : dstPoint fromView : dstView];
1322 if (NSView<X11Window> *
const view = (NSView<X11Window> *)[dstView hitTest : dstPoint]) {
1328 NSView<X11Window> *
const srcView =
fPimpl->GetWindow(srcWin).fContentView;
1329 NSView<X11Window> *
const dstView =
fPimpl->GetWindow(dstWin).fContentView;
1332 if ([dstView superview]) {
1336 const NSPoint
pt = [[dstView superview] convertPoint : dstPoint fromView : dstView];
1337 if (NSView<X11Window> *
const view = (NSView<X11Window> *)[dstView hitTest : pt]) {
1361 if (
fPimpl->IsRootWindow(wid)) {
1369 NSObject<X11Drawable> *window =
fPimpl->GetDrawable(wid);
1371 if (!window.fIsPixmap) {
1391 assert(!
fPimpl->IsRootWindow(wid) &&
"SetWindowBackground, can not set color for root window");
1393 fPimpl->GetWindow(wid).fBackgroundPixel = color;
1407 "SetWindowBackgroundPixmap, can not set background for a root window");
1408 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
1409 "SetWindowBackgroundPixmap, invalid window id");
1411 NSObject<X11Window> *
const window =
fPimpl->GetWindow(windowID);
1412 if (pixmapID ==
kNone) {
1413 window.fBackgroundPixmap = nil;
1418 "SetWindowBackgroundPixmap, parameter 'pixmapID' is not a valid pixmap id");
1419 assert(
fPimpl->GetDrawable(pixmapID).fIsPixmap == YES &&
1420 "SetWindowBackgroundPixmap, bad drawable");
1422 NSObject<X11Drawable> *
const pixmapOrImage =
fPimpl->GetDrawable(pixmapID);
1425 Util::NSScopeGuard<QuartzImage> backgroundImage;
1427 if ([pixmapOrImage isKindOfClass : [QuartzPixmap
class]]) {
1428 backgroundImage.Reset([[QuartzImage alloc] initFromPixmap : (QuartzPixmap *)pixmapOrImage]);
1429 if (backgroundImage.Get())
1430 window.fBackgroundPixmap = backgroundImage.Get();
1432 backgroundImage.Reset([[QuartzImage alloc] initFromImage : (QuartzImage *)pixmapOrImage]);
1433 if (backgroundImage.Get())
1434 window.fBackgroundPixmap = backgroundImage.Get();
1437 if (!backgroundImage.Get())
1439 Error(
"SetWindowBackgroundPixmap",
"QuartzImage initialization failed");
1448 if (windowID <= fPimpl->GetRootWindowID())
1451 NSView<X11Window> *
view =
fPimpl->GetWindow(windowID).fContentView;
1452 return view.fParentView ? view.fParentView.fID :
fPimpl->GetRootWindowID();
1461 const Util::AutoreleasePool pool;
1463 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1465 if ([(NSObject *)drawable isKindOfClass : [NSWindow
class]]) {
1466 NSString *
const windowTitle = [NSString stringWithCString : name encoding : NSASCIIStringEncoding];
1467 [(NSWindow *)drawable setTitle : windowTitle];
1498 "ShapeCombineMask, windowID parameter is a 'root' window");
1499 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
1500 "ShapeCombineMask, windowID parameter is a bad window id");
1502 "ShapeCombineMask, pixmapID parameter must point to QuartzImage object");
1509 if (
fPimpl->GetWindow(windowID).fContentView.fParentView)
1512 QuartzImage *
const srcImage = (QuartzImage *)
fPimpl->GetDrawable(pixmapID);
1513 assert(srcImage.
fIsStippleMask == YES &&
"ShapeCombineMask, source image is not a stipple mask");
1517 const Util::NSScopeGuard<QuartzImage>
image([[QuartzImage alloc] initFromImageFlipped : srcImage]);
1521 [qw setOpaque : NO];
1522 [qw setBackgroundColor : [NSColor clearColor]];
1526 #pragma mark - "Window manager hints" set of functions.
1532 assert(!
fPimpl->IsRootWindow(wid) &&
"SetMWMHints, called for 'root' window");
1535 NSUInteger newMask = 0;
1537 if ([qw styleMask] & NSTitledWindowMask) {
1538 newMask |= NSTitledWindowMask;
1539 newMask |= NSClosableWindowMask;
1543 newMask |= NSMiniaturizableWindowMask | NSResizableWindowMask;
1546 newMask |= NSMiniaturizableWindowMask;
1548 newMask |= NSResizableWindowMask;
1551 [qw setStyleMask : newMask];
1554 if (!qw.fMainWindow) {
1555 [[qw standardWindowButton : NSWindowZoomButton] setEnabled : YES];
1556 [[qw standardWindowButton : NSWindowMiniaturizeButton] setEnabled : YES];
1559 if (!qw.fMainWindow) {
1560 [[qw standardWindowButton : NSWindowZoomButton] setEnabled : funcs & kMWMDecorMaximize];
1561 [[qw standardWindowButton : NSWindowMiniaturizeButton] setEnabled : funcs & kMWMDecorMinimize];
1582 assert(!
fPimpl->IsRootWindow(wid) &&
"SetWMSizeHints, called for root window");
1584 const NSUInteger styleMask = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask;
1585 const NSRect minRect = [NSWindow frameRectForContentRect : NSMakeRect(0., 0., wMin, hMin) styleMask : styleMask];
1586 const NSRect maxRect = [NSWindow frameRectForContentRect : NSMakeRect(0., 0., wMax, hMax) styleMask : styleMask];
1589 [qw setMinSize : minRect.size];
1590 [qw setMaxSize : maxRect.size];
1611 assert(wid >
fPimpl->GetRootWindowID() &&
"SetWMTransientHint, wid parameter is not a valid window id");
1613 if (
fPimpl->IsRootWindow(mainWid))
1618 if (![mainWindow isVisible])
1623 if (mainWindow != transientWindow) {
1626 Error(
"SetWMTransientHint",
"window is already transient for other window");
1628 [[transientWindow standardWindowButton : NSWindowZoomButton] setEnabled : NO];
1632 Warning(
"SetWMTransientHint",
"transient and main windows are the same window");
1635 #pragma mark - GUI-rendering part.
1641 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawLineAux, called for root window");
1643 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1644 CGContextRef ctx = drawable.fContext;
1645 assert(ctx != 0 &&
"DrawLineAux, context is null");
1658 CGContextSetAllowsAntialiasing(ctx,
false);
1660 if (!drawable.fIsPixmap)
1661 CGContextTranslateCTM(ctx, 0.5, 0.5);
1669 SetStrokeParametersFromX11Context(ctx, gcVals);
1670 CGContextBeginPath(ctx);
1671 CGContextMoveToPoint(ctx, x1, y1);
1672 CGContextAddLineToPoint(ctx, x2, y2);
1673 CGContextStrokePath(ctx);
1675 CGContextSetAllowsAntialiasing(ctx,
true);
1690 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawLine, called for root window");
1695 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1696 if (!drawable.fIsPixmap) {
1697 NSObject<X11Window> *
const window = (NSObject<X11Window> *)drawable;
1700 if (ParentRendersToChild(view)) {
1710 fPimpl->fX11CommandBuffer.AddDrawLine(wid, gcVals, x1, y1, x2, y2);
1716 fPimpl->fX11CommandBuffer.AddDrawLine(wid, gcVals, x1, y1, x2, y2);
1726 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawSegmentsAux, called for root window");
1727 assert(segments != 0 &&
"DrawSegmentsAux, segments parameter is null");
1728 assert(nSegments > 0 &&
"DrawSegmentsAux, nSegments <= 0");
1730 for (
Int_t i = 0; i < nSegments; ++i)
1731 DrawLineAux(wid, gcVals, segments[i].fX1, segments[i].fY1 - 3, segments[i].fX2, segments[i].fY2 - 3);
1743 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawSegments, called for root window");
1744 assert(gc > 0 && gc <=
fX11Contexts.size() &&
"DrawSegments, invalid context index");
1745 assert(segments != 0 &&
"DrawSegments, parameter 'segments' is null");
1746 assert(nSegments > 0 &&
"DrawSegments, number of segments <= 0");
1748 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1751 if (!drawable.fIsPixmap) {
1754 if (ParentRendersToChild(view)) {
1764 fPimpl->fX11CommandBuffer.AddDrawSegments(wid, gcVals, segments, nSegments);
1770 fPimpl->fX11CommandBuffer.AddDrawSegments(wid, gcVals, segments, nSegments);
1780 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawRectangleAux, called for root window");
1782 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1784 if (!drawable.fIsPixmap) {
1797 CGContextRef ctx =
fPimpl->GetDrawable(wid).fContext;
1798 assert(ctx &&
"DrawRectangleAux, context is null");
1801 CGContextSetAllowsAntialiasing(ctx,
false);
1803 SetStrokeParametersFromX11Context(ctx, gcVals);
1805 const CGRect rect = CGRectMake(x, y, w, h);
1806 CGContextStrokeRect(ctx, rect);
1808 CGContextSetAllowsAntialiasing(ctx,
true);
1820 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawRectangle, called for root window");
1821 assert(gc > 0 && gc <=
fX11Contexts.size() &&
"DrawRectangle, invalid context index");
1825 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1827 if (!drawable.fIsPixmap) {
1828 NSObject<X11Window> *
const window = (NSObject<X11Window> *)drawable;
1831 if (ParentRendersToChild(view)) {
1841 fPimpl->fX11CommandBuffer.AddDrawRectangle(wid, gcVals, x, y, w, h);
1847 fPimpl->fX11CommandBuffer.AddDrawRectangle(wid, gcVals, x, y, w, h);
1863 assert(!
fPimpl->IsRootWindow(wid) &&
"FillRectangleAux, called for root window");
1865 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1866 CGContextRef ctx = drawable.fContext;
1867 CGSize patternPhase = {};
1869 if (drawable.fIsPixmap) {
1875 const CGRect fillRect = CGRectMake(x, y, w, h);
1877 if (!drawable.fIsPixmap) {
1880 const NSPoint origin = [view.fParentView convertPoint : view.frame.origin toView : nil];
1881 patternPhase.width = origin.x;
1882 patternPhase.height = origin.y;
1888 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals) || HasFillTiledStyle(gcVals)) {
1889 PatternContext patternContext = {gcVals.
fMask, gcVals.
fFillStyle, 0, 0, nil, patternPhase};
1891 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals)) {
1893 "FillRectangleAux, fill_style is FillStippled/FillOpaqueStippled,"
1894 " but no stipple is set in a context");
1899 if (HasFillOpaqueStippledStyle(gcVals))
1903 "FillRectangleAux, fill_style is FillTiled, but not tile is set in a context");
1905 patternContext.fImage =
fPimpl->GetDrawable(gcVals.
fTile);
1909 CGContextFillRect(ctx, fillRect);
1914 SetFilledAreaColorFromX11Context(ctx, gcVals);
1915 CGContextFillRect(ctx, fillRect);
1928 assert(!
fPimpl->IsRootWindow(wid) &&
"FillRectangle, called for root window");
1929 assert(gc > 0 && gc <=
fX11Contexts.size() &&
"FillRectangle, invalid context index");
1932 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1934 if (!drawable.fIsPixmap) {
1935 NSObject<X11Window> *
const window = (NSObject<X11Window> *)drawable;
1938 if (ParentRendersToChild(view)) {
1948 fPimpl->fX11CommandBuffer.AddFillRectangle(wid, gcVals, x, y, w, h);
1965 assert(!
fPimpl->IsRootWindow(wid) &&
"FillPolygonAux, called for root window");
1966 assert(polygon != 0 &&
"FillPolygonAux, parameter 'polygon' is null");
1967 assert(nPoints > 0 &&
"FillPolygonAux, number of points must be positive");
1969 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
1970 CGContextRef ctx = drawable.fContext;
1972 CGSize patternPhase = {};
1974 if (!drawable.fIsPixmap) {
1976 const NSPoint origin = [view convertPoint : view.frame.origin toView : nil];
1977 patternPhase.width = origin.x;
1978 patternPhase.height = origin.y;
1983 CGContextSetAllowsAntialiasing(ctx,
false);
1985 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals) || HasFillTiledStyle(gcVals)) {
1986 PatternContext patternContext = {gcVals.
fMask, gcVals.
fFillStyle, 0, 0, nil, patternPhase};
1988 if (HasFillStippledStyle(gcVals) || HasFillOpaqueStippledStyle(gcVals)) {
1990 "FillRectangleAux, fill style is FillStippled/FillOpaqueStippled,"
1991 " but no stipple is set in a context");
1996 if (HasFillOpaqueStippledStyle(gcVals))
2000 "FillRectangleAux, fill_style is FillTiled, but not tile is set in a context");
2002 patternContext.fImage =
fPimpl->GetDrawable(gcVals.
fTile);
2007 SetFilledAreaColorFromX11Context(ctx, gcVals);
2012 CGContextBeginPath(ctx);
2013 if (!drawable.fIsPixmap) {
2014 CGContextMoveToPoint(ctx, polygon[0].fX, polygon[0].fY - 2);
2015 for (
Int_t i = 1; i < nPoints; ++i)
2016 CGContextAddLineToPoint(ctx, polygon[i].fX, polygon[i].fY - 2);
2019 for (
Int_t i = 1; i < nPoints; ++i)
2023 CGContextFillPath(ctx);
2024 CGContextSetAllowsAntialiasing(ctx,
true);
2047 assert(polygon != 0 &&
"FillPolygon, parameter 'polygon' is null");
2048 assert(nPoints > 0 &&
"FillPolygon, number of points must be positive");
2051 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
2054 if (!drawable.fIsPixmap) {
2057 if (ParentRendersToChild(view)) {
2067 fPimpl->fX11CommandBuffer.AddFillPolygon(wid, gcVals, polygon, nPoints);
2073 fPimpl->fX11CommandBuffer.AddFillPolygon(wid, gcVals, polygon, nPoints);
2087 assert(!
fPimpl->IsRootWindow(src) &&
"CopyAreaAux, src parameter is root window");
2088 assert(!
fPimpl->IsRootWindow(dst) &&
"CopyAreaAux, dst parameter is root window");
2092 const Util::AutoreleasePool pool;
2094 NSObject<X11Drawable> *
const srcDrawable =
fPimpl->GetDrawable(src);
2095 NSObject<X11Drawable> *
const dstDrawable =
fPimpl->GetDrawable(dst);
2100 QuartzImage *mask = nil;
2103 "CopyArea, mask is not a pixmap");
2113 [dstDrawable copy : srcDrawable area : copyArea withMask : mask clipOrigin : clipOrigin toPoint : dstPoint];
2123 assert(!
fPimpl->IsRootWindow(src) &&
"CopyArea, src parameter is root window");
2124 assert(!
fPimpl->IsRootWindow(dst) &&
"CopyArea, dst parameter is root window");
2127 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(dst);
2130 if (!drawable.fIsPixmap) {
2133 if (ParentRendersToChild(view)) {
2135 CopyAreaAux(src, dst, gcVals, srcX, srcY, width, height, dstX, dstY);
2143 fPimpl->fX11CommandBuffer.AddCopyArea(src, dst, gcVals, srcX, srcY, width, height, dstX, dstY);
2145 CopyAreaAux(src, dst, gcVals, srcX, srcY, width, height, dstX, dstY);
2148 if (
fPimpl->GetDrawable(src).fIsPixmap) {
2150 CopyAreaAux(src, dst, gcVals, srcX, srcY, width, height, dstX, dstY);
2153 fPimpl->fX11CommandBuffer.AddCopyArea(src, dst, gcVals, srcX, srcY, width, height, dstX, dstY);
2155 CopyAreaAux(src, dst, gcVals, srcX, srcY, width, height, dstX, dstY);
2164 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawStringAux, called for root window");
2166 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
2167 CGContextRef ctx = drawable.fContext;
2168 assert(ctx != 0 &&
"DrawStringAux, context is null");
2172 CGContextSetTextMatrix(ctx, CGAffineTransformIdentity);
2175 if (!drawable.fIsPixmap) {
2176 CGContextTranslateCTM(ctx, 0., drawable.fHeight);
2177 CGContextScaleCTM(ctx, 1., -1.);
2181 CGContextSetAllowsAntialiasing(ctx,
true);
2186 len = std::strlen(text);
2188 CGFloat textColor[4] = {0., 0., 0., 1.};
2193 CGContextSetRGBFillColor(ctx, textColor[0], textColor[1], textColor[2], textColor[3]);
2198 std::vector<UniChar> unichars((
unsigned char *)text, (
unsigned char *)text + len);
2211 assert(!
fPimpl->IsRootWindow(wid) &&
"DrawString, called for root window");
2214 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
2218 if (!drawable.fIsPixmap) {
2221 if (ParentRendersToChild(view)) {
2226 }
catch (
const std::exception &) {
2238 fPimpl->fX11CommandBuffer.AddDrawString(wid, gcVals, x, y, text, len);
2245 fPimpl->fX11CommandBuffer.AddDrawString(wid, gcVals, x, y, text, len);
2254 assert(!
fPimpl->IsRootWindow(windowID) &&
"ClearAreaAux, called for root window");
2257 assert(view.fContext != 0 &&
"ClearAreaAux, view.fContext is null");
2265 if (!view.fBackgroundPixmap) {
2267 CGFloat rgb[3] = {};
2271 CGContextSetRGBFillColor(view.fContext, rgb[0], rgb[1], rgb[2], 1.);
2272 CGContextFillRect(view.fContext, CGRectMake(x, y, w, h));
2274 const CGRect fillRect = CGRectMake(x, y, w, h);
2276 CGSize patternPhase = {};
2277 if (view.fParentView) {
2278 const NSPoint origin = [view.fParentView convertPoint : view.frame.origin toView : nil];
2279 patternPhase.width = origin.x;
2280 patternPhase.height = origin.y;
2284 PatternContext patternContext = {
Mask_t(), 0, 0, 0, view.fBackgroundPixmap, patternPhase};
2286 CGContextFillRect(view.fContext, fillRect);
2300 assert(!
fPimpl->IsRootWindow(wid) &&
"ClearArea, called for root window");
2305 if (ParentRendersToChild(view)) {
2313 if (!view.fIsOverlapped && view.fMapState ==
kIsViewable) {
2315 fPimpl->fX11CommandBuffer.AddClearArea(wid, x, y, w, h);
2333 #pragma mark - Pixmap management.
2339 NSSize newSize = {};
2344 Util::NSScopeGuard<QuartzPixmap> pixmap([[QuartzPixmap alloc] initWithW : w
H : h
2345 scaleFactor : [[NSScreen mainScreen] backingScaleFactor]]);
2347 pixmap.Get().fID =
fPimpl->RegisterDrawable(pixmap.Get());
2348 return (
Int_t)pixmap.Get().fID;
2351 Error(
"OpenPixmap",
"QuartzPixmap initialization failed");
2359 assert(!
fPimpl->IsRootWindow(wid) &&
"ResizePixmap, called for root window");
2361 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
2362 assert(drawable.fIsPixmap == YES &&
"ResizePixmap, invalid drawable");
2364 QuartzPixmap *pixmap = (QuartzPixmap *)drawable;
2369 if ([pixmap resizeW : w
H : h scaleFactor : [[NSScreen mainScreen] backingScaleFactor]])
2379 "SelectPixmap, parameter 'pixmapID' is not a valid id");
2388 "CopyPixmap, parameter 'pixmapID' is not a valid id");
2390 "CopyPixmap, fSelectedDrawable is not a valid window id");
2392 NSObject<X11Drawable> *
const source =
fPimpl->GetDrawable(pixmapID);
2393 assert([source isKindOfClass : [QuartzPixmap
class]] &&
2394 "CopyPixmap, source is not a pixmap");
2395 QuartzPixmap *
const pixmap = (QuartzPixmap *)source;
2398 NSObject<X11Drawable> * destination = nil;
2400 if (drawable.fIsPixmap) {
2401 destination = drawable;
2404 if (window.fBackBuffer) {
2405 destination = window.fBackBuffer;
2407 Warning(
"CopyPixmap",
"Operation skipped, since destination"
2408 " window is not double buffered");
2416 [destination copy : pixmap area : copyArea withMask : nil clipOrigin : X11::Point() toPoint : dstPoint];
2425 #pragma mark - Different functions to create pixmap from different data sources. Used by GUI.
2426 #pragma mark - These functions implement TVirtualX interface, some of them dupilcate others.
2442 assert(bitmap != 0 &&
"CreatePixmap, parameter 'bitmap' is null");
2443 assert(width > 0 &&
"CreatePixmap, parameter 'width' is 0");
2444 assert(height > 0 &&
"CreatePixmap, parameter 'height' is 0");
2446 std::vector<unsigned char> imageData (depth > 1 ? width * height * 4 : width * height);
2449 backgroundPixel, depth, &imageData[0]);
2452 Util::NSScopeGuard<QuartzImage>
image;
2455 image.Reset([[QuartzImage alloc] initWithW : width
H : height data: &imageData[0]]);
2457 image.Reset([[QuartzImage alloc] initMaskWithW : width
H : height bitmapMask : &imageData[0]]);
2460 Error(
"CreatePixmap",
"QuartzImage initialization failed");
2464 image.Get().fID =
fPimpl->RegisterDrawable(image.Get());
2465 return image.Get().fID;
2472 assert(bits != 0 &&
"CreatePixmapFromData, data parameter is null");
2473 assert(width != 0 &&
"CreatePixmapFromData, width parameter is 0");
2474 assert(height != 0 &&
"CreatePixmapFromData, height parameter is 0");
2478 std::vector<unsigned char> imageData(bits, bits + width * height * 4);
2481 unsigned char *p = &imageData[0];
2482 for (
unsigned i = 0, e = width * height; i < e; ++i, p += 4)
2486 Util::NSScopeGuard<QuartzImage>
image([[QuartzImage alloc] initWithW : width
2487 H : height data : &imageData[0]]);
2491 Error(
"CreatePixmapFromData",
"QuartzImage initialziation failed");
2495 image.Get().fID =
fPimpl->RegisterDrawable(image.Get());
2496 return image.Get().fID;
2503 assert(std::numeric_limits<unsigned char>::digits == 8 &&
"CreateBitmap, ASImage requires octets");
2511 std::vector<unsigned char> imageData(width * height);
2514 for (
unsigned i = 0, j = 0, e = width / 8 * height; i < e; ++i) {
2515 for(
unsigned bit = 0; bit < 8; ++bit, ++j) {
2516 if (bitmap[i] & (1 << bit))
2524 Util::NSScopeGuard<QuartzImage>
image([[QuartzImage alloc] initMaskWithW : width
2525 H : height bitmapMask : &imageData[0]]);
2528 Error(
"CreateBitmap",
"QuartzImage initialization failed");
2532 image.Get().fID =
fPimpl->RegisterDrawable(image.Get());
2533 return image.Get().fID;
2539 fPimpl->DeleteDrawable(pixmapID);
2546 assert(
fPimpl->GetDrawable(pixmapID).fIsPixmap == YES &&
"DeletePixmap, object is not a pixmap");
2547 fPimpl->fX11CommandBuffer.AddDeletePixmap(pixmapID);
2563 if (
fPimpl->IsRootWindow(wid)) {
2564 Warning(
"GetColorBits",
"Called for root window");
2566 assert(x >= 0 &&
"GetColorBits, parameter 'x' is negative");
2567 assert(y >= 0 &&
"GetColorBits, parameter 'y' is negative");
2568 assert(w != 0 &&
"GetColorBits, parameter 'w' is 0");
2569 assert(h != 0 &&
"GetColorBits, parameter 'h' is 0");
2572 return [
fPimpl->GetDrawable(wid) readColorBits : area];
2578 #pragma mark - XImage emulation.
2594 assert(wid >
fPimpl->GetRootWindowID() &&
"GetImageSize, parameter 'wid' is invalid");
2596 NSObject<X11Drawable> *
const drawable =
fPimpl->GetDrawable(wid);
2597 width = drawable.fWidth;
2598 height = drawable.fHeight;
2612 "PutPixel, parameter 'imageID' is a bad pixmap id");
2613 assert(x >= 0 &&
"PutPixel, parameter 'x' is negative");
2614 assert(y >= 0 &&
"PutPixel, parameter 'y' is negative");
2616 QuartzPixmap *
const pixmap = (QuartzPixmap *)
fPimpl->GetDrawable(imageID);
2618 unsigned char rgb[3] = {};
2620 [pixmap putPixel : rgb X : x Y : y];
2631 CopyArea(imageID, drawableID, gc, srcX, srcY, width, height, dstX, dstY);
2639 "DeleteImage, imageID parameter is not a valid image id");
2643 #pragma mark - Mouse related code.
2661 assert(!
fPimpl->IsRootWindow(wid) &&
"GrabButton, called for 'root' window");
2663 NSObject<X11Window> *
const widget =
fPimpl->GetWindow(wid);
2666 widget.fPassiveGrabOwnerEvents = YES;
2667 widget.fPassiveGrabButton = button;
2668 widget.fPassiveGrabEventMask = eventMask;
2669 widget.fPassiveGrabKeyModifiers = keyModifiers;
2672 widget.fPassiveGrabOwnerEvents = NO;
2673 widget.fPassiveGrabButton = -1;
2674 widget.fPassiveGrabEventMask = 0;
2675 widget.fPassiveGrabKeyModifiers = 0;
2688 NSView<X11Window> *
const view =
fPimpl->GetWindow(wid).fContentView;
2689 assert(!
fPimpl->IsRootWindow(wid) &&
"GrabPointer, called for 'root' window");
2692 fPimpl->fX11EventTranslator.SetPointerGrab(view, eventMask, ownerEvents);
2696 fPimpl->fX11EventTranslator.CancelPointerGrab();
2747 assert(!
fPimpl->IsRootWindow(wid) &&
"GrabKey, called for root window");
2749 NSView<X11Window> *
const view =
fPimpl->GetWindow(wid).fContentView;
2753 [view addPassiveKeyGrab : keyCode modifiers : cocoaKeyModifiers];
2755 [view removePassiveKeyGrab : keyCode modifiers : cocoaKeyModifiers];
2774 return fPimpl->fX11EventTranslator.GetInputFocus();
2781 assert(!
fPimpl->IsRootWindow(wid) &&
"SetInputFocus, called for root window");
2784 fPimpl->fX11EventTranslator.SetInputFocus(nil);
2786 fPimpl->fX11EventTranslator.SetInputFocus(
fPimpl->GetWindow(wid).fContentView);
2802 assert(buf != 0 &&
"LookupString, parameter 'buf' is null");
2803 assert(length >= 2 &&
"LookupString, parameter 'length' - not enough memory to return null-terminated ASCII string");
2808 #pragma mark - Font management.
2815 assert(fontName != 0 &&
"LoadQueryFont, fontName is null");
2824 return fPimpl->fFontManager.LoadFont(xlfd);
2839 fPimpl->fFontManager.UnloadFont(fs);
2854 return fPimpl->fFontManager.GetTextWidth(font, s, len);
2861 fPimpl->fFontManager.GetFontProperties(font, maxAscent, maxDescent);
2888 if (fontName && fontName[0]) {
2891 return fPimpl->fFontManager.ListFonts(xlfd, maxNames, count);
2904 fPimpl->fFontManager.FreeFontNames(fontList);
2907 #pragma mark - Color management.
2915 return fPimpl->fX11ColorParser.ParseColor(colorName, color);
2921 const unsigned red = unsigned(
double(color.
fRed) / 0xFFFF * 0xFF);
2922 const unsigned green = unsigned(
double(color.
fGreen) / 0xFFFF * 0xFF);
2923 const unsigned blue = unsigned(
double(color.
fBlue) / 0xFFFF * 0xFF);
2924 color.
fPixel = red << 16 | green << 8 | blue;
2932 color.
fRed = (color.
fPixel >> 16 & 0xFF) * 0xFFFF / 0xFF;
2933 color.
fGreen = (color.
fPixel >> 8 & 0xFF) * 0xFFFF / 0xFF;
2934 color.
fBlue = (color.
fPixel & 0xFF) * 0xFFFF / 0xFF;
2947 if (
const TColor *
const color =
gROOT->GetColor(rootColorIndex)) {
2948 Float_t red = 0.f, green = 0.f, blue = 0.f;
2949 color->GetRGB(red, green, blue);
2950 pixel = unsigned(red * 255) << 16;
2951 pixel |= unsigned(green * 255) << 8;
2952 pixel |= unsigned(blue * 255);
2986 #pragma mark - Graphical context management.
3010 x11Context.fForeground = foreground;
3018 assert(gval != 0 &&
"ChangeGC, gval parameter is null");
3022 x11Context.
fMask |= mask;
3035 if (mask & kGCLineWidth)
3037 if (mask & kGCLineStyle)
3072 const unsigned nDashes =
sizeof x11Context.
fDashes /
sizeof x11Context.
fDashes[0];
3073 for (
unsigned i = 0; i < nDashes; ++i)
3086 srcContext.fMask = mask;
3106 #pragma mark - Cursor management.
3128 assert(!
fPimpl->IsRootWindow(wid) &&
"SetCursor, called for root window");
3130 NSView<X11Window> *
const view =
fPimpl->GetWindow(wid).fContentView;
3131 view.fCurrentCursor = cursor;
3151 const NSPoint screenPoint = [NSEvent mouseLocation];
3167 rootWinID =
fPimpl->GetRootWindowID();
3169 NSPoint screenPoint = [NSEvent mouseLocation];
3172 rootX = screenPoint.x;
3173 rootY = screenPoint.y;
3176 if (winID >
fPimpl->GetRootWindowID()) {
3177 NSObject<X11Window> *
const window =
fPimpl->GetWindow(winID);
3182 winX = screenPoint.x;
3183 winY = screenPoint.y;
3188 childWinID = childWin.fID;
3196 #pragma mark - OpenGL management.
3205 return [[NSScreen mainScreen] backingScaleFactor];
3210 const std::vector<std::pair<UInt_t, Int_t> > &formatComponents)
3214 typedef std::pair<UInt_t, Int_t> component_type;
3215 typedef std::vector<component_type>::size_type size_type;
3218 std::vector<NSOpenGLPixelFormatAttribute> attribs;
3219 for (size_type i = 0, e = formatComponents.size(); i < e; ++i) {
3220 const component_type &comp = formatComponents[i];
3223 attribs.push_back(NSOpenGLPFADoubleBuffer);
3225 attribs.push_back(NSOpenGLPFADepthSize);
3226 attribs.push_back(comp.second > 0 ? comp.second : 32);
3228 attribs.push_back(NSOpenGLPFAAccumSize);
3229 attribs.push_back(comp.second > 0 ? comp.second : 1);
3231 attribs.push_back(NSOpenGLPFAStencilSize);
3232 attribs.push_back(comp.second > 0 ? comp.second : 8);
3234 attribs.push_back(NSOpenGLPFAMultisample);
3235 attribs.push_back(NSOpenGLPFASampleBuffers);
3236 attribs.push_back(1);
3237 attribs.push_back(NSOpenGLPFASamples);
3238 attribs.push_back(comp.second ? comp.second : 8);
3242 attribs.push_back(0);
3244 NSOpenGLPixelFormat *
const pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes : &attribs[0]];
3245 const Util::NSScopeGuard<NSOpenGLPixelFormat> formatGuard(pixelFormat);
3247 NSView<X11Window> *parentView = nil;
3248 if (!
fPimpl->IsRootWindow(parentID)) {
3249 parentView =
fPimpl->GetWindow(parentID).fContentView;
3251 "CreateOpenGLWindow, parent view must be QuartzView");
3254 NSRect viewFrame = {};
3255 viewFrame.size.width = width;
3256 viewFrame.size.height = height;
3259 const Util::NSScopeGuard<ROOTOpenGLView> viewGuard(glView);
3264 [parentView addChild : glView];
3265 glID =
fPimpl->RegisterDrawable(glView);
3271 const Util::NSScopeGuard<QuartzWindow> winGuard(parent);
3275 Error(
"CreateOpenGLWindow",
"QuartzWindow allocation/initialization"
3276 " failed for a top-level GL widget");
3280 glID =
fPimpl->RegisterDrawable(parent);
3291 "CreateOpenGLContext, parameter 'windowID' is a root window");
3293 "CreateOpenGLContext, view is not an OpenGL view");
3295 NSOpenGLContext *
const sharedContext =
fPimpl->GetGLContextForHandle(sharedID);
3298 const Util::NSScopeGuard<NSOpenGLContext>
3299 newContext([[NSOpenGLContext alloc] initWithFormat : glView.
pixelFormat shareContext : sharedContext]);
3301 const Handle_t ctxID =
fPimpl->RegisterGLContext(newContext.Get());
3315 assert(ctxID > 0 &&
"MakeOpenGLContextCurrent, invalid context id");
3317 NSOpenGLContext *
const glContext =
fPimpl->GetGLContextForHandle(ctxID);
3319 Error(
"MakeOpenGLContextCurrent",
"No OpenGL context found for id %d",
int(ctxID));
3327 if ([glContext
view] != glView)
3328 [glContext setView : glView];
3336 [glContext makeCurrentContext];
3349 NSView *fakeView = nil;
3356 const UInt_t width =
std::max(glView.frame.size.width, CGFloat(100));
3357 const UInt_t height =
std::max(glView.frame.size.height, CGFloat(100));
3359 NSRect viewFrame = {};
3360 viewFrame.size.width = width;
3361 viewFrame.size.height = height;
3363 const NSUInteger styleMask = NSTitledWindowMask | NSClosableWindowMask |
3364 NSMiniaturizableWindowMask | NSResizableWindowMask;
3367 fakeWindow = [[
QuartzWindow alloc] initWithContentRect : viewFrame styleMask : styleMask
3368 backing : NSBackingStoreBuffered defer : NO windowAttributes : &attr];
3369 Util::NSScopeGuard<QuartzWindow> winGuard(fakeWindow);
3372 [fakeView setHidden : NO];
3374 fPimpl->SetFakeGLWindow(fakeWindow);
3378 [fakeView setHidden : NO];
3382 [glContext setView : fakeView];
3383 [glContext makeCurrentContext];
3392 NSOpenGLContext *
const currentContext = [NSOpenGLContext currentContext];
3393 if (!currentContext) {
3394 Error(
"GetCurrentOpenGLContext",
"The current OpenGL context is null");
3398 const Handle_t contextID =
fPimpl->GetHandleForGLContext(currentContext);
3400 Error(
"GetCurrentOpenGLContext",
"The current OpenGL context was"
3401 " not created/registered by TGCocoa");
3409 assert(ctxID > 0 &&
"FlushOpenGLBuffer, invalid context id");
3411 NSOpenGLContext *
const glContext =
fPimpl->GetGLContextForHandle(ctxID);
3412 assert(glContext != nil &&
"FlushOpenGLBuffer, bad context id");
3414 if (glContext != [NSOpenGLContext currentContext])
3418 [glContext flushBuffer];
3427 NSOpenGLContext *
const glContext =
fPimpl->GetGLContextForHandle(ctxID);
3428 if (NSView *
const v = [glContext
view]) {
3430 ((ROOTOpenGLView *)
v).fOpenGLContext = nil;
3432 [glContext clearDrawable];
3435 if (glContext == [NSOpenGLContext currentContext])
3436 [NSOpenGLContext clearCurrentContext];
3438 fPimpl->DeleteGLContext(ctxID);
3441 #pragma mark - Off-screen rendering for TPad/TCanvas.
3447 assert(windowID > (
Int_t)
fPimpl->GetRootWindowID() &&
"SetDoubleBuffer called for root window");
3449 if (windowID == 999) {
3450 Warning(
"SetDoubleBuffer",
"called with wid == 999");
3471 "SetDoubleBufferON, called, but no correct window was selected before");
3475 assert(window.fIsPixmap == NO &&
3476 "SetDoubleBufferON, selected drawable is a pixmap, can not attach pixmap to pixmap");
3478 const unsigned currW = window.fWidth;
3479 const unsigned currH = window.fHeight;
3481 if (QuartzPixmap *
const currentPixmap = window.fBackBuffer) {
3482 if (currH == currentPixmap.fHeight && currW == currentPixmap.fWidth)
3487 Util::NSScopeGuard<QuartzPixmap> pixmap([[QuartzPixmap alloc] initWithW : currW
3488 H : currH scaleFactor : [[NSScreen mainScreen] backingScaleFactor]]);
3490 window.fBackBuffer = pixmap.Get();
3493 Error(
"SetDoubleBufferON",
"QuartzPixmap initialization failed");
3505 #pragma mark - Event management part.
3510 if (
fPimpl->IsRootWindow(wid))
3519 fPimpl->fX11EventTranslator.fEventQueue.push_back(newEvent);
3525 assert(
fPimpl->fX11EventTranslator.fEventQueue.size() > 0 &&
"NextEvent, event queue is empty");
3527 event =
fPimpl->fX11EventTranslator.fEventQueue.front();
3528 fPimpl->fX11EventTranslator.fEventQueue.pop_front();
3534 return (
Int_t)
fPimpl->fX11EventTranslator.fEventQueue.size();
3541 typedef X11::EventQueue_t::iterator iterator_type;
3543 iterator_type it =
fPimpl->fX11EventTranslator.fEventQueue.begin();
3544 iterator_type eIt =
fPimpl->fX11EventTranslator.fEventQueue.end();
3546 for (; it != eIt; ++it) {
3547 const Event_t &queuedEvent = *it;
3548 if (queuedEvent.
fWindow == windowID && queuedEvent.
fType == type) {
3549 event = queuedEvent;
3550 fPimpl->fX11EventTranslator.fEventQueue.erase(it);
3566 #pragma mark - "Drag and drop", "Copy and paste", X11 properties.
3575 assert(name != 0 &&
"InternAtom, parameter 'name' is null");
3576 return FindAtom(name, !onlyIfExist);
3594 "SetPrimarySelectionOwner, windowID parameter is a 'root' window");
3595 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3596 "SetPrimarySelectionOwner, windowID parameter is not a valid window");
3598 const Atom_t primarySelectionAtom =
FindAtom(
"XA_PRIMARY",
false);
3600 "SetPrimarySelectionOwner, predefined XA_PRIMARY atom was not found");
3619 "SetSelectionOwner, windowID parameter is a 'root' window'");
3620 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3621 "SetSelectionOwner, windowID parameter is not a valid window");
3636 const Atom_t primarySelectionAtom =
FindAtom(
"XA_PRIMARY",
false);
3638 "GetPrimarySelectionOwner, predefined XA_PRIMARY atom was not found");
3662 "ConvertPrimarySelection, parameter 'windowID' is root window");
3663 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3664 "ConvertPrimarySelection, parameter windowID parameter is not a window id");
3668 "ConvertPrimarySelection, XA_PRIMARY predefined atom not found");
3672 "ConvertPrimarySelection, XA_STRING predefined atom not found");
3674 ConvertSelection(windowID, primarySelectionAtom, stringAtom, clipboard, when);
3691 "ConvertSelection, parameter 'windowID' is root window'");
3692 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3693 "ConvertSelection, parameter 'windowID' is not a window id");
3703 newEvent.fWindow = windowID;
3704 newEvent.fUser[0] = windowID;
3705 newEvent.fUser[1] = selection;
3706 newEvent.fUser[2] = target;
3707 newEvent.fUser[3] = property;
3715 ULong_t *bytesAfterReturn,
unsigned char **propertyReturn)
3726 if (
fPimpl->IsRootWindow(windowID))
3729 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3730 "GetProperty, parameter 'windowID' is not a valid window id");
3732 "GetProperty, parameter 'propertyID' is not a valid atom");
3733 assert(actualType != 0 &&
"GetProperty, parameter 'actualType' is null");
3734 assert(actualFormat != 0 &&
"GetProperty, parameter 'actualFormat' is null");
3735 assert(bytesAfterReturn != 0 &&
"GetProperty, parameter 'bytesAfterReturn' is null");
3736 assert(propertyReturn != 0 &&
"GetProperty, parameter 'propertyReturn' is null");
3738 const Util::AutoreleasePool pool;
3740 *bytesAfterReturn = 0;
3741 *propertyReturn = 0;
3744 const std::string &atomName =
fAtomToName[propertyID - 1];
3745 NSObject<X11Window> *window =
fPimpl->GetWindow(windowID);
3747 if (![window hasProperty : atomName.c_str()]) {
3748 Error(
"GetProperty",
"Unknown property %s requested", atomName.c_str());
3752 unsigned tmpFormat = 0, tmpElements = 0;
3753 *propertyReturn = [window getProperty : atomName.c_str() returnType : actualType
3754 returnFormat : &tmpFormat nElements : &tmpElements];
3755 *actualFormat = (
Int_t)tmpFormat;
3756 *nItems = tmpElements;
3776 "GetPasteBuffer, parameter 'windowID' is root window");
3777 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3778 "GetPasteBuffer, parameter 'windowID' is not a valid window");
3780 "GetPasteBuffer, parameter 'propertyID' is not a valid atom");
3782 const Util::AutoreleasePool pool;
3784 const std::string &atomString =
fAtomToName[propertyID - 1];
3785 NSObject<X11Window> *window =
fPimpl->GetWindow(windowID);
3787 if (![window hasProperty : atomString.c_str()]) {
3788 Error(
"GetPasteBuffer",
"No property %s on a window", atomString.c_str());
3793 unsigned tmpFormat = 0, nElements = 0;
3795 const Util::ScopedArray<char>
3796 propertyData((
char *)[window getProperty : atomString.c_str()
3797 returnType : &tmpType returnFormat : &tmpFormat
3798 nElements : &nElements]);
3800 assert(tmpFormat == 8 &&
"GetPasteBuffer, property has wrong format");
3802 text.
Insert(0, propertyData.Get(), nElements);
3803 nChars = (
Int_t)nElements;
3808 [window removeProperty : atomString.c_str()];
3840 "ChangeProperty, parameter 'windowID' is root window");
3841 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3842 "ChangeProperty, parameter 'windowID' is not a valid window id");
3844 "ChangeProperty, parameter 'propertyID' is not a valid atom");
3846 const Util::AutoreleasePool pool;
3848 const std::string &atomString =
fAtomToName[propertyID - 1];
3850 NSObject<X11Window> *
const window =
fPimpl->GetWindow(windowID);
3851 [window setProperty : atomString.c_str() data : data size : len forType : type format : 8];
3874 "ChangeProperties, parameter 'windowID' is root window");
3875 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3876 "ChangeProperties, parameter 'windowID' is not a valid window id");
3878 "ChangeProperties, parameter 'propertyID' is not a valid atom");
3880 const Util::AutoreleasePool pool;
3882 const std::string &atomName =
fAtomToName[propertyID - 1];
3884 NSObject<X11Window> *
const window =
fPimpl->GetWindow(windowID);
3885 [window setProperty : atomName.c_str() data : data
3886 size : len forType : type format : format];
3905 "DeleteProperty, parameter 'windowID' is root window");
3906 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3907 "DeleteProperty, parameter 'windowID' is not a valid window");
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()];
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");
3955 std::vector<unsigned> propertyData;
3956 propertyData.push_back(4);
3959 for (
unsigned i = 0; typeList[i]; ++i)
3960 propertyData.push_back(
unsigned(typeList[i]));
3963 [view setProperty : "XdndAware" data : (unsigned char *)&propertyData[0]
3964 size : propertyData.size() forType : xaAtomAtom format : 32];
3972 if (windowID <= fPimpl->GetRootWindowID())
3975 assert(
fPimpl->GetDrawable(windowID).fIsPixmap == NO &&
3976 "IsDNDAware, windowID parameter is not a window");
3979 return view.fIsDNDAware;
3987 ::Warning(
"SetTypeList",
"Not implemented");
4011 fPimpl->IsRootWindow(winID) ? nil :
fPimpl->GetWindow(winID).fContentView,
4012 dragWinID, inputWinID,
x,
y, maxDepth);
4014 return testView.fID;
4019 #pragma mark - Noops.
4039 chupx = chupy = 0.f;
4144 NSPoint newCursorPosition = {};
4145 newCursorPosition.x = ix;
4146 newCursorPosition.y = iy;
4148 if (
fPimpl->GetRootWindowID() == winID) {
4153 "Warp, drawable is not a window");
4158 CGWarpMouseCursorPosition(NSPointToCGPoint(newCursorPosition));
4390 #pragma mark - Details and aux. functions.
4395 return &
fPimpl->fX11EventTranslator;
4401 return &
fPimpl->fX11CommandBuffer;
4427 if (!drawable.fIsPixmap) {
4428 Error(
"GetCurrentContext",
"TCanvas/TPad's internal error,"
4429 " selected drawable is not a pixmap!");
4433 return drawable.fContext;
4446 ProcessSerialNumber psn = {0, kCurrentProcess};
4448 const OSStatus res1 = TransformProcessType(&psn, kProcessTransformToForegroundApplication);
4453 if (res1 != noErr && res1 != paramErr) {
4454 Error(
"MakeProcessForeground",
"TransformProcessType failed with code %d",
int(res1));
4457 #ifdef MAC_OS_X_VERSION_10_9
4459 [[NSApplication sharedApplication] activateIgnoringOtherApps : YES];
4461 const OSErr res2 = SetFrontProcess(&psn);
4462 if (res2 != noErr) {
4463 Error(
"MakeProcessForeground",
"SetFrontProcess failed with code %d", res2);
4470 #ifdef MAC_OS_X_VERSION_10_9
4472 [[NSApplication sharedApplication] activateIgnoringOtherApps : YES];
4474 ProcessSerialNumber psn = {};
4476 OSErr res = GetCurrentProcess(&psn);
4478 Error(
"MakeProcessForeground",
"GetCurrentProcess failed with code %d", res);
4482 res = SetFrontProcess(&psn);
4484 Error(
"MapProcessForeground",
"SetFrontProcess failed with code %d", res);
4496 const std::map<std::string, Atom_t>::const_iterator it =
fNameToAtom.find(atomName);
4500 else if (addIfNotFound) {
4515 const char *
const iconDirectoryPath =
gEnv->
GetValue(
"Gui.IconPath",
"$(ROOTSYS)/icons");
4516 if (iconDirectoryPath) {
4518 if (fileName.Get()) {
4519 const Util::AutoreleasePool pool;
4521 NSString *cocoaStr = [NSString stringWithCString : fileName.Get() encoding : NSASCIIStringEncoding];
4522 NSImage *image = [[[NSImage alloc] initWithContentsOfFile : cocoaStr] autorelease];
4523 [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 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 SetTextMagnitude(Float_t mgn)
Sets the current text magnification factor to "mgn".
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...).
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 Display_t GetDisplay() const
Returns handle to display (might be useful in some cases where direct X11 manipulation outside of TVi...
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
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
virtual void Bell(Int_t percent)
Sets the sound bell. Percent is loudness from -100% to 100%.
Int_t MapKeySymToKeyCode(Int_t keySym)
virtual Window_t GetDefaultRootWindow() const
Returns handle to the default root window created when calling XOpenDisplay().
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".
std::auto_ptr< ROOT::MacOSX::Details::CocoaPrivate > fPimpl
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 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".
QuartzWindow * FindWindowInPoint(Int_t x, Int_t y)
virtual Window_t GetParent(Window_t wid) const
Returns the parent of the window "id".
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.
ROOT::MacOSX::X11::CommandBuffer * GetCommandBuffer() const
virtual void CloseDisplay()
Closes connection to display server and destroys all windows.
virtual Bool_t EmptyRegion(Region_t reg)
Returns kTRUE if the region reg is empty.
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)
QuartzView * fContentView
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.
virtual Int_t RequestLocator(Int_t mode, Int_t ctyp, Int_t &x, Int_t &y)
Requests Locator position.
virtual Visual_t GetVisual() const
Returns handle to visual.
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 void FreeFontStruct(FontStruct_t fs)
Frees the font structure "fs".
static std::string format(double x, double y, int digits, int width)
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.
ClassImp(TIterator) Bool_t TIterator return false
Compare two iterator objects.
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.
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
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)
Bool_t IsCocoaDraw() const
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".
static void swap(double &a, double &b)
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.
UChar_t mod R__LOCKGUARD2(gSrvAuthenticateMutex)
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 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 Int_t GetDoubleBuffer(Int_t wid)
Queries the double buffer value for the window "wid".
virtual Int_t GetDepth() const
Returns depth of screen (number of bit planes).
virtual Double_t GetOpenGLScalingFactor()
On a HiDPI resolution it can be > 1., this means glViewport should use scaled width and height...
void FillRectangleAux(Drawable_t wid, const GCValues_t &gcVals, Int_t x, Int_t y, UInt_t w, UInt_t h)
virtual void DeleteProperty(Window_t, Atom_t &)
Deletes the specified property only if the property was defined on the specified window and causes th...
if(pyself &&pyself!=Py_None)
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 addChild:(NSView< X11Window > *child)
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: ...
NSPoint TranslateFromScreen(NSPoint point, NSView< X11Window > *to)
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
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 Int_t GetScreen() const
Returns screen number.
virtual Window_t GetCurrentWindow() const
pointer to the current internal window used in canvas graphics
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)
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.
ROOT::MacOSX::X11::Rectangle GetDisplayGeometry() const
Bool_t fGraphicsExposures
int GlobalYCocoaToROOT(CGFloat yCocoa)
virtual void Sync(Int_t mode)
Set synchronisation on or off.
bool ViewIsHtmlViewFrame(NSView< X11Window > *view, bool checkParent)
virtual Bool_t Init(void *display)
Initializes the X system.
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".
Double_t length(const TVector2 &v)
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.
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
virtual void DestroyRegion(Region_t reg)
Destroys the region "reg".
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.
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
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.
virtual void UpdateWindow(Int_t mode)
Updates or synchronises client and server once (not permanent).
void ReparentChild(Window_t wid, Window_t pid, Int_t x, Int_t y)
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 SetKeyAutoRepeat(Bool_t on=kTRUE)
Turns key auto repeat on (kTRUE) or off (kFALSE).
virtual void DeleteGC(GContext_t gc)
Deletes the specified GC "gc".
virtual Colormap_t GetColormap() const
Returns handle to colormap.
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
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 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 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
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 t...
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 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...
virtual void SetWMPosition(Window_t winID, Int_t x, Int_t y)
Tells the window manager the desired position [x,y] of window "id".
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 Int_t SupportsExtension(const char *extensionName) const
Returns 1 if window system server supports extension given by the argument, returns 0 in case extensi...
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)
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 RemoveWindow(ULong_t qwid)
Removes the created by Qt window "qwid".
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 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 Bool_t MakeOpenGLContextCurrent(Handle_t ctx, Window_t windowID)
Makes context ctx current OpenGL context.
bool CocoaInitialized() const
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.
virtual void WMDeleteNotify(Window_t wid)
Tells WM to send message when window is closed via WM.
std::vector< std::string > fAtomToName
virtual UInt_t ScreenWidthMM() const
Returns the width of the screen in millimeters.
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 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 Bool_t HasTTFonts() const
Returns True when TrueType fonts are used.
virtual void SendEvent(Window_t wid, Event_t *ev)
Specifies the event "ev" is to be sent to the window "id".
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.
ROOT::MacOSX::X11::EventTranslator * GetEventTranslator() const
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.
virtual void SetClipOFF(Int_t wid)
Turns off the clipping for the window "wid".
bool ViewIsTextViewFrame(NSView< X11Window > *view, bool checkParent)
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 InitWindow(ULong_t window)
Creates a new window and return window number.
void addTransientWindow:(QuartzWindow *window)
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".
virtual Handle_t GetCurrentOpenGLContext()
Asks OpenGL subsystem about the current OpenGL context.
virtual UInt_t ExecCommand(TGWin32Command *code)
Executes the command "code" coming from the other threads (Win32)
void * GetCurrentContext()
virtual Handle_t GetNativeEvent() const
Returns the current native event handle.
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.
const char Int_t const char * image
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.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.