From 592498124330a6f3e277476c51c7ce5bea704c11 Mon Sep 17 00:00:00 2001 From: nakst <> Date: Fri, 8 Oct 2021 23:00:15 +0100 Subject: [PATCH] fix visual bugs --- apps/installer.cpp | 3 ++- apps/test.cpp | 3 +++ desktop/gui.cpp | 25 ++++++++++++++----------- res/Theme Source.dat | Bin 556632 -> 556632 bytes 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/apps/installer.cpp b/apps/installer.cpp index afd3eaf..39f09b6 100644 --- a/apps/installer.cpp +++ b/apps/installer.cpp @@ -1031,7 +1031,8 @@ void _start() { EsSyscall(ES_SYSCALL_WINDOW_SET_PROPERTY, handle, ES_WINDOW_SOLID_TRUE, 0, ES_WINDOW_PROPERTY_SOLID); EsSyscall(ES_SYSCALL_WINDOW_SET_PROPERTY, handle, 0, 0, ES_WINDOW_PROPERTY_FOCUSED); - EsPanel *sheet = EsPanelCreate(window, ES_PANEL_VERTICAL | ES_CELL_PUSH | ES_CELL_CENTER, ES_STYLE_INSTALLER_ROOT); + EsPanel *clearBackground = EsPanelCreate(window, ES_CELL_FILL, ES_STYLE_CLEAR_BACKGROUND); + EsPanel *sheet = EsPanelCreate(clearBackground, ES_PANEL_VERTICAL | ES_CELL_PUSH | ES_CELL_CENTER, ES_STYLE_INSTALLER_ROOT); switcher = EsPanelCreate(sheet, ES_CELL_H_FILL | ES_PANEL_SWITCHER); switcher->messageUser = SwitcherMessage; diff --git a/apps/test.cpp b/apps/test.cpp index 4be63b8..73090c5 100644 --- a/apps/test.cpp +++ b/apps/test.cpp @@ -152,6 +152,9 @@ void InitialiseInstance(EsInstance *instance) { EsPanel *panel = EsPanelCreate(instance->window, ES_CELL_FILL, &stylePanel); EsButtonCreate(panel, ES_BUTTON_CHECKBOX, 0, "Checkbox"); + EsTextboxCreate(panel); + EsTextboxCreate(panel); + EsButtonOnCommand(EsButtonCreate(panel, ES_FLAGS_DEFAULT, 0, "Alert 1"), [] (EsInstance *, EsElement *element, EsCommand *) { EsDialog *dialog = EsDialogShow(element->window, "Rename multiple items", -1, "Choose the format for the new names.", -1, ES_ICON_DOCUMENT_EDIT, ES_FLAGS_DEFAULT); diff --git a/desktop/gui.cpp b/desktop/gui.cpp index ca50358..5210cbb 100644 --- a/desktop/gui.cpp +++ b/desktop/gui.cpp @@ -40,7 +40,7 @@ struct { // Input. bool draggingStarted, mouseButtonDown; uint8_t leftModifiers, rightModifiers; - int lastClickX, lastClickY, lastClickButton, resizeType; + int lastClickX, lastClickY, lastClickButton; // Menus. bool menuMode; @@ -59,7 +59,6 @@ struct { // Misc. Array allWindows; HashTable keyboardShortcutNames; - EsCursorStyle resizeCursor; EsElement *insertAfter; // Resizing data. @@ -445,11 +444,15 @@ struct EsWindow : EsElement { EsWindowStyle windowStyle; uint32_t windowWidth, windowHeight; + // TODO Replace this with a bitset? bool willUpdate, toolbarFillMode, destroyInstanceAfterClose, doNotPaint; bool restoreOnNextMove, resetPositionOnNextMove, receivedFirstResize, isMaximised; bool hovering, activated, appearActivated; bool visualizeRepaints, visualizeLayoutBounds, visualizePaintSteps; // Inspector properties. + uint8_t resizeType; + EsCursorStyle resizeCursor; + EsElement *mainPanel, *toolbar; EsPanel *toolbarSwitcher; Array dialogs; @@ -669,14 +672,14 @@ int ProcessWindowBorderMessage(EsWindow *window, EsMessage *message, EsRectangle message->cursorStyle = ES_CURSOR_NORMAL; if (window->isMaximised) { - gui.resizeType = 0; - gui.resizeCursor = message->cursorStyle; + window->resizeType = 0; + window->resizeCursor = message->cursorStyle; } else { bool left = position.x < to, right = position.x >= bounds.r - to, top = position.y < to, bottom = position.y >= bounds.b - to; if (gui.resizing) { - message->cursorStyle = gui.resizeCursor; + message->cursorStyle = window->resizeCursor; } else if (position.x < from || position.y < from || position.x >= bounds.r - from || position.y >= bounds.b - from) { } else if ((right && top) || (bottom && left)) { @@ -690,8 +693,8 @@ int ProcessWindowBorderMessage(EsWindow *window, EsMessage *message, EsRectangle } if (!window->pressed && !gui.mouseButtonDown) { - gui.resizeType = (left ? RESIZE_LEFT : 0) | (right ? RESIZE_RIGHT : 0) | (top ? RESIZE_TOP : 0) | (bottom ? RESIZE_BOTTOM : 0); - gui.resizeCursor = message->cursorStyle; + window->resizeType = (left ? RESIZE_LEFT : 0) | (right ? RESIZE_RIGHT : 0) | (top ? RESIZE_TOP : 0) | (bottom ? RESIZE_BOTTOM : 0); + window->resizeCursor = message->cursorStyle; } } @@ -702,15 +705,15 @@ int ProcessWindowBorderMessage(EsWindow *window, EsMessage *message, EsRectangle if (gui.resizing) { EsPoint screenPosition = EsMouseGetPosition(nullptr); - WindowChangeBounds(gui.resizeType, screenPosition.x, screenPosition.y, + WindowChangeBounds(window->resizeType, screenPosition.x, screenPosition.y, &gui.lastClickX, &gui.lastClickY, window, gui.resizingBothSides, &gui.resizeStartBounds); } } else if (message->type == ES_MSG_MOUSE_LEFT_DRAG) { EsPoint screenPosition = EsMouseGetPosition(nullptr); - if (!window->isMaximised || gui.resizeType == RESIZE_MOVE) { - WindowChangeBounds(gui.resizeType, screenPosition.x, screenPosition.y, + if (!window->isMaximised || window->resizeType == RESIZE_MOVE) { + WindowChangeBounds(window->resizeType, screenPosition.x, screenPosition.y, &gui.lastClickX, &gui.lastClickY, window, gui.resizingBothSides, &gui.resizeStartBounds); gui.resizing = true; @@ -7403,7 +7406,7 @@ void UIProcessWindowManagerMessage(EsWindow *window, EsMessage *message, Process } else if (message->type == ES_MSG_SCROLL_WHEEL) { EsElement *element = window->dragged ?: window->pressed ?: window->hovered; - if (element && (~element->flags & ES_ELEMENT_DISABLED) && (~element->state & UI_STATE_BLOCK_INTERACTION)) { + if (element && (~element->state & UI_STATE_BLOCK_INTERACTION)) { UIMessageSendPropagateToAncestors(element, message); } } else if (message->type == ES_MSG_WINDOW_RESIZED) { diff --git a/res/Theme Source.dat b/res/Theme Source.dat index beb7658e00c66bf1c9d56fb1fa98f543403432bf..d78f6a23df0c75339ea18da78b156d84774f370f 100644 GIT binary patch delta 184 zcmccdNAboV#fBEf7N#xCm-Uz#8yKgDO=SBuz2P_`%k%@!Sy-p%eq!RBtmiK_y+NN@ zV!DA5qrmh7-&q8v88HHR`pg{DmwaS0nBJqzsxWUSPm1Fnxg;lf?EnADKKDr#G}RDoj_< zX6D$gVZqeFINd>kQDeG;I&;MI4egAY?H7%hftUq|S%H{s`$Z%6b6*%4w=YoV*bxQ* DXbvQu