summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llprimitive/lldaeloader.cpp2
-rw-r--r--indra/llwindow/llopenglview-objc.h13
-rw-r--r--indra/llwindow/llopenglview-objc.mm82
-rw-r--r--indra/llwindow/llwindowmacosx-objc.mm3
-rw-r--r--indra/newview/llappdelegate-objc.mm2
-rw-r--r--indra/newview/llappviewermacosx-objc.h3
-rw-r--r--indra/newview/llappviewermacosx-objc.mm39
-rw-r--r--indra/newview/llfilepicker_mac.mm6
-rw-r--r--indra/newview/llfloateremojipicker.cpp4
-rw-r--r--indra/newview/llfloateruipreview.cpp3
10 files changed, 36 insertions, 121 deletions
diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp
index 0759447902..4c028e7128 100644
--- a/indra/llprimitive/lldaeloader.cpp
+++ b/indra/llprimitive/lldaeloader.cpp
@@ -1314,7 +1314,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
{
//Build a joint for the resolver to work with
char str[64]={0};
- sprintf(str,"./%s",(*jointIt).first.c_str() );
+ snprintf(str, sizeof(str), "./%s",(*jointIt).first.c_str() );
//LL_WARNS()<<"Joint "<< str <<LL_ENDL;
//Setup the resolver
diff --git a/indra/llwindow/llopenglview-objc.h b/indra/llwindow/llopenglview-objc.h
index 97f4125484..a528d7547f 100644
--- a/indra/llwindow/llopenglview-objc.h
+++ b/indra/llwindow/llopenglview-objc.h
@@ -88,9 +88,6 @@
@interface LLNSWindow : NSWindow
-- (NSPoint)convertToScreenFromLocalPoint:(NSPoint)point relativeToView:(NSView *)view;
-- (NSPoint)flipPoint:(NSPoint)aPoint;
-
@end
@interface NSScreen (PointConversion)
@@ -100,16 +97,6 @@
*/
+ (NSScreen *)currentScreenForMouseLocation;
-/*
- Allows you to convert a point from global coordinates to the current screen coordinates.
- */
-- (NSPoint)convertPointToScreenCoordinates:(NSPoint)aPoint;
-
-/*
- Allows to flip the point coordinates, so y is 0 at the top instead of the bottom. x remains the same
- */
-- (NSPoint)flipPoint:(NSPoint)aPoint;
-
@end
#endif
diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm
index 4e5b882011..36ae9c60a0 100644
--- a/indra/llwindow/llopenglview-objc.mm
+++ b/indra/llwindow/llopenglview-objc.mm
@@ -28,6 +28,8 @@
#import "llwindowmacosx-objc.h"
#import "llappdelegate-objc.h"
+#import <Carbon/Carbon.h>
+
extern BOOL gHiDPISupport;
#pragma mark local functions
@@ -105,20 +107,6 @@ attributedStringInfo getSegments(NSAttributedString *str)
return screen;
}
-
-- (NSPoint)convertPointToScreenCoordinates:(NSPoint)aPoint
-{
- float normalizedX = fabs(fabs(self.frame.origin.x) - fabs(aPoint.x));
- float normalizedY = aPoint.y - self.frame.origin.y;
-
- return NSMakePoint(normalizedX, normalizedY);
-}
-
-- (NSPoint)flipPoint:(NSPoint)aPoint
-{
- return NSMakePoint(aPoint.x, self.frame.size.height - aPoint.y);
-}
-
@end
@implementation LLOpenGLView
@@ -244,7 +232,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
- (id) initWithFrame:(NSRect)frame withSamples:(NSUInteger)samples andVsync:(BOOL)vsync
{
- [self registerForDraggedTypes:[NSArray arrayWithObject:NSURLPboardType]];
+ [self registerForDraggedTypes:[NSArray arrayWithObject:NSPasteboardTypeURL]];
[self initWithFrame:frame];
// Initialize with a default "safe" pixel format that will work with versions dating back to OS X 10.6.
@@ -295,13 +283,13 @@ attributedStringInfo getSegments(NSAttributedString *str)
if (vsync)
{
GLint value = 1;
- [glContext setValues:&value forParameter:NSOpenGLCPSwapInterval];
+ [glContext setValues:&value forParameter:NSOpenGLContextParameterSwapInterval];
} else {
// supress this error after move to Xcode 7:
// error: null passed to a callee that requires a non-null argument [-Werror,-Wnonnull]
// Tried using ObjC 'nonnull' keyword as per SO article but didn't build
GLint swapInterval=0;
- [glContext setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval];
+ [glContext setValues:&swapInterval forParameter:NSOpenGLContextParameterSwapInterval];
}
mOldResize = false;
@@ -355,13 +343,13 @@ attributedStringInfo getSegments(NSAttributedString *str)
mMousePos[1] = mPoint.y;
// Apparently people still use this?
- if ([theEvent modifierFlags] & NSCommandKeyMask &&
- !([theEvent modifierFlags] & NSControlKeyMask) &&
- !([theEvent modifierFlags] & NSShiftKeyMask) &&
- !([theEvent modifierFlags] & NSAlternateKeyMask) &&
- !([theEvent modifierFlags] & NSAlphaShiftKeyMask) &&
- !([theEvent modifierFlags] & NSFunctionKeyMask) &&
- !([theEvent modifierFlags] & NSHelpKeyMask))
+ if ([theEvent modifierFlags] & NSEventModifierFlagCommand &&
+ !([theEvent modifierFlags] & NSEventModifierFlagControl) &&
+ !([theEvent modifierFlags] & NSEventModifierFlagShift) &&
+ !([theEvent modifierFlags] & NSEventModifierFlagOption) &&
+ !([theEvent modifierFlags] & NSEventModifierFlagCapsLock) &&
+ !([theEvent modifierFlags] & NSEventModifierFlagFunction) &&
+ !([theEvent modifierFlags] & NSEventModifierFlagHelp))
{
callRightMouseDown(mMousePos, [theEvent modifierFlags]);
mSimulatedRightClick = true;
@@ -511,7 +499,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
if (acceptsText &&
!mMarkedTextAllowed &&
- !(mModifiers & (NSControlKeyMask | NSCommandKeyMask)) && // commands don't invoke InputWindow
+ !(mModifiers & (NSEventModifierFlagControl | NSEventModifierFlagCommand)) && // commands don't invoke InputWindow
![(LLAppDelegate*)[NSApp delegate] romanScript] &&
ch > ' ' &&
ch != NSDeleteCharacter &&
@@ -534,14 +522,14 @@ attributedStringInfo getSegments(NSAttributedString *str)
NSInteger mask = 0;
switch([theEvent keyCode])
{
- case 56:
- mask = NSShiftKeyMask;
+ case kVK_Shift:
+ mask = NSEventModifierFlagShift;
break;
- case 58:
- mask = NSAlternateKeyMask;
+ case kVK_Option:
+ mask = NSEventModifierFlagOption;
break;
- case 59:
- mask = NSControlKeyMask;
+ case kVK_Control:
+ mask = NSEventModifierFlagControl;
break;
default:
return;
@@ -582,7 +570,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
pboard = [sender draggingPasteboard];
- if ([[pboard types] containsObject:NSURLPboardType])
+ if ([[pboard types] containsObject:NSPasteboardTypeURL])
{
if (sourceDragMask & NSDragOperationLink) {
NSURL *fileUrl = [[pboard readObjectsForClasses:[NSArray arrayWithObject:[NSURL class]] options:[NSDictionary dictionary]] objectAtIndex:0];
@@ -657,7 +645,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
};
int string_length = [aString length];
- unichar text[string_length];
+ unichar* text = (unichar*)malloc(sizeof(unichar) * string_length);
attributedStringInfo segments;
// I used 'respondsToSelector:@selector(string)'
// to judge aString is an attributed string or not.
@@ -675,6 +663,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
segments.seg_standouts.push_back(true);
}
setMarkedText(text, selected, replacement, string_length, segments);
+ free(text);
if (string_length > 0)
{
mHasMarkedText = TRUE;
@@ -783,9 +772,9 @@ attributedStringInfo getSegments(NSAttributedString *str)
- (void) insertNewline:(id)sender
{
- if (!(mModifiers & NSCommandKeyMask) &&
- !(mModifiers & NSShiftKeyMask) &&
- !(mModifiers & NSAlternateKeyMask))
+ if (!(mModifiers & NSEventModifierFlagCommand) &&
+ !(mModifiers & NSEventModifierFlagShift) &&
+ !(mModifiers & NSEventModifierFlagOption))
{
callUnicodeCallback(13, 0);
} else {
@@ -904,27 +893,6 @@ attributedStringInfo getSegments(NSAttributedString *str)
return self;
}
-- (NSPoint)convertToScreenFromLocalPoint:(NSPoint)point relativeToView:(NSView *)view
-{
- NSScreen *currentScreen = [NSScreen currentScreenForMouseLocation];
- if(currentScreen)
- {
- NSPoint windowPoint = [view convertPoint:point toView:nil];
- NSPoint screenPoint = [[view window] convertBaseToScreen:windowPoint];
- NSPoint flippedScreenPoint = [currentScreen flipPoint:screenPoint];
- flippedScreenPoint.y += [currentScreen frame].origin.y;
-
- return flippedScreenPoint;
- }
-
- return NSZeroPoint;
-}
-
-- (NSPoint)flipPoint:(NSPoint)aPoint
-{
- return NSMakePoint(aPoint.x, self.frame.size.height - aPoint.y);
-}
-
- (BOOL) becomeFirstResponder
{
callFocus();
diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm
index 2e75d309ea..41b1e3195c 100644
--- a/indra/llwindow/llwindowmacosx-objc.mm
+++ b/indra/llwindow/llwindowmacosx-objc.mm
@@ -213,7 +213,8 @@ OSErr setImageCursor(CursorRef ref)
NSWindowRef createNSWindow(int x, int y, int width, int height)
{
LLNSWindow *window = [[LLNSWindow alloc]initWithContentRect:NSMakeRect(x, y, width, height)
- styleMask:NSTitledWindowMask | NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTexturedBackgroundWindowMask backing:NSBackingStoreBuffered defer:NO];
+ styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskResizable | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable
+ backing:NSBackingStoreBuffered defer:NO];
[window makeKeyAndOrderFront:nil];
[window setAcceptsMouseMovedEvents:TRUE];
[window setRestorable:FALSE]; // Viewer manages state from own settings
diff --git a/indra/newview/llappdelegate-objc.mm b/indra/newview/llappdelegate-objc.mm
index d4b05dde72..b8fd3dc189 100644
--- a/indra/newview/llappdelegate-objc.mm
+++ b/indra/newview/llappdelegate-objc.mm
@@ -372,7 +372,7 @@ struct AttachmentInfo
- (void)sendEvent:(NSEvent *)event
{
[super sendEvent:event];
- if ([event type] == NSKeyUp && ([event modifierFlags] & NSCommandKeyMask))
+ if ([event type] == NSEventTypeKeyUp && ([event modifierFlags] & NSEventModifierFlagCommand))
{
[[self keyWindow] sendEvent:event];
}
diff --git a/indra/newview/llappviewermacosx-objc.h b/indra/newview/llappviewermacosx-objc.h
index d0ae0a7fc2..3fbf4202f1 100644
--- a/indra/newview/llappviewermacosx-objc.h
+++ b/indra/newview/llappviewermacosx-objc.h
@@ -30,9 +30,6 @@
#include <string>
#include <vector>
-//Why? Because BOOL
-void launchApplication(const std::string* app_name, const std::vector<std::string>* args);
-
void force_ns_sxeption();
#endif // LL_LLAPPVIEWERMACOSX_OBJC_H
diff --git a/indra/newview/llappviewermacosx-objc.mm b/indra/newview/llappviewermacosx-objc.mm
index 9b6bfe621b..2ea3f2f171 100644
--- a/indra/newview/llappviewermacosx-objc.mm
+++ b/indra/newview/llappviewermacosx-objc.mm
@@ -33,45 +33,6 @@
#include "llappviewermacosx-objc.h"
-void launchApplication(const std::string* app_name, const std::vector<std::string>* args)
-{
-
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- if (app_name->empty()) return;
-
- NSMutableString* app_name_ns = [NSMutableString stringWithString:[[NSBundle mainBundle] resourcePath]]; //Path to resource dir
- [app_name_ns appendFormat:@"/%@", [NSString stringWithCString:app_name->c_str()
- encoding:[NSString defaultCStringEncoding]]];
-
- NSMutableArray *args_ns = nil;
- args_ns = [[NSMutableArray alloc] init];
-
- for (int i=0; i < args->size(); ++i)
- {
- NSLog(@"Adding string %s", (*args)[i].c_str());
- [args_ns addObject:
- [NSString stringWithCString:(*args)[i].c_str()
- encoding:[NSString defaultCStringEncoding]]];
- }
-
- NSTask *task = [[NSTask alloc] init];
- NSBundle *bundle = [NSBundle bundleWithPath:[[NSWorkspace sharedWorkspace] fullPathForApplication:app_name_ns]];
- [task setLaunchPath:[bundle executablePath]];
- [task setArguments:args_ns];
- [task launch];
-
-// NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
-// NSURL *url = [NSURL fileURLWithPath:[workspace fullPathForApplication:app_name_ns]];
-//
-// NSError *error = nil;
-// [workspace launchApplicationAtURL:url options:0 configuration:[NSDictionary dictionaryWithObject:args_ns forKey:NSWorkspaceLaunchConfigurationArguments] error:&error];
- //TODO Handle error
-
- [pool release];
- return;
-}
-
void force_ns_sxeption()
{
NSException *exception = [NSException exceptionWithName:@"Forced NSException" reason:nullptr userInfo:nullptr];
diff --git a/indra/newview/llfilepicker_mac.mm b/indra/newview/llfilepicker_mac.mm
index b21bc724fb..978069457c 100644
--- a/indra/newview/llfilepicker_mac.mm
+++ b/indra/newview/llfilepicker_mac.mm
@@ -86,7 +86,7 @@ std::unique_ptr<std::vector<std::string>> doLoadDialog(const std::vector<std::st
result = [panel runModal];
- if (result == NSOKButton)
+ if (result == NSModalResponseOK)
{
NSArray *filesToOpen = [panel URLs];
int i, count = [filesToOpen count];
@@ -173,7 +173,7 @@ std::unique_ptr<std::string> doSaveDialog(const std::string* file,
[panel setNameFieldStringValue: fileName];
[panel setDirectoryURL: url];
if([panel runModal] ==
- NSFileHandlingPanelOKButton)
+ NSModalResponseOK)
{
NSURL* url = [panel URL];
NSString* p = [url path];
@@ -211,7 +211,7 @@ void doSaveDialogModeless(const std::string* file,
[panel beginWithCompletionHandler:^(NSModalResponse result)
{
- if (result == NSOKButton)
+ if (result == NSModalResponseOK)
{
NSURL* url = [panel URL];
NSString* p = [url path];
diff --git a/indra/newview/llfloateremojipicker.cpp b/indra/newview/llfloateremojipicker.cpp
index 7e13503103..c5f4a2f0cf 100644
--- a/indra/newview/llfloateremojipicker.cpp
+++ b/indra/newview/llfloateremojipicker.cpp
@@ -1284,7 +1284,7 @@ void LLFloaterEmojiPicker::saveState()
if (!recentlyUsed.empty())
recentlyUsed += ",";
char buffer[32];
- sprintf(buffer, "%u", (U32)emoji);
+ snprintf(buffer, sizeof(buffer), "%u", (U32)emoji);
recentlyUsed += buffer;
if (!--maxCount)
break;
@@ -1301,7 +1301,7 @@ void LLFloaterEmojiPicker::saveState()
if (!frequentlyUsed.empty())
frequentlyUsed += ",";
char buffer[32];
- sprintf(buffer, "%u:%u", (U32)it.first, (U32)it.second);
+ snprintf(buffer, sizeof(buffer), "%u:%u", (U32)it.first, (U32)it.second);
frequentlyUsed += buffer;
if (!--maxCount)
break;
diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp
index 990a299c50..abffba8ffa 100644
--- a/indra/newview/llfloateruipreview.cpp
+++ b/indra/newview/llfloateruipreview.cpp
@@ -1042,7 +1042,7 @@ void LLFloaterUIPreview::getExecutablePath(const std::vector<std::string>& filen
{
CFStringRef executable_cfstr = (CFStringRef)CFDictionaryGetValue(bundleInfoDict, CFSTR("CFBundleExecutable")); // get the name of the actual executable (e.g. TextEdit or firefox-bin)
int max_file_length = 256; // (max file name length is 255 in OSX)
- char executable_buf[max_file_length];
+ char* executable_buf = (char*)malloc(sizeof(char) * max_file_length);
if(CFStringGetCString(executable_cfstr, executable_buf, max_file_length, kCFStringEncodingMacRoman)) // convert CFStringRef to char*
{
executable_path += std::string("/Contents/MacOS/") + std::string(executable_buf); // append path to executable directory and then executable name to exec path
@@ -1052,6 +1052,7 @@ void LLFloaterUIPreview::getExecutablePath(const std::vector<std::string>& filen
std::string warning = "Unable to get CString from CFString for executable path";
popupAndPrintWarning(warning);
}
+ free(executable_buf);
}
else
{