21 #ifdef WITH_INPUT_NDOF
25 #include "AssertMacros.h"
27 #import <Cocoa/Cocoa.h>
30 #include <Carbon/Carbon.h>
32 #include <sys/sysctl.h>
34 #include <sys/types.h>
36 #include <mach/mach_time.h>
38 #pragma mark KeyMap, mouse converters
124 case kVK_ANSI_Keypad0:
126 case kVK_ANSI_Keypad1:
128 case kVK_ANSI_Keypad2:
130 case kVK_ANSI_Keypad3:
132 case kVK_ANSI_Keypad4:
134 case kVK_ANSI_Keypad5:
136 case kVK_ANSI_Keypad6:
138 case kVK_ANSI_Keypad7:
140 case kVK_ANSI_Keypad8:
142 case kVK_ANSI_Keypad9:
144 case kVK_ANSI_KeypadDecimal:
146 case kVK_ANSI_KeypadEnter:
148 case kVK_ANSI_KeypadPlus:
150 case kVK_ANSI_KeypadMinus:
152 case kVK_ANSI_KeypadMultiply:
154 case kVK_ANSI_KeypadDivide:
156 case kVK_ANSI_KeypadClear:
213 case kVK_ForwardDelete:
251 if ((recvChar >=
'A') && (recvChar <=
'Z')) {
254 else if ((recvChar >=
'a') && (recvChar <=
'z')) {
259 CFDataRef uchrHandle;
260 TISInputSourceRef kbdTISHandle;
262 kbdTISHandle = TISCopyCurrentKeyboardLayoutInputSource();
263 uchrHandle = (CFDataRef)TISGetInputSourceProperty(kbdTISHandle,
264 kTISPropertyUnicodeKeyLayoutData);
265 CFRelease(kbdTISHandle);
271 UInt32 deadKeyState = 0;
272 UniCharCount actualStrLength = 0;
274 UCKeyTranslate((UCKeyboardLayout *)CFDataGetBytePtr(uchrHandle),
279 kUCKeyTranslateNoDeadKeysBit,
321 #pragma mark Utility functions
323 #define FIRSTFILEBUFLG 512
341 #pragma mark Cocoa objects
356 - (
void)applicationDidFinishLaunching:(NSNotification *)aNotification;
357 - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename;
358 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
359 - (
void)applicationWillTerminate:(NSNotification *)aNotification;
360 - (
void)applicationWillBecomeActive:(NSNotification *)aNotification;
361 - (
void)toggleFullScreen:(NSNotification *)notification;
362 - (
void)windowWillClose:(NSNotification *)notification;
369 NSNotificationCenter *
center = [NSNotificationCenter defaultCenter];
370 [center addObserver:self
371 selector:@selector(windowWillClose:)
372 name:NSWindowWillCloseNotification
379 NSNotificationCenter *
center = [NSNotificationCenter defaultCenter];
380 [center removeObserver:self name:NSWindowWillCloseNotification object:nil];
389 - (
void)applicationDidFinishLaunching:(NSNotification *)aNotification
396 [NSApp activateIgnoringOtherApps:YES];
399 [NSEvent setMouseCoalescingEnabled:NO];
402 - (
BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
407 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
413 return NSTerminateCancel;
419 - (
void)applicationWillTerminate:(NSNotification *)aNotification
427 - (
void)applicationWillBecomeActive:(NSNotification *)aNotification
432 - (
void)toggleFullScreen:(NSNotification *)notification
453 - (
void)windowWillClose:(NSNotification *)notification
455 NSWindow *closing_window = (NSWindow *)[notification
object];
457 if (![closing_window isKeyWindow]) {
468 NSInteger index = [[NSApp orderedWindows] indexOfObject:closing_window];
469 if (index != NSNotFound) {
473 for (NSWindow *current_window in [NSApp orderedWindows]) {
474 if (current_window == closing_window) {
477 if ([current_window isOnActiveSpace] && [current_window canBecomeKeyWindow]) {
478 [current_window makeKeyAndOrderFront:nil];
484 for (NSNumber *window_number in [NSWindow windowNumbersWithOptions:0]) {
485 NSWindow *current_window = [NSApp windowWithWindowNumber:[window_number integerValue]];
486 if (current_window == closing_window) {
489 if ([current_window canBecomeKeyWindow]) {
490 [current_window makeKeyAndOrderFront:nil];
498 #pragma mark initialization/finalization
503 struct timeval boottime;
505 char *rstring =
NULL;
516 mib[1] = KERN_BOOTTIME;
517 len =
sizeof(
struct timeval);
519 sysctl(mib, 2, &boottime, &
len,
NULL, 0);
520 m_start_time = ((boottime.tv_sec * 1000) + (boottime.tv_usec / 1000));
526 rstring = (
char *)malloc(
len);
527 sysctl(mib, 2, rstring, &
len,
NULL, 0);
547 #ifdef WITH_INPUT_NDOF
555 if (!GetCurrentProcess(&psn)) {
556 TransformProcessType(&psn, kProcessTransformToForegroundApplication);
557 SetFrontProcess(&psn);
562 [NSApplication sharedApplication];
564 if ([NSApp mainMenu] == nil) {
565 NSMenu *mainMenubar = [[NSMenu alloc] init];
566 NSMenuItem *menuItem;
571 appMenu = [[NSMenu alloc] initWithTitle:@"Blender"];
573 [appMenu addItemWithTitle:@"About Blender"
574 action:@selector(orderFrontStandardAboutPanel:)
576 [appMenu addItem:[NSMenuItem separatorItem]];
578 menuItem = [appMenu addItemWithTitle:@"Hide Blender"
579 action:@selector(hide:)
581 [menuItem setKeyEquivalentModifierMask:NSEventModifierFlagCommand];
583 menuItem = [appMenu addItemWithTitle:@"Hide Others"
584 action:@selector(hideOtherApplications:)
587 setKeyEquivalentModifierMask:(NSEventModifierFlagOption | NSEventModifierFlagCommand)];
589 [appMenu addItemWithTitle:@"Show All"
590 action:@selector(unhideAllApplications:)
593 menuItem = [appMenu addItemWithTitle:@"Quit Blender"
594 action:@selector(terminate:)
596 [menuItem setKeyEquivalentModifierMask:NSEventModifierFlagCommand];
598 menuItem = [[NSMenuItem alloc] init];
599 [menuItem setSubmenu:appMenu];
601 [mainMenubar addItem:menuItem];
603 [NSApp performSelector:@selector(setAppleMenu:) withObject:appMenu];
607 windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
609 menuItem = [windowMenu addItemWithTitle:@"Minimize"
610 action:@selector(performMiniaturize:)
612 [menuItem setKeyEquivalentModifierMask:NSEventModifierFlagCommand];
614 [windowMenu addItemWithTitle:@"Zoom" action:@selector(performZoom:) keyEquivalent:@""];
616 menuItem = [windowMenu addItemWithTitle:@"Enter Full Screen"
617 action:@selector(toggleFullScreen:)
620 setKeyEquivalentModifierMask:NSEventModifierFlagControl | NSEventModifierFlagCommand];
622 menuItem = [windowMenu addItemWithTitle:@"Close"
623 action:@selector(performClose:)
625 [menuItem setKeyEquivalentModifierMask:NSEventModifierFlagCommand];
627 menuItem = [[NSMenuItem alloc] init];
628 [menuItem setSubmenu:windowMenu];
630 [mainMenubar addItem:menuItem];
633 [NSApp setMainMenu:mainMenubar];
634 [NSApp setWindowsMenu:windowMenu];
635 [windowMenu release];
638 if ([NSApp delegate] == nil) {
641 [NSApp setDelegate:appDelegate];
647 NSWindow.allowsAutomaticWindowTabbing = NO;
649 [NSApp finishLaunching];
655 #pragma mark window management
660 struct timeval currentTime;
662 gettimeofday(¤tTime,
NULL);
666 return ((currentTime.tv_sec * 1000) + (currentTime.tv_usec / 1000) -
m_start_time);
674 return NSScreen.screens.count;
682 NSRect frame = [[NSScreen mainScreen] visibleFrame];
685 NSRect contentRect = [NSWindow
686 contentRectForFrameRect:frame
687 styleMask:(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable |
688 NSWindowStyleMaskMiniaturizable)];
690 width = contentRect.size.width;
691 height = contentRect.size.height;
709 const bool exclusive,
710 const bool is_dialog,
717 NSRect frame = [[NSScreen mainScreen] visibleFrame];
718 NSRect contentRect = [NSWindow
719 contentRectForFrameRect:frame
720 styleMask:(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable |
721 NSWindowStyleMaskMiniaturizable)];
726 left =
left > contentRect.origin.x ?
left : contentRect.origin.x;
728 bottom =
bottom > contentRect.origin.y ?
bottom + contentRect.origin.y : contentRect.origin.y;
754 GHOST_PRINT(
"GHOST_SystemCocoa::createWindow(): window invalid\n");
770 if (
context->initializeDrawingContext())
792 NSPoint scr_co = NSMakePoint(
x,
y);
794 int windowNumberAtPoint = [NSWindow windowNumberAtPoint:scr_co belowWindowWithWindowNumber:0];
795 NSWindow *nswindow = [NSApp windowWithWindowNumber:windowNumberAtPoint];
797 if (nswindow == nil) {
809 NSPoint mouseLoc = [NSEvent mouseLocation];
828 CGAssociateMouseAndMouseCursorPosition(
false);
830 CGAssociateMouseAndMouseCursorPosition(
true);
842 float xf = (
float)
x, yf = (
float)
y;
848 NSScreen *windowScreen = window->
getScreen();
849 NSRect screenRect = [windowScreen frame];
852 xf -= screenRect.origin.x;
853 yf -= screenRect.origin.y;
856 yf = screenRect.size.height - yf;
858 CGDisplayMoveCursorToPoint((CGDirectDisplayID)[[[windowScreen deviceDescription]
859 objectForKey:
@"NSScreenNumber"] unsignedIntValue],
860 CGPointMake(xf, yf));
867 CGAssociateMouseAndMouseCursorPosition(
true);
886 UInt32 button_state = GetCurrentEventButtonState();
897 #pragma mark Event handlers
904 bool anyProcessed =
false;
917 timeOut = kEventDurationForever;
925 ::ReceiveNextEvent(0,
NULL, timeOut,
false, &event);
934 event = [NSApp nextEventMatchingMask:NSEventMaskAny
935 untilDate:[NSDate distantPast]
936 inMode:NSDefaultRunLoopMode
952 if ([event
type] == NSEventTypeKeyDown && [event keyCode] == kVK_Tab &&
953 ([event modifierFlags] & NSEventModifierFlagControl)) {
960 if ([event
type] == NSEventTypeKeyUp &&
961 ([event modifierFlags] & (NSEventModifierFlagCommand | NSEventModifierFlagOption)))
964 [NSApp sendEvent:event];
967 }
while (event != nil);
969 }
while (waitForEvent && !anyProcessed);
991 [window->getCocoaWindow() makeKeyAndOrderFront:nil];
997 unsigned int modifiers;
1007 modifiers = [[[NSApplication sharedApplication] currentEvent] modifierFlags];
1009 if ((modifiers & NSEventModifierFlagShift) != (
m_modifierMask & NSEventModifierFlagShift)) {
1017 if ((modifiers & NSEventModifierFlagControl) != (
m_modifierMask & NSEventModifierFlagControl)) {
1025 if ((modifiers & NSEventModifierFlagOption) != (
m_modifierMask & NSEventModifierFlagOption)) {
1033 if ((modifiers & NSEventModifierFlagCommand) != (
m_modifierMask & NSEventModifierFlagCommand)) {
1071 switch (eventType) {
1137 switch (eventType) {
1149 NSArray *droppedArray;
1150 size_t pastedTextSize;
1151 NSString *droppedStr;
1158 switch (draggedObjectType) {
1160 droppedArray = (NSArray *)
data;
1166 strArray->
count = [droppedArray count];
1167 if (strArray->
count == 0) {
1174 for (i = 0; i < strArray->
count; i++) {
1175 droppedStr = [droppedArray objectAtIndex:i];
1177 pastedTextSize = [droppedStr lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
1178 temp_buff = (
uint8_t *)malloc(pastedTextSize + 1);
1181 strArray->
count = i;
1185 strncpy((
char *)temp_buff,
1186 [droppedStr cStringUsingEncoding:NSUTF8StringEncoding],
1188 temp_buff[pastedTextSize] =
'\0';
1190 strArray->
strings[i] = temp_buff;
1197 droppedStr = (NSString *)
data;
1198 pastedTextSize = [droppedStr lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
1200 temp_buff = (
uint8_t *)malloc(pastedTextSize + 1);
1202 if (temp_buff ==
NULL) {
1206 strncpy((
char *)temp_buff,
1207 [droppedStr cStringUsingEncoding:NSUTF8StringEncoding],
1210 temp_buff[pastedTextSize] =
'\0';
1216 NSImage *droppedImg = (NSImage *)
data;
1217 NSSize imgSize = [droppedImg size];
1222 int x,
y, to_i, from_i;
1223 NSBitmapImageRep *blBitmapFormatImageRGB, *blBitmapFormatImageRGBA, *bitmapImage = nil;
1224 NSEnumerator *enumerator;
1225 NSImageRep *representation;
1229 [droppedImg release];
1234 enumerator = [[droppedImg representations] objectEnumerator];
1235 while ((representation = [enumerator nextObject])) {
1236 if ([representation isKindOfClass:[NSBitmapImageRep
class]]) {
1237 bitmapImage = (NSBitmapImageRep *)representation;
1241 if (bitmapImage == nil)
1244 if (([bitmapImage bitsPerPixel] == 32) && (([bitmapImage bitmapFormat] & 0x5) == 0) &&
1245 ![bitmapImage isPlanar]) {
1248 rasterRGB = (
uint8_t *)[bitmapImage bitmapData];
1249 for (
y = 0;
y < imgSize.height;
y++) {
1250 to_i = (imgSize.height -
y - 1) * imgSize.width;
1251 from_i =
y * imgSize.width;
1252 memcpy(toIBuf + 4 * to_i, rasterRGB + 4 * from_i, 4 * imgSize.width);
1257 [bitmapImage setSize:imgSize];
1265 blBitmapFormatImageRGB = [[NSBitmapImageRep alloc]
1266 initWithBitmapDataPlanes:NULL
1267 pixelsWide:imgSize.width
1268 pixelsHigh:imgSize.height
1273 colorSpaceName:NSDeviceRGBColorSpace
1274 bitmapFormat:(NSBitmapFormat)0
1275 bytesPerRow:4 * imgSize.width
1278 [NSGraphicsContext saveGraphicsState];
1280 setCurrentContext:[NSGraphicsContext
1281 graphicsContextWithBitmapImageRep:blBitmapFormatImageRGB]];
1283 [NSGraphicsContext restoreGraphicsState];
1285 rasterRGB = (
uint8_t *)[blBitmapFormatImageRGB bitmapData];
1286 if (rasterRGB ==
NULL) {
1287 [bitmapImage release];
1288 [blBitmapFormatImageRGB release];
1289 [droppedImg release];
1294 blBitmapFormatImageRGBA = [[NSBitmapImageRep alloc]
1295 initWithBitmapDataPlanes:NULL
1296 pixelsWide:imgSize.width
1297 pixelsHigh:imgSize.height
1302 colorSpaceName:NSDeviceRGBColorSpace
1303 bitmapFormat:(NSBitmapFormat)0
1304 bytesPerRow:4 * imgSize.width
1307 [NSGraphicsContext saveGraphicsState];
1309 setCurrentContext:[NSGraphicsContext
1310 graphicsContextWithBitmapImageRep:blBitmapFormatImageRGBA]];
1312 [NSGraphicsContext restoreGraphicsState];
1314 rasterRGBA = (
uint8_t *)[blBitmapFormatImageRGBA bitmapData];
1315 if (rasterRGBA ==
NULL) {
1316 [bitmapImage release];
1317 [blBitmapFormatImageRGB release];
1318 [blBitmapFormatImageRGBA release];
1319 [droppedImg release];
1325 for (
y = 0;
y < imgSize.height;
y++) {
1326 for (
x = 0;
x < imgSize.width;
x++) {
1327 to_i = (imgSize.height -
y - 1) * imgSize.width +
x;
1328 from_i =
y * imgSize.width +
x;
1330 toIBuf[4 * to_i] = rasterRGB[4 * from_i];
1331 toIBuf[4 * to_i + 1] = rasterRGB[4 * from_i + 1];
1332 toIBuf[4 * to_i + 2] = rasterRGB[4 * from_i + 2];
1333 toIBuf[4 * to_i + 3] = rasterRGBA[4 * from_i + 3];
1337 [blBitmapFormatImageRGB release];
1338 [blBitmapFormatImageRGBA release];
1339 [droppedImg release];
1353 getMilliSeconds(), eventType, draggedObjectType, window, mouseX, mouseY, eventData));
1379 NSString *filepath = (NSString *)filepathStr;
1380 NSArray *windowsList;
1382 size_t filenameTextSize;
1386 windowsList = [NSApp orderedWindows];
1387 if ([windowsList
count]) {
1388 [[windowsList objectAtIndex:0] makeKeyAndOrderFront:nil];
1403 filenameTextSize = [filepath lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
1404 temp_buff = (
char *)malloc(filenameTextSize + 1);
1406 if (temp_buff ==
NULL) {
1410 strncpy(temp_buff, [filepath cStringUsingEncoding:NSUTF8StringEncoding], filenameTextSize);
1411 temp_buff[filenameTextSize] =
'\0';
1421 NSEvent *
event = (NSEvent *)eventPtr;
1432 switch (eventType) {
1433 case NSEventTypeTabletPoint:
1441 ct.
Xtilt = [event tilt].x;
1442 ct.
Ytilt = [event tilt].y;
1445 case NSEventTypeTabletProximity:
1448 if ([event isEnteringProximity]) {
1450 switch ([event pointingDeviceType]) {
1451 case NSPointingDeviceTypePen:
1454 case NSPointingDeviceTypeEraser:
1457 case NSPointingDeviceTypeCursor:
1458 case NSPointingDeviceTypeUnknown:
1466 GHOST_ASSERT(
FALSE,
"GHOST_SystemCocoa::handleTabletEvent : unknown event received");
1475 NSEvent *
event = (NSEvent *)eventPtr;
1477 switch ([event subtype]) {
1478 case NSEventSubtypeTabletPoint:
1481 case NSEventSubtypeTabletProximity:
1492 NSEvent *
event = (NSEvent *)eventPtr;
1500 (
void *)[event window]);
1511 switch ([event
type]) {
1512 case NSEventTypeLeftMouseDown:
1518 window -> GetCocoaTabletData()));
1520 case NSEventTypeRightMouseDown:
1526 window -> GetCocoaTabletData()));
1528 case NSEventTypeOtherMouseDown:
1534 window -> GetCocoaTabletData()));
1537 case NSEventTypeLeftMouseUp:
1543 window -> GetCocoaTabletData()));
1545 case NSEventTypeRightMouseUp:
1551 window -> GetCocoaTabletData()));
1553 case NSEventTypeOtherMouseUp:
1559 window -> GetCocoaTabletData()));
1562 case NSEventTypeLeftMouseDragged:
1563 case NSEventTypeRightMouseDragged:
1564 case NSEventTypeOtherMouseDragged:
1567 case NSEventTypeMouseMoved: {
1571 bool is_tablet =
false;
1577 switch (grab_mode) {
1580 int32_t x_warp, y_warp, x_accum, y_accum,
x,
y;
1586 x_accum += [event deltaX];
1597 window -> GetCocoaTabletData()));
1602 NSTimeInterval timestamp = [event timestamp];
1609 NSPoint mousePos = [event locationInWindow];
1623 correctedBounds.
m_b = (windowBounds.
m_b - windowBounds.
m_t) - correctedBounds.
m_b;
1624 correctedBounds.
m_t = (windowBounds.
m_b - windowBounds.
m_t) - correctedBounds.
m_t;
1631 int32_t warped_x_mouse = x_mouse;
1632 int32_t warped_y_mouse = y_mouse;
1638 if (x_mouse != warped_x_mouse || y_mouse != warped_y_mouse) {
1643 y_accum + (y_mouse - warped_y_mouse));
1657 window -> GetCocoaTabletData()));
1662 NSPoint mousePos = [event locationInWindow];
1671 window -> GetCocoaTabletData()));
1677 case NSEventTypeScrollWheel: {
1678 NSEventPhase momentumPhase = NSEventPhaseNone;
1679 NSEventPhase phase = NSEventPhaseNone;
1681 momentumPhase = [event momentumPhase];
1682 phase = [event phase];
1688 if (momentumPhase) {
1701 else if (phase == NSEventPhaseEnded)
1709 double deltaF = [event deltaY];
1712 deltaF = [event deltaX];
1716 delta = deltaF > 0.0 ? 1 : -1;
1720 NSPoint mousePos = [event locationInWindow];
1726 dx = [event scrollingDeltaX];
1727 dy = [event scrollingDeltaY];
1731 if (phase == NSEventPhaseNone && momentumPhase == NSEventPhaseNone) {
1732 dx = [event deltaX];
1733 dy = [event deltaY];
1737 NSPoint delta = [[cocoawindow contentView] convertPointToBacking:NSMakePoint(dx, dy)];
1745 [event isDirectionInvertedFromDevice]));
1749 case NSEventTypeMagnify: {
1750 NSPoint mousePos = [event locationInWindow];
1758 [event magnification] * 125.0 + 0.1,
1763 case NSEventTypeSmartMagnify: {
1764 NSPoint mousePos = [event locationInWindow];
1771 case NSEventTypeRotate: {
1772 NSPoint mousePos = [event locationInWindow];
1780 [event rotation] * -5.0,
1794 NSEvent *
event = (NSEvent *)eventPtr;
1796 unsigned int modifiers;
1797 NSString *characters;
1798 NSData *convertedCharacters;
1800 NSString *charsIgnoringModifiers;
1808 char utf8_buf[6] = {
'\0'};
1810 switch ([event
type]) {
1812 case NSEventTypeKeyDown:
1813 case NSEventTypeKeyUp:
1814 charsIgnoringModifiers = [event charactersIgnoringModifiers];
1815 if ([charsIgnoringModifiers
length] > 0) {
1817 [charsIgnoringModifiers characterAtIndex:0],
1818 [event
type] == NSEventTypeKeyDown ? kUCKeyActionDown :
1824 [event
type] == NSEventTypeKeyDown ? kUCKeyActionDown :
1828 characters = [event characters];
1829 if ([characters
length] > 0) {
1830 convertedCharacters = [characters dataUsingEncoding:NSUTF8StringEncoding];
1832 for (
int x = 0;
x < [convertedCharacters length];
x++) {
1833 utf8_buf[x] = ((
char *)[convertedCharacters bytes])[x];
1853 if ([event
type] == NSEventTypeKeyDown) {
1861 printf(
"Key down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u utf8=%s\n",
1863 [charsIgnoringModifiers
length] > 0 ? [charsIgnoringModifiers characterAtIndex:0] :
1873 printf(
"Key up rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u utf8=%s\n",
1875 [charsIgnoringModifiers
length] > 0 ? [charsIgnoringModifiers characterAtIndex:0] :
1884 case NSEventTypeFlagsChanged:
1885 modifiers = [event modifierFlags];
1887 if ((modifiers & NSEventModifierFlagShift) != (
m_modifierMask & NSEventModifierFlagShift)) {
1895 if ((modifiers & NSEventModifierFlagControl) !=
1898 [event timestamp] * 1000,
1904 if ((modifiers & NSEventModifierFlagOption) !=
1907 [event timestamp] * 1000,
1913 if ((modifiers & NSEventModifierFlagCommand) !=
1916 [event timestamp] * 1000,
1935 #pragma mark Clipboard get/set
1940 size_t pastedTextSize;
1944 NSPasteboard *pasteBoard = [NSPasteboard generalPasteboard];
1946 NSString *textPasted = [pasteBoard stringForType:NSStringPboardType];
1948 if (textPasted == nil) {
1952 pastedTextSize = [textPasted lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
1954 temp_buff = (
char *)malloc(pastedTextSize + 1);
1956 if (temp_buff ==
NULL) {
1960 strncpy(temp_buff, [textPasted cStringUsingEncoding:NSUTF8StringEncoding], pastedTextSize);
1962 temp_buff[pastedTextSize] =
'\0';
1980 NSPasteboard *pasteBoard = NSPasteboard.generalPasteboard;
1981 [pasteBoard declareTypes:@[ NSStringPboardType ] owner:nil];
1982 NSString *textToCopy = [NSString stringWithCString:buffer encoding:NSUTF8StringEncoding];
1983 [pasteBoard setString:textToCopy forType:NSStringPboardType];
typedef float(TangentPoint)[2]
void BLI_kdtree_nd_() free(KDTree *tree)
typedef double(DMatrix)[4][4]
#define GHOST_ASSERT(x, info)
NSNotificationCenter * center
int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG])
static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction)
static bool g_hasFirstFile
static GHOST_TButton convertButton(int button)
static char g_firstFileBuf[512]
@ GHOST_kTrackpadEventMagnify
@ GHOST_kTrackpadEventSmartMagnify
@ GHOST_kTrackpadEventRotate
@ GHOST_kTrackpadEventScroll
@ GHOST_kEventWindowClose
@ GHOST_kEventDraggingDropDone
@ GHOST_kEventDraggingExited
@ GHOST_kEventNativeResolutionChange
@ GHOST_kEventDraggingUpdated
@ GHOST_kEventOpenMainFile
@ GHOST_kEventDraggingEntered
@ GHOST_kEventWindowActivate
@ GHOST_kEventWindowUpdate
@ GHOST_kEventWindowDeactivate
@ GHOST_kEventQuitRequest
static const GHOST_TabletData GHOST_TABLET_DATA_NONE
@ GHOST_kTabletModeEraser
@ GHOST_kTabletModeStylus
void * GHOST_TEventDataPtr
@ GHOST_kKeyNumpadAsterisk
GHOST_TDrawingContextType
@ GHOST_kModifierKeyLeftControl
@ GHOST_kModifierKeyLeftAlt
@ GHOST_kModifierKeyLeftShift
@ GHOST_kDragnDropTypeFilenames
@ GHOST_kDragnDropTypeBitmap
@ GHOST_kDragnDropTypeString
@ GHOST_kButtonMaskButton4
@ GHOST_kButtonMaskButton7
@ GHOST_kButtonMaskButton6
@ GHOST_kButtonMaskButton5
@ GHOST_kButtonMaskMiddle
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble top
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble bottom
struct ImBuf * IMB_allocImBuf(unsigned int x, unsigned int y, unsigned char planes, unsigned int flags)
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
virtual GHOST_TSuccess initialize(void)
virtual bool getValid() const =0
virtual void wrapPoint(int32_t &x, int32_t &y, int32_t ofs, GHOST_TAxisFlag axis)
bool processEvents(bool waitForEvent)
GHOST_TSuccess disposeContext(GHOST_IContext *context)
GHOST_TSuccess handleWindowEvent(GHOST_TEventType eventType, GHOST_WindowCocoa *window)
GHOST_TSuccess handleDraggingEvent(GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType, GHOST_WindowCocoa *window, int mouseX, int mouseY, void *data)
GHOST_IWindow * getWindowUnderCursor(int32_t x, int32_t y)
bool m_needDelayedApplicationBecomeActiveEventProcessing
GHOST_TSuccess handleApplicationBecomeActiveEvent()
GHOST_TSuccess setCursorPosition(int32_t x, int32_t y)
GHOST_TSuccess handleMouseEvent(void *eventPtr)
double m_last_warp_timestamp
void notifyExternalEventProcessed()
GHOST_TSuccess handleKeyEvent(void *eventPtr)
uint8_t getNumDisplays() const
void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const
GHOST_TSuccess getButtons(GHOST_Buttons &buttons) const
void putClipboard(const char *buffer, bool selection) const
void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const
bool m_ignoreWindowSizedMessages
GHOST_TSuccess handleTabletEvent(void *eventPtr, short eventType)
bool m_ignoreMomentumScroll
bool handleOpenDocumentRequest(void *filepathStr)
GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const
uint64_t getMilliSeconds() const
char * getClipboard(bool selection) const
bool m_outsideLoopEventProcessed
GHOST_TSuccess setMouseCursorPosition(int32_t x, int32_t y)
GHOST_IContext * createOffscreenContext(GHOST_GLSettings glSettings)
GHOST_TSuccess getCursorPosition(int32_t &x, int32_t &y) const
GHOST_IWindow * createWindow(const char *title, int32_t left, int32_t top, uint32_t width, uint32_t height, GHOST_TWindowState state, GHOST_TDrawingContextType type, GHOST_GLSettings glSettings, const bool exclusive=false, const bool is_dialog=false, const GHOST_IWindow *parentWindow=NULL)
bool m_multitouchGestures
virtual GHOST_TSuccess init()
GHOST_TimerManager * getTimerManager() const
GHOST_WindowManager * m_windowManager
bool validWindow(GHOST_IWindow *window)
GHOST_TSuccess pushEvent(GHOST_IEvent *event)
GHOST_DisplayManager * m_displayManager
bool fireTimers(uint64_t time)
void clientToScreenIntern(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const
void getClientBounds(GHOST_Rect &bounds) const
void * getOSWindow() const
void setNativePixelSize(void)
void screenToClientIntern(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const
GHOST_TabletData & GetCocoaTabletData()
void loadCursor(bool visible, GHOST_TStandardCursor cursor) const
void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const
GHOST_TSuccess addWindow(GHOST_IWindow *window)
GHOST_IWindow * getActiveWindow(void) const
GHOST_IWindow * getWindowAssociatedWithOSWindow(void *osWindow)
const std::vector< GHOST_IWindow * > & getWindows() const
GHOST_TSuccess setActiveWindow(GHOST_IWindow *window)
void setWindowInactive(const GHOST_IWindow *window)
GHOST_TSuccess getCursorGrabBounds(GHOST_Rect &bounds)
bool getCursorVisibility() const
void setCursorGrabAccum(int32_t x, int32_t y)
void getCursorGrabInitPos(int32_t &x, int32_t &y) const
GHOST_TAxisFlag getCursorGrabAxis() const
GHOST_TGrabCursorMode getCursorGrabMode() const
GHOST_TSuccess updateDrawingContext()
GHOST_TStandardCursor getCursorShape() const
bool getCursorGrabModeIsWarp() const
void getCursorGrabAccum(int32_t &x, int32_t &y) const
SyclQueue void void size_t num_bytes void
GHOST_SystemCocoa * systemCocoa
void setSystemCocoa:(GHOST_SystemCocoa *sysCocoa)
ccl_global float * buffer
T length(const vec_base< T, Size > &a)
unsigned __int64 uint64_t
void set(GHOST_TModifierKey mask, bool down)
void WM_exit(bContext *C)
Main exit function to close Blender ordinarily.