resizing works partly
Some checks failed
pyrite-dev/milsko/pipeline/head There was a failure building this commit

This commit is contained in:
Nishi 2026-09-26 17:41:38 +09:00
commit e2da02f2c9
7 changed files with 171 additions and 71 deletions

120
configure vendored
View file

@ -4,7 +4,7 @@ $target =~ s/\r?\n$//;
# MSYS with MinGW gives us some other shit idk # MSYS with MinGW gives us some other shit idk
if (index($target, "MINGW") != -1) { if (index($target, "MINGW") != -1) {
$target = "Windows"; $target = "Windows";
} }
foreach my $l (@ARGV) { foreach my $l (@ARGV) {
@ -16,11 +16,11 @@ foreach my $l (@ARGV) {
} }
our $prefix = "/usr/local"; our $prefix = "/usr/local";
our $cc = defined($ENV{CC}) ? $ENV{CC} : "*host*gcc"; our $cc = defined($ENV{CC}) ? $ENV{CC} : "*host*gcc";
our $cxx = defined($ENV{CXX}) ? $ENV{CXX} : "*host*g++"; our $cxx = defined($ENV{CXX}) ? $ENV{CXX} : "*host*g++";
our $ar = defined($ENV{AR}) ? $ENV{AR} : "*host*ar"; our $ar = defined($ENV{AR}) ? $ENV{AR} : "*host*ar";
our $incdir = "-I include"; our $incdir = "-I include";
our $incdir2 = ""; our $incdir2 = "";
our $cflags = "-fPIC -D_MILSKO -D_MILSKO_BUILD -fvisibility=hidden"; our $cflags = "-fPIC -D_MILSKO -D_MILSKO_BUILD -fvisibility=hidden";
our $libdir = ""; our $libdir = "";
our $ldflags = ""; our $ldflags = "";
@ -68,46 +68,54 @@ my %features = (
"static" => "build static library", "static" => "build static library",
"wayland" => "enable wayland backend", "wayland" => "enable wayland backend",
"gnustep" => "use gnustep", "gnustep" => "use gnustep",
"dbus" => "use DBus on supported platform", "dbus" => "use DBus on supported platform",
"allow-sloppy-focus" => "prevent the x11 backend from using XSetInputFocus to enforce click-to-focus", "allow-sloppy-focus" =>
"prevent the x11 backend from using XSetInputFocus to enforce click-to-focus",
"direct3d9" => "(Windows only) build Direct3D9 widget" "direct3d9" => "(Windows only) build Direct3D9 widget"
); );
my @features_keys = ( my @features_keys = (
"1classic-theme", "1stb-image", "1classic-theme", "1stb-image",
"1stb-truetype", "1freetype2", "1gdi-text", "1stb-truetype", "1freetype2",
"1opengl", "2xrender", "1gdi-text", "1opengl",
"1vulkan", "2vulkan-string-helper", "2xrender", "1vulkan",
"1shared", "1static", "2vulkan-string-helper", "1shared",
"1wayland", "1gnustep", "1static", "1wayland",
"1dbus", "1direct3d9" "1gnustep", "1dbus",
"1direct3d9"
); );
sub def_platform { sub def_platform {
if($target eq "Windows") { if ($target eq "Windows") {
param_set("freetype2", 0); param_set("freetype2", 0);
param_set("stb-truetype", 0); param_set("stb-truetype", 0);
param_set("direct3d9", 1); param_set("direct3d9", 1);
} elsif($target ne "Darwin" and $target ne "ClassicMacOS" and $target ne "Haiku") { }
param_set("freetype2", 1); elsif ( $target ne "Darwin"
param_set("stb-truetype", 0); and $target ne "ClassicMacOS"
} else { and $target ne "Haiku")
param_set("freetype2", 0); {
param_set("stb-truetype", 1); param_set("freetype2", 1);
} param_set("stb-truetype", 0);
if($target eq "Linux" || $target eq "FreeBSD") { }
param_set("x11", 1); else {
param_set("freetype2", 0);
param_set("stb-truetype", 1);
}
if ($target eq "Linux" || $target eq "FreeBSD") {
param_set("x11", 1);
param_set("xrender", 1); param_set("xrender", 1);
if(!param_get("tiny")){ if (!param_get("tiny")) {
param_set("wayland", 1); param_set("wayland", 1);
} }
param_set("dbus", 1); param_set("dbus", 1);
} }
if($target eq "NetBSD" || $target eq "OpenBSD") { if ($target eq "NetBSD" || $target eq "OpenBSD") {
param_set("x11", 1); param_set("x11", 1);
} }
if($target eq "Windows") { if ($target eq "Windows") {
param_set("gdi-text", 1); param_set("gdi-text", 1);
} else { }
else {
param_set("gdi-text", 0); param_set("gdi-text", 0);
} }
} }
@ -120,7 +128,6 @@ foreach my $l (@ARGV) {
def_platform(); def_platform();
foreach my $l (@ARGV) { foreach my $l (@ARGV) {
if ($l =~ /^--with-([^=]+)=(.+)$/) { if ($l =~ /^--with-([^=]+)=(.+)$/) {
param_set($1, $2); param_set($1, $2);
@ -141,7 +148,7 @@ foreach my $l (@ARGV) {
$cross = 1; $cross = 1;
} }
elsif ($l eq "--tiny") { elsif ($l eq "--tiny") {
param_set("tiny",1); param_set("tiny", 1);
} }
elsif (($l eq "-h") or ($l eq "--help")) { elsif (($l eq "-h") or ($l eq "--help")) {
print("Milsko Toolkit Configuration Utility\n"); print("Milsko Toolkit Configuration Utility\n");
@ -154,7 +161,9 @@ foreach my $l (@ARGV) {
print(" --host=TARGET Host for compiler/archiver\n"); print(" --host=TARGET Host for compiler/archiver\n");
print(" --target=TARGET Specify target\n"); print(" --target=TARGET Specify target\n");
print(" --cflags=CFLAGS Add cflags\n"); print(" --cflags=CFLAGS Add cflags\n");
print(" --tiny Build smallest possible library\n"); print(
" --tiny Build smallest possible library\n"
);
print(" --cross Indicate cross compilation\n"); print(" --cross Indicate cross compilation\n");
print("\n"); print("\n");
print("Features:\n"); print("Features:\n");
@ -211,9 +220,9 @@ foreach my $e (param_list()) {
} }
print("Enabled: " . join(" ", @l) . "\n"); print("Enabled: " . join(" ", @l) . "\n");
$cc =~ s/\*host\*/$host/; $cc =~ s/\*host\*/$host/;
$cxx =~ s/\*host\*/$host/; $cxx =~ s/\*host\*/$host/;
$ar =~ s/\*host\*/$host/; $ar =~ s/\*host\*/$host/;
open(OUT, ">", "Makefile"); open(OUT, ">", "Makefile");
print(OUT "PREFIX = ${prefix}\n"); print(OUT "PREFIX = ${prefix}\n");
@ -261,9 +270,9 @@ print(OUT "\n");
print(OUT "\n"); print(OUT "\n");
if (param_get("shared")) { if (param_get("shared")) {
my $linker = "CC"; my $linker = "CC";
if (grep(/^haiku$/, @backends)) { if (grep(/^haiku$/, @backends)) {
$linker = "CXX"; $linker = "CXX";
} }
print( OUT "src/${library_prefix}Mw${library_suffix}: " print( OUT "src/${library_prefix}Mw${library_suffix}: "
. join(" ", @library_targets) . join(" ", @library_targets)
. "\n"); . "\n");
@ -279,18 +288,18 @@ if (param_get("static")) {
} }
foreach my $l (@library_targets) { foreach my $l (@library_targets) {
my $warn = "-Wall -Wextra -Wno-sign-compare -Wno-unused-value"; my $warn = "-Wall -Wextra -Wno-sign-compare -Wno-unused-value";
my $s = $l; my $s = $l;
my $compiler = "CC"; my $compiler = "CC";
my $o = $object_suffix; my $o = $object_suffix;
$o =~ s/\./\\\./g; $o =~ s/\./\\\./g;
if ($l =~ /cocoa/) { if ($l =~ /cocoa/) {
$s =~ s/$o$/.m/; $s =~ s/$o$/.m/;
} }
elsif ($l =~ /haiku/) { elsif ($l =~ /haiku/) {
$s =~ s/$o$/.cc/; $s =~ s/$o$/.cc/;
$compiler = "CXX"; $compiler = "CXX";
} }
else { else {
$s =~ s/$o$/.c/; $s =~ s/$o$/.c/;
@ -321,13 +330,12 @@ if (param_get("examples")) {
if (param_get("shared")) { if (param_get("shared")) {
print(OUT print(OUT
"${l}: ${s}${object_suffix} src/${library_prefix}Mw${library_suffix}\n" "${l}: ${s}${object_suffix} src/${library_prefix}Mw${library_suffix}\n"
);
} else {
print(OUT
"${l}: ${s}${object_suffix} src/${library_prefix}Mw.a\n"
); );
} }
else {
print(OUT "${l}: ${s}${object_suffix} src/${library_prefix}Mw.a\n");
}
if (grep(/^cocoa$/, @backends)) { if (grep(/^cocoa$/, @backends)) {
print(OUT print(OUT
" \$(CC) -L./src \$\(LIBDIR) -o ${l} ${s}${object_suffix} -lMw ${math} ${libs}\n" " \$(CC) -L./src \$\(LIBDIR) -o ${l} ${s}${object_suffix} -lMw ${math} ${libs}\n"
@ -339,11 +347,15 @@ if (param_get("examples")) {
); );
} }
if($target eq "ClassicMacOS") { if ($target eq "ClassicMacOS") {
print(OUT print( OUT " "
" ".$ENV{RETRO68_TOOLCHAIN_PATH}."/bin/MakePEF ${l} -o ${s}.pef\n"); . $ENV{RETRO68_TOOLCHAIN_PATH}
print(OUT . "/bin/MakePEF ${l} -o ${s}.pef\n");
" Rez -I ".$ENV{RETRO68_TOOLCHAIN_PATH}."/RIncludes ".$ENV{RETRO68_TOOLCHAIN_PATH}."/RIncludes/Retro68APPL.r -DCFRAG_NAME=\"example\" --data ${l}.pef --cc ${l}.dsk -t APPL\n" print( OUT " Rez -I "
. $ENV{RETRO68_TOOLCHAIN_PATH}
. "/RIncludes "
. $ENV{RETRO68_TOOLCHAIN_PATH}
. "/RIncludes/Retro68APPL.r -DCFRAG_NAME=\"example\" --data ${l}.pef --cc ${l}.dsk -t APPL\n"
); );
} }

View file

@ -83,6 +83,16 @@ MWDECL MwCursor MwCursorCenter;
*/ */
MWDECL MwCursor MwCursorCenterMask; MWDECL MwCursor MwCursorCenterMask;
/*!
* @brief Bottom right cursor
*/
MWDECL MwCursor MwCursorBottomRight;
/*!
* @brief Bottom right cursor mask
*/
MWDECL MwCursor MwCursorBottomRightMask;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -244,7 +244,9 @@ struct _MwSubWindow {
int width; int width;
int height; int height;
MwPoint cursor_start; MwPoint cursor_start;
MwPoint local_start;
MwPoint base; MwPoint base;
int mouse_cache;
}; };
struct _MwTab { struct _MwTab {

View file

@ -219,8 +219,8 @@ static void MwLLFreeColorImpl(MwLLColor color) {}
static MwBool lmao = MwFALSE; static MwBool lmao = MwFALSE;
static int MwLLPendingImpl(MwLL handle) { static int MwLLPendingImpl(MwLL handle) {
lmao = !lmao; lmao = !lmao;
return lmao; return lmao;
} }
static void MwLLNextEventImpl(MwLL handle) { static void MwLLNextEventImpl(MwLL handle) {
MwLLDispatch(handle, draw, NULL); MwLLDispatch(handle, draw, NULL);
@ -264,10 +264,10 @@ static void MwLLRaiseImpl(MwLL handle) {}
static void MwLLClipImpl(MwLL handle, MwRect* rect) {} static void MwLLClipImpl(MwLL handle, MwRect* rect) {}
static void MwLLSetupDragAndDropImpl(MwLL handle) {} static void MwLLSetupDragAndDropImpl(MwLL handle) {}
static int MwLLCairoCallInitImpl(void) { static int MwLLCairoCallInitImpl(void) {
if(cairo_load_funcs() != 0) { if(cairo_load_funcs() != 0) {
return 1; return 1;
} }
return 0; return 0;
} }
#include "call.c" #include "call.c"
CALL(Cairo); CALL(Cairo);

View file

@ -23,11 +23,11 @@
#define RESIZE(handle) \ #define RESIZE(handle) \
{ \ { \
int RESIZE_i; \ int RESIZE_i; \
MwDispatch(handle, resize); \
MwDispatchUserHandler(handle, MwNresizeHandler, NULL); \ MwDispatchUserHandler(handle, MwNresizeHandler, NULL); \
for(RESIZE_i = 0; RESIZE_i < arrlen(handle->children); RESIZE_i++) { \ for(RESIZE_i = 0; RESIZE_i < arrlen(handle->children); RESIZE_i++) { \
MwDispatch(handle->children[RESIZE_i], parent_resize); \ MwDispatch(handle->children[RESIZE_i], parent_resize); \
} \ } \
MwDispatch(handle, resize); \
} }
static void MWAPI MwVaListApply_Internal(MwWidget handle, va_list va, int only_early); static void MWAPI MwVaListApply_Internal(MwWidget handle, va_list va, int only_early);
@ -590,7 +590,7 @@ int MwPending(MwWidget handle) {
for(i = 0; i < arrlen(handle->children); i++) { for(i = 0; i < arrlen(handle->children); i++) {
if(MwPending(handle->children[i])) return 1; if(MwPending(handle->children[i])) return 1;
} }
return (arrlen(handle->tick_list) > 0 && (MwTimeGetTick() - handle->last_tick) >= (MwGetInteger(handle, MwNwaitMS) == MwDEFAULT ? MwWaitMS : MwGetInteger(handle, MwNwaitMS))) || (arrlen(handle->destroy_queue) > 0) || (handle->widget_class == NULL ? 0 : MwLLPending(handle->lowlevel)); return (arrlen(handle->tick_list) > 0 && (MwTimeGetTick() - handle->last_tick) >= (MwGetInteger(handle, MwNwaitMS) == MwDEFAULT ? MwWaitMS : MwGetInteger(handle, MwNwaitMS))) || (arrlen(handle->destroy_queue) > 0) || (arrlen(handle->resize_queue) > 0) || (handle->widget_class == NULL ? 0 : MwLLPending(handle->lowlevel));
} }
void MwLoop(MwWidget handle) { void MwLoop(MwWidget handle) {

43
src/cursor/bottomright.c Normal file
View file

@ -0,0 +1,43 @@
#include <Mw/Milsko.h>
/**
* Created by bitmaptobdf
*
* Copyright notice:
* These ""glyphs"" are unencumbered
*/
MwCursor MwCursorBottomRight = {
14, 14, -13, -1, {3, /* ............## */
3, /* ............## */
2083, /* ..#.....#...## */
1059, /* ...#....#...## */
547, /* ....#...#...## */
291, /* .....#..#...## */
163, /* ......#.#...## */
99, /* .......##...## */
4067, /* ..#######...## */
3, /* ............## */
3, /* ............## */
3, /* ............## */
16383, /* ############## */
16383, /* ############## */
0, 0}};
MwCursor MwCursorBottomRightMask = {
16, 16, -14, -2, {
15, /* ............#### */
15, /* ............#### */
12527, /* ..##....###.#### */
14575, /* ..###...###.#### */
7407, /* ...###..###.#### */
3823, /* ....###.###.#### */
2031, /* .....######.#### */
1007, /* ......#####.#### */
16367, /* ..#########.#### */
16367, /* ..#########.#### */
16367, /* ..#########.#### */
15, /* ............#### */
65535, /* ################ */
65535, /* ################ */
65535, /* ################ */
65535 /* ################ */
}};

View file

@ -359,10 +359,29 @@ static void prop_change(MwWidget handle, const char* key) {
if(strcmp(key, MwNtitle) == 0 || strcmp(key, MwNiconPixmap) == 0) MwForceRender(handle); if(strcmp(key, MwNtitle) == 0 || strcmp(key, MwNiconPixmap) == 0) MwForceRender(handle);
} }
static MwWidget mwSubWindowGetFrameImpl(MwWidget handle) { static int is_bottom_right(MwWidget handle, MwPoint* p) {
int w = MwGetInteger(handle, MwNwidth);
int h = MwGetInteger(handle, MwNheight);
if(p->x >= (w - TitleHeight) && p->y >= (h - TitleHeight)) {
return 1;
}
return 0;
}
static void mouse_move(MwWidget handle) {
MwSubWindow sw = handle->internal; MwSubWindow sw = handle->internal;
return sw->frame; if(is_bottom_right(handle, &handle->mouse_point)) {
if(sw->mouse_cache == 0) MwLLSetCursor(handle->lowlevel, &MwCursorBottomRight, &MwCursorBottomRightMask);
sw->mouse_cache = 1;
} else if(!handle->pressed && sw->mouse_cache != 0) {
sw->mouse_cache = 0;
MwLLSetCursor(handle->lowlevel, &MwCursorDefault, &MwCursorDefaultMask);
}
} }
static void mouse_down(MwWidget handle, void* ptr) { static void mouse_down(MwWidget handle, void* ptr) {
@ -371,13 +390,20 @@ static void mouse_down(MwWidget handle, void* ptr) {
if(m->button == MwMOUSE_LEFT && !sw->minimized && !sw->maximized) { if(m->button == MwMOUSE_LEFT && !sw->minimized && !sw->maximized) {
MwGetCursorCoord(handle, &sw->cursor_start); MwGetCursorCoord(handle, &sw->cursor_start);
sw->base.x = MwGetInteger(handle, MwNx); sw->local_start = handle->mouse_point;
sw->base.y = MwGetInteger(handle, MwNy); sw->base.x = MwGetInteger(handle, MwNx);
sw->base.y = MwGetInteger(handle, MwNy);
} }
MwLLRaise(handle->lowlevel); MwLLRaise(handle->lowlevel);
} }
static MwWidget mwSubWindowGetFrameImpl(MwWidget handle) {
MwSubWindow sw = handle->internal;
return sw->frame;
}
static void func_handler(MwWidget handle, const char* name, void* out, va_list va) { static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {
(void)va; (void)va;
@ -394,10 +420,17 @@ static void tick(MwWidget handle) {
MwGetCursorCoord(handle, &p); MwGetCursorCoord(handle, &p);
MwVaApply(handle, if(sw->mouse_cache == 1) {
MwNx, sw->base.x + p.x - sw->cursor_start.x, MwVaApply(handle,
MwNy, sw->base.y + p.y - sw->cursor_start.y, MwNwidth, handle->mouse_point.x,
NULL); MwNheight, handle->mouse_point.y,
NULL);
} else {
MwVaApply(handle,
MwNx, sw->base.x + p.x - sw->cursor_start.x,
MwNy, sw->base.y + p.y - sw->cursor_start.y,
NULL);
}
} }
} }
@ -408,7 +441,7 @@ MwClassRec MwSubWindowClassRec = {
NULL, /* click */ NULL, /* click */
parent_resize, /* parent_resize */ parent_resize, /* parent_resize */
prop_change, /* prop_change */ prop_change, /* prop_change */
NULL, /* mouse_move */ mouse_move, /* mouse_move */
NULL, /* mouse_up */ NULL, /* mouse_up */
mouse_down, /* mouse_down */ mouse_down, /* mouse_down */
NULL, /* key */ NULL, /* key */