mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add MacOS support to window geometry save/restore
Also make sure the config is flushed to disk. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
d742d7b391
commit
b24d0f2f60
2 changed files with 10 additions and 3 deletions
|
@ -326,6 +326,8 @@ void save_window_geometry(void)
|
|||
gtk_window_get_size(GTK_WINDOW (main_window), &window_width, &window_height);
|
||||
subsurface_set_conf_int("window_width", window_width);
|
||||
subsurface_set_conf_int("window_height", window_height);
|
||||
|
||||
subsurface_flush_conf();
|
||||
}
|
||||
|
||||
void restore_window_geometry(void)
|
||||
|
|
11
macos.c
11
macos.c
|
@ -47,7 +47,8 @@ void subsurface_set_conf_bool(char *name, int value)
|
|||
|
||||
void subsurface_set_conf_int(char *name, int value)
|
||||
{
|
||||
/* CF pref stuff here? */
|
||||
CFNumberRef numRef = CFNumberCreate(NULL, kCFNumberIntType, &value);
|
||||
CFPreferencesSetAppValue(CFSTR_VAR(name), numRef, SUBSURFACE_PREFERENCES);
|
||||
}
|
||||
|
||||
const void *subsurface_get_conf(char *name)
|
||||
|
@ -72,9 +73,13 @@ int subsurface_get_conf_bool(char *name)
|
|||
|
||||
int subsurface_get_conf_int(char *name)
|
||||
{
|
||||
Boolean exists;
|
||||
CFIndex value;
|
||||
|
||||
return -1; /* CF pref stuff here? */
|
||||
|
||||
value = CFPreferencesGetAppIntegerValue(CFSTR_VAR(name), SUBSURFACE_PREFERENCES, &exists);
|
||||
if (!exists)
|
||||
return -1;
|
||||
return value;
|
||||
}
|
||||
|
||||
void subsurface_flush_conf(void)
|
||||
|
|
Loading…
Add table
Reference in a new issue