Browse Source

macosx: Add missing EXTENSION_WIDGET_PASSWORD handling

pull/83/head
Marvin Scholz 8 years ago
parent
commit
2c0fa9d110
  1. 25
      modules/gui/macosx/VLCExtensionsDialogProvider.m
  2. 4
      modules/gui/macosx/VLCUIWidgets.h
  3. 6
      modules/gui/macosx/VLCUIWidgets.m

25
modules/gui/macosx/VLCExtensionsDialogProvider.m

@ -76,6 +76,17 @@ static NSView *createControlFromWidget(extension_widget_t *widget, id self)
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(syncTextField:) name:NSControlTextDidChangeNotification object:field];
return field;
}
case EXTENSION_WIDGET_PASSWORD:
{
VLCDialogSecureTextField *field = [[VLCDialogSecureTextField alloc] init];
[field setWidget:widget];
[field setAutoresizingMask:NSViewWidthSizable];
[field setFont:[NSFont systemFontOfSize:0]];
[[field cell] setControlSize:NSRegularControlSize];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(syncTextField:) name:NSControlTextDidChangeNotification object:field];
return field;
}
case EXTENSION_WIDGET_CHECK_BOX:
{
VLCDialogButton *button = [[VLCDialogButton alloc] init];
@ -315,9 +326,17 @@ static void extensionDialogCallback(extension_dialog_t *p_ext_dialog,
- (void)syncTextField:(NSNotification *)notifcation
{
id sender = [notifcation object];
assert([sender isKindOfClass:[VLCDialogTextField class]]);
VLCDialogTextField *field = sender;
extension_widget_t *widget = [field widget];
assert([sender isKindOfClass:[VLCDialogTextField class]] ||
[sender isKindOfClass:[VLCDialogSecureTextField class]]);
NSTextField *field = sender;
extension_widget_t *widget;
if ([sender isKindOfClass:[VLCDialogTextField class]])
widget = [(VLCDialogTextField*)field widget];
else if ([sender isKindOfClass:[VLCDialogSecureTextField class]])
widget = [(VLCDialogSecureTextField*)field widget];
else
return;
vlc_mutex_lock(&widget->p_dialog->lock);
free(widget->psz_text);

4
modules/gui/macosx/VLCUIWidgets.h

@ -42,6 +42,10 @@
@property (readwrite) extension_widget_t *widget;
@end
@interface VLCDialogSecureTextField : NSSecureTextField
@property (readwrite) extension_widget_t *widget;
@end
@interface VLCDialogWindow : NSWindow
@property (readwrite) extension_dialog_t *dialog;
@property (readwrite) BOOL has_lock;

6
modules/gui/macosx/VLCUIWidgets.m

@ -41,6 +41,12 @@
@end
@implementation VLCDialogSecureTextField
@end
@implementation VLCDialogLabel
- (void)resetCursorRects {
[self addCursorRect:[self bounds] cursor:[NSCursor arrowCursor]];

Loading…
Cancel
Save