mirror of https://gitlab.com/nakst/essence
fix visual bugs
This commit is contained in:
parent
a03bfa7c04
commit
5924981243
|
@ -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, ES_WINDOW_SOLID_TRUE, 0, ES_WINDOW_PROPERTY_SOLID);
|
||||||
EsSyscall(ES_SYSCALL_WINDOW_SET_PROPERTY, handle, 0, 0, ES_WINDOW_PROPERTY_FOCUSED);
|
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 = EsPanelCreate(sheet, ES_CELL_H_FILL | ES_PANEL_SWITCHER);
|
||||||
switcher->messageUser = SwitcherMessage;
|
switcher->messageUser = SwitcherMessage;
|
||||||
|
|
||||||
|
|
|
@ -152,6 +152,9 @@ void InitialiseInstance(EsInstance *instance) {
|
||||||
EsPanel *panel = EsPanelCreate(instance->window, ES_CELL_FILL, &stylePanel);
|
EsPanel *panel = EsPanelCreate(instance->window, ES_CELL_FILL, &stylePanel);
|
||||||
EsButtonCreate(panel, ES_BUTTON_CHECKBOX, 0, "Checkbox");
|
EsButtonCreate(panel, ES_BUTTON_CHECKBOX, 0, "Checkbox");
|
||||||
|
|
||||||
|
EsTextboxCreate(panel);
|
||||||
|
EsTextboxCreate(panel);
|
||||||
|
|
||||||
EsButtonOnCommand(EsButtonCreate(panel, ES_FLAGS_DEFAULT, 0, "Alert 1"), [] (EsInstance *, EsElement *element, EsCommand *) {
|
EsButtonOnCommand(EsButtonCreate(panel, ES_FLAGS_DEFAULT, 0, "Alert 1"), [] (EsInstance *, EsElement *element, EsCommand *) {
|
||||||
EsDialog *dialog = EsDialogShow(element->window, "Rename multiple items", -1,
|
EsDialog *dialog = EsDialogShow(element->window, "Rename multiple items", -1,
|
||||||
"Choose the format for the new names.", -1, ES_ICON_DOCUMENT_EDIT, ES_FLAGS_DEFAULT);
|
"Choose the format for the new names.", -1, ES_ICON_DOCUMENT_EDIT, ES_FLAGS_DEFAULT);
|
||||||
|
|
|
@ -40,7 +40,7 @@ struct {
|
||||||
// Input.
|
// Input.
|
||||||
bool draggingStarted, mouseButtonDown;
|
bool draggingStarted, mouseButtonDown;
|
||||||
uint8_t leftModifiers, rightModifiers;
|
uint8_t leftModifiers, rightModifiers;
|
||||||
int lastClickX, lastClickY, lastClickButton, resizeType;
|
int lastClickX, lastClickY, lastClickButton;
|
||||||
|
|
||||||
// Menus.
|
// Menus.
|
||||||
bool menuMode;
|
bool menuMode;
|
||||||
|
@ -59,7 +59,6 @@ struct {
|
||||||
// Misc.
|
// Misc.
|
||||||
Array<EsWindow *> allWindows;
|
Array<EsWindow *> allWindows;
|
||||||
HashTable keyboardShortcutNames;
|
HashTable keyboardShortcutNames;
|
||||||
EsCursorStyle resizeCursor;
|
|
||||||
EsElement *insertAfter;
|
EsElement *insertAfter;
|
||||||
|
|
||||||
// Resizing data.
|
// Resizing data.
|
||||||
|
@ -445,11 +444,15 @@ struct EsWindow : EsElement {
|
||||||
EsWindowStyle windowStyle;
|
EsWindowStyle windowStyle;
|
||||||
uint32_t windowWidth, windowHeight;
|
uint32_t windowWidth, windowHeight;
|
||||||
|
|
||||||
|
// TODO Replace this with a bitset?
|
||||||
bool willUpdate, toolbarFillMode, destroyInstanceAfterClose, doNotPaint;
|
bool willUpdate, toolbarFillMode, destroyInstanceAfterClose, doNotPaint;
|
||||||
bool restoreOnNextMove, resetPositionOnNextMove, receivedFirstResize, isMaximised;
|
bool restoreOnNextMove, resetPositionOnNextMove, receivedFirstResize, isMaximised;
|
||||||
bool hovering, activated, appearActivated;
|
bool hovering, activated, appearActivated;
|
||||||
bool visualizeRepaints, visualizeLayoutBounds, visualizePaintSteps; // Inspector properties.
|
bool visualizeRepaints, visualizeLayoutBounds, visualizePaintSteps; // Inspector properties.
|
||||||
|
|
||||||
|
uint8_t resizeType;
|
||||||
|
EsCursorStyle resizeCursor;
|
||||||
|
|
||||||
EsElement *mainPanel, *toolbar;
|
EsElement *mainPanel, *toolbar;
|
||||||
EsPanel *toolbarSwitcher;
|
EsPanel *toolbarSwitcher;
|
||||||
Array<EsDialog *> dialogs;
|
Array<EsDialog *> dialogs;
|
||||||
|
@ -669,14 +672,14 @@ int ProcessWindowBorderMessage(EsWindow *window, EsMessage *message, EsRectangle
|
||||||
message->cursorStyle = ES_CURSOR_NORMAL;
|
message->cursorStyle = ES_CURSOR_NORMAL;
|
||||||
|
|
||||||
if (window->isMaximised) {
|
if (window->isMaximised) {
|
||||||
gui.resizeType = 0;
|
window->resizeType = 0;
|
||||||
gui.resizeCursor = message->cursorStyle;
|
window->resizeCursor = message->cursorStyle;
|
||||||
} else {
|
} else {
|
||||||
bool left = position.x < to, right = position.x >= bounds.r - to,
|
bool left = position.x < to, right = position.x >= bounds.r - to,
|
||||||
top = position.y < to, bottom = position.y >= bounds.b - to;
|
top = position.y < to, bottom = position.y >= bounds.b - to;
|
||||||
|
|
||||||
if (gui.resizing) {
|
if (gui.resizing) {
|
||||||
message->cursorStyle = gui.resizeCursor;
|
message->cursorStyle = window->resizeCursor;
|
||||||
} else if (position.x < from || position.y < from
|
} else if (position.x < from || position.y < from
|
||||||
|| position.x >= bounds.r - from || position.y >= bounds.b - from) {
|
|| position.x >= bounds.r - from || position.y >= bounds.b - from) {
|
||||||
} else if ((right && top) || (bottom && left)) {
|
} else if ((right && top) || (bottom && left)) {
|
||||||
|
@ -690,8 +693,8 @@ int ProcessWindowBorderMessage(EsWindow *window, EsMessage *message, EsRectangle
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!window->pressed && !gui.mouseButtonDown) {
|
if (!window->pressed && !gui.mouseButtonDown) {
|
||||||
gui.resizeType = (left ? RESIZE_LEFT : 0) | (right ? RESIZE_RIGHT : 0) | (top ? RESIZE_TOP : 0) | (bottom ? RESIZE_BOTTOM : 0);
|
window->resizeType = (left ? RESIZE_LEFT : 0) | (right ? RESIZE_RIGHT : 0) | (top ? RESIZE_TOP : 0) | (bottom ? RESIZE_BOTTOM : 0);
|
||||||
gui.resizeCursor = message->cursorStyle;
|
window->resizeCursor = message->cursorStyle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -702,15 +705,15 @@ int ProcessWindowBorderMessage(EsWindow *window, EsMessage *message, EsRectangle
|
||||||
|
|
||||||
if (gui.resizing) {
|
if (gui.resizing) {
|
||||||
EsPoint screenPosition = EsMouseGetPosition(nullptr);
|
EsPoint screenPosition = EsMouseGetPosition(nullptr);
|
||||||
WindowChangeBounds(gui.resizeType, screenPosition.x, screenPosition.y,
|
WindowChangeBounds(window->resizeType, screenPosition.x, screenPosition.y,
|
||||||
&gui.lastClickX, &gui.lastClickY, window,
|
&gui.lastClickX, &gui.lastClickY, window,
|
||||||
gui.resizingBothSides, &gui.resizeStartBounds);
|
gui.resizingBothSides, &gui.resizeStartBounds);
|
||||||
}
|
}
|
||||||
} else if (message->type == ES_MSG_MOUSE_LEFT_DRAG) {
|
} else if (message->type == ES_MSG_MOUSE_LEFT_DRAG) {
|
||||||
EsPoint screenPosition = EsMouseGetPosition(nullptr);
|
EsPoint screenPosition = EsMouseGetPosition(nullptr);
|
||||||
|
|
||||||
if (!window->isMaximised || gui.resizeType == RESIZE_MOVE) {
|
if (!window->isMaximised || window->resizeType == RESIZE_MOVE) {
|
||||||
WindowChangeBounds(gui.resizeType, screenPosition.x, screenPosition.y,
|
WindowChangeBounds(window->resizeType, screenPosition.x, screenPosition.y,
|
||||||
&gui.lastClickX, &gui.lastClickY, window,
|
&gui.lastClickX, &gui.lastClickY, window,
|
||||||
gui.resizingBothSides, &gui.resizeStartBounds);
|
gui.resizingBothSides, &gui.resizeStartBounds);
|
||||||
gui.resizing = true;
|
gui.resizing = true;
|
||||||
|
@ -7403,7 +7406,7 @@ void UIProcessWindowManagerMessage(EsWindow *window, EsMessage *message, Process
|
||||||
} else if (message->type == ES_MSG_SCROLL_WHEEL) {
|
} else if (message->type == ES_MSG_SCROLL_WHEEL) {
|
||||||
EsElement *element = window->dragged ?: window->pressed ?: window->hovered;
|
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);
|
UIMessageSendPropagateToAncestors(element, message);
|
||||||
}
|
}
|
||||||
} else if (message->type == ES_MSG_WINDOW_RESIZED) {
|
} else if (message->type == ES_MSG_WINDOW_RESIZED) {
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue