+
+# ifdef USE_TOUCHBAR
+ static BOOL created_touchbar = NO;
+
+ if (!touchbar_view &&
+ //#### !self.isPreview &&
+ self.window.screen == [[NSScreen screens] objectAtIndex: 0] &&
+ !created_touchbar) {
+
+ // Figure out which NSScreen has the touchbar on it;
+ // find its bounds; create a saver there.
+
+ created_touchbar = YES;
+ NSScreen *tbs = [[NSScreen screens] lastObject]; // #### write me
+ NSRect rect = [tbs visibleFrame];
+
+ // #### debugging
+ rect.origin.x += 40;
+ rect.origin.x += 40;
+ rect.size.width /= 4;
+ rect.size.height /= 4;
+ NSLog(@"## TB %.0f, %.0f %.0f x %.0f",
+ rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
+
+ touchbar_view = [[[self class] alloc]
+ initWithFrame:rect
+ saverName:[NSString stringWithCString:xsft->progclass
+ encoding:NSISOLatin1StringEncoding]
+ isPreview:self.isPreview];
+ [touchbar_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
+
+ touchbar_window = [[NSWindow alloc]
+ initWithContentRect:rect
+ styleMask: (NSTitledWindowMask|NSResizableWindowMask)
+ backing:NSBackingStoreBuffered
+ defer:YES
+ screen:tbs];
+ [touchbar_window setTitle: @"XScreenSaver Touchbar"];
+ [[touchbar_window contentView] addSubview: touchbar_view];
+ [touchbar_window makeKeyAndOrderFront:touchbar_window];
+ }
+
+ if (touchbar_view) [touchbar_view startAnimation];
+# endif // USE_TOUCHBAR