35 #if defined(WITH_GL_EGL)
41 #ifdef WITH_INPUT_NDOF
45 #include "AssertMacros.h"
47 #import <Cocoa/Cocoa.h>
50 #include <Carbon/Carbon.h>
52 #include <sys/sysctl.h>
54 #include <sys/types.h>
56 #include <mach/mach_time.h>
58 #pragma mark KeyMap, mouse converters
122 case kVK_ISO_Section:
145 case kVK_ANSI_Keypad0:
147 case kVK_ANSI_Keypad1:
149 case kVK_ANSI_Keypad2:
151 case kVK_ANSI_Keypad3:
153 case kVK_ANSI_Keypad4:
155 case kVK_ANSI_Keypad5:
157 case kVK_ANSI_Keypad6:
159 case kVK_ANSI_Keypad7:
161 case kVK_ANSI_Keypad8:
163 case kVK_ANSI_Keypad9:
165 case kVK_ANSI_KeypadDecimal:
167 case kVK_ANSI_KeypadEnter:
169 case kVK_ANSI_KeypadPlus:
171 case kVK_ANSI_KeypadMinus:
173 case kVK_ANSI_KeypadMultiply:
175 case kVK_ANSI_KeypadDivide:
177 case kVK_ANSI_KeypadClear:
234 case kVK_ForwardDelete:
271 if ((recvChar >=
'A') && (recvChar <=
'Z')) {
274 else if ((recvChar >=
'a') && (recvChar <=
'z')) {
279 CFDataRef uchrHandle;
280 TISInputSourceRef kbdTISHandle;
282 kbdTISHandle = TISCopyCurrentKeyboardLayoutInputSource();
283 uchrHandle = (CFDataRef)TISGetInputSourceProperty(kbdTISHandle,
284 kTISPropertyUnicodeKeyLayoutData);
285 CFRelease(kbdTISHandle);
291 UInt32 deadKeyState = 0;
292 UniCharCount actualStrLength = 0;
294 UCKeyTranslate((UCKeyboardLayout *)CFDataGetBytePtr(uchrHandle),
299 kUCKeyTranslateNoDeadKeysBit,
340 #pragma mark Utility functions
342 #define FIRSTFILEBUFLG 512
360 #pragma mark Cocoa objects
375 - (void)applicationDidFinishLaunching:(NSNotification *)aNotification;
376 - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename;
377 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
378 - (void)applicationWillTerminate:(NSNotification *)aNotification;
379 - (void)applicationWillBecomeActive:(NSNotification *)aNotification;
380 - (void)toggleFullScreen:(NSNotification *)notification;
381 - (void)windowWillClose:(NSNotification *)notification;
388 NSNotificationCenter *
center = [NSNotificationCenter defaultCenter];
389 [center addObserver:self
390 selector:@selector(windowWillClose:)
391 name:NSWindowWillCloseNotification
398 NSNotificationCenter *
center = [NSNotificationCenter defaultCenter];
399 [center removeObserver:self name:NSWindowWillCloseNotification object:nil];
408 - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
415 [NSApp activateIgnoringOtherApps:YES];
418 [NSEvent setMouseCoalescingEnabled:NO];
421 - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
426 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
432 return NSTerminateCancel;
438 - (void)applicationWillTerminate:(NSNotification *)aNotification
444 - (void)applicationWillBecomeActive:(NSNotification *)aNotification
449 - (void)toggleFullScreen:(NSNotification *)notification
467 - (void)windowWillClose:(NSNotification *)notification
469 NSWindow *closing_window = (NSWindow *)[notification
object];
470 NSInteger index = [[NSApp orderedWindows] indexOfObject:closing_window];
471 if (index != NSNotFound) {
475 for (NSWindow *current_window in [NSApp orderedWindows]) {
476 if (current_window == closing_window) {
479 if ([current_window isOnActiveSpace] && [current_window canBecomeKeyWindow]) {
480 [current_window makeKeyAndOrderFront:nil];
486 for (NSNumber *window_number in [NSWindow windowNumbersWithOptions:0]) {
487 NSWindow *current_window = [NSApp windowWithWindowNumber:[window_number integerValue]];
488 if (current_window == closing_window) {
491 if ([current_window canBecomeKeyWindow]) {
492 [current_window makeKeyAndOrderFront:nil];
500 #pragma mark initialization/finalization
505 struct timeval boottime;
507 char *rstring =
NULL;
518 mib[1] = KERN_BOOTTIME;
519 len =
sizeof(
struct timeval);
521 sysctl(mib, 2, &boottime, &
len,
NULL, 0);
522 m_start_time = ((boottime.tv_sec * 1000) + (boottime.tv_usec / 1000));
528 rstring = (
char *)malloc(
len);
529 sysctl(mib, 2, rstring, &
len,
NULL, 0);
549 #ifdef WITH_INPUT_NDOF
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())
795 NSPoint mouseLoc = [NSEvent mouseLocation];
814 CGAssociateMouseAndMouseCursorPosition(
false);
816 CGAssociateMouseAndMouseCursorPosition(
true);
828 float xf = (
float)
x, yf = (
float)
y;
834 NSScreen *windowScreen = window->
getScreen();
835 NSRect screenRect = [windowScreen frame];
838 xf -= screenRect.origin.x;
839 yf -= screenRect.origin.y;
842 yf = screenRect.size.height - yf;
844 CGDisplayMoveCursorToPoint((CGDirectDisplayID)[[[windowScreen deviceDescription]
845 objectForKey:
@"NSScreenNumber"] unsignedIntValue],
846 CGPointMake(xf, yf));
853 CGAssociateMouseAndMouseCursorPosition(
true);
872 UInt32 button_state = GetCurrentEventButtonState();
883 #pragma mark Event handlers
890 bool anyProcessed =
false;
903 timeOut = kEventDurationForever;
911 ::ReceiveNextEvent(0,
NULL, timeOut,
false, &event);
920 event = [NSApp nextEventMatchingMask:NSEventMaskAny
921 untilDate:[NSDate distantPast]
922 inMode:NSDefaultRunLoopMode
938 if ([event
type] == NSEventTypeKeyDown && [event keyCode] == kVK_Tab &&
939 ([event modifierFlags] & NSEventModifierFlagControl)) {
946 if ([event
type] == NSEventTypeKeyUp &&
947 ([event modifierFlags] & (NSEventModifierFlagCommand | NSEventModifierFlagOption)))
950 [NSApp sendEvent:event];
953 }
while (event != nil);
955 }
while (waitForEvent && !anyProcessed);
977 [window->getCocoaWindow() makeKeyAndOrderFront:nil];
983 unsigned int modifiers;
993 modifiers = [[[NSApplication sharedApplication] currentEvent] modifierFlags];
995 if ((modifiers & NSEventModifierFlagShift) != (
m_modifierMask & NSEventModifierFlagShift)) {
1003 if ((modifiers & NSEventModifierFlagControl) != (
m_modifierMask & NSEventModifierFlagControl)) {
1011 if ((modifiers & NSEventModifierFlagOption) != (
m_modifierMask & NSEventModifierFlagOption)) {
1019 if ((modifiers & NSEventModifierFlagCommand) != (
m_modifierMask & NSEventModifierFlagCommand)) {
1054 NSArray *windowsList;
1055 windowsList = [NSApp orderedWindows];
1059 switch (eventType) {
1125 switch (eventType) {
1136 NSArray *droppedArray;
1137 size_t pastedTextSize;
1138 NSString *droppedStr;
1145 switch (draggedObjectType) {
1147 droppedArray = (NSArray *)
data;
1153 strArray->
count = [droppedArray count];
1154 if (strArray->
count == 0) {
1161 for (i = 0; i < strArray->
count; i++) {
1162 droppedStr = [droppedArray objectAtIndex:i];
1164 pastedTextSize = [droppedStr lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
1165 temp_buff = (
GHOST_TUns8 *)malloc(pastedTextSize + 1);
1168 strArray->
count = i;
1172 strncpy((
char *)temp_buff,
1173 [droppedStr cStringUsingEncoding:NSUTF8StringEncoding],
1175 temp_buff[pastedTextSize] =
'\0';
1177 strArray->
strings[i] = temp_buff;
1184 droppedStr = (NSString *)
data;
1185 pastedTextSize = [droppedStr lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
1187 temp_buff = (
GHOST_TUns8 *)malloc(pastedTextSize + 1);
1189 if (temp_buff ==
NULL) {
1193 strncpy((
char *)temp_buff,
1194 [droppedStr cStringUsingEncoding:NSUTF8StringEncoding],
1197 temp_buff[pastedTextSize] =
'\0';
1203 NSImage *droppedImg = (NSImage *)
data;
1204 NSSize imgSize = [droppedImg size];
1209 int x,
y, to_i, from_i;
1210 NSBitmapImageRep *blBitmapFormatImageRGB, *blBitmapFormatImageRGBA, *bitmapImage = nil;
1211 NSEnumerator *enumerator;
1212 NSImageRep *representation;
1216 [droppedImg release];
1221 enumerator = [[droppedImg representations] objectEnumerator];
1222 while ((representation = [enumerator nextObject])) {
1223 if ([representation isKindOfClass:[NSBitmapImageRep
class]]) {
1224 bitmapImage = (NSBitmapImageRep *)representation;
1228 if (bitmapImage == nil)
1231 if (([bitmapImage bitsPerPixel] == 32) && (([bitmapImage bitmapFormat] & 0x5) == 0) &&
1232 ![bitmapImage isPlanar]) {
1235 rasterRGB = (
GHOST_TUns8 *)[bitmapImage bitmapData];
1236 for (
y = 0;
y < imgSize.height;
y++) {
1237 to_i = (imgSize.height -
y - 1) * imgSize.width;
1238 from_i =
y * imgSize.width;
1239 memcpy(toIBuf + 4 * to_i, rasterRGB + 4 * from_i, 4 * imgSize.width);
1244 [bitmapImage setSize:imgSize];
1252 blBitmapFormatImageRGB = [[NSBitmapImageRep alloc]
1253 initWithBitmapDataPlanes:NULL
1254 pixelsWide:imgSize.width
1255 pixelsHigh:imgSize.height
1260 colorSpaceName:NSDeviceRGBColorSpace
1261 bitmapFormat:(NSBitmapFormat)0
1262 bytesPerRow:4 * imgSize.width
1265 [NSGraphicsContext saveGraphicsState];
1267 setCurrentContext:[NSGraphicsContext
1268 graphicsContextWithBitmapImageRep:blBitmapFormatImageRGB]];
1270 [NSGraphicsContext restoreGraphicsState];
1272 rasterRGB = (
GHOST_TUns8 *)[blBitmapFormatImageRGB bitmapData];
1273 if (rasterRGB ==
NULL) {
1274 [bitmapImage release];
1275 [blBitmapFormatImageRGB release];
1276 [droppedImg release];
1281 blBitmapFormatImageRGBA = [[NSBitmapImageRep alloc]
1282 initWithBitmapDataPlanes:NULL
1283 pixelsWide:imgSize.width
1284 pixelsHigh:imgSize.height
1289 colorSpaceName:NSDeviceRGBColorSpace
1290 bitmapFormat:(NSBitmapFormat)0
1291 bytesPerRow:4 * imgSize.width
1294 [NSGraphicsContext saveGraphicsState];
1296 setCurrentContext:[NSGraphicsContext
1297 graphicsContextWithBitmapImageRep:blBitmapFormatImageRGBA]];
1299 [NSGraphicsContext restoreGraphicsState];
1301 rasterRGBA = (
GHOST_TUns8 *)[blBitmapFormatImageRGBA bitmapData];
1302 if (rasterRGBA ==
NULL) {
1303 [bitmapImage release];
1304 [blBitmapFormatImageRGB release];
1305 [blBitmapFormatImageRGBA release];
1306 [droppedImg release];
1312 for (
y = 0;
y < imgSize.height;
y++) {
1313 for (
x = 0;
x < imgSize.width;
x++) {
1314 to_i = (imgSize.height -
y - 1) * imgSize.width +
x;
1315 from_i =
y * imgSize.width +
x;
1317 toIBuf[4 * to_i] = rasterRGB[4 * from_i];
1318 toIBuf[4 * to_i + 1] = rasterRGB[4 * from_i + 1];
1319 toIBuf[4 * to_i + 2] = rasterRGB[4 * from_i + 2];
1320 toIBuf[4 * to_i + 3] = rasterRGBA[4 * from_i + 3];
1324 [blBitmapFormatImageRGB release];
1325 [blBitmapFormatImageRGBA release];
1326 [droppedImg release];
1338 getMilliSeconds(), eventType, draggedObjectType, window, mouseX, mouseY, eventData));
1364 NSString *filepath = (NSString *)filepathStr;
1365 NSArray *windowsList;
1367 size_t filenameTextSize;
1371 windowsList = [NSApp orderedWindows];
1372 if ([windowsList
count]) {
1373 [[windowsList objectAtIndex:0] makeKeyAndOrderFront:nil];
1388 filenameTextSize = [filepath lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
1389 temp_buff = (
char *)malloc(filenameTextSize + 1);
1391 if (temp_buff ==
NULL) {
1395 strncpy(temp_buff, [filepath cStringUsingEncoding:NSUTF8StringEncoding], filenameTextSize);
1396 temp_buff[filenameTextSize] =
'\0';
1406 NSEvent *
event = (NSEvent *)eventPtr;
1417 switch (eventType) {
1418 case NSEventTypeTabletPoint:
1426 ct.
Xtilt = [event tilt].x;
1427 ct.
Ytilt = [event tilt].y;
1430 case NSEventTypeTabletProximity:
1433 if ([event isEnteringProximity]) {
1435 switch ([event pointingDeviceType]) {
1436 case NSPointingDeviceTypePen:
1439 case NSPointingDeviceTypeEraser:
1442 case NSPointingDeviceTypeCursor:
1443 case NSPointingDeviceTypeUnknown:
1451 GHOST_ASSERT(
FALSE,
"GHOST_SystemCocoa::handleTabletEvent : unknown event received");
1460 NSEvent *
event = (NSEvent *)eventPtr;
1462 switch ([event subtype]) {
1463 case NSEventSubtypeTabletPoint:
1466 case NSEventSubtypeTabletProximity:
1477 NSEvent *
event = (NSEvent *)eventPtr;
1485 (
void *)[event window]);
1496 switch ([event
type]) {
1497 case NSEventTypeLeftMouseDown:
1503 window -> GetCocoaTabletData()));
1505 case NSEventTypeRightMouseDown:
1511 window -> GetCocoaTabletData()));
1513 case NSEventTypeOtherMouseDown:
1519 window -> GetCocoaTabletData()));
1522 case NSEventTypeLeftMouseUp:
1528 window -> GetCocoaTabletData()));
1530 case NSEventTypeRightMouseUp:
1536 window -> GetCocoaTabletData()));
1538 case NSEventTypeOtherMouseUp:
1544 window -> GetCocoaTabletData()));
1547 case NSEventTypeLeftMouseDragged:
1548 case NSEventTypeRightMouseDragged:
1549 case NSEventTypeOtherMouseDragged:
1552 case NSEventTypeMouseMoved: {
1556 bool is_tablet =
false;
1562 switch (grab_mode) {
1571 x_accum += [event deltaX];
1582 window -> GetCocoaTabletData()));
1587 NSTimeInterval timestamp = [event timestamp];
1594 NSPoint mousePos = [event locationInWindow];
1608 correctedBounds.
m_b = (windowBounds.
m_b - windowBounds.
m_t) - correctedBounds.
m_b;
1609 correctedBounds.
m_t = (windowBounds.
m_b - windowBounds.
m_t) - correctedBounds.
m_t;
1623 if (x_mouse != warped_x_mouse || y_mouse != warped_y_mouse) {
1628 y_accum + (y_mouse - warped_y_mouse));
1642 window -> GetCocoaTabletData()));
1647 NSPoint mousePos = [event locationInWindow];
1656 window -> GetCocoaTabletData()));
1662 case NSEventTypeScrollWheel: {
1663 NSEventPhase momentumPhase = NSEventPhaseNone;
1664 NSEventPhase phase = NSEventPhaseNone;
1666 momentumPhase = [event momentumPhase];
1667 phase = [event phase];
1673 if (momentumPhase) {
1684 if (phase == NSEventPhaseBegan)
1686 else if (phase == NSEventPhaseEnded)
1694 double deltaF = [event deltaY];
1697 deltaF = [event deltaX];
1701 delta = deltaF > 0.0 ? 1 : -1;
1705 NSPoint mousePos = [event locationInWindow];
1711 dx = [event scrollingDeltaX];
1712 dy = [event scrollingDeltaY];
1716 if (phase == NSEventPhaseNone && momentumPhase == NSEventPhaseNone) {
1717 dx = [event deltaX];
1718 dy = [event deltaY];
1722 NSPoint delta = [[cocoawindow contentView] convertPointToBacking:NSMakePoint(dx, dy)];
1730 [event isDirectionInvertedFromDevice]));
1734 case NSEventTypeMagnify: {
1735 NSPoint mousePos = [event locationInWindow];
1743 [event magnification] * 125.0 + 0.1,
1748 case NSEventTypeSmartMagnify: {
1749 NSPoint mousePos = [event locationInWindow];
1756 case NSEventTypeRotate: {
1757 NSPoint mousePos = [event locationInWindow];
1765 [event rotation] * -5.0,
1779 NSEvent *
event = (NSEvent *)eventPtr;
1781 unsigned int modifiers;
1782 NSString *characters;
1783 NSData *convertedCharacters;
1785 unsigned char ascii;
1786 NSString *charsIgnoringModifiers;
1794 char utf8_buf[6] = {
'\0'};
1797 switch ([event
type]) {
1799 case NSEventTypeKeyDown:
1800 case NSEventTypeKeyUp:
1801 charsIgnoringModifiers = [event charactersIgnoringModifiers];
1802 if ([charsIgnoringModifiers
length] > 0) {
1804 [charsIgnoringModifiers characterAtIndex:0],
1805 [event
type] == NSEventTypeKeyDown ? kUCKeyActionDown :
1811 [event
type] == NSEventTypeKeyDown ? kUCKeyActionDown :
1816 characters = [event characters];
1817 if ([characters
length] > 0) {
1818 convertedCharacters = [characters dataUsingEncoding:NSUTF8StringEncoding];
1820 for (
int x = 0;
x < [convertedCharacters length];
x++) {
1821 utf8_buf[x] = ((
char *)[convertedCharacters bytes])[x];
1842 if (utf8_buf[0] && !utf8_buf[1]) {
1843 ascii = utf8_buf[0];
1846 if ([event
type] == NSEventTypeKeyDown) {
1853 [event isARepeat]));
1855 printf(
"Key down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",
1857 [charsIgnoringModifiers
length] > 0 ? [charsIgnoringModifiers characterAtIndex:0] :
1869 printf(
"Key up rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",
1871 [charsIgnoringModifiers
length] > 0 ? [charsIgnoringModifiers characterAtIndex:0] :
1882 case NSEventTypeFlagsChanged:
1883 modifiers = [event modifierFlags];
1885 if ((modifiers & NSEventModifierFlagShift) != (
m_modifierMask & NSEventModifierFlagShift)) {
1893 if ((modifiers & NSEventModifierFlagControl) !=
1896 [event timestamp] * 1000,
1902 if ((modifiers & NSEventModifierFlagOption) !=
1905 [event timestamp] * 1000,
1911 if ((modifiers & NSEventModifierFlagCommand) !=
1914 [event timestamp] * 1000,
1933 #pragma mark Clipboard get/set
1938 size_t pastedTextSize;
1942 NSPasteboard *pasteBoard = [NSPasteboard generalPasteboard];
1944 NSString *textPasted = [pasteBoard stringForType:NSStringPboardType];
1946 if (textPasted == nil) {
1950 pastedTextSize = [textPasted lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
1952 temp_buff = (
GHOST_TUns8 *)malloc(pastedTextSize + 1);
1954 if (temp_buff ==
NULL) {
1959 (
char *)temp_buff, [textPasted cStringUsingEncoding:NSUTF8StringEncoding], pastedTextSize);
1961 temp_buff[pastedTextSize] =
'\0';
1979 NSPasteboard *pasteBoard = NSPasteboard.generalPasteboard;
1980 [pasteBoard declareTypes:@[ NSStringPboardType ] owner:nil];
1981 NSString *textToCopy = [NSString stringWithCString:buffer encoding:NSUTF8StringEncoding];
1982 [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
static GHOST_TButtonMask convertButton(int button)
int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG])
static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction)
static bool g_hasFirstFile
static char g_firstFileBuf[512]
@ GHOST_kTrackpadEventMagnify
@ GHOST_kTrackpadEventSmartMagnify
@ GHOST_kTrackpadEventRotate
@ GHOST_kTrackpadEventScroll
unsigned int GHOST_TUns32
unsigned long long GHOST_TUns64
@ GHOST_kEventWindowClose
@ GHOST_kEventDraggingDropDone
@ GHOST_kEventDraggingExited
@ GHOST_kEventNativeResolutionChange
@ GHOST_kEventDraggingUpdated
@ GHOST_kEventOpenMainFile
@ GHOST_kEventDraggingEntered
@ GHOST_kEventButtonUp
Mouse button event.
@ GHOST_kEventWindowActivate
@ GHOST_kEventWindowUpdate
@ GHOST_kEventWindowDeactivate
@ GHOST_kEventButtonDown
Mouse move event.
@ GHOST_kEventKeyDown
Trackpad event.
@ GHOST_kEventQuitRequest
static const GHOST_TabletData GHOST_TABLET_DATA_NONE
@ GHOST_kTabletModeEraser
@ GHOST_kTabletModeStylus
void * GHOST_TEventDataPtr
@ GHOST_kKeyNumpadAsterisk
GHOST_TDrawingContextType
@ GHOST_kButtonMaskButton4
@ GHOST_kButtonMaskButton7
@ GHOST_kButtonMaskButton6
@ GHOST_kButtonMaskButton5
@ GHOST_kButtonMaskMiddle
@ GHOST_kModifierKeyLeftControl
@ GHOST_kModifierKeyLeftAlt
@ GHOST_kModifierKeyLeftShift
@ GHOST_kDragnDropTypeFilenames
@ GHOST_kDragnDropTypeBitmap
@ GHOST_kDragnDropTypeString
unsigned char GHOST_TUns8
_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 type
_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 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)
SIMD_FORCE_INLINE btScalar length(const btQuaternion &q)
Return the length of a quaternion.
virtual GHOST_TSuccess initialize(void)
virtual bool getValid() const =0
virtual void wrapPoint(GHOST_TInt32 &x, GHOST_TInt32 &y, GHOST_TInt32 ofs, GHOST_TAxisFlag axis)
bool processEvents(bool waitForEvent)
GHOST_TSuccess setMouseCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
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)
void putClipboard(GHOST_TInt8 *buffer, bool selection) const
bool m_needDelayedApplicationBecomeActiveEventProcessing
GHOST_TSuccess handleApplicationBecomeActiveEvent()
GHOST_TSuccess handleMouseEvent(void *eventPtr)
double m_last_warp_timestamp
void notifyExternalEventProcessed()
GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
GHOST_TSuccess handleKeyEvent(void *eventPtr)
GHOST_TUns64 getMilliSeconds() const
GHOST_TUns8 getNumDisplays() const
GHOST_TSuccess getButtons(GHOST_Buttons &buttons) const
GHOST_TUns32 m_modifierMask
void getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &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
bool m_outsideLoopEventProcessed
GHOST_IContext * createOffscreenContext(GHOST_GLSettings glSettings)
GHOST_IWindow * createWindow(const char *title, GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height, GHOST_TWindowState state, GHOST_TDrawingContextType type, GHOST_GLSettings glSettings, const bool exclusive=false, const bool is_dialog=false, const GHOST_IWindow *parentWindow=NULL)
GHOST_TSuccess getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 &y) const
GHOST_TUns64 m_start_time
GHOST_TUns8 * getClipboard(bool selection) const
void getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
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
GHOST_TUns64 nextFireTime()
bool fireTimers(GHOST_TUns64 time)
void clientToScreenIntern(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32 &outX, GHOST_TInt32 &outY) const
void getClientBounds(GHOST_Rect &bounds) const
void * getOSWindow() const
void screenToClientIntern(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32 &outX, GHOST_TInt32 &outY) const
void setNativePixelSize(void)
void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32 &outX, GHOST_TInt32 &outY) const
GHOST_TabletData & GetCocoaTabletData()
void loadCursor(bool visible, GHOST_TStandardCursor cursor) 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
GHOST_TAxisFlag getCursorGrabAxis() const
void getCursorGrabInitPos(GHOST_TInt32 &x, GHOST_TInt32 &y) const
void setCursorGrabAccum(GHOST_TInt32 x, GHOST_TInt32 y)
GHOST_TGrabCursorMode getCursorGrabMode() const
void getCursorGrabAccum(GHOST_TInt32 &x, GHOST_TInt32 &y) const
GHOST_TSuccess updateDrawingContext()
GHOST_TStandardCursor getCursorShape() const
bool getCursorGrabModeIsWarp() const
GHOST_SystemCocoa * systemCocoa
void setSystemCocoa:(GHOST_SystemCocoa *sysCocoa)
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int ccl_global float * buffer
struct SELECTID_Context context
void set(GHOST_TModifierKeyMask mask, bool down)