diff --git a/apps/file_manager/main.cpp b/apps/file_manager/main.cpp index d1cb4de..4cfc718 100644 --- a/apps/file_manager/main.cpp +++ b/apps/file_manager/main.cpp @@ -313,10 +313,17 @@ void BlockingTaskThread(EsGeneric _instance) { void BlockingTaskComplete(Instance *instance) { EsAssert(instance->blockingTaskInProgress); // Task should have been in progress. instance->blockingTaskInProgress = false; - if (instance->blockingTaskReachedTimeout) EsDialogClose(instance->blockingDialog); + + if (instance->blockingTaskReachedTimeout && instance->blockingDialog) { + EsDialogClose(instance->blockingDialog); + } + instance->blockingDialog = nullptr; Task *task = &instance->blockingTask; - if (task->then) task->then(instance, task); + + if (task->then) { + task->then(instance, task); + } } void BlockingTaskQueue(Instance *instance, Task task) { diff --git a/desktop/gui.cpp b/desktop/gui.cpp index 4090b87..69ff719 100644 --- a/desktop/gui.cpp +++ b/desktop/gui.cpp @@ -912,12 +912,9 @@ EsWindow *EsWindowCreate(EsInstance *instance, EsWindowStyle style) { EsSyscall(ES_SYSCALL_WINDOW_SET_PROPERTY, window->handle, style == ES_WINDOW_PLAIN ? ES_WINDOW_SOLID_TRUE : ES_FLAGS_DEFAULT, 0, ES_WINDOW_PROPERTY_SOLID); window->mainPanel = EsPanelCreate(window, ES_ELEMENT_NON_CLIENT | ES_CELL_FILL, nullptr); } else if (style == ES_WINDOW_MENU) { - EsSyscall(ES_SYSCALL_WINDOW_SET_PROPERTY, window->handle, ES_WINDOW_SOLID_TRUE, 9 * theming.scale, ES_WINDOW_PROPERTY_SOLID); - EsSyscall(ES_SYSCALL_WINDOW_SET_PROPERTY, window->handle, BLEND_WINDOW_MATERIAL_GLASS, 0, ES_WINDOW_PROPERTY_MATERIAL); + window->SetStyle(ES_STYLE_MENU_ROOT); - window->SetStyle(ES_STYLE_PANEL_MENU_ROOT); - - EsPanel *panel = EsPanelCreate(window, ES_ELEMENT_NON_CLIENT | ES_PANEL_HORIZONTAL | ES_CELL_FILL, ES_STYLE_PANEL_MENU_CONTAINER); + EsPanel *panel = EsPanelCreate(window, ES_ELEMENT_NON_CLIENT | ES_PANEL_HORIZONTAL | ES_CELL_FILL, ES_STYLE_MENU_CONTAINER); panel->cName = "menu"; panel->separatorStylePart = ES_STYLE_MENU_SEPARATOR_VERTICAL; panel->separatorFlags = ES_CELL_V_FILL; @@ -934,6 +931,9 @@ EsWindow *EsWindowCreate(EsInstance *instance, EsWindowStyle style) { }; window->mainPanel = panel; + + EsSyscall(ES_SYSCALL_WINDOW_SET_PROPERTY, window->handle, ES_WINDOW_SOLID_TRUE, panel->currentStyle->insets.l, ES_WINDOW_PROPERTY_SOLID); + EsSyscall(ES_SYSCALL_WINDOW_SET_PROPERTY, window->handle, BLEND_WINDOW_MATERIAL_GLASS, 0, ES_WINDOW_PROPERTY_MATERIAL); } if (style == ES_WINDOW_INSPECTOR) { @@ -966,7 +966,7 @@ void EsMenuAddSeparator(EsMenu *menu) { } void EsMenuNextColumn(EsMenu *menu, uint64_t flags) { - EsPanelCreate(menu->children[0], ES_PANEL_VERTICAL | ES_CELL_V_TOP | flags, ES_STYLE_PANEL_MENU_COLUMN); + EsPanelCreate(menu->children[0], ES_PANEL_VERTICAL | ES_CELL_V_TOP | flags, ES_STYLE_MENU_COLUMN); } EsElement *EsMenuGetSource(EsMenu *menu) { @@ -1037,20 +1037,20 @@ void EsMenuShow(EsMenu *menu, int fixedWidth, int fixedHeight) { EsRectangle windowBounds = menu->source->window->GetScreenBounds(); - if (position.x + width >= windowBounds.r) { - position.x = windowBounds.r - width - 1; + if (position.x + width - menuInsets.r >= windowBounds.r) { + position.x = windowBounds.r - width - 1 + menuInsets.r; } - if (position.x < windowBounds.l) { - position.x = windowBounds.l; + if (position.x + menuInsets.l < windowBounds.l) { + position.x = windowBounds.l - menuInsets.l; } - if (position.y + height >= windowBounds.b) { - position.y = windowBounds.b - height - 1; + if (position.y + height - menuInsets.b >= windowBounds.b) { + position.y = windowBounds.b - height - 1 + menuInsets.b; } - if (position.y < windowBounds.t) { - position.y = windowBounds.t; + if (position.y + menuInsets.t < windowBounds.t) { + position.y = windowBounds.t - menuInsets.t; } } else { position = EsMouseGetPosition(); diff --git a/desktop/styles.header b/desktop/styles.header index f71f235..076edfc 100644 --- a/desktop/styles.header +++ b/desktop/styles.header @@ -47,6 +47,9 @@ define ES_STYLE_LIST_VIEW_BORDERED (ES_STYLE_CAST(1295)) define ES_STYLE_LIST_DISPLAY_DEFAULT (ES_STYLE_CAST(1441)) private define ES_STYLE_MARKER_DOWN_ARROW (ES_STYLE_CAST(1297)) private define ES_STYLE_MARKER_UP_ARROW (ES_STYLE_CAST(1501)) +private define ES_STYLE_MENU_COLUMN (ES_STYLE_CAST(1321)) +private define ES_STYLE_MENU_CONTAINER (ES_STYLE_CAST(1323)) +private define ES_STYLE_MENU_ROOT (ES_STYLE_CAST(1325)) private define ES_STYLE_MENU_ITEM_HEADER (ES_STYLE_CAST(1299)) private define ES_STYLE_MENU_ITEM_NORMAL (ES_STYLE_CAST(1301)) private define ES_STYLE_MENU_SEPARATOR_HORIZONTAL (ES_STYLE_CAST(1303)) @@ -60,9 +63,6 @@ define ES_STYLE_PANEL_GROUP_BOX (ES_STYLE_CAST(1315)) define ES_STYLE_PANEL_INSET (ES_STYLE_CAST(1641)) private define ES_STYLE_PANEL_INSPECTOR_WINDOW_CONTAINER (ES_STYLE_CAST(1317)) private define ES_STYLE_PANEL_INSPECTOR_WINDOW_ROOT (ES_STYLE_CAST(1319)) -private define ES_STYLE_PANEL_MENU_COLUMN (ES_STYLE_CAST(1321)) -private define ES_STYLE_PANEL_MENU_CONTAINER (ES_STYLE_CAST(1323)) -private define ES_STYLE_PANEL_MENU_ROOT (ES_STYLE_CAST(1325)) define ES_STYLE_PANEL_POPUP (ES_STYLE_CAST(1331)) define ES_STYLE_PANEL_SHEET (ES_STYLE_CAST(1333)) private define ES_STYLE_PANEL_SHUTDOWN_OVERLAY (ES_STYLE_CAST(1335)) diff --git a/desktop/theme.cpp b/desktop/theme.cpp index b0f39c1..0db6a37 100644 --- a/desktop/theme.cpp +++ b/desktop/theme.cpp @@ -547,13 +547,11 @@ void ThemeFillCorner(EsPainter *painter, EsRectangle bounds, int cx, int cy, if (outsideCount == (1 << (2 * STYLE_CORNER_OVERSAMPLING))) { } else if (mainPaint.type == THEME_PAINT_OVERWRITE) { // TODO Support borders when using an overwrite main paint. - uint32_t m1 = ((mainCount << 8) >> STYLE_CORNER_OVERSAMPLING * 2); - uint32_t m2 = 256 - m1; - uint32_t r2 = m2 * (*b & 0x00FF00FF); - uint32_t g2 = m2 * ((*b >> 8) & 0x00FF00FF); - uint32_t r1 = m1 * (mainColor & 0x00FF00FF); - uint32_t g1 = m1 * ((mainColor >> 8) & 0x00FF00FF); - *b = (0xFF00FF00 & (g1 + g2)) | (0x00FF00FF & ((r1 + r2) >> 8)); + // TODO Anti-aliasing (if it's possible). + + if (mainCount > (1 << (2 * STYLE_CORNER_OVERSAMPLING - 1))) { + *b = mainColor; + } } else if (outsideCount || ((borderColor & 0xFF000000) != 0xFF000000) || (mainColor & 0xFF000000) != 0xFF000000) { BlendPixel(b, (mainColor & 0x00FFFFFF) | (((mainAlpha * mainCount) << (24 - STYLE_CORNER_OVERSAMPLING * 2)) & 0xFF000000), painter->target->fullAlpha); diff --git a/kernel/graphics.cpp b/kernel/graphics.cpp index 50ef71d..a599378 100644 --- a/kernel/graphics.cpp +++ b/kernel/graphics.cpp @@ -240,7 +240,7 @@ void Surface::Scroll(EsRectangle region, ptrdiff_t delta, bool vertical) { #define C2(p) ((p & 0x00FF0000) >> 0x10) #define C3(p) ((p & 0xFF000000) >> 0x18) -ES_FUNCTION_OPTIMISE_O2 +ES_FUNCTION_OPTIMISE_O3 void BlurRegionOfImage(uint32_t *image, int width, int height, int stride, uint16_t *k, uintptr_t repeat) { if (width <= 3 || height <= 3) { return; @@ -281,7 +281,7 @@ void BlurRegionOfImage(uint32_t *image, int width, int height, int stride, uint1 } } -ES_FUNCTION_OPTIMISE_O2 +ES_FUNCTION_OPTIMISE_O3 void BlurRegionOfImage(uint32_t *image, int width, int height, int stride, uintptr_t repeat) { if (width <= 3 || height <= 3) { return; @@ -296,9 +296,9 @@ void BlurRegionOfImage(uint32_t *image, int width, int height, int stride, uintp for (int i = 0; i < width; i++, u++, v++) { if (i + 3 < width) g = *v; - *u = (((C0(a) * 0x07 + C0(b) * 0x1A + C0(c) * 0x38 + C0(d) * 0x49 + C0(e) * 0x38 + C0(f) * 0x1A + C0(g) * 0x07) >> 8) << 0x00) - + (((C1(a) * 0x07 + C1(b) * 0x1A + C1(c) * 0x38 + C1(d) * 0x49 + C1(e) * 0x38 + C1(f) * 0x1A + C1(g) * 0x07) >> 8) << 0x08) - + (((C2(a) * 0x07 + C2(b) * 0x1A + C2(c) * 0x38 + C2(d) * 0x49 + C2(e) * 0x38 + C2(f) * 0x1A + C2(g) * 0x07) >> 8) << 0x10) + *u = (((C0(a) * 0x07 + C0(b) * 0x1A + C0(c) * 0x38 + C0(d) * 0x4D + C0(e) * 0x38 + C0(f) * 0x1A + C0(g) * 0x07) >> 8) << 0x00) + + (((C1(a) * 0x07 + C1(b) * 0x1A + C1(c) * 0x38 + C1(d) * 0x4D + C1(e) * 0x38 + C1(f) * 0x1A + C1(g) * 0x07) >> 8) << 0x08) + + (((C2(a) * 0x07 + C2(b) * 0x1A + C2(c) * 0x38 + C2(d) * 0x4D + C2(e) * 0x38 + C2(f) * 0x1A + C2(g) * 0x07) >> 8) << 0x10) + (C3(d) << 0x18); a = b, b = c, c = d, d = e, e = f, f = g; } @@ -314,9 +314,9 @@ void BlurRegionOfImage(uint32_t *image, int width, int height, int stride, uintp for (int i = 0; i < height; i++, u += stride, v += stride) { if (i + 3 < height) g = *v; - *u = (((C0(a) * 0x07 + C0(b) * 0x1A + C0(c) * 0x38 + C0(d) * 0x49 + C0(e) * 0x38 + C0(f) * 0x1A + C0(g) * 0x07) >> 8) << 0x00) - + (((C1(a) * 0x07 + C1(b) * 0x1A + C1(c) * 0x38 + C1(d) * 0x49 + C1(e) * 0x38 + C1(f) * 0x1A + C1(g) * 0x07) >> 8) << 0x08) - + (((C2(a) * 0x07 + C2(b) * 0x1A + C2(c) * 0x38 + C2(d) * 0x49 + C2(e) * 0x38 + C2(f) * 0x1A + C2(g) * 0x07) >> 8) << 0x10) + *u = (((C0(a) * 0x07 + C0(b) * 0x1A + C0(c) * 0x38 + C0(d) * 0x4D + C0(e) * 0x38 + C0(f) * 0x1A + C0(g) * 0x07) >> 8) << 0x00) + + (((C1(a) * 0x07 + C1(b) * 0x1A + C1(c) * 0x38 + C1(d) * 0x4D + C1(e) * 0x38 + C1(f) * 0x1A + C1(g) * 0x07) >> 8) << 0x08) + + (((C2(a) * 0x07 + C2(b) * 0x1A + C2(c) * 0x38 + C2(d) * 0x4D + C2(e) * 0x38 + C2(f) * 0x1A + C2(g) * 0x07) >> 8) << 0x10) + (C3(d) << 0x18); a = b, b = c, c = d, d = e, e = f, f = g; } diff --git a/res/Theme Source.dat b/res/Theme Source.dat index 232da27..7b86dd0 100644 Binary files a/res/Theme Source.dat and b/res/Theme Source.dat differ diff --git a/res/Themes/Theme.dat b/res/Themes/Theme.dat index dd7f039..6427ce7 100644 Binary files a/res/Themes/Theme.dat and b/res/Themes/Theme.dat differ