package reader // Options is used by the DisplayReader to configure how each field of // the DisplayConfig will be queried. type Options struct { // Returns the resolution for each display as the preferred // resolution rather than the currently configured resolution. PreferredResolution bool // Returns the default layout (displays ordered right-to-left // as they are found), rather than their currently configured // layout. DefaultLayout bool // Ignores input devices which do not have an absolute mode. IgnoreRelativeInputDevices bool // Ignore querying display resolutions (current resolution // will still be queried). IgnoreSupportedResolutions bool } func CreateOptions(options ...Option) Options { opts := &Options{} for _, o := range options { o(opts) } return *opts } // A Option is used to modify how the Reader obtains the // DisplayConfig fields. type Option func(*Options) // WithPreferredResolution instructs the reader to return the // resolution for each display as the preferred resolution // rather than the currently configured resolution. func WithPreferredResolution() Option { return func(opts *Options) { opts.PreferredResolution = true } } // WithDefaultLayout tells the reader to return the default // layout (displays ordered right-to-left as they are found), // rather than their currently configured layout. func WithDefaultLayout() Option { return func(opts *Options) { opts.DefaultLayout = true } } // WithAbsoluteInputDevices instructs the reader to // obtain absolute input devices only. func WithIgnoreRelativeInputDevices() Option { return func(opts *Options) { opts.IgnoreRelativeInputDevices = true } } // WithIgnoreSupportedResolutions instructs the reader to ignore // querying display resolutions (current resolution will // still be queried). func WithIgnoreSupportedResolutions() Option { return func(opts *Options) { opts.IgnoreSupportedResolutions = true } }