[haiku-development] Re: Design question.

  • From: "Adrien Destugues" <pulkomandy@xxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 31 Mar 2021 20:46:00 +0000

Which is the BeOS / Haiku way?

We are a bit undecided on that in the existing code.

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)

- 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)

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.

-- 
Adrien.


Other related posts: