[haiku-development] Re: Design question.

  • From: fredrik@xxxxxxxxx
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 31 Mar 2021 23:15:49 +0200

The various options are:
- The preference panel writes a settings file, the server reads it. No
shared code.
- Same as above, but the code is shared by having the Jamfile of one
component reuse sources of the other
- Variant: the shared code is in a separate directory
(src/kits/shared, or src/libs for example)
I hate duplicate code ;). So in kit would be nice place.

- The preference panel somehow communicates with the server and the
server writes the file
- Examples: setting display brightness, configuring mouse settings
- The API can be public, allowing other tools to alter the settings
(for example the screen brightness can be set from the command line
screenmode tool as well)
That I didn't thought about

I think moving settings management to the server is interesting
because it allows any user-space application to change the setting. As
shown above this is useful when you have both a command line and a
graphical application (it's the case for screen mode, or for network
devices for example). It also goes well with our idea of making the
settings apply live, but there are some things to keep in mind

To keep the example of screen brightness, it is not written to the
file immediately when the setting changes. The reason is, doing so
would mean sliding the brighness slider in screen preferences would
result in the file being rewritten everytime the mouse moves. Not a
great option. So instead, the setting is applied live, but the file is
written only when app_server shuts down.
Yes ok.. so when you quit you computer? What happends when it crashes? Perhaps not a problem. Would it be a problem one could save it to a tempfaile and then when the server shuts down we swaps files.


So right now it looks like the settings handling will be moved to the kit.
Changes will be send to the server and saved when it quits.. in there somewhere we will store the old value so we can do a one time undo.

//Fredrik



Other related posts: