Touch Bar support

This commit is contained in:
Jack Andersen 2017-02-08 23:22:12 -10:00
parent bb227b9cc0
commit 27a455c61d
2 changed files with 21 additions and 0 deletions
include/boo
lib/mac

View File

@ -304,6 +304,8 @@ public:
virtual void setStyle(EWindowStyle style)=0;
virtual EWindowStyle getStyle() const=0;
virtual void setTouchBarProvider(void*) {}
virtual IGraphicsCommandQueue* getCommandQueue()=0;
virtual IGraphicsDataFactory* getDataFactory()=0;

View File

@ -18,10 +18,12 @@ namespace boo {class WindowCocoa; class GraphicsContextCocoa;}
@interface WindowCocoaInternal : NSWindow
{
boo::WindowCocoa* booWindow;
id touchBarProvider;
}
- (id)initWithBooWindow:(boo::WindowCocoa*)bw title:(const std::string&)title;
- (void)setFrameDefault;
- (NSRect)genFrameDefault;
- (void)setTouchBarProvider:(id)provider;
@end
/* AppKit applies OpenGL much differently than other platforms
@ -1490,6 +1492,14 @@ public:
return retval;
}
void setTouchBarProvider(void* provider)
{
dispatch_sync(dispatch_get_main_queue(),
^{
[m_nsWindow setTouchBarProvider:(__bridge_transfer id)provider];
});
}
void waitForRetrace()
{
static_cast<GraphicsContextCocoa*>(m_gfxCtx)->waitForRetrace();
@ -1560,6 +1570,15 @@ IWindow* _WindowCocoaNew(const SystemString& title, NSOpenGLContext* lastGLCtx,
(scrFrame.size.height - height) / 2.0,
width, height);
}
- (void)setTouchBarProvider:(id<NSTouchBarProvider>)provider
{
touchBarProvider = provider;
self.touchBar = nil;
}
- (NSTouchBar*)makeTouchBar
{
return [touchBarProvider makeTouchBar];
}
- (void)close
{
booWindow->_clearWindow();