This commit is contained in:
nakst 2021-09-19 11:25:40 +01:00
parent 7bc509cb4c
commit 5b9b87afe9
3 changed files with 25 additions and 11 deletions

View File

@ -3611,8 +3611,8 @@ int ProcessCanvasPaneMessage(EsElement *element, EsMessage *message) {
// TODO Set cursor. // TODO Set cursor.
EsPoint point = EsMouseGetPosition(pane); EsPoint point = EsMouseGetPosition(pane);
pane->zoomFit = false; pane->zoomFit = false;
pane->panX -= (float) (point.x - pane->lastPanPoint.y) / pane->zoom; pane->panX -= (float) (point.x - pane->lastPanPoint.x) / pane->zoom;
pane->panY -= (float) (point.x - pane->lastPanPoint.y) / pane->zoom; pane->panY -= (float) (point.y - pane->lastPanPoint.y) / pane->zoom;
pane->lastPanPoint = point; pane->lastPanPoint = point;
EsElementRelayout(pane); EsElementRelayout(pane);
} else if (message->type == ES_MSG_GET_CURSOR && pane->window->dragged == pane) { } else if (message->type == ES_MSG_GET_CURSOR && pane->window->dragged == pane) {
@ -4143,7 +4143,7 @@ void DrawStyledBox(EsPainter *painter, StyledBox box) {
layerBox.mainPaintType = THEME_PAINT_SOLID; layerBox.mainPaintType = THEME_PAINT_SOLID;
layerBox.borderPaintType = THEME_PAINT_SOLID; layerBox.borderPaintType = THEME_PAINT_SOLID;
uint8_t info[sizeof(ThemeLayerBox) + sizeof(ThemePaintCustom) + sizeof(ThemePaintSolid) * 2]; uint8_t info[sizeof(ThemeLayerBox) + sizeof(ThemePaintCustom) + sizeof(ThemePaintSolid) * 2] = {};
if (box.fragmentShader) { if (box.fragmentShader) {
ThemeLayerBox *infoBox = (ThemeLayerBox *) info; ThemeLayerBox *infoBox = (ThemeLayerBox *) info;
@ -4962,7 +4962,7 @@ EsSplitter *EsSplitterCreate(EsElement *parent, uint64_t flags, const EsStyle *s
// aspect ratio; sizing // aspect ratio; sizing
// upscale/downscale quality // upscale/downscale quality
// subregion, transformations // subregion, transformations
// transparency, IsRegionCompletelyOpaque, proper blending mode with fragmentShader in DrawStyledBox // transparency, IsRegionCompletelyOpaque
// image sets, DPI; SVG scaling // image sets, DPI; SVG scaling
// embedding in TextDisplay // embedding in TextDisplay
// merge with IconDisplay // merge with IconDisplay
@ -6850,7 +6850,7 @@ void UIWindowLayoutNow(EsWindow *window, ProcessMessageTiming *timing) {
bool UISetCursor(EsWindow *window) { bool UISetCursor(EsWindow *window) {
EsCursorStyle cursorStyle = ES_CURSOR_NORMAL; EsCursorStyle cursorStyle = ES_CURSOR_NORMAL;
EsElement *element = window->pressed ?: window->hovered; EsElement *element = window->dragged ?: window->pressed ?: window->hovered;
if (element) { if (element) {
EsMessage m = { ES_MSG_GET_CURSOR }; EsMessage m = { ES_MSG_GET_CURSOR };
@ -7165,7 +7165,8 @@ void UIProcessWindowManagerMessage(EsWindow *window, EsMessage *message, Process
UIFindHoverElement(window); UIFindHoverElement(window);
bool changedCursor = UISetCursor(window); bool changedCursor = UISetCursor(window);
if (THEME_RECT_VALID(window->updateRegion) && window->width == (int) window->windowWidth && window->height == (int) window->windowHeight) { if (window->width == (int) window->windowWidth && window->height == (int) window->windowHeight
&& THEME_RECT_VALID(window->updateRegion) && !window->doNotPaint) {
UIWindowPaintNow(window, timing, message->type == ES_MSG_WINDOW_RESIZED); UIWindowPaintNow(window, timing, message->type == ES_MSG_WINDOW_RESIZED);
} else if (changedCursor) { } else if (changedCursor) {
EsSyscall(ES_SYSCALL_SCREEN_FORCE_UPDATE, 0, 0, 0, 0); EsSyscall(ES_SYSCALL_SCREEN_FORCE_UPDATE, 0, 0, 0, 0);

View File

@ -604,6 +604,10 @@ void ThemeFillBlurCorner(EsPainter *painter, EsRectangle bounds, int cx, int cy,
ES_FUNCTION_OPTIMISE_O2 ES_FUNCTION_OPTIMISE_O2
void GradientCacheSetup(GradientCache *cache, const ThemePaintLinearGradient *gradient, int width, int height, EsBuffer *data) { void GradientCacheSetup(GradientCache *cache, const ThemePaintLinearGradient *gradient, int width, int height, EsBuffer *data) {
if (!gradient) {
return;
}
width--, height--; width--, height--;
cache->dx = gradient->transform[0] / width * (GRADIENT_CACHE_COUNT << GRADIENT_COORD_BASE); cache->dx = gradient->transform[0] / width * (GRADIENT_CACHE_COUNT << GRADIENT_COORD_BASE);

View File

@ -93,6 +93,7 @@ struct WindowManager {
KEvent windowsToCloseEvent; KEvent windowsToCloseEvent;
EsObjectID currentWindowID; EsObjectID currentWindowID;
size_t inspectorWindowCount; size_t inspectorWindowCount;
EsMessageType pressedWindowButton;
// Cursor: // Cursor:
@ -547,16 +548,24 @@ void WindowManager::ClickCursor(unsigned buttons) {
// TODO Setting pressedWindow if holding with other mouse buttons. // TODO Setting pressedWindow if holding with other mouse buttons.
if (message.type == ES_MSG_MOUSE_LEFT_DOWN) { if (message.type == ES_MSG_MOUSE_LEFT_DOWN || message.type == ES_MSG_MOUSE_MIDDLE_DOWN || message.type == ES_MSG_MOUSE_RIGHT_DOWN) {
pressedWindow = window; if (!pressedWindow) {
} else if (message.type == ES_MSG_MOUSE_LEFT_UP) { pressedWindowButton = message.type;
pressedWindow = window;
}
}
if (message.type == ES_MSG_MOUSE_LEFT_UP || message.type == ES_MSG_MOUSE_MIDDLE_UP || message.type == ES_MSG_MOUSE_RIGHT_UP) {
if (pressedWindow) { if (pressedWindow) {
// Always send the messages to the pressed window, if there is one. // Always send the messages to the pressed window, if there is one.
window = pressedWindow; window = pressedWindow;
} }
pressedWindow = nullptr; if (pressedWindowButton == message.type - 1) {
moveCursorNone = true; // We might have moved outside the window. // Only end pressing if this is the same button as pressing started with.
pressedWindow = nullptr;
moveCursorNone = true; // We might have moved outside the window.
}
} }
if (window) { if (window) {