diff --git a/desktop/gui.cpp b/desktop/gui.cpp index 24a25c8..ee5be6d 100644 --- a/desktop/gui.cpp +++ b/desktop/gui.cpp @@ -17,9 +17,10 @@ // Behaviour of activation clicks. --> Only ignore activation clicks from menus. // Behaviour of the scroll wheel with regards to focused/hovered elements --> Scroll the hovered element only. +// TODO Get these from the theme file. #define WINDOW_INSET ((int) (19 * theming.scale)) #define CONTAINER_TAB_BAND_HEIGHT ((int) (33 * theming.scale)) -#define BORDER_THICKNESS ((int) (9 * theming.scale)) +#define BORDER_THICKNESS ((int) ( 9 * theming.scale)) // #define TRACE_LAYOUT @@ -790,7 +791,8 @@ int ProcessRootMessage(EsElement *element, EsMessage *message) { EsElementMove(window->GetChild(0), WINDOW_INSET, WINDOW_INSET, bounds.r - WINDOW_INSET * 2, CONTAINER_TAB_BAND_HEIGHT); } else if (message->type == ES_MSG_UI_SCALE_CHANGED) { // This message is also sent when the window is created. - EsSyscall(ES_SYSCALL_WINDOW_SET_PROPERTY, window->handle, ES_WINDOW_SOLID_TRUE, 10 * theming.scale, ES_WINDOW_PROPERTY_SOLID); + EsRectangle solidInsets = ES_RECT_1((WINDOW_INSET - BORDER_THICKNESS) * theming.scale); + EsSyscall(ES_SYSCALL_WINDOW_SET_PROPERTY, window->handle, ES_WINDOW_SOLID_TRUE, (uintptr_t) &solidInsets, ES_WINDOW_PROPERTY_SOLID); EsRectangle embedInsets = ES_RECT_4(WINDOW_INSET, WINDOW_INSET, WINDOW_INSET + CONTAINER_TAB_BAND_HEIGHT, WINDOW_INSET); EsSyscall(ES_SYSCALL_WINDOW_SET_PROPERTY, window->handle, (uintptr_t) &embedInsets, 0, ES_WINDOW_PROPERTY_EMBED_INSETS); EsRectangle opaqueBounds = ES_RECT_4(WINDOW_INSET, window->windowWidth - WINDOW_INSET, WINDOW_INSET, window->windowHeight - WINDOW_INSET); @@ -937,7 +939,7 @@ EsWindow *EsWindowCreate(EsInstance *instance, EsWindowStyle style) { EsElementStartTransition(window, ES_TRANSITION_FADE_IN); - 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, ES_WINDOW_SOLID_TRUE, (uintptr_t) &panel->currentStyle->insets, ES_WINDOW_PROPERTY_SOLID); EsSyscall(ES_SYSCALL_WINDOW_SET_PROPERTY, window->handle, BLEND_WINDOW_MATERIAL_GLASS, 0, ES_WINDOW_PROPERTY_MATERIAL); } diff --git a/kernel/syscall.cpp b/kernel/syscall.cpp index 952c9b3..13e229f 100644 --- a/kernel/syscall.cpp +++ b/kernel/syscall.cpp @@ -418,7 +418,9 @@ SYSCALL_IMPLEMENT(ES_SYSCALL_WINDOW_SET_PROPERTY) { window->solid = (argument1 & ES_WINDOW_SOLID_TRUE) != 0; window->noClickActivate = (argument1 & ES_WINDOW_SOLID_NO_ACTIVATE) != 0; window->noBringToFront = (argument1 & ES_WINDOW_SOLID_NO_BRING_TO_FRONT) != 0; - window->solidInsets = ES_RECT_1I(argument2); + EsRectangle solidInsets = ES_RECT_1(0); + if (argument2) SYSCALL_READ(&solidInsets, argument2, sizeof(EsRectangle)); + window->solidOffsets = ES_RECT_4(solidInsets.l, -solidInsets.r, solidInsets.t, -solidInsets.b); KMutexAcquire(&windowManager.mutex); windowManager.MoveCursor(0, 0); KMutexRelease(&windowManager.mutex); diff --git a/kernel/windows.cpp b/kernel/windows.cpp index 275a87b..b7d8bf1 100644 --- a/kernel/windows.cpp +++ b/kernel/windows.cpp @@ -34,7 +34,7 @@ struct Window { // State: EsWindowStyle style; - EsRectangle solidInsets, embedInsets; + EsRectangle solidOffsets, embedInsets; bool solid, noClickActivate, hidden, isMaximised, alwaysOnTop, hoveringOverEmbed, queuedScrollUpdate, activationClick, noBringToFront; volatile bool closed; @@ -249,7 +249,7 @@ Window *WindowManager::FindWindowAtPosition(int cursorX, int cursorY, EsObjectID EsRectangle bounds = ES_RECT_4PD(window->position.x, window->position.y, window->width, window->height); if (window->solid && !window->hidden && exclude != window->id - && EsRectangleContains(EsRectangleAdd(bounds, window->solidInsets), cursorX, cursorY) + && EsRectangleContains(EsRectangleAdd(bounds, window->solidOffsets), cursorX, cursorY) && (!window->isMaximised || EsRectangleContains(workArea, cursorX, cursorY))) { return window; } @@ -791,25 +791,25 @@ bool Window::Move(EsRectangle rectangle, uint32_t flags) { // TS("Move window\n"); if (flags & ES_WINDOW_MOVE_ADJUST_TO_FIT_SCREEN) { + rectangle = EsRectangleAdd(rectangle, solidOffsets); + if (rectangle.r > (int32_t) graphics.frameBuffer.width) { - rectangle.l -= rectangle.r - graphics.frameBuffer.width; - rectangle.r -= rectangle.r - graphics.frameBuffer.width; + rectangle = Translate(rectangle, graphics.frameBuffer.width - rectangle.r, 0); } if (rectangle.b > (int32_t) graphics.frameBuffer.height) { - rectangle.t -= rectangle.b - graphics.frameBuffer.height; - rectangle.b -= rectangle.b - graphics.frameBuffer.height; + rectangle = Translate(rectangle, 0, graphics.frameBuffer.height - rectangle.b); } if (rectangle.l < 0) { - rectangle.r -= rectangle.l - 0; - rectangle.l = 0; + rectangle = Translate(rectangle, -rectangle.l, 0); } if (rectangle.t < 0) { - rectangle.b -= rectangle.t - 0; - rectangle.t = 0; + rectangle = Translate(rectangle, 0, -rectangle.t); } + + rectangle = EsRectangleSubtract(rectangle, solidOffsets); } size_t newWidth = rectangle.r - rectangle.l; diff --git a/ports/freetype/build.sh b/ports/freetype/build.sh index 62277d0..ef0a982 100755 --- a/ports/freetype/build.sh +++ b/ports/freetype/build.sh @@ -1,5 +1,5 @@ if [ ! -d "bin/freetype" ]; then - echo " Downloading and building FreeType..." + echo "Downloading and building FreeType..." if [ ! -f "bin/freetype-2.9.tar" ]; then curl https://mirrors.up.pt/pub/nongnu/freetype/freetype-2.9.tar.gz > bin/freetype-2.9.tar.gz 2> bin/freetype_dl.txt diff --git a/ports/harfbuzz/build.sh b/ports/harfbuzz/build.sh index cbb5501..34c1655 100755 --- a/ports/harfbuzz/build.sh +++ b/ports/harfbuzz/build.sh @@ -1,5 +1,5 @@ if [ ! -d "bin/harfbuzz" ]; then - echo " Downloading and building Harfbuzz..." + echo "Downloading and building Harfbuzz..." if [ ! -f "bin/harfbuzz-2.6.4.tar" ]; then curl https://www.freedesktop.org/software/harfbuzz/release/harfbuzz-2.6.4.tar.xz > bin/harfbuzz-2.6.4.tar.xz 2> bin/harfbuzz_dl.txt diff --git a/util/build.c b/util/build.c index 0b32543..4d3cef7 100644 --- a/util/build.c +++ b/util/build.c @@ -1431,10 +1431,11 @@ void DoCommand(const char *l) { fprintf(stderr, "Crash report made at " ColorHighlight "%s" ColorNormal ".\n", cwd); } else if (0 == strcmp(l, "help") || 0 == strcmp(l, "h") || 0 == strcmp(l, "?")) { printf(ColorHighlight "\n=== Common Commands ===\n" ColorNormal); - printf("build (b) - Build.\n"); - printf("test (t2) - Build and run in Qemu.\n"); - printf("vbox (v) - Build (with optimisations enabled) and run in VirtualBox.\n"); - printf("debug (d) - Build and run in Qemu (GDB server enabled).\n"); + printf("build (b) - Build.\n"); + printf("qemu-with-kvm (k) - Build (with optimisations enabled) and run in Qemu with KVM.\n"); + printf("test (t2) - Build and run in Qemu.\n"); + printf("vbox (v) - Build (with optimisations enabled) and run in VirtualBox.\n"); + printf("debug (d) - Build and run in Qemu (GDB server enabled).\n"); printf("config - Open the local configuration editor.\n"); printf("exit - Exit the build system.\n"); @@ -1448,7 +1449,7 @@ void DoCommand(const char *l) { printf("live - Create a live USB or CDROM.\n"); printf(ColorHighlight "\n=== Utilities ===\n" ColorNormal); - printf("designer - Open the interface style designer.\n"); + printf("designer2 - Open the interface style designer.\n"); printf("line-count - Count lines of code.\n"); printf("ascii - Convert a string to a list of ASCII codepoints.\n"); printf("a2l - Translate addresses to lines.\n");