Monitor load/save code (not hooked up yet)
This commit is contained in:
31
src/config.c
31
src/config.c
@@ -936,6 +936,37 @@ load_video(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
load_monitor(int monitor_index)
|
||||
{
|
||||
char monitor_config_name[sizeof("Monitor #") + 12] = { [0] = 0 };
|
||||
snprintf(monitor_config_name, sizeof(monitor_config_name), "Monitor #%i", monitor_index + 1);
|
||||
|
||||
char* ptr = config_get_string(monitor_config_name, "window_coordinates", "0, 0, 0, 0");
|
||||
sscanf(ptr, "%i, %i, %i, %i", &monitors[monitor_index].mon_window_x, &monitors[monitor_index].mon_window_y,
|
||||
&monitors[monitor_index].mon_window_w, &monitors[monitor_index].mon_window_h);
|
||||
}
|
||||
|
||||
static void
|
||||
save_monitor(int monitor_index)
|
||||
{
|
||||
char monitor_config_name[sizeof("Monitor #") + 12] = { [0] = 0 };
|
||||
char saved_coordinates[12 * 4 + 8 + 1] = { [0] = 0 };
|
||||
|
||||
snprintf(monitor_config_name, sizeof(monitor_config_name), "Monitor #%i", monitor_index + 1);
|
||||
if (!(monitors[monitor_index].mon_window_x == 0
|
||||
&& monitors[monitor_index].mon_window_y == 0
|
||||
&& monitors[monitor_index].mon_window_w == 0
|
||||
&& monitors[monitor_index].mon_window_h == 0)) {
|
||||
snprintf(saved_coordinates, sizeof(saved_coordinates), "%i, %i, %i, %i", monitors[monitor_index].mon_window_x, monitors[monitor_index].mon_window_y,
|
||||
monitors[monitor_index].mon_window_w, monitors[monitor_index].mon_window_h);
|
||||
|
||||
config_set_string(monitor_config_name, "window_coordinates", saved_coordinates);
|
||||
}
|
||||
else config_delete_var(monitor_config_name, "window_coordinates");
|
||||
}
|
||||
|
||||
|
||||
/* Load "Input Devices" section. */
|
||||
static void
|
||||
load_input_devices(void)
|
||||
|
@@ -109,6 +109,10 @@ typedef struct monitor_t
|
||||
mon_video_timing_write_l;
|
||||
int mon_overscan_x;
|
||||
int mon_overscan_y;
|
||||
int mon_window_x;
|
||||
int mon_window_y;
|
||||
int mon_window_w;
|
||||
int mon_window_h;
|
||||
int mon_force_resize;
|
||||
int mon_fullchange;
|
||||
int mon_changeframecount;
|
||||
|
Reference in New Issue
Block a user