2021-11-15 20:20:19 -05:00
|
|
|
#include "helpers.h"
|
|
|
|
|
|
|
|
#include "settings.h"
|
|
|
|
|
|
|
|
int helpers_gap_size(
|
|
|
|
const unsigned int displayed_clients,
|
2021-11-15 21:12:27 -05:00
|
|
|
const bool selected_is_fullscreen,
|
|
|
|
const bool any_is_fullscreen
|
2021-11-15 20:20:19 -05:00
|
|
|
) {
|
|
|
|
const SettingsForSingleWindow gap_for_single_window = settings_get_gap_for_single_window();
|
|
|
|
const int gap_size = settings_get_gap_size();
|
|
|
|
|
|
|
|
if (displayed_clients > 1) return gap_size;
|
|
|
|
|
|
|
|
switch (gap_for_single_window) {
|
|
|
|
case SETTINGS_FOR_SINGLE_WINDOW_NEVER:
|
|
|
|
return 0;
|
|
|
|
case SETTINGS_FOR_SINGLE_WINDOW_ALWAYS:
|
|
|
|
return gap_size;
|
|
|
|
case SETTINGS_FOR_SINGLE_WINDOW_NOT_IN_FULLSCREEN:
|
|
|
|
return selected_is_fullscreen ? 0 : gap_size;
|
2021-11-15 21:12:27 -05:00
|
|
|
case SETTINGS_FOR_SINGLE_WINDOW_NOBODY_IS_FULLSCREEN:
|
|
|
|
return (selected_is_fullscreen || any_is_fullscreen) ? 0 : gap_size;
|
2021-11-15 20:47:36 -05:00
|
|
|
default:
|
|
|
|
// TODO: maybe we should assert here
|
|
|
|
return 0;
|
2021-11-15 20:20:19 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int helpers_border_width(
|
|
|
|
const unsigned int displayed_clients,
|
2021-11-15 21:12:27 -05:00
|
|
|
const bool selected_is_fullscreen,
|
|
|
|
const bool any_is_fullscreen
|
2021-11-15 20:20:19 -05:00
|
|
|
) {
|
|
|
|
const SettingsForSingleWindow border_for_single_window = settings_get_border_for_single_window();
|
|
|
|
const int border_width = settings_get_border_width();
|
|
|
|
|
|
|
|
if (displayed_clients > 1) return border_width;
|
|
|
|
|
|
|
|
switch (border_for_single_window) {
|
|
|
|
case SETTINGS_FOR_SINGLE_WINDOW_NEVER:
|
|
|
|
return 0;
|
|
|
|
case SETTINGS_FOR_SINGLE_WINDOW_ALWAYS:
|
|
|
|
return border_width;
|
|
|
|
case SETTINGS_FOR_SINGLE_WINDOW_NOT_IN_FULLSCREEN:
|
|
|
|
return selected_is_fullscreen ? 0 : border_width;
|
2021-11-15 21:12:27 -05:00
|
|
|
case SETTINGS_FOR_SINGLE_WINDOW_NOBODY_IS_FULLSCREEN:
|
|
|
|
return (selected_is_fullscreen || any_is_fullscreen) ? 0 : border_width;
|
2021-11-15 20:47:36 -05:00
|
|
|
default:
|
|
|
|
// TODO: maybe we should assert here
|
|
|
|
return 0;
|
2021-11-15 20:20:19 -05:00
|
|
|
}
|
|
|
|
}
|