resizing works partly
Some checks failed
pyrite-dev/milsko/pipeline/head There was a failure building this commit
Some checks failed
pyrite-dev/milsko/pipeline/head There was a failure building this commit
This commit is contained in:
parent
c9dbca2cc8
commit
e2da02f2c9
7 changed files with 171 additions and 71 deletions
120
configure
vendored
120
configure
vendored
|
|
@ -4,7 +4,7 @@ $target =~ s/\r?\n$//;
|
|||
|
||||
# MSYS with MinGW gives us some other shit idk
|
||||
if (index($target, "MINGW") != -1) {
|
||||
$target = "Windows";
|
||||
$target = "Windows";
|
||||
}
|
||||
|
||||
foreach my $l (@ARGV) {
|
||||
|
|
@ -16,11 +16,11 @@ foreach my $l (@ARGV) {
|
|||
}
|
||||
|
||||
our $prefix = "/usr/local";
|
||||
our $cc = defined($ENV{CC}) ? $ENV{CC} : "*host*gcc";
|
||||
our $cxx = defined($ENV{CXX}) ? $ENV{CXX} : "*host*g++";
|
||||
our $ar = defined($ENV{AR}) ? $ENV{AR} : "*host*ar";
|
||||
our $cc = defined($ENV{CC}) ? $ENV{CC} : "*host*gcc";
|
||||
our $cxx = defined($ENV{CXX}) ? $ENV{CXX} : "*host*g++";
|
||||
our $ar = defined($ENV{AR}) ? $ENV{AR} : "*host*ar";
|
||||
our $incdir = "-I include";
|
||||
our $incdir2 = "";
|
||||
our $incdir2 = "";
|
||||
our $cflags = "-fPIC -D_MILSKO -D_MILSKO_BUILD -fvisibility=hidden";
|
||||
our $libdir = "";
|
||||
our $ldflags = "";
|
||||
|
|
@ -68,46 +68,54 @@ my %features = (
|
|||
"static" => "build static library",
|
||||
"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",
|
||||
"dbus" => "use DBus on supported platform",
|
||||
"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"
|
||||
"1classic-theme", "1stb-image",
|
||||
"1stb-truetype", "1freetype2",
|
||||
"1gdi-text", "1opengl",
|
||||
"2xrender", "1vulkan",
|
||||
"2vulkan-string-helper", "1shared",
|
||||
"1static", "1wayland",
|
||||
"1gnustep", "1dbus",
|
||||
"1direct3d9"
|
||||
);
|
||||
|
||||
sub def_platform {
|
||||
if($target eq "Windows") {
|
||||
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") {
|
||||
param_set("freetype2", 1);
|
||||
param_set("stb-truetype", 0);
|
||||
} else {
|
||||
param_set("freetype2", 0);
|
||||
param_set("stb-truetype", 1);
|
||||
}
|
||||
if($target eq "Linux" || $target eq "FreeBSD") {
|
||||
param_set("x11", 1);
|
||||
if ($target eq "Windows") {
|
||||
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")
|
||||
{
|
||||
param_set("freetype2", 1);
|
||||
param_set("stb-truetype", 0);
|
||||
}
|
||||
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);
|
||||
if(!param_get("tiny")){
|
||||
if (!param_get("tiny")) {
|
||||
param_set("wayland", 1);
|
||||
}
|
||||
param_set("dbus", 1);
|
||||
}
|
||||
if($target eq "NetBSD" || $target eq "OpenBSD") {
|
||||
if ($target eq "NetBSD" || $target eq "OpenBSD") {
|
||||
param_set("x11", 1);
|
||||
}
|
||||
if($target eq "Windows") {
|
||||
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);
|
||||
|
|
@ -141,7 +148,7 @@ foreach my $l (@ARGV) {
|
|||
$cross = 1;
|
||||
}
|
||||
elsif ($l eq "--tiny") {
|
||||
param_set("tiny",1);
|
||||
param_set("tiny", 1);
|
||||
}
|
||||
elsif (($l eq "-h") or ($l eq "--help")) {
|
||||
print("Milsko Toolkit Configuration Utility\n");
|
||||
|
|
@ -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");
|
||||
|
|
@ -211,9 +220,9 @@ foreach my $e (param_list()) {
|
|||
}
|
||||
print("Enabled: " . join(" ", @l) . "\n");
|
||||
|
||||
$cc =~ s/\*host\*/$host/;
|
||||
$cc =~ s/\*host\*/$host/;
|
||||
$cxx =~ s/\*host\*/$host/;
|
||||
$ar =~ s/\*host\*/$host/;
|
||||
$ar =~ s/\*host\*/$host/;
|
||||
|
||||
open(OUT, ">", "Makefile");
|
||||
print(OUT "PREFIX = ${prefix}\n");
|
||||
|
|
@ -261,9 +270,9 @@ print(OUT "\n");
|
|||
print(OUT "\n");
|
||||
if (param_get("shared")) {
|
||||
my $linker = "CC";
|
||||
if (grep(/^haiku$/, @backends)) {
|
||||
$linker = "CXX";
|
||||
}
|
||||
if (grep(/^haiku$/, @backends)) {
|
||||
$linker = "CXX";
|
||||
}
|
||||
print( OUT "src/${library_prefix}Mw${library_suffix}: "
|
||||
. join(" ", @library_targets)
|
||||
. "\n");
|
||||
|
|
@ -279,18 +288,18 @@ if (param_get("static")) {
|
|||
}
|
||||
|
||||
foreach my $l (@library_targets) {
|
||||
my $warn = "-Wall -Wextra -Wno-sign-compare -Wno-unused-value";
|
||||
my $s = $l;
|
||||
my $warn = "-Wall -Wextra -Wno-sign-compare -Wno-unused-value";
|
||||
my $s = $l;
|
||||
my $compiler = "CC";
|
||||
my $o = $object_suffix;
|
||||
my $o = $object_suffix;
|
||||
$o =~ s/\./\\\./g;
|
||||
|
||||
if ($l =~ /cocoa/) {
|
||||
$s =~ s/$o$/.m/;
|
||||
}
|
||||
elsif ($l =~ /haiku/) {
|
||||
$s =~ s/$o$/.cc/;
|
||||
$compiler = "CXX";
|
||||
$s =~ s/$o$/.cc/;
|
||||
$compiler = "CXX";
|
||||
}
|
||||
else {
|
||||
$s =~ s/$o$/.c/;
|
||||
|
|
@ -321,13 +330,12 @@ if (param_get("examples")) {
|
|||
|
||||
if (param_get("shared")) {
|
||||
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"
|
||||
"${l}: ${s}${object_suffix} src/${library_prefix}Mw${library_suffix}\n"
|
||||
);
|
||||
}
|
||||
else {
|
||||
print(OUT "${l}: ${s}${object_suffix} src/${library_prefix}Mw.a\n");
|
||||
}
|
||||
if (grep(/^cocoa$/, @backends)) {
|
||||
print(OUT
|
||||
" \$(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") {
|
||||
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"
|
||||
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"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -244,7 +244,9 @@ struct _MwSubWindow {
|
|||
int width;
|
||||
int height;
|
||||
MwPoint cursor_start;
|
||||
MwPoint local_start;
|
||||
MwPoint base;
|
||||
int mouse_cache;
|
||||
};
|
||||
|
||||
struct _MwTab {
|
||||
|
|
|
|||
|
|
@ -219,8 +219,8 @@ static void MwLLFreeColorImpl(MwLLColor color) {}
|
|||
|
||||
static MwBool lmao = MwFALSE;
|
||||
static int MwLLPendingImpl(MwLL handle) {
|
||||
lmao = !lmao;
|
||||
return lmao;
|
||||
lmao = !lmao;
|
||||
return lmao;
|
||||
}
|
||||
static void MwLLNextEventImpl(MwLL handle) {
|
||||
MwLLDispatch(handle, draw, NULL);
|
||||
|
|
@ -264,10 +264,10 @@ static void MwLLRaiseImpl(MwLL handle) {}
|
|||
static void MwLLClipImpl(MwLL handle, MwRect* rect) {}
|
||||
static void MwLLSetupDragAndDropImpl(MwLL handle) {}
|
||||
static int MwLLCairoCallInitImpl(void) {
|
||||
if(cairo_load_funcs() != 0) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
if(cairo_load_funcs() != 0) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#include "call.c"
|
||||
CALL(Cairo);
|
||||
|
|
|
|||
|
|
@ -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
43
src/cursor/bottomright.c
Normal 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 /* ################ */
|
||||
}};
|
||||
|
|
@ -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,13 +390,20 @@ static void mouse_down(MwWidget handle, void* ptr) {
|
|||
|
||||
if(m->button == MwMOUSE_LEFT && !sw->minimized && !sw->maximized) {
|
||||
MwGetCursorCoord(handle, &sw->cursor_start);
|
||||
sw->base.x = MwGetInteger(handle, MwNx);
|
||||
sw->base.y = MwGetInteger(handle, MwNy);
|
||||
sw->local_start = handle->mouse_point;
|
||||
sw->base.x = MwGetInteger(handle, MwNx);
|
||||
sw->base.y = MwGetInteger(handle, MwNy);
|
||||
}
|
||||
|
||||
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,10 +420,17 @@ static void tick(MwWidget handle) {
|
|||
|
||||
MwGetCursorCoord(handle, &p);
|
||||
|
||||
MwVaApply(handle,
|
||||
MwNx, sw->base.x + p.x - sw->cursor_start.x,
|
||||
MwNy, sw->base.y + p.y - sw->cursor_start.y,
|
||||
NULL);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue