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

52
configure vendored
View file

@ -69,17 +69,19 @@ my %features = (
"wayland" => "enable wayland backend",
"gnustep" => "use gnustep",
"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"
);
my @features_keys = (
"1classic-theme", "1stb-image",
"1stb-truetype", "1freetype2", "1gdi-text",
"1opengl", "2xrender",
"1vulkan", "2vulkan-string-helper",
"1shared", "1static",
"1wayland", "1gnustep",
"1dbus", "1direct3d9"
"1stb-truetype", "1freetype2",
"1gdi-text", "1opengl",
"2xrender", "1vulkan",
"2vulkan-string-helper", "1shared",
"1static", "1wayland",
"1gnustep", "1dbus",
"1direct3d9"
);
sub def_platform {
@ -87,10 +89,15 @@ sub def_platform {
param_set("freetype2", 0);
param_set("stb-truetype", 0);
param_set("direct3d9", 1);
} elsif($target ne "Darwin" and $target ne "ClassicMacOS" and $target ne "Haiku") {
}
elsif ( $target ne "Darwin"
and $target ne "ClassicMacOS"
and $target ne "Haiku")
{
param_set("freetype2", 1);
param_set("stb-truetype", 0);
} else {
}
else {
param_set("freetype2", 0);
param_set("stb-truetype", 1);
}
@ -107,7 +114,8 @@ sub def_platform {
}
if ($target eq "Windows") {
param_set("gdi-text", 1);
} else {
}
else {
param_set("gdi-text", 0);
}
}
@ -120,7 +128,6 @@ foreach my $l (@ARGV) {
def_platform();
foreach my $l (@ARGV) {
if ($l =~ /^--with-([^=]+)=(.+)$/) {
param_set($1, $2);
@ -154,7 +161,9 @@ foreach my $l (@ARGV) {
print(" --host=TARGET Host for compiler/archiver\n");
print(" --target=TARGET Specify target\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("\n");
print("Features:\n");
@ -323,10 +332,9 @@ if (param_get("examples")) {
print(OUT
"${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)) {
print(OUT
@ -340,10 +348,14 @@ if (param_get("examples")) {
}
if ($target eq "ClassicMacOS") {
print(OUT
" ".$ENV{RETRO68_TOOLCHAIN_PATH}."/bin/MakePEF ${l} -o ${s}.pef\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"
print( OUT " "
. $ENV{RETRO68_TOOLCHAIN_PATH}
. "/bin/MakePEF ${l} -o ${s}.pef\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;
/*!
* @brief Bottom right cursor
*/
MWDECL MwCursor MwCursorBottomRight;
/*!
* @brief Bottom right cursor mask
*/
MWDECL MwCursor MwCursorBottomRightMask;
#ifdef __cplusplus
}
#endif

View file

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

View file

@ -23,11 +23,11 @@
#define RESIZE(handle) \
{ \
int RESIZE_i; \
MwDispatch(handle, resize); \
MwDispatchUserHandler(handle, MwNresizeHandler, NULL); \
for(RESIZE_i = 0; RESIZE_i < arrlen(handle->children); RESIZE_i++) { \
MwDispatch(handle->children[RESIZE_i], parent_resize); \
} \
MwDispatch(handle, resize); \
}
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++) {
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) {

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);
}
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;
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) {
@ -371,6 +390,7 @@ static void mouse_down(MwWidget handle, void* ptr) {
if(m->button == MwMOUSE_LEFT && !sw->minimized && !sw->maximized) {
MwGetCursorCoord(handle, &sw->cursor_start);
sw->local_start = handle->mouse_point;
sw->base.x = MwGetInteger(handle, MwNx);
sw->base.y = MwGetInteger(handle, MwNy);
}
@ -378,6 +398,12 @@ static void mouse_down(MwWidget handle, void* ptr) {
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) {
(void)va;
@ -394,12 +420,19 @@ static void tick(MwWidget handle) {
MwGetCursorCoord(handle, &p);
if(sw->mouse_cache == 1) {
MwVaApply(handle,
MwNwidth, handle->mouse_point.x,
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);
}
}
}
MwClassRec MwSubWindowClassRec = {
wcreate, /* create */
@ -408,7 +441,7 @@ MwClassRec MwSubWindowClassRec = {
NULL, /* click */
parent_resize, /* parent_resize */
prop_change, /* prop_change */
NULL, /* mouse_move */
mouse_move, /* mouse_move */
NULL, /* mouse_up */
mouse_down, /* mouse_down */
NULL, /* key */