mirror of https://gitlab.com/nakst/essence
enable hover state setting
This commit is contained in:
parent
9923c28ad9
commit
a19e0996bb
|
@ -89,6 +89,7 @@ struct GlobalData {
|
||||||
volatile float uiScale;
|
volatile float uiScale;
|
||||||
volatile bool swapLeftAndRightButtons;
|
volatile bool swapLeftAndRightButtons;
|
||||||
volatile bool showCursorShadow;
|
volatile bool showCursorShadow;
|
||||||
|
volatile bool enableHoverState;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ThreadLocalStorage {
|
struct ThreadLocalStorage {
|
||||||
|
|
|
@ -1793,7 +1793,7 @@ bool EsElement::RefreshStyleState() {
|
||||||
if (((state & UI_STATE_LEFT_PRESSED) && ((state & UI_STATE_HOVERED) || gui.draggingStarted || (state & UI_STATE_STRONG_PRESSED)))
|
if (((state & UI_STATE_LEFT_PRESSED) && ((state & UI_STATE_HOVERED) || gui.draggingStarted || (state & UI_STATE_STRONG_PRESSED)))
|
||||||
|| (state & UI_STATE_MENU_SOURCE)) {
|
|| (state & UI_STATE_MENU_SOURCE)) {
|
||||||
styleStateFlags |= THEME_PRIMARY_STATE_PRESSED;
|
styleStateFlags |= THEME_PRIMARY_STATE_PRESSED;
|
||||||
} else if (((state & UI_STATE_HOVERED) && !window->pressed) || (window && window->pressed == this)) {
|
} else if (((state & UI_STATE_HOVERED) && !window->pressed && api.global->enableHoverState) || (window && window->pressed == this)) {
|
||||||
styleStateFlags |= THEME_PRIMARY_STATE_HOVERED;
|
styleStateFlags |= THEME_PRIMARY_STATE_HOVERED;
|
||||||
} else {
|
} else {
|
||||||
styleStateFlags |= THEME_PRIMARY_STATE_IDLE;
|
styleStateFlags |= THEME_PRIMARY_STATE_IDLE;
|
||||||
|
|
|
@ -134,6 +134,7 @@ void SettingsUpdateGlobalAndWindowManager() {
|
||||||
api.global->clickChainTimeoutMs = EsSystemConfigurationReadInteger(EsLiteral("general"), EsLiteral("click_chain_timeout_ms"));
|
api.global->clickChainTimeoutMs = EsSystemConfigurationReadInteger(EsLiteral("general"), EsLiteral("click_chain_timeout_ms"));
|
||||||
api.global->swapLeftAndRightButtons = EsSystemConfigurationReadInteger(EsLiteral("general"), EsLiteral("swap_left_and_right_buttons"));
|
api.global->swapLeftAndRightButtons = EsSystemConfigurationReadInteger(EsLiteral("general"), EsLiteral("swap_left_and_right_buttons"));
|
||||||
api.global->showCursorShadow = EsSystemConfigurationReadInteger(EsLiteral("general"), EsLiteral("show_cursor_shadow"));
|
api.global->showCursorShadow = EsSystemConfigurationReadInteger(EsLiteral("general"), EsLiteral("show_cursor_shadow"));
|
||||||
|
api.global->enableHoverState = EsSystemConfigurationReadInteger(EsLiteral("general"), EsLiteral("enable_hover_state"));
|
||||||
|
|
||||||
{
|
{
|
||||||
float newUIScale = EsSystemConfigurationReadInteger(EsLiteral("general"), EsLiteral("ui_scale")) * 0.01f;
|
float newUIScale = EsSystemConfigurationReadInteger(EsLiteral("general"), EsLiteral("ui_scale")) * 0.01f;
|
||||||
|
@ -637,7 +638,6 @@ void SettingsColorButtonCommand(EsInstance *, EsElement *element, EsCommand *) {
|
||||||
EsMutexRelease(&api.systemConfigurationMutex);
|
EsMutexRelease(&api.systemConfigurationMutex);
|
||||||
SettingsWindowColorUpdated();
|
SettingsWindowColorUpdated();
|
||||||
desktop.configurationModified = true;
|
desktop.configurationModified = true;
|
||||||
ConfigurationWriteToFile();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsPageTheme(EsElement *element, SettingsPage *page) {
|
void SettingsPageTheme(EsElement *element, SettingsPage *page) {
|
||||||
|
@ -653,7 +653,7 @@ void SettingsPageTheme(EsElement *element, SettingsPage *page) {
|
||||||
|
|
||||||
EsPanel *table = EsPanelCreate(container, ES_CELL_H_CENTER | ES_PANEL_TABLE | ES_PANEL_HORIZONTAL, &styleSettingsTable);
|
EsPanel *table = EsPanelCreate(container, ES_CELL_H_CENTER | ES_PANEL_TABLE | ES_PANEL_HORIZONTAL, &styleSettingsTable);
|
||||||
EsPanelSetBands(table, 2);
|
EsPanelSetBands(table, 2);
|
||||||
EsTextDisplayCreate(table, ES_CELL_H_RIGHT, 0, "Wallpaper:", -1);
|
EsTextDisplayCreate(table, ES_CELL_H_RIGHT, 0, INTERFACE_STRING(DesktopSettingsThemeWallpaper));
|
||||||
|
|
||||||
EsTextbox *textbox = EsTextboxCreate(table, ES_CELL_H_LEFT | ES_CELL_H_PUSH | ES_TEXTBOX_EDIT_BASED | ES_ELEMENT_FREE_USER_DATA, ES_STYLE_TEXTBOX_BORDERED_SINGLE);
|
EsTextbox *textbox = EsTextboxCreate(table, ES_CELL_H_LEFT | ES_CELL_H_PUSH | ES_TEXTBOX_EDIT_BASED | ES_ELEMENT_FREE_USER_DATA, ES_STYLE_TEXTBOX_BORDERED_SINGLE);
|
||||||
size_t currentWallpaperBytes;
|
size_t currentWallpaperBytes;
|
||||||
|
@ -685,7 +685,7 @@ void SettingsPageTheme(EsElement *element, SettingsPage *page) {
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
EsTextDisplayCreate(table, ES_CELL_H_RIGHT, 0, "Window color:", -1);
|
EsTextDisplayCreate(table, ES_CELL_H_RIGHT, 0, INTERFACE_STRING(DesktopSettingsThemeWindowColor));
|
||||||
EsPanel *panel = EsPanelCreate(table, ES_CELL_H_LEFT | ES_PANEL_HORIZONTAL);
|
EsPanel *panel = EsPanelCreate(table, ES_CELL_H_LEFT | ES_PANEL_HORIZONTAL);
|
||||||
uint8_t windowColor = EsSystemConfigurationReadInteger(EsLiteral("general"), EsLiteral("window_color"));
|
uint8_t windowColor = EsSystemConfigurationReadInteger(EsLiteral("general"), EsLiteral("window_color"));
|
||||||
|
|
||||||
|
@ -696,6 +696,9 @@ void SettingsPageTheme(EsElement *element, SettingsPage *page) {
|
||||||
button->messageUser = SettingsColorButtonMessage;
|
button->messageUser = SettingsColorButtonMessage;
|
||||||
EsButtonOnCommand(button, SettingsColorButtonCommand);
|
EsButtonOnCommand(button, SettingsColorButtonCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table = EsPanelCreate(container, ES_CELL_H_FILL, &styleSettingsCheckboxGroup);
|
||||||
|
SettingsAddCheckbox(table, INTERFACE_STRING(DesktopSettingsThemeEnableHoverState), 'H', "general", "enable_hover_state");
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsPage settingsPages[] = {
|
SettingsPage settingsPages[] = {
|
||||||
|
|
|
@ -8,6 +8,7 @@ show_cursor_shadow=1
|
||||||
scroll_lines_per_notch=3
|
scroll_lines_per_notch=3
|
||||||
ui_scale=100
|
ui_scale=100
|
||||||
window_color=3
|
window_color=3
|
||||||
|
enable_hover_state=1
|
||||||
|
|
||||||
[ui]
|
[ui]
|
||||||
font_fallback=Inter
|
font_fallback=Inter
|
||||||
|
|
|
@ -133,6 +133,10 @@ DEFINE_INTERFACE_STRING(DesktopSettingsMouseCursorTrailsMany, "Many");
|
||||||
|
|
||||||
DEFINE_INTERFACE_STRING(DesktopSettingsDisplayUIScale, "Interface scale:");
|
DEFINE_INTERFACE_STRING(DesktopSettingsDisplayUIScale, "Interface scale:");
|
||||||
|
|
||||||
|
DEFINE_INTERFACE_STRING(DesktopSettingsThemeWindowColor, "Window color:");
|
||||||
|
DEFINE_INTERFACE_STRING(DesktopSettingsThemeEnableHoverState, "Highlight the item the cursor is over");
|
||||||
|
DEFINE_INTERFACE_STRING(DesktopSettingsThemeWallpaper, "Wallpaper");
|
||||||
|
|
||||||
// File operations.
|
// File operations.
|
||||||
|
|
||||||
DEFINE_INTERFACE_STRING(FileCannotSave, "The document was not saved.");
|
DEFINE_INTERFACE_STRING(FileCannotSave, "The document was not saved.");
|
||||||
|
|
Loading…
Reference in New Issue