Skip to content

Commit 13b62d8

Browse files
author
Rye
committed
Clean up deprecated and dead code for macOS
1 parent 0933468 commit 13b62d8

11 files changed

+23
-108
lines changed

indra/llwindow/llopenglview-objc.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,13 @@
4242
unsigned int mMarkedTextLength;
4343
bool mMarkedTextAllowed;
4444
bool mSimulatedRightClick;
45-
bool mOldResize;
4645
}
4746
- (id) initWithSamples:(NSUInteger)samples;
4847
- (id) initWithSamples:(NSUInteger)samples andVsync:(BOOL)vsync;
4948
- (id) initWithFrame:(NSRect)frame withSamples:(NSUInteger)samples andVsync:(BOOL)vsync;
5049

5150
- (void)commitCurrentPreedit;
5251

53-
- (void) setOldResize:(bool)oldresize;
54-
5552
// rebuildContext
5653
// Destroys and recreates a context with the view's internal format set via setPixelFormat;
5754
// Use this in event of needing to rebuild a context for whatever reason, without needing to assign a new pixel format.
@@ -68,7 +65,6 @@
6865
- (unsigned long) getVramSize;
6966

7067
- (void) allowMarkedTextInput:(bool)allowed;
71-
- (void) viewDidEndLiveResize;
7268

7369
@end
7470

indra/llwindow/llopenglview-objc.mm

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,6 @@ - (NSPoint)flipPoint:(NSPoint)aPoint
123123

124124
@implementation LLOpenGLView
125125

126-
// Force a high quality update after live resizing
127-
- (void) viewDidEndLiveResize
128-
{
129-
if (mOldResize) //Maint-3135
130-
{
131-
NSSize size = [self frame].size;
132-
callResize(size.width, size.height);
133-
}
134-
}
135-
136126
- (unsigned long)getVramSize
137127
{
138128
CGLRendererInfoObj info = 0;
@@ -187,14 +177,8 @@ - (void)viewDidMoveToWindow
187177
}
188178
}
189179

190-
- (void)setOldResize:(bool)oldresize
191-
{
192-
mOldResize = oldresize;
193-
}
194-
195180
- (void)windowResized:(NSNotification *)notification;
196181
{
197-
if (!mOldResize) //Maint-3288
198182
{
199183
NSSize dev_sz = gHiDPISupport ? [self convertSizeToBacking:[self frame].size] : [self frame].size;
200184
callResize(dev_sz.width, dev_sz.height);
@@ -244,7 +228,7 @@ - (id) initWithSamples:(NSUInteger)samples andVsync:(BOOL)vsync
244228

245229
- (id) initWithFrame:(NSRect)frame withSamples:(NSUInteger)samples andVsync:(BOOL)vsync
246230
{
247-
[self registerForDraggedTypes:[NSArray arrayWithObject:NSURLPboardType]];
231+
[self registerForDraggedTypes:[NSArray arrayWithObject:NSPasteboardTypeURL]];
248232
[self initWithFrame:frame];
249233

250234
// Initialize with a default "safe" pixel format that will work with versions dating back to OS X 10.6.
@@ -295,16 +279,14 @@ - (id) initWithFrame:(NSRect)frame withSamples:(NSUInteger)samples andVsync:(BOO
295279
if (vsync)
296280
{
297281
GLint value = 1;
298-
[glContext setValues:&value forParameter:NSOpenGLCPSwapInterval];
282+
[glContext setValues:&value forParameter:NSOpenGLContextParameterSwapInterval];
299283
} else {
300284
// supress this error after move to Xcode 7:
301285
// error: null passed to a callee that requires a non-null argument [-Werror,-Wnonnull]
302286
// Tried using ObjC 'nonnull' keyword as per SO article but didn't build
303287
GLint swapInterval=0;
304-
[glContext setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval];
288+
[glContext setValues:&swapInterval forParameter:NSOpenGLContextParameterSwapInterval];
305289
}
306-
307-
mOldResize = false;
308290

309291
return self;
310292
}
@@ -355,13 +337,13 @@ - (void) mouseDown:(NSEvent *)theEvent
355337
mMousePos[1] = mPoint.y;
356338

357339
// Apparently people still use this?
358-
if ([theEvent modifierFlags] & NSCommandKeyMask &&
359-
!([theEvent modifierFlags] & NSControlKeyMask) &&
360-
!([theEvent modifierFlags] & NSShiftKeyMask) &&
361-
!([theEvent modifierFlags] & NSAlternateKeyMask) &&
362-
!([theEvent modifierFlags] & NSAlphaShiftKeyMask) &&
363-
!([theEvent modifierFlags] & NSFunctionKeyMask) &&
364-
!([theEvent modifierFlags] & NSHelpKeyMask))
340+
if ([theEvent modifierFlags] & NSEventModifierFlagCommand &&
341+
!([theEvent modifierFlags] & NSEventModifierFlagControl) &&
342+
!([theEvent modifierFlags] & NSEventModifierFlagShift) &&
343+
!([theEvent modifierFlags] & NSEventModifierFlagOption) &&
344+
!([theEvent modifierFlags] & NSEventModifierFlagCapsLock) &&
345+
!([theEvent modifierFlags] & NSEventModifierFlagFunction) &&
346+
!([theEvent modifierFlags] & NSEventModifierFlagHelp))
365347
{
366348
callRightMouseDown(mMousePos, [theEvent modifierFlags]);
367349
mSimulatedRightClick = true;
@@ -511,7 +493,7 @@ - (void) keyDown:(NSEvent *)theEvent
511493

512494
if (acceptsText &&
513495
!mMarkedTextAllowed &&
514-
!(mModifiers & (NSControlKeyMask | NSCommandKeyMask)) && // commands don't invoke InputWindow
496+
!(mModifiers & (NSEventModifierFlagControl | NSEventModifierFlagCommand)) && // commands don't invoke InputWindow
515497
![(LLAppDelegate*)[NSApp delegate] romanScript] &&
516498
ch > ' ' &&
517499
ch != NSDeleteCharacter &&
@@ -535,13 +517,13 @@ - (void)flagsChanged:(NSEvent *)theEvent
535517
switch([theEvent keyCode])
536518
{
537519
case 56:
538-
mask = NSShiftKeyMask;
520+
mask = NSEventModifierFlagShift;
539521
break;
540522
case 58:
541-
mask = NSAlternateKeyMask;
523+
mask = NSEventModifierFlagOption;
542524
break;
543525
case 59:
544-
mask = NSControlKeyMask;
526+
mask = NSEventModifierFlagControl;
545527
break;
546528
default:
547529
return;
@@ -582,7 +564,7 @@ - (NSDragOperation) draggingEntered:(id<NSDraggingInfo>)sender
582564

583565
pboard = [sender draggingPasteboard];
584566

585-
if ([[pboard types] containsObject:NSURLPboardType])
567+
if ([[pboard types] containsObject:NSPasteboardTypeURL])
586568
{
587569
if (sourceDragMask & NSDragOperationLink) {
588570
NSURL *fileUrl = [[pboard readObjectsForClasses:[NSArray arrayWithObject:[NSURL class]] options:[NSDictionary dictionary]] objectAtIndex:0];
@@ -783,9 +765,9 @@ - (void)insertText:(id)aString replacementRange:(NSRange)replacementRange
783765

784766
- (void) insertNewline:(id)sender
785767
{
786-
if (!(mModifiers & NSCommandKeyMask) &&
787-
!(mModifiers & NSShiftKeyMask) &&
788-
!(mModifiers & NSAlternateKeyMask))
768+
if (!(mModifiers & NSEventModifierFlagCommand) &&
769+
!(mModifiers & NSEventModifierFlagShift) &&
770+
!(mModifiers & NSEventModifierFlagOption))
789771
{
790772
callUnicodeCallback(13, 0);
791773
} else {

indra/llwindow/llwindow.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ class LLWindow : public LLInstanceTracker<LLWindow>
148148
virtual void swapBuffers() = 0;
149149
virtual void bringToFront() = 0;
150150
virtual void focusClient() { }; // this may not have meaning or be required on other platforms, therefore, it's not abstract
151-
virtual void setOldResize(bool oldresize) { };
152151
// handy coordinate space conversion routines
153152
// NB: screen to window and vice verse won't work on width/height coordinate pairs,
154153
// as the conversion must take into account left AND right border widths, etc.

indra/llwindow/llwindowmacosx-objc.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ bool isCGCursorVisible();
100100
void hideNSCursorTillMove(bool hide);
101101
void requestUserAttention();
102102
long showAlert(std::string title, std::string text, int type);
103-
void setResizeMode(bool oldresize, void* glview);
104103

105104
NSWindowRef createNSWindow(int x, int y, int width, int height);
106105

indra/llwindow/llwindowmacosx-objc.mm

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ OSErr setImageCursor(CursorRef ref)
213213
NSWindowRef createNSWindow(int x, int y, int width, int height)
214214
{
215215
LLNSWindow *window = [[LLNSWindow alloc]initWithContentRect:NSMakeRect(x, y, width, height)
216-
styleMask:NSTitledWindowMask | NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTexturedBackgroundWindowMask backing:NSBackingStoreBuffered defer:NO];
216+
styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskResizable | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable backing:NSBackingStoreBuffered defer:NO];
217217
[window makeKeyAndOrderFront:nil];
218218
[window setAcceptsMouseMovedEvents:TRUE];
219219
[window setRestorable:FALSE]; // Viewer manages state from own settings
@@ -227,11 +227,6 @@ GLViewRef createOpenGLView(NSWindowRef window, unsigned int samples, bool vsync)
227227
return glview;
228228
}
229229

230-
void setResizeMode(bool oldresize, void* glview)
231-
{
232-
[(LLOpenGLView *)glview setOldResize:oldresize];
233-
}
234-
235230
void glSwapBuffers(void* context)
236231
{
237232
[(NSOpenGLContext*)context flushBuffer];

indra/llwindow/llwindowmacosx.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,6 @@ class LLWindowMacOSX : public LLWindow
172172

173173
bool shouldPostQuit() { return mPostQuit; }
174174

175-
//Satisfy MAINT-3135 and MAINT-3288 with a flag.
176-
/*virtual */ void setOldResize(bool oldresize) override {setResizeMode(oldresize, mGLView); }
177-
178175
private:
179176
void restoreGLContext();
180177

indra/newview/llappdelegate-objc.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ @implementation LLApplication
371371
- (void)sendEvent:(NSEvent *)event
372372
{
373373
[super sendEvent:event];
374-
if ([event type] == NSKeyUp && ([event modifierFlags] & NSCommandKeyMask))
374+
if ([event type] == NSEventTypeKeyUp && ([event modifierFlags] & NSEventModifierFlagCommand))
375375
{
376376
[[self keyWindow] sendEvent:event];
377377
}

indra/newview/llappviewer.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3259,17 +3259,6 @@ bool LLAppViewer::initWindow()
32593259

32603260
LLNotificationsUI::LLNotificationManager::getInstance();
32613261

3262-
3263-
#ifdef LL_DARWIN
3264-
//Satisfy both MAINT-3135 (OSX 10.6 and earlier) MAINT-3288 (OSX 10.7 and later)
3265-
LLOSInfo& os_info = LLOSInfo::instance();
3266-
if (os_info.mMajorVer == 10 && os_info.mMinorVer < 7)
3267-
{
3268-
if ( os_info.mMinorVer == 6 && os_info.mBuild < 8 )
3269-
gViewerWindow->getWindow()->setOldResize(true);
3270-
}
3271-
#endif
3272-
32733262
if (gSavedSettings.getBOOL("WindowMaximized"))
32743263
{
32753264
gViewerWindow->getWindow()->maximize();

indra/newview/llappviewermacosx-objc.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@
3030
#include <string>
3131
#include <vector>
3232

33-
//Why? Because BOOL
34-
void launchApplication(const std::string* app_name, const std::vector<std::string>* args);
35-
3633
void force_ns_sxeption();
3734

3835
#endif // LL_LLAPPVIEWERMACOSX_OBJC_H

indra/newview/llappviewermacosx-objc.mm

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -33,45 +33,6 @@
3333

3434
#include "llappviewermacosx-objc.h"
3535

36-
void launchApplication(const std::string* app_name, const std::vector<std::string>* args)
37-
{
38-
39-
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
40-
41-
if (app_name->empty()) return;
42-
43-
NSMutableString* app_name_ns = [NSMutableString stringWithString:[[NSBundle mainBundle] resourcePath]]; //Path to resource dir
44-
[app_name_ns appendFormat:@"/%@", [NSString stringWithCString:app_name->c_str()
45-
encoding:[NSString defaultCStringEncoding]]];
46-
47-
NSMutableArray *args_ns = nil;
48-
args_ns = [[NSMutableArray alloc] init];
49-
50-
for (int i=0; i < args->size(); ++i)
51-
{
52-
NSLog(@"Adding string %s", (*args)[i].c_str());
53-
[args_ns addObject:
54-
[NSString stringWithCString:(*args)[i].c_str()
55-
encoding:[NSString defaultCStringEncoding]]];
56-
}
57-
58-
NSTask *task = [[NSTask alloc] init];
59-
NSBundle *bundle = [NSBundle bundleWithPath:[[NSWorkspace sharedWorkspace] fullPathForApplication:app_name_ns]];
60-
[task setLaunchPath:[bundle executablePath]];
61-
[task setArguments:args_ns];
62-
[task launch];
63-
64-
// NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
65-
// NSURL *url = [NSURL fileURLWithPath:[workspace fullPathForApplication:app_name_ns]];
66-
//
67-
// NSError *error = nil;
68-
// [workspace launchApplicationAtURL:url options:0 configuration:[NSDictionary dictionaryWithObject:args_ns forKey:NSWorkspaceLaunchConfigurationArguments] error:&error];
69-
//TODO Handle error
70-
71-
[pool release];
72-
return;
73-
}
74-
7536
void force_ns_sxeption()
7637
{
7738
NSException *exception = [NSException exceptionWithName:@"Forced NSException" reason:nullptr userInfo:nullptr];

0 commit comments

Comments
 (0)