[vlc-commits] macosx: Add missing EXTENSION_WIDGET_PASSWORD handling
Marvin Scholz
git at videolan.org
Thu Dec 6 16:02:33 CET 2018
vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Thu Dec 6 15:59:07 2018 +0100| [2c0fa9d11015301b0fbb79ba2d831e86135382e5] | committer: Marvin Scholz
macosx: Add missing EXTENSION_WIDGET_PASSWORD handling
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2c0fa9d11015301b0fbb79ba2d831e86135382e5
---
modules/gui/macosx/VLCExtensionsDialogProvider.m | 25 +++++++++++++++++++++---
modules/gui/macosx/VLCUIWidgets.h | 4 ++++
modules/gui/macosx/VLCUIWidgets.m | 6 ++++++
3 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/modules/gui/macosx/VLCExtensionsDialogProvider.m b/modules/gui/macosx/VLCExtensionsDialogProvider.m
index 533d64ae0b..e6a3130c5c 100644
--- a/modules/gui/macosx/VLCExtensionsDialogProvider.m
+++ b/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);
diff --git a/modules/gui/macosx/VLCUIWidgets.h b/modules/gui/macosx/VLCUIWidgets.h
index 4948af2633..d084cf980a 100644
--- a/modules/gui/macosx/VLCUIWidgets.h
+++ b/modules/gui/macosx/VLCUIWidgets.h
@@ -42,6 +42,10 @@
@property (readwrite) extension_widget_t *widget;
@end
+ at interface VLCDialogSecureTextField : NSSecureTextField
+ at property (readwrite) extension_widget_t *widget;
+ at end
+
@interface VLCDialogWindow : NSWindow
@property (readwrite) extension_dialog_t *dialog;
@property (readwrite) BOOL has_lock;
diff --git a/modules/gui/macosx/VLCUIWidgets.m b/modules/gui/macosx/VLCUIWidgets.m
index b621e35d92..2f04490863 100644
--- a/modules/gui/macosx/VLCUIWidgets.m
+++ b/modules/gui/macosx/VLCUIWidgets.m
@@ -41,6 +41,12 @@
@end
+
+ at implementation VLCDialogSecureTextField
+
+ at end
+
+
@implementation VLCDialogLabel
- (void)resetCursorRects {
[self addCursorRect:[self bounds] cursor:[NSCursor arrowCursor]];
More information about the vlc-commits
mailing list