summaryrefslogtreecommitdiff
path: root/dgl/src/pugl
diff options
context:
space:
mode:
authorfalkTX <falktx@gmail.com>2014-05-13 18:28:48 +0100
committerfalkTX <falktx@gmail.com>2014-05-13 18:28:48 +0100
commit5c4b72d8d88fbbe30cab1bd117001d3432dfbfe3 (patch)
tree988abdb63a011546f239a0697d8183349530bf9b /dgl/src/pugl
parent08d717fbe350704d8dda18e2ba2f29b7b85e970d (diff)
pugl osx stuff; remove extended code, not needed anymore
Diffstat (limited to 'dgl/src/pugl')
-rw-r--r--dgl/src/pugl/pugl_osx.m69
-rw-r--r--dgl/src/pugl/pugl_osx_extended.h38
-rw-r--r--dgl/src/pugl/pugl_osx_extended.m104
3 files changed, 39 insertions, 172 deletions
diff --git a/dgl/src/pugl/pugl_osx.m b/dgl/src/pugl/pugl_osx.m
index 0770b114..02005077 100644
--- a/dgl/src/pugl/pugl_osx.m
+++ b/dgl/src/pugl/pugl_osx.m
@@ -351,55 +351,64 @@ struct PuglInternalsImpl {
id window;
};
-PuglView*
-puglCreate(PuglNativeWindow parent,
- const char* title,
- int width,
- int height,
- bool resizable,
- bool visible)
-{
- PuglView* view = (PuglView*)calloc(1, sizeof(PuglView));
- PuglInternals* impl = (PuglInternals*)calloc(1, sizeof(PuglInternals));
- if (!view || !impl) {
- return NULL;
- }
+PuglInternals*
+puglInitInternals()
+{
+ return (PuglInternals*)calloc(1, sizeof(PuglInternals));
+}
- view->impl = impl;
- view->width = width;
- view->height = height;
+int
+puglCreateWindow(PuglView* view, const char* title)
+{
+ PuglInternals* impl = view->impl;
[NSAutoreleasePool new];
[NSApplication sharedApplication];
- NSString* titleString = [[NSString alloc]
- initWithBytes:title
- length:strlen(title)
- encoding:NSUTF8StringEncoding];
-
id window = [[PuglWindow new]retain];
[window setPuglview:view];
- [window setTitle:titleString];
+
+ if (title) {
+ NSString* titleString = [[NSString alloc]
+ initWithBytes:title
+ length:strlen(title)
+ encoding:NSUTF8StringEncoding];
+
+ [window setTitle:titleString];
+ }
impl->glview = [PuglOpenGLView new];
impl->window = window;
impl->glview->puglview = view;
- [window setContentView:impl->glview];
[NSApp activateIgnoringOtherApps:YES];
+ [window setContentView:impl->glview];
[window makeFirstResponder:impl->glview];
-
[window makeKeyAndOrderFront:window];
- if (! visible) {
- [window setIsVisible:NO];
- }
+ // wait for first puglShowWindow
+ [window setIsVisible:NO];
- return view;
+ // TODO - handle view->parent and view->resizable
- // unused
- (void)parent; (void)resizable;
+ return 0;
+}
+
+void
+puglShowWindow(PuglView* view)
+{
+ id window = view->impl->window;
+
+ [window setIsVisible:YES];
+}
+
+void
+puglHideWindow(PuglView* view)
+{
+ id window = view->impl->window;
+
+ [window setIsVisible:NO];
}
void
diff --git a/dgl/src/pugl/pugl_osx_extended.h b/dgl/src/pugl/pugl_osx_extended.h
deleted file mode 100644
index d718eb58..00000000
--- a/dgl/src/pugl/pugl_osx_extended.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- Copyright 2012 David Robillard <http://drobilla.net>
- Copyright 2013 Filipe Coelho <falktx@falktx.com>
-
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-
-/**
- @file pugl_osx_extended.h Extended OSX/Cocoa Pugl Implementation.
-*/
-
-#include <stdbool.h>
-
-#include "pugl.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void puglImplIdle(PuglView* view);
-void puglImplFocus(PuglView* view);
-void puglImplSetSize(PuglView* view, unsigned int width, unsigned int height, bool forced);
-void puglImplSetTitle(PuglView* view, const char* title);
-void puglImplSetVisible(PuglView* view, bool yesNo);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
diff --git a/dgl/src/pugl/pugl_osx_extended.m b/dgl/src/pugl/pugl_osx_extended.m
deleted file mode 100644
index d638dc02..00000000
--- a/dgl/src/pugl/pugl_osx_extended.m
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- Copyright 2012 David Robillard <http://drobilla.net>
- Copyright 2013 Filipe Coelho <falktx@falktx.com>
-
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-
-/**
- @file pugl_osx_extended.m Extended OSX/Cocoa Pugl Implementation.
-*/
-
-#import "pugl_osx.m"
-
-#include "pugl_osx_extended.h"
-
-void puglImplIdle(PuglView* view)
-{
- NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
- NSEvent* event;
-
- static const NSUInteger eventMask = (NSLeftMouseDownMask | NSLeftMouseUpMask |
- NSRightMouseDownMask | NSRightMouseUpMask |
- NSMouseMovedMask |
- NSLeftMouseDraggedMask | NSRightMouseDraggedMask |
- NSMouseEnteredMask | NSMouseExitedMask |
- NSKeyDownMask | NSKeyUpMask |
- NSFlagsChangedMask |
- NSCursorUpdateMask | NSScrollWheelMask);
-
- for (;;) {
- event = [view->impl->window
- nextEventMatchingMask:eventMask
- untilDate:[NSDate distantPast]
- inMode:NSEventTrackingRunLoopMode
- dequeue:YES];
-
- if (event == nil)
- break;
-
- [view->impl->window sendEvent: event];
- }
-
- [pool release];
-}
-
-void puglImplFocus(PuglView* view)
-{
- id window = view->impl->window;
-
- // TODO
- [NSApp activateIgnoringOtherApps:YES];
- [window makeKeyAndOrderFront:window];
-}
-
-void puglImplSetSize(PuglView* view, unsigned int width, unsigned int height, bool forced)
-{
- id window = view->impl->window;
-
- NSRect frame = [window frame];
- frame.origin.y -= height - frame.size.height;
- frame.size.width = width;
- frame.size.height = height+20;
-
-// if (forced) {
-// [window setFrame:frame];
-// } else {
- [window setFrame:frame display:YES animate:NO];
-// }
-
- // unused
- return; (void)forced;
-}
-
-void puglImplSetTitle(PuglView* view, const char* title)
-{
- id window = view->impl->window;
-
- NSString* titleString = [[NSString alloc]
- initWithBytes:title
- length:strlen(title)
- encoding:NSUTF8StringEncoding];
-
- [window setTitle:titleString];
-}
-
-void puglImplSetVisible(PuglView* view, bool yesNo)
-{
- id window = view->impl->window;
-
- if (yesNo)
- [window setIsVisible:YES];
- else
- [window setIsVisible:NO];
-}