[vlc-devel] [PATCH] Dim MacBook keyboard backlight during video playback on OSX

Maxime Mouchet max at maxmouchet.com
Tue May 12 08:32:21 CEST 2015


> Hi,
> As an additional remark: Why using a singleton pattern? I think its really not needed for this class.
> I know the singleton pattern is misused a lot in the macosx codebase, but I want to get rid of them soon, if possible. So I would prefer if we can prevent introducing new singletons.
> Best,
> David

The idea was to remember easily the last backlight value, in order to restore it when we come from play to pause. For example if the class has to be used from several different objects. But indeed it should be possible to do without, I’ll check.

Also I was thinking if it wouldn’t be better to check if dataPort could not be opened in init, something like:
- (id)init {
    dataPort = [self getDataPort];

    if (!dataPort) {
          [self release];
          return nil;

And then check if the object is not nil when using it. Instead of checking in get/setBrightness like I did before. What do you think ?

Thanks a lot for the comments,

More information about the vlc-devel mailing list