Compare commits

..

857 commits

Author SHA1 Message Date
ca9a24a2b0 watcom opengl fix 2026-08-10 04:32:44 +09:00
df1972e91c remove winmm 2026-08-10 01:55:27 +09:00
ca41b5936b Update src/core.c 2026-08-09 15:32:56 +09:00
f652523963 fix another c89 issue 2026-08-09 15:27:54 +09:00
6a205453a7 fix c89 discrepency 2026-08-09 15:26:48 +09:00
87f6dff101 Update include/Mw/MachDep.h 2026-08-09 15:19:31 +09:00
8e4774054e Update src/lowlevel.c 2026-08-09 15:16:32 +09:00
ff823028cd Update include/Mw/LowLevel.h 2026-08-09 15:16:00 +09:00
054b085bcd fix compiles on machines where we have no vulkan 2026-08-08 16:32:11 -07:00
9856979906 Dynload winmm, which is weird but it fixes vs2022 builds 2026-08-08 16:24:23 -07:00
6f976ae0ce more fuller suite of error mutes for vs2022 2026-08-08 16:02:53 -07:00
bde66f13a5 fix the wall of warnings on VS2022 2026-08-08 15:26:42 -07:00
85b66d0d9a fix font rendering 2026-07-26 01:44:01 +09:00
974947b400 remove warnings 2026-07-26 01:21:50 +09:00
7c2ab989fa formatting 2026-07-24 20:51:17 -07:00
39a458d80f win32: remove unused urlmon dep 2026-07-23 18:24:56 +09:00
f6c129b31c win32: pass utf8 function to dnd 2026-07-23 01:00:56 -07:00
e20684f89b remove mime type stuff for now
Windows's built in function for getting mime type sucks, and I don't want to have to vendor in libmagic. We'll leave this as something the user can handle themselves.
2026-07-23 00:56:13 -07:00
9dd96d9cec dynload drag functions 2026-07-23 00:34:38 -07:00
f35e781762 win32: move away from com for drag and drop to avoid conflicts (and because com sucks) 2026-07-23 00:10:26 -07:00
c404e9e14b remove some leftover debug prints oops 2026-07-22 21:33:37 -07:00
7e339cfd60 gdi: properly quit drag and drop after its finished 2026-07-22 21:31:03 -07:00
0fd0611a99 dynload CoInitializeEx 2026-07-22 20:02:08 -07:00
fb6c7a4772 replace FMFD_DEFAULT with 0 2026-07-22 19:55:40 -07:00
981591120c linke to uuid 2026-07-22 19:54:27 -07:00
b3e24df2f6 include urlmon.h in MachDep.h 2026-07-22 19:51:11 -07:00
27b4f83840 linke to ole32 2026-07-22 19:49:05 -07:00
d3af13ebd6 drag and drop beginnings
Reviewed-on: pyrite-dev/milsko#33
2026-07-23 11:45:01 +09:00
7d6f6ca93a fix gdi text on mingw 2026-07-21 19:37:34 -07:00
90f69b63d4 version bump 2026-07-21 01:45:29 -07:00
6a635fc1df changelog should mention newest entry change 2026-07-21 01:30:33 -07:00
6843d6ae05 changelog had item in wrong place 2026-07-21 01:26:37 -07:00
6db8ce17c3 changelog 2026-07-21 01:25:20 -07:00
639f8e619f fix stb_ds include 2026-07-21 00:26:58 -07:00
1103751f57 fix stb_ds include 2026-07-21 00:24:37 -07:00
2c19489acd entry ending box should tick 2026-07-21 00:15:33 -07:00
80e3d25147 gdi text loading should be loading the right functions Oops 2026-07-20 23:39:02 -07:00
5a660bfe90 remove accidental debug print 2026-07-20 22:02:13 -07:00
529309df37 wayland: fix size hints 2026-07-20 21:56:42 -07:00
e2aa8dec7b wayland size limit should only apply to toplevels oops 2026-07-20 21:18:26 -07:00
6c6b97d92e classicmacos: remove dupl setrgb/penmode call 2026-07-19 23:06:26 -07:00
d2191ef33a accidentally removed classic mac os init code from core.c 2026-07-19 23:03:09 -07:00
f91fc66fb6 make some updates to get classicmacos.c working but its probably over 2026-07-19 23:01:43 -07:00
2c2e21503f MwFALMwFALSE -> MwFALSE 2026-07-19 20:58:32 -07:00
d0d2339d6b fix 2026-07-19 20:56:34 -07:00
3dc4641ff9 underscore prefix for gdi dynloaded functions 2026-07-19 20:52:07 -07:00
d9bf9bbb95 support gdi text under win95 2026-07-19 20:44:49 -07:00
74a800b3ef fix reparent freeze 2026-07-20 09:07:41 +09:00
d056d1b7fb wayland: min width/height of 50 2026-07-19 15:06:10 -07:00
a30d306da0 fix perl files 2026-07-20 06:21:25 +09:00
ad8173d562 have cmake not prefix the library 2026-07-19 14:20:43 -07:00
1fe59521bf remove directwrite in favor of gdi 2026-07-19 14:16:14 -07:00
b7ed160614 generate makefile 2026-07-20 04:00:56 +09:00
8a6bfb62de work 2026-07-20 03:58:29 +09:00
d36c9190ec better timer 2026-07-20 03:45:50 +09:00
b285d1ba8d fix tick 2026-07-20 03:36:31 +09:00
09fc854aba fix memleak 2026-07-19 21:11:43 +09:00
84531e9be1 fix documentation 2026-07-19 21:06:32 +09:00
bc5fc10816 faster gdi text rendering 2026-07-19 21:04:33 +09:00
6bc00c6dca better naming 2026-07-19 20:39:31 +09:00
8ebc8108ed implement gdi text renderer 2026-07-19 20:37:04 +09:00
9a29682915 fix cmake 2026-07-19 17:53:30 +09:00
2c9d0c78e4 allow null for name 2026-07-17 22:15:33 -07:00
b20a54fb76 new function MwWindowShouldClose 2026-07-17 21:55:42 -07:00
f260c3c11e win32: missed a break under WM_CLOSE 2026-07-17 20:47:28 -07:00
42802313cb win32: migrate if/else chain to switch case 2026-07-17 20:45:50 -07:00
575b8eaee1 DirectWrite support (#28)
Reviewed-on: pyrite-dev/milsko#28
2026-07-18 11:39:52 +09:00
610c63228e have CMakeLists.txt install a pkgconfig file (+ other fixes for building with MSYS) (#27)
Reviewed-on: pyrite-dev/milsko#27
2026-07-17 07:48:06 +09:00
4b6eae99dc fixed some memleaks while also trying to fix popups not being destroyed correctly 2026-07-13 15:54:58 -07:00
a4d095cabf wayland: fix popup positioning when CSD is active. fix CSD stride 2026-07-13 14:00:32 -07:00
1a75d6cea1 wrongful stb_ds include 2026-07-09 21:54:46 -07:00
82b68c9c53 only do MwLibraryInit wayland/cairo if USE_WAYLAND 2026-07-09 21:51:21 -07:00
c2bb601311 seperate wayland's cairo functionality into a backend that can be used seperately 2026-07-09 21:45:30 -07:00
14d010f9a2 wayland: have MwLLEndStateChange use the right x/y when not detaching 2026-07-09 16:00:39 -07:00
53878b08ee fix cmake 2026-07-09 15:55:11 -07:00
070ee6025b fix wayland warnings 2026-07-09 15:34:59 -07:00
044b067f7f several fixes. layer surfaces now work 2026-07-09 15:19:25 -07:00
a16e48edd5 started on layer surface 2026-07-07 23:04:58 -07:00
7dad6806c3 allow tool windows without a parent; currently fake them, should use layer surfaces later 2026-07-07 20:47:32 -07:00
b860c26505 actually fix Borderless on wayland and confirm it working 2026-07-07 18:29:02 -07:00
5ea01c80c5 wayland: fix popup positioning 2026-07-07 18:22:59 -07:00
d3b0996561 wayland: fix MakeBorderless not working w CSD 2026-07-05 00:44:54 -07:00
0826afb334 fix color leak 2 2026-07-05 06:51:49 +09:00
1f4fddfa67 fix color leak 2026-07-05 06:30:54 +09:00
541499f43c add RESIZE_ON_TICK and fix CMake 2026-07-05 05:24:03 +09:00
7d40eff3e5 fix 2026-05-27 15:45:57 +09:00
884c05acb7 wayland: oops! we have MwTimeGetTick, we should use that (even though I'm not sure if that's consistent across platforms. but it will at least compile 2026-05-24 23:01:48 -07:00
052863dcfe wayland: set a default for keyboard_repeat/keyboard_rate in case a compostior doesn't send key_repeat_info 2026-05-24 22:54:50 -07:00
e8a4e266b3 wayland: do keyboard repeat 2026-05-24 22:51:10 -07:00
3c1bd9956f wayland: 'focused' widgets should also have key events sent 2026-05-24 22:18:29 -07:00
fcca66d1e4 cmake builds shouldn't be linking to libraries that we dynload 2026-05-24 14:13:02 -07:00
3727c9f587 fix wayland csd 2026-05-23 23:34:38 -07:00
6ecbe998f8 fix wayland csd 2026-05-23 23:32:43 -07:00
314cc0da85 format 2026-05-23 06:15:20 +09:00
add02b695b make label respect alignment 2026-05-23 06:14:37 +09:00
3dac44ed92 use proper method 2026-05-23 03:53:13 +09:00
f7df6df342 better fix 2026-05-23 03:49:47 +09:00
732b47a300 fix 2026-05-23 03:47:09 +09:00
143167761c fix warning 2026-05-23 03:42:23 +09:00
149f99622a add disabled widgets 2026-05-22 11:41:17 -07:00
9e165b71d4 add MwNiconPixmap to frame and MwTabFocus 2026-05-23 03:16:37 +09:00
3d6e08541a fix 2026-05-22 14:17:40 +09:00
e7506922d2 finalize tab fix a bit more 2026-05-21 18:21:50 -07:00
262019b1d4 fix 2026-05-22 09:19:19 +09:00
95e7db9607 Mw/TypeDefs.h: new -> _new 2026-05-21 15:45:26 -05:00
2e2833f57b color 2026-05-21 10:56:12 +09:00
1fe971e1df fix 2026-05-21 08:43:45 +09:00
31df1aa72c wayland: don't incl dbus 2026-05-20 16:33:43 -07:00
9ee96a71c4 wayland: overhaul CSD, functions/looks much better. 2026-05-20 16:29:43 -07:00
632f63dee8 backport fix 2026-05-21 06:04:04 +09:00
6f204af3e6 wayland: fix comment 2026-05-20 14:02:41 -07:00
637015e4d5 rename MwWaylandAlwaysRender to MwWaylandVulkan 2026-05-20 02:43:22 -07:00
b8229c3ee8 wayland/opengl: revert "instead of just breaking, select the one with the lowest visual ID" 2026-05-20 04:09:47 -05:00
ddca432762 wayland/opengl: instead of just breaking, select the one with the lowest visual ID specifically 2026-05-20 04:07:44 -05:00
86286a0420 wayland/opengl: break after first config match, amidst other c89 fixes. 2026-05-20 04:03:12 -05:00
b7415dd240 fix calling convention stuff 2026-05-15 01:32:29 +09:00
276a9eeec5 fix warnings and sigsegv 2026-05-15 00:25:24 +09:00
65115b53d6
remove old stuff 2026-05-14 21:25:16 +09:00
4b335ad49f
fix 2026-05-14 21:24:43 +09:00
35e8e819e1
fix 2026-05-14 21:12:47 +09:00
32266c7656
add table widget 2026-05-14 21:10:22 +09:00
0628250631 draw func for label should be set per widget oops 2026-05-13 00:37:22 -07:00
501e32375e label: oops, put the function for setting draw_seven_segment in the correct place 2026-05-13 00:16:17 -07:00
b258f1e05d label: replace giant if/else block in draw, just change the draw handler function when MwSetSevenSegment is called 2026-05-13 00:05:06 -07:00
206dd9a0a6 1.3 2026-05-13 14:49:02 +09:00
1ec68267e5 forgot to update xml 2026-05-13 14:47:48 +09:00
e448a8ed4e fix 2026-05-13 14:41:35 +09:00
90128dc6b2 fix some stuff 2026-05-13 14:23:02 +09:00
21dcb02428
fix warning 2026-05-13 06:18:00 +09:00
5ff8d9a6f1 fix 2026-05-12 10:57:51 +09:00
56544212b1 add MwTreeViewGetOpened 2026-05-12 09:49:06 +09:00
b38c146ddf
remove debug message 2026-05-11 03:55:42 +09:00
1d4b1d4e35
rewrite in c 2026-05-10 06:25:27 +09:00
bb599c9fbb
add icon-converter.sh 2026-05-10 03:22:24 +09:00
416bdaf25e
use MwStringPrintIntoBuffer 2026-05-09 02:43:32 +09:00
e929efb461
tab 2026-05-08 19:00:32 +09:00
d0a4d1f1af
1.2a 2026-05-08 01:54:29 +09:00
582582379b fix rendering 2026-05-08 00:35:51 +09:00
d1143a68ac
smoother tab 2026-05-07 22:59:54 +09:00
37c3f9cbdc
1.2 2026-05-07 19:50:10 +09:00
8cb40ce2d4 also works on wayland now 2026-05-07 19:47:09 +09:00
059b287a09
fix separator 2026-05-07 19:45:14 +09:00
4410656236
oops 2026-05-07 19:42:51 +09:00
19416d7451
DrawWidgetBack fix 2026-05-07 19:40:16 +09:00
fe9b08ef55 fix 2026-05-07 18:53:13 +09:00
bf5ab45f2e wayland 2026-05-07 18:51:42 +09:00
ad49a55812 gdi clipping 2026-05-07 18:40:14 +09:00
1c2cd6e875
tab widget 2026-05-07 18:30:24 +09:00
6eefe44f6f
update 2026-05-07 15:59:48 +09:00
44996a484a fix cmake 2026-05-06 18:23:27 -07:00
fdb27599b6 wsl fix 2026-05-06 17:56:50 +09:00
3ead7afbcf justify wayland's use of gbm in a comment 2026-05-06 03:07:25 -05:00
786ed04e69 wayland: downgrade xdg_wm_base back to 1 2026-05-06 00:56:35 -07:00
2c3cb787d4 wayland: implement resizing for new opengl gbm 2026-05-06 00:30:16 -07:00
232763a3e3 ugh 2026-05-06 16:15:55 +09:00
38d1cb7289 wayland: guard sys/mman.h 2026-05-06 00:01:55 -07:00
97778752ec wayland: have the opengl widget use gbm instead of wl_egl, removing its need for MwWaylandAlwaysRender 2026-05-05 23:57:07 -07:00
ee5e04c64e wayland: apply full region to 1st-level children 2026-05-05 19:19:58 -07:00
801c5e03d4 fix opengl wayland flicklering 2026-05-05 19:04:19 -07:00
0550e74b98 fix 2026-05-05 18:34:06 -07:00
5c74e65516 wayland: yeah this is just fucked 2026-05-05 18:30:09 -07:00
daced7a897 wayland: whatever it works on kde 2026-05-05 18:11:29 -07:00
8a59ee840b
update xml 2026-05-06 06:27:16 +09:00
f45b679be3
stuff 2026-05-06 06:10:45 +09:00
6db3d83945
j 2026-05-06 04:53:24 +09:00
4dc670850d
fix 2026-05-06 04:39:53 +09:00
00c069b96a
test watcom too 2026-05-06 04:38:28 +09:00
7f667189fc
oops 2026-05-06 04:33:48 +09:00
bcc4766e5f
format 2026-05-06 04:28:23 +09:00
2dd2ae3f85
gldemos too 2026-05-06 04:27:55 +09:00
4fdc578448
can compile examples now 2026-05-06 04:16:45 +09:00
cc7f4f7ea8 no more warnings 2026-05-06 03:44:04 +09:00
e835a9cd60 detach works 2026-05-06 03:36:57 +09:00
4777f893c6
color 2026-05-06 01:51:15 +09:00
89911082ed
things 2026-05-06 00:12:40 +09:00
37fae993b9 wayland: fix GetCursorCoordImpl somewhat 2026-05-04 21:40:04 -07:00
1c8e301e15 doc: mention one-file suggestion in BACKENDDEV.md 2026-05-04 21:09:31 -07:00
d49e50f95a wayland: split wayland.c into four files 2026-05-04 21:07:39 -07:00
8eacf36c6a wayland: misc fixes 2026-05-04 20:46:34 -07:00
0b7f8d3f67 wayland: only update cursor coord if its on the currentlyHeldWidget OR if there is no currentlyHeldW 2026-05-04 15:25:16 -05:00
b025f46507 Accidentally committed test file 2026-05-04 15:16:38 -05:00
a205120e91 wayland: slightly fix GetCursorCoordImpl 2026-05-04 13:08:03 -07:00
49294dc975
h 2026-05-04 20:15:08 +09:00
0ae1d7e625
raise 2026-05-04 20:13:57 +09:00
d24c948fbf windows impl 2026-05-04 19:26:52 +09:00
11069552df
raise 2026-05-04 19:24:09 +09:00
e7d9edec27
bugfix 2026-05-04 12:47:24 +09:00
c43c497780
bugfix 2026-05-04 12:42:47 +09:00
3b0f5faa57
improve tick system 2026-05-04 12:37:38 +09:00
1214cc0854 a little bit better 2026-05-04 00:01:17 +09:00
ab1dfc2e60
drag 2026-05-02 22:43:54 +09:00
d05e121bf1 win32 fix 2026-05-02 21:51:51 +09:00
b1389692a1 fix typo 2026-05-02 13:44:20 +09:00
ea20a31694
introduce boolean attr to xml 2026-05-02 03:54:47 +09:00
5ac885e082
title was missing 2026-05-02 02:03:44 +09:00
9bfa4f4092
some fix 2026-05-02 02:00:51 +09:00
1f232522b7
minimize/maximize 2026-05-02 00:22:12 +09:00
141ea4a027 haiku fix 2026-05-01 22:35:35 +09:00
3542d7524a
buttons 2026-05-01 22:25:13 +09:00
dce15aed4d
update 2026-05-01 19:53:28 +09:00
d3bb57757c
oops 2026-04-30 22:56:37 +09:00
4c17f84d4b
win32 fix 2026-04-30 22:43:11 +09:00
6b94ac5db9 wip 2026-04-30 14:28:56 +09:00
d1f97c0fa4 comment 2026-04-30 12:35:42 +09:00
a6adca6696 wip subwindow 2026-04-30 08:38:08 +09:00
c483c5f042 add haiku to tier 3 2026-04-29 16:48:20 -05:00
150581e716 wip 2026-04-29 15:14:38 +09:00
e618144fbc add darwin dylib ifdefs for shared libs
Co-Authored-By: Quote Walker <operz@coralcmd.net>
2026-04-29 13:47:40 +09:00
572c170cd6 fix 2026-04-29 12:28:00 +00:00
94c4bcd2cc better treeview 2026-04-29 11:47:45 +00:00
b908921d68 resize/move 2026-04-29 05:53:22 +09:00
8d6c2c0d52 implement close 2026-04-29 05:39:47 +09:00
38321022b9
fix menu 2026-04-29 05:21:59 +09:00
76f03c2019 stuff 2026-04-29 05:20:06 +09:00
c095fb97a8 less flickering 2026-04-29 04:24:01 +09:00
c998c61655 mouse and stuff 2026-04-29 03:41:00 +09:00
1eb0b0154b bitmap 2026-04-29 01:03:50 +09:00
7d005dc7bb polygon 2026-04-28 23:21:32 +09:00
62008ec5d9 fix 2026-04-28 22:01:42 +09:00
f2f901dc05 haiku 2026-04-28 12:59:25 +00:00
6a5ad2cd8c oops 2026-04-28 18:46:51 +00:00
f02a4d3f4b wip 2026-04-28 18:24:29 +00:00
f2de281e20 locker 2026-04-28 17:48:20 +00:00
f23a466d33 wip haiku 2026-04-28 17:45:57 +00:00
147124d408 Fpicker example 2026-04-28 00:33:56 -07:00
39b3c035fc at least no more segfault 2026-04-28 16:30:01 +00:00
d980f5c6b2 forgot to replace 2026-04-28 15:25:22 +09:00
df275c3331 use proper linker 2026-04-28 15:24:45 +09:00
4b2676b741 stub 2026-04-28 15:21:57 +09:00
7b06a0d5f5 stub 2026-04-28 15:21:11 +09:00
7893234cd3 stub 2026-04-28 15:20:14 +09:00
733b3c1f1c stub 2026-04-28 15:18:09 +09:00
6341b76a86 perltidy 2026-04-28 15:08:00 +09:00
22b0891598 init haiku 2026-04-28 15:06:38 +00:00
6137728de7 bring back some old code 2026-04-28 14:12:54 +09:00
f4be507c35 gdi: remove dead USE_PLGBLT code, since its always defined 2026-04-28 14:10:41 +09:00
bdcd380a2c wine fix 2026-04-28 13:32:55 +09:00
5ae3704a4c fix 2026-04-28 13:30:02 +09:00
095867ce70 opengl stuff 2026-04-28 13:19:08 +09:00
7f98e8cae1 gdi: secondary dark theme detction through GetSysColor 2026-04-27 21:18:16 -07:00
75ce2c3adc FreeBSD pl: correction 2026-04-27 13:14:31 -07:00
d909812891 i think this is probably needed for doing wayland on freebsd? 2026-04-27 12:39:23 -07:00
d1936e4a8f
add BSD targets 2026-04-27 17:59:16 +09:00
e878ae0253
1.0a 2026-04-27 17:29:34 +09:00
e79bffa5c6 1.0a but with the correct patch level 2026-04-27 01:12:27 -07:00
e66cb4e3d4 1.0a 2026-04-27 01:07:17 -07:00
790688e4cc gdi: check for DwmSetWindowAttribute before executing 2026-04-27 01:02:17 -07:00
73b320fc18 have opengl gracefully fail 2026-04-27 00:31:20 -07:00
36f5647883 test 2026-04-27 16:31:03 +09:00
413105c1a8 detect old windows and do stuff 2026-04-27 16:29:23 +09:00
2323b7f69f MwLLDoModern 2026-04-26 23:55:49 -07:00
b4829308d9 use BitBlt instead for gdi 2026-04-27 15:54:40 +09:00
84db46648e Tier 2026-04-26 22:35:44 -07:00
2a333897b7 disable cocoa opengl on cmake 2026-04-26 22:20:50 -07:00
e40735b6e9 cmake: don't have USE_COCOA oops 2026-04-26 22:15:37 -07:00
fb56fac3dc cmake nococoa.mg 2026-04-26 22:14:51 -07:00
4a0059b2f1 typo 2026-04-26 22:12:00 -07:00
af3f569b0a readme should mention wayland too oops 2026-04-26 22:03:50 -07:00
a8b406bc04 update readme 2026-04-26 22:03:00 -07:00
196a1c87f5 lowlevel.md: mention adding to mw/lowlevel.h 2026-04-26 22:00:15 -07:00
153b7e8254 wayland: allow use on macos 2026-04-26 21:57:46 -07:00
a155126e84 mention enums in backenddev.md 2026-04-26 21:53:19 -07:00
c0c64ad677 backenddev.md 2026-04-26 21:51:29 -07:00
53ab5dd875 add 1.0 banner 2026-04-27 13:46:57 +09:00
c56bea32ed document some of lowlevel functions 2026-04-27 13:46:57 +09:00
c7d9a2e6cc Wayland: fix input region 2026-04-26 21:22:27 -07:00
d3135d4c1e wayland: fix clipboard 2026-04-26 21:22:27 -07:00
24d7412f1c prepare for 1.0 2026-04-27 13:07:56 +09:00
93a7c5e350 prepare for 1.0 2026-04-27 13:00:35 +09:00
a8b2fa1e18 prepare for 1.0 2026-04-27 12:59:01 +09:00
c14c267ebe add iteration option to fuzzer 2026-04-27 12:45:48 +09:00
b639367470 remove roundness 2026-04-27 12:41:57 +09:00
1562c3b89e cocoa backend postponed 2026-04-26 20:31:09 -07:00
fa3488402e apologies to all niri users guess you can't use clipboard until we find that out 2026-04-26 20:07:32 -07:00
4f7b3718e3 better looking progressbar 2026-04-27 12:07:06 +09:00
ea5906b03b wayland 2026-04-26 20:01:12 -07:00
beba0116a0 put MwLLNextEvent's XSetInputFocus under the new option 2026-04-26 20:01:12 -07:00
2a982603d3 fix font rendering 2026-04-27 11:58:53 +09:00
4bf321f3a2 introduce MwFreeWidget 2026-04-27 11:44:10 +09:00
3779b2e0db new x11 option for disabling the forced click-to-focus so that the fuzzer can work: 2026-04-26 19:43:32 -07:00
bb51bc3c5f x11: have upper bounds on pixmap drawings 2026-04-26 19:34:11 -07:00
9035133782 Update src/backend/x11.c 2026-04-26 20:13:33 -05:00
3005ec9c0c fuzzer fixes 2026-04-26 18:11:39 -07:00
2e23342620 Update src/backend/x11.c 2026-04-26 19:54:19 -05:00
f00c380f3d more comprehensive fuzzer 2026-04-26 17:42:56 -07:00
a78b7b6762 fix some uninitialized values 2026-04-27 08:54:13 +09:00
4aaecdb962 Merge branch 'master' of ssh://gitea.nishi.boats:2222/pyrite-dev/milsko 2026-04-26 14:02:23 -07:00
984b8de414 tiny config disables dbus integrationg 2026-04-26 14:01:33 -07:00
e65d4e7f32
fix font rendering 2026-04-27 05:50:50 +09:00
4e78157e71
why? 2026-04-27 05:50:05 +09:00
16a0eeae4f
fix font rendering 2026-04-27 05:47:08 +09:00
837c28133a ensure even further that the clipboards are set up if the function is called before wl_seat) 2026-04-26 13:44:11 -07:00
6c3d376d1f Merge branch 'master' of ssh://gitea.nishi.boats:2222/pyrite-dev/milsko 2026-04-26 13:24:02 -07:00
215488e653 wayland: account also for compositors that may be presenting wl_data_device before wl_seat 2026-04-26 13:23:33 -07:00
b6e21d8478
make treeview faster too 2026-04-27 05:12:52 +09:00
1e939ae316 wayland: memset device_ctx_wl to accomidate for platforms that don't have a clipboard device 2026-04-26 13:10:45 -07:00
64bd640529 remove comments as they are documented in xml now 2026-04-27 05:07:24 +09:00
3beb11706e make listbox faster 2026-04-27 05:04:54 +09:00
6927ffd27d
introduce MwNdarkThemeAutomatic 2026-04-27 05:00:41 +09:00
6f9f98f22c wayland: don't destroy wl_pointer/wl_keyboard 2026-04-26 13:00:12 -07:00
7cb7a2739e wayland: early return on SetWHImpl if width and height are the same 2026-04-26 12:47:22 -07:00
8ad9e19de0 fix viewport on wayland 2026-04-26 12:44:04 -07:00
212d00ea13
fix stuff 2026-04-27 04:25:16 +09:00
21e2f2d599
update how newlines are handled 2026-04-27 04:04:04 +09:00
2ae01d3902
fix font rendering 2026-04-27 03:48:15 +09:00
2cd11d0189
stuff 2026-04-27 03:40:09 +09:00
190e4353e4
fix ft2 rendering 2026-04-27 03:39:02 +09:00
986ffdccc1
fix cursor position 2026-04-27 03:31:18 +09:00
ca703f24d5
measure line properly 2026-04-27 03:14:12 +09:00
833947c1ec
introduce widget->user 2026-04-26 23:09:02 +09:00
4536b30fbc fix combobox issue 2026-04-24 12:53:27 +09:00
1c26efcc91 idk 2026-04-24 09:09:37 +09:00
47c2a74d74 combobox should close when the parent window is resized 2026-04-23 14:50:11 -07:00
4d6d459920 wayland: fix warnings 2026-04-23 14:47:51 -07:00
931cff0f6d wayland: only recreate buffers on SetWH when Pending rolls around 2026-04-23 14:39:38 -07:00
7cdd2bcc79 fix memleaks under wayland 2026-04-23 14:02:33 -07:00
70c5d7782f wayland now changes the cursor properly 2026-04-23 13:32:05 -07:00
cb375fbcbf fix weston 2026-04-23 12:31:53 -07:00
201c5f84a5
add NULL as parent for MwReparent 2026-04-24 04:24:07 +09:00
2a09a71659
oops 2026-04-24 04:06:24 +09:00
d9a6c7ee5f
format 2026-04-24 03:53:54 +09:00
05e7d8377b
improve menu 2026-04-24 03:53:31 +09:00
ae0791dbc3 don't call wl_pointer_set_cursor on pointer_enteR 2026-04-23 11:28:38 -07:00
261622a2e0 h 2026-04-23 11:04:47 -07:00
21d07056d9 fix window disappearing on weston 2026-04-23 10:57:05 -07:00
efc6002bdb Merge branch 'master' of ssh://forgejo.nishi.boats:2222/pyrite-dev/milsko 2026-04-23 10:45:39 -07:00
9c95757f8d wayland: better system for destroyed events 2026-04-23 10:45:29 -07:00
0c793d6832
improve xrender output 2026-04-24 02:42:29 +09:00
d225f7cb72
add widgets to periodic table 2026-04-24 02:23:25 +09:00
183e2b0e04 WOW 2026-04-24 02:02:44 +09:00
81b154982b ughghghhhh 2026-04-24 01:51:11 +09:00
f8fff8f37d add cursor 2026-04-24 01:43:50 +09:00
da20432c31 ugh 2026-04-24 01:43:38 +09:00
85c5409790 man 2026-04-23 23:27:44 +09:00
a249b3264d seems to work 2026-04-23 23:03:25 +09:00
ca7e50d911 fix clipping 2026-04-23 22:47:52 +09:00
dbb436f5a2 better yet broken 2026-04-23 22:45:46 +09:00
06645250ca
fix 2026-04-23 17:05:50 +09:00
6ae6386852
test 2026-04-23 17:05:24 +09:00
5ff982d106 add ui charset converter and stuff 2026-04-23 14:59:35 +09:00
2369b96091 add checkbox and radiobox demo to periodic table 2026-04-22 14:28:28 +09:00
65f16f3144 fix 2026-04-22 13:45:55 +09:00
0b1879bfa5 build for linux 2026-04-22 13:41:18 +09:00
319927aee1 fix 2026-04-22 12:14:35 +09:00
129f8f4d66 build dll 2026-04-22 12:13:43 +09:00
2dd2c3870f introduce MWAPI 2026-04-22 12:05:49 +09:00
77ca92452e fix 2026-04-22 08:52:57 +09:00
b0f89d1dcc thing 2026-04-22 08:51:35 +09:00
89cfece767 M 2026-04-21 12:54:26 -07:00
79e1774cb8 mac fixed 2026-04-21 12:12:08 -07:00
8eca6c04e9 some mac fixes 2026-04-20 16:02:44 -07:00
352f2e5059 tim cook is stepping down 2026-04-20 16:02:33 -05:00
1fd86732f5 add props_change, closes #20 2026-04-20 16:22:06 +09:00
4423c318e8 fix for -O3 2026-04-20 15:51:51 +09:00
ece1527689 idk how this works, but seems to work 2026-04-20 15:37:50 +09:00
8870b3a0c5 fix someday 2026-04-20 15:15:35 +09:00
76a82c821e fix 2026-04-20 14:55:09 +09:00
42d6ca171e clip only sublevel widget 2026-04-20 14:49:20 +09:00
65f907a65f fix corner 2026-04-20 14:45:01 +09:00
0788297ed3 wayland: prevent xdg_toplevel_configure from firing too often 2026-04-19 21:12:39 -07:00
fdf73ab9e7 somehow my recursive render change with setwh undid clipping 2026-04-19 21:08:52 -07:00
81b229c99a Recursive_render on SetWH 2026-04-19 20:53:47 -07:00
0606f398ae working clipping with wayland 2026-04-20 12:36:01 +09:00
e0554cdb92 wayland clipping 2026-04-19 18:50:33 -07:00
4869821fe1 m 2026-04-19 18:05:58 -07:00
4b250960b6 milsko.xml seperate void props 2026-04-19 18:03:37 -07:00
0396e9b269 milsko.xml vulkanConfig should be struct prop 2026-04-19 18:03:08 -07:00
eff89312ac vulkan milsko.xml 2026-04-19 18:02:17 -07:00
65382dcf3f vulkan/milsko.xml: document MwVulkanConfig 2026-04-19 17:56:48 -07:00
70deb1b303 vulkan/milsko.xml: document vulkanConfig 2026-04-19 17:55:18 -07:00
ccdad14846 vulkan: use new system 2026-04-19 17:53:10 -07:00
e62db26db2 Update src/core.c 2026-04-19 19:40:41 -05:00
e3e170bebd vulkan: temp going back to global thing 2026-04-19 17:34:23 -07:00
3f722de0b6 vulkan: temp going back to global thing 2026-04-19 17:33:44 -07:00
315638ba3f Update src/core.c 2026-04-19 19:31:35 -05:00
aecfdf8f2b vulkan: initialize handle->internal if null 2026-04-19 17:29:58 -07:00
98a6559215 Update src/core.c 2026-04-19 19:25:20 -05:00
b4df1ab241 Update src/core.c 2026-04-19 19:19:26 -05:00
775488f7d2
update 2026-04-20 09:06:04 +09:00
51f88a848f
update 2026-04-20 09:01:36 +09:00
5d0c84d748
introduce early props 2026-04-20 09:00:28 +09:00
93325bb49c
update 2026-04-20 05:36:33 +09:00
6eee227693
fix 2026-04-20 04:21:34 +09:00
769a49c1ff
fix 2026-04-20 03:46:34 +09:00
a7828a44d8
fix 2026-04-20 03:45:45 +09:00
c945ebb9ca
oops 2026-04-20 03:05:17 +09:00
27c9eb97c1
fix as ioi intended this 2026-04-20 02:48:51 +09:00
449a0691e0
fix 2026-04-20 02:44:37 +09:00
a59154d5f1
remove MwMessageBoxDestroy, introduce destroy_inject 2026-04-20 02:04:43 +09:00
20d1a455e7
solve problems 2026-04-20 01:51:29 +09:00
4eb20e47b5
update 2026-04-20 00:28:35 +09:00
be6198aa83
oops 2026-04-20 00:24:49 +09:00
47ba1a9b50
rename some stuff 2026-04-20 00:23:04 +09:00
d3eb93a30a
change key constants 2026-04-20 00:18:04 +09:00
74f41cafde
fix 2026-04-20 00:09:08 +09:00
7fb12e8182
oops 2026-04-19 11:57:19 +09:00
f4087440aa
logo for nodejs binding 2026-04-19 06:17:23 +09:00
d0a6bd892d add some impl comments to mac, fix a hypothetical bug 2026-04-18 11:02:44 -07:00
39bee0e5cc
fix 2026-04-18 21:52:02 +09:00
55c562645a
listbox rewrite done 2026-04-18 19:40:28 +09:00
a666010564
wip rewrite listbox 2026-04-18 19:21:50 +09:00
10fda7bfc4 re-fix typo 2026-04-17 13:14:41 -07:00
ba15189c21 revert wayland changes that were causing crashes 2026-04-17 13:12:22 -07:00
c93a9980f3
oops 2026-04-18 01:57:54 +09:00
242253efbb
oops 2026-04-18 01:57:35 +09:00
212782f0be
fix 2026-04-18 01:55:56 +09:00
251b497c2f
hints 2026-04-18 00:54:32 +09:00
7b9870cebc
fix things 2026-04-17 21:26:41 +09:00
40cae5d2a5
fix 2026-04-17 18:17:50 +09:00
be2b40731f major surgery on dbus code 2026-04-17 03:16:43 -05:00
e4bd49ab83 minor adjustments for compliance 2026-04-17 03:16:43 -05:00
e916154df6
update format 2026-04-17 17:05:34 +09:00
138555f41d auto detect dark theme change via dbus signals 2026-04-17 01:12:44 -05:00
bc942153fe cmacos: working? 2026-04-16 22:58:16 -07:00
3e49278a15 added wip fuzzer, fixed alot of memory leaks with wayland 2026-04-16 18:36:42 -07:00
e41dbd43c1 fix warnings 2026-04-16 13:22:21 -07:00
9caa50b94d
fix enum 2026-04-17 01:52:04 +09:00
d6538d4410
fix 2026-04-17 01:46:47 +09:00
c0e36df063
oops 2026-04-17 01:44:17 +09:00
6259f57677
fix cmake 2026-04-17 01:39:59 +09:00
570f05540e
many things changed 2026-04-17 01:36:34 +09:00
5220f742be
some changes 2026-04-17 01:03:14 +09:00
7a2ca3aa2d
oops 2026-04-17 00:27:04 +09:00
13a2db7fa8
better for binding 2026-04-17 00:26:02 +09:00
5201c46a21
update vulkan/opengl 2026-04-17 00:20:29 +09:00
b82e13cb2e
define opengl/vulkan symbols anyways 2026-04-16 23:53:29 +09:00
79efc31c55
dbus should work on netbsd now 2026-04-16 23:40:29 +09:00
c88dc48817 cmacos: Right we can just use the lowercase newcwindow instead of worrying about pascal conversions 2026-04-16 00:55:18 -07:00
8b176d3a00 cmacos: remove parent check oops 2026-04-16 00:53:37 -07:00
9b138c458e cmacos: very untested code but it's all so basic that it should work 2026-04-16 00:45:59 -07:00
0e96b715b0 classic mac os: comment out MwTimeSleep because I realize that wouldn't work either way 2026-04-15 22:25:26 -07:00
5ca241ad0a update time.c to not do a cast 2026-04-15 22:20:13 -07:00
b2ce5597b0 fix warning 2026-04-16 14:07:20 +09:00
220b76135e Merge branch 'master' into clipboard 2026-04-15 23:49:19 -05:00
15c39a2405 windows shouldn't default to ft2 anyways 2026-04-15 21:48:52 -07:00
62fd2adcd1 Merge branch 'master' into clipboard 2026-04-15 23:47:00 -05:00
2228fa1a46 fix build 2026-04-15 21:46:37 -07:00
5136207bf1 Merge branch 'master' into clipboard 2026-04-15 23:42:47 -05:00
c85b471c43 Merge branch 'master' into classicmacos 2026-04-15 23:42:22 -05:00
f8a94b7380 cmake 2026-04-15 21:41:16 -07:00
47fe57b31c ok 2026-04-15 20:25:08 -07:00
5315f4ec4d classic mac os 2026-04-15 20:21:20 -07:00
712a640f9d probably it is better to do this way 2026-04-16 10:47:24 +09:00
4e4da8659e fix gdi opengl 2026-04-16 10:45:53 +09:00
6f9b3c12a7 fix 2026-04-16 09:55:18 +09:00
48b847093b oops 2026-04-16 09:50:08 +09:00
a2c1489ffb add MwLLSetDarkTheme 2026-04-16 09:35:53 +09:00
0fb9c45ea4 improve 2026-04-16 08:42:01 +09:00
677d8c8046 guard dbus function impls with ifdef 2026-04-15 18:26:32 -05:00
54fed150e8 dbus 2026-04-15 16:12:38 -07:00
ecdecbc93b Merge branch 'master' into clipboard 2026-04-15 17:27:14 -05:00
9087782960 wayland: fix DBUS_FUNC 2026-04-15 15:23:55 -07:00
dc97522bb0 wayland: abstract the dbus stuff a bit in case we need it later 2026-04-15 15:21:16 -07:00
43c66417c7 use pkg-config for dbus includes 2026-04-15 14:03:48 -07:00
12703d451e use pkg-config for dbus includes 2026-04-15 14:02:22 -07:00
6257376b1f Merge branch 'master' into clipboard 2026-04-15 14:00:17 -07:00
a0c864d85b fix wayland crash by having MwLLDestroy flush before actually destroying handle 2026-04-15 13:58:50 -07:00
64930db2fc color picker example: have button match the background 2026-04-15 13:03:24 -07:00
d05e31b154 wayland: don't poll for dark theme, that doesn't work 2026-04-15 13:00:59 -07:00
a3bbcf30b2 wayland: dark theme detection 2026-04-15 12:25:51 -07:00
f7eb9840de milsko.xml: MwClipboardType should be marked as an enum for MwGetClipboard 2026-04-15 11:19:10 -07:00
e77eb5e08a add clipboard stuff to milsko.xml 2026-04-15 11:14:13 -07:00
b641a03bae clipboard refactoring 2026-04-15 10:58:46 -07:00
5c386e7665 Update examples/basic/colorpicker.c 2026-04-15 03:08:55 -05:00
6ff6b22644 border around color picker wheel 2026-04-15 01:05:51 -07:00
5cb9b5cab9 have color picker check for dark theme 2026-04-15 00:54:47 -07:00
0c822d5bfa some wayland fixes curtosey of valgrind 2026-04-14 23:49:04 -07:00
4ab846ad51 fix fpe in text drawing code 2026-04-14 22:53:20 -07:00
fc8330f477 uninitialized 2026-04-15 00:29:16 -05:00
714842461c Update examples/vkdemos/CMakeLists.txt 2026-04-14 23:04:59 -05:00
aac2b410c0 gl cmake doesnt need win32 2026-04-14 23:04:39 -05:00
83f5f7a820 examples cmake doesnt need win32 2026-04-14 23:04:13 -05:00
391f5a6924 remove endian related error 2026-04-15 12:23:54 +09:00
28f6d6ac56 cocoa: untested vulkan code 2026-04-14 20:08:45 -07:00
065b0d824c cocoa: untested vulkan code 2026-04-14 20:03:59 -07:00
32f99b62b6 have MwStringIsKeyUTF8 not use ub 2026-04-14 19:51:52 -07:00
4d7b33741f fix mac os memleak, maybe fix stringisutf8 idk 2026-04-14 19:38:52 -07:00
a01e1a9514 milsko.xml: remove roundness 2026-04-14 20:54:05 -05:00
a7d790698f mac: getXYImpl should also flip whatever is given to it 2026-04-14 18:28:44 -07:00
6e5057f8c6 cocoa: no more flickering 2026-04-14 18:04:00 -07:00
d597dc9411 new drawing system now works properly-ish 2026-04-14 16:58:28 -07:00
bfc6d8e9af mac: ditch the image rep shit and try switching to a draw commands system 2026-04-14 15:52:11 -07:00
1d59488927 wayland: fix several places where we don't attach buffer if not configured 2026-04-14 13:45:47 -07:00
f22f45d5bf give up on rounded borders 2026-04-14 13:34:49 -07:00
0e2e3a1901 some gnustep fixes, probably close to giving up on this ngl 2026-04-14 13:13:17 -07:00
fe72bc92bf mac: actually dispatch close event. reorganize code slightly more now that less is in objective-c methods 2026-04-13 22:30:25 -07:00
c0d7cb3fbc mac: add a few comments 2026-04-13 21:50:10 -07:00
554e5cd5dd mac: merge all the MilskoCocoa* functions into the C Milsko functions that call them, cleaning up the codebase 2026-04-13 21:36:17 -07:00
522f32cfcd mac: revert back to what i had before with drawing, i still don't know how to fix this but it's better then nothing 2026-04-13 21:19:09 -07:00
9283455cb9 links to gnustep but doesn't run 2026-04-13 20:07:00 -07:00
7d85a784f5 i think we're now linking to gnustep properly 2026-04-13 18:39:21 -07:00
a4c61b0e38 gnustep support? 2026-04-13 17:44:27 -07:00
bb876b9620 mac: only recreate rep if width/height is different. also untested but i'm confident in this 2026-04-13 16:45:20 -07:00
b661face26 mac: more untested changes but its just removing dead comments so i know this won't break anything 2026-04-13 16:43:31 -07:00
f44a70d4ec mac: untested code but i'll fall asleep at night with this in the codebase compared to the other thing 2026-04-13 16:21:30 -07:00
14e908488c mac 2026-04-13 16:09:28 -07:00
728983b92c fix builds on osx 10.4 2026-04-13 13:46:25 -07:00
0ab497ca88 oops prioritize wayland 2026-04-13 11:28:54 -07:00
c4f6d1eb14 Update src/core.c 2026-04-11 18:30:00 -05:00
2a7cf2de83 x11: allow apple. 2026-04-11 18:26:15 -05:00
d1f351a7ef
fix cmake 2026-04-12 07:27:07 +09:00
3852646ce3
fix warning 2026-04-12 07:12:59 +09:00
00397f17ea
update milsko.xml 2026-04-12 06:44:35 +09:00
0325584319
fix document 2026-04-12 00:27:04 +09:00
67788da3fb wayland: call wl_surface_attach on every update_buffer to fix weston 2026-04-08 12:36:18 -07:00
37bba97508 fix warnings 2026-04-09 04:03:48 +09:00
c0bfb51601 wayland/x11's env checking shouldn't be else if just if 2026-04-08 12:00:48 -07:00
e9ea675ae6 change the env vars that wayland/x11 check for 2026-04-08 11:59:05 -07:00
84ad1b0d6b Merge branch 'master' of ssh://forgejo.nishi.boats:2222/pyrite-dev/milsko 2026-04-08 11:48:09 -07:00
42af900127 ft2, stbtt: draw letters over each other so that they don't clip each other 2026-04-08 11:47:58 -07:00
3c336b5e95
fix listbox 2026-04-09 03:44:29 +09:00
a652514ab0
always use monospace for listbox 2026-04-09 03:42:45 +09:00
d373f04eed ft2: slightly better spacing 2026-04-08 11:38:55 -07:00
291bb09047
disable XIM for now 2026-04-09 00:35:04 +09:00
8a5a2f0f02
nvm 2026-04-07 22:59:16 +09:00
6af4c73905
introduce MwAfterStep, breaking change 2026-04-07 22:56:18 +09:00
1531f89ef0
better rendering 2026-04-07 22:42:19 +09:00
5d8e39b268
better size 2026-04-06 23:28:32 +09:00
5f6789631d
fix font size 2026-04-06 23:27:27 +09:00
d76bb49e45
better font rendering 2026-04-06 23:19:33 +09:00
8d597328f9
fix 2026-04-06 17:37:19 +09:00
07cab25d3e
fix 2026-04-06 17:36:14 +09:00
29bab28b78
oops 2026-04-06 17:34:32 +09:00
0de09207a4
refactor font api 2026-04-06 17:29:09 +09:00
9fc659b652
some code does this 2026-04-04 00:38:18 +09:00
55cb65be26
be c89 2026-04-04 00:35:11 +09:00
cce41b32b8 document tiny flag; have it use flto on clang 2026-03-31 17:15:25 -07:00
a00d4ba144 configure updates, new 'tiny config' option 2026-03-31 16:54:01 -07:00
da3312cee9 x11: only load in needed functions. also make it so xrender just isn't used if it's not found 2026-03-31 14:26:47 -07:00
d4f6ca14e2 allow x11 backend to be disabled (on by default) (i doubt people will do this) 2026-03-31 13:54:12 -07:00
2e2a97e4a8 replace MwPrintIntoBuffer w MwStringPrintIntoBuffer in core.c 2026-03-31 13:30:34 -07:00
b6b8f742d7 fix vulkan's usage of removed error primative 2026-03-31 13:28:05 -07:00
af54b3e515 dynload x11 and xrender 2026-03-31 13:24:28 -07:00
9d7d4541e4 dynload freetype2 2026-03-31 12:44:32 -07:00
2e30d7f4d9 remove merge conflict artifacts, prefix MwIsKeyUTF8 2026-03-31 12:36:31 -07:00
597dbe4e5a merge conflict 2026-03-30 11:32:40 -07:00
9560c4fd92 merge conflict 2026-03-30 11:31:40 -07:00
3d99a9249f remove mw/error.h includes 2026-03-30 11:22:22 -07:00
32842ca160 document MwStringPrintIntoBuffer slightly better 2026-03-30 11:19:15 -07:00
35d2b4bb76 MwStringPrintIntoBuffer 2026-03-30 11:14:33 -07:00
a5beb9e6b9
define types properly 2026-03-29 21:15:27 +09:00
e8d32dafc7
oops 2026-03-29 09:42:58 +09:00
e312b325c8
fix things 2026-03-29 09:42:34 +09:00
112ddd1521
fix libpng/libjpeg, enable zlib 2026-03-29 09:36:43 +09:00
89dad2c4be Wayland massachusetts 2026-03-27 18:06:17 -07:00
252490e2cf Wayland pointer lock fixes 2026-03-27 17:15:59 -07:00
4d694bba49 several wayland fixes, new util function MwIsUTF8 so that both backends can consistently check if something is a valid utf8 2026-03-27 15:14:19 -07:00
87c870a6c0
fix periodic 2026-03-28 02:40:12 +09:00
dac94c78e1
huh 2026-03-28 02:39:30 +09:00
df50c9531c
almost complete 2026-03-27 17:26:14 +09:00
7be0a72fca
optimize box later 2026-03-27 16:41:32 +09:00
f6abf02486
wip 2026-03-27 16:31:28 +09:00
251fc41020
fix hang 2026-03-27 16:16:30 +09:00
0e5f4f5ef7
fix document 2026-03-27 15:35:03 +09:00
309cd98ea1 Merge branch 'master' of ssh://forgejo.nishi.boats:2222/pyrite-dev/milsko 2026-03-26 23:33:46 -07:00
78ee4033b5 wayland: MwLLShowImpl 2026-03-26 23:32:24 -07:00
a16c1bcb5b
more 2026-03-27 15:31:51 +09:00
1d76cabf4c
wip 2026-03-27 15:25:02 +09:00
a5186cc1e9 Merge branch 'master' of ssh://forgejo.nishi.boats:2222/pyrite-dev/milsko 2026-03-26 22:53:42 -07:00
414fde9b77 fix text positioning on entry 2026-03-26 22:53:20 -07:00
efe1ea076e
fix timing 2026-03-27 14:49:10 +09:00
bf9474f4f4 mergE 2026-03-26 22:48:14 -07:00
a9d8d62146 reduce contrast of complex frame in light mode 2026-03-26 22:47:07 -07:00
f1c4a12cf3
implement MwLLGetClipboard for X11 2026-03-27 14:40:07 +09:00
efbf90945a fix entry widget's use of clipboard 2026-03-26 21:58:47 -07:00
d61e432e97 wayland: fix combobox 2026-03-26 21:36:57 -07:00
37835cb53a Merge branch 'master' of ssh://forgejo.nishi.boats:2222/pyrite-dev/milsko 2026-03-26 21:03:03 -07:00
849c439830 better code and better look for borders 2026-03-26 21:02:45 -07:00
7998454ab9 fix ub 2026-03-27 12:54:33 +09:00
6cc3925282
add MwNdarkTheme 2026-03-27 11:25:53 +09:00
df11b86cea +2 -> +3 2026-03-26 21:07:59 -05:00
258d0d2cb2 update xml 2026-03-26 21:07:59 -05:00
a42482a4e4 epic 2026-03-26 21:07:59 -05:00
8f7df275fb better 2026-03-26 21:07:59 -05:00
fc18c86201 disable rounding on checkbox 2026-03-26 21:07:59 -05:00
e5acf07b38 disable rounding on combobox 2026-03-26 21:07:59 -05:00
8dfa34e555 only do backing box draw if backend doesn't do transparency 2026-03-26 21:07:59 -05:00
17e437075e let ioixd do the job 2026-03-26 21:07:59 -05:00
60e1f36a41 slightly stronger gradient on modern theme 2026-03-26 21:07:59 -05:00
00e44bec32 MwNisRounded 2026-03-26 21:07:59 -05:00
6538f8e836 fix wayland csd, more doublebuffering fixes 2026-03-26 21:07:59 -05:00
2a2fdf55bc wayland: double buffering 2026-03-26 21:07:59 -05:00
19cd6dc242 increase smoothness 2026-03-26 21:07:59 -05:00
548d6c46fd r 2026-03-26 21:07:59 -05:00
8d7016367e experimental rounded corners idea 2026-03-26 21:07:59 -05:00
70f7f8f084
fix box bug 2026-03-27 11:05:15 +09:00
6ba77904d6 fix hitTest 2026-03-25 21:06:32 -07:00
90706b184f apple: assorted fixes 2026-03-25 19:09:01 -07:00
0bbbc51bb9 apple: fix polygon/pixmap coordinates, add line function 2026-03-25 18:53:13 -07:00
bcb108ae5f apple: 'more correct' polygons weren't correct at all 2026-03-25 18:47:58 -07:00
74779c8f42 apple: better polygons, revealing a bigger issue maybe 2026-03-25 18:21:27 -07:00
82999d716a apple: move all event stuff into callback system, fix cmake support for apple, add gl/vk examples to cmake 2026-03-25 17:49:50 -07:00
6bb72c224b support wayland backend on cmake 2026-03-25 14:06:50 -07:00
c05843a04b
ugh 2026-03-25 17:09:36 +09:00
aa6d1f43d3
fix 2026-03-25 17:06:44 +09:00
fa9ad8b984 enable wayland by default on linux builds 2026-03-25 00:43:35 -07:00
4b2bf63889 wayland: support pointer locking 2026-03-25 00:31:23 -07:00
f4e2ec8fa9 h 2026-03-24 23:44:30 -07:00
9757623d3c make always_render a global variable, MwWaylandAlwaysRender 2026-03-24 23:24:20 -07:00
a826ce5e12 GOD IS GOOD 2026-03-24 23:08:43 -07:00
195cccd65a perfect MwLLDetach 2026-03-24 22:40:36 -07:00
2a7327f27a wayland: update backbuffer on enddraw 2026-03-24 19:42:37 -07:00
aad8d1b536 wayland: combo box consistently shows up now 2026-03-24 18:01:55 -07:00
7162350e24 use-experimental-wayland => use-wayland 2026-03-24 17:39:25 -07:00
47746ff30e dynamically load wayland and its dependencies, fix warnings 2026-03-24 17:38:21 -07:00
e86d6acdf3 we can just draw even if events are pending 2026-03-24 14:53:02 -07:00
9a23045c30 change draw_n_resize to just resize 2026-03-24 14:43:38 -07:00
1ad75eca90 only draw on the parent and resize on the child in draw_n_resize 2026-03-24 14:41:20 -07:00
57609f1823 fire a draw/resize event manually to children when resizing 2026-03-24 13:31:49 -07:00
5e823b5a25 wayland: gl improvements 2026-03-23 19:30:21 -07:00
b9933b70e2 wayland: on resize, fire draw before resize 2026-03-23 15:56:01 -07:00
d491357635 wayland: csd fixes 2026-03-23 15:45:48 -07:00
24ae1c4e11 wayland: have backbuffer be larger then framebuffer instead of other way around 2026-03-23 15:32:28 -07:00
8ccf819b57 wayland: positive width/height 2026-03-23 14:56:27 -07:00
682d84879b wayland: cap x/y for viewporter to 0,0 2026-03-23 14:54:36 -07:00
ea2d62f2e1 more wayland fixes 2026-03-23 14:28:49 -07:00
f4072bcb3f fix clipboard 2026-03-23 13:38:26 -07:00
56cb0d4841 wayland: fix cursor 2026-03-24 04:56:08 +09:00
6277c8837a Merge branch 'master' of ssh://forgejo.nishi.boats:2221/pyrite-dev/milsko 2026-03-23 12:36:12 -07:00
3d83e0ca64 wayland: fix cursor 2026-03-23 12:35:29 -07:00
efa6804f46 fix math 2026-03-24 04:34:10 +09:00
6c65e58e37
fix 2026-03-24 04:27:57 +09:00
6d7fe3271f
fix cursor thing for x11/gdi, also format 2026-03-24 04:26:36 +09:00
9d65e9c6bf Wayland improvements 2026-03-23 12:05:32 -07:00
c3d25e6b7d wayland: don't do draw dispatch on forceRender anymore, merely update the buffer 2026-03-22 16:32:36 -07:00
09441380b5 wayland: fallback if selected_cairo is null 2026-03-22 16:15:50 -07:00
2499f82933 wayland: fix double free in wp_viewporter_interface_destroy 2026-03-22 16:12:54 -07:00
0527d376b7 add function for forcing the client to be configured before doing any xdg stuff (in a way Both all compositors like) 2026-03-20 20:23:02 -07:00
69076f2893 fix menus on csd 2026-03-20 19:42:30 -07:00
dee940161e clip: only apply extra clipping when haves decorations 2026-03-20 19:33:12 -07:00
52d676e54f csd and clipping 2026-03-20 19:28:18 -07:00
4e70de98e9 merge conflict 2026-03-19 19:46:58 -07:00
3cf94f6651 wayland: malicious compliance with gnome's CSD rule 2026-03-19 19:43:57 -07:00
22fe52c4a3 ugh 2026-03-20 09:59:07 +09:00
3eeace0963 don't use wl_dispatch_pending_timeout appearently debian still doesn't ship with it 2026-03-19 17:32:36 -07:00
f78e5e620f wayland: image clipping attempt 2026-03-19 17:06:48 -07:00
f44f98b8aa wayland: don't update buffer if we haven't configured 2026-03-19 16:35:56 -07:00
04eb28b617 revert the removal of MwLLBeginDraw/EndDraw, turns out the newer system still doesn't please weston and likely other compositors 2026-03-19 16:05:44 -07:00
42db5889db wayland c89 2026-03-19 16:01:32 -07:00
5f53236c91 remove unused test parameter added to common lowLevel 2026-03-19 15:59:44 -07:00
91c05b670d wayland: working viewport, subsurface input region 2026-03-19 15:57:20 -07:00
5960823801 wayland: don't early return from pointer_button, it causes a deadlock 2026-03-18 23:07:16 -07:00
0a62467760 correct mouse clicks 2026-03-18 23:01:39 -07:00
9309b5fe83 remove old hacks from wayland code, including MwLLBeginDraw and MwLLEndDraw which was really only ever needed for wayland and not anymore 2026-03-18 19:24:51 -07:00
fc7896b5ce wayland: improve event loop 2026-03-17 22:17:05 -07:00
eb0919333a wayland: fix several examples 2026-03-17 20:39:37 -07:00
1cb8fb6c53 wayland: SEVERAL fixes 2026-03-17 20:28:58 -07:00
d14c17b86e wayland fixes 2026-03-17 17:43:22 -07:00
98eb529c6f Merge branch 'master' of ssh://gitea.nishi.boats:2222/pyrite-dev/milsko 2026-03-16 16:09:01 -07:00
c64d7778cd mac: convert child windows to subviews 2026-03-16 16:08:25 -07:00
3260643ada
i wonder if this works 2026-03-14 05:21:53 +09:00
8f04ccdb68
cleanup 2026-03-14 05:16:27 +09:00
43dd61ffbe
clean old things 2026-03-14 05:10:16 +09:00
db5f0ed40a mac: some fixes 2026-03-12 01:10:45 -07:00
96528ca433 mac: don't set the xywh of parent windows twice 2026-03-11 20:27:51 -07:00
13320dce78 proper event handling 2026-03-11 15:49:14 -07:00
02faed2f04 reduce cpu usage on event loop 2026-03-11 13:13:16 -07:00
6c53df0fc5 correct pixmap updating (sadly memcpy'ing is not enough) 2026-03-10 20:09:37 -07:00
d9ee157ee8 mac: support delayed creation of the view's context, for anything whose size starts at 0x0 2026-03-10 17:10:47 -07:00
d3c30bf6d3 mac: mouse fixing, somewwhat. also just always send events for a bit 2026-03-10 16:31:29 -07:00
8f379e9751 add comment clarifying pending 2026-03-10 15:46:46 -07:00
9f1b455341 mac: new event pumping architecture that sucks and i hate it but apple is happy with it so we're happy with it 2026-03-10 15:33:20 -07:00
a0e2ec7f57 undo sending mouse event to both the parent and widget itself, forgot that that's exactly something we don't want to do 2026-03-09 16:40:30 -07:00
4ca11145f1 some 10.4 fixes 2026-03-09 16:35:09 -07:00
3f84b0f868 mac: document MilskoFakePointer 2026-03-09 16:19:12 -07:00
dd67e42054 mac: remove debug prints 2026-03-09 16:14:48 -07:00
dccc402b3d mac: send mouse/key to both event itself and window, evidently 2026-03-09 16:13:49 -07:00
128a1ec524 mac: 'implement' tool windows 2026-03-09 15:07:46 -07:00
65afd85439 mac: most window functions now implemented (save for makeToolWindow) 2026-03-09 14:01:57 -07:00
9eda46d981 mac: remove accidental includes 2026-03-08 23:38:57 -05:00
21d5625ec7 fix forceRender, at the cost of breaking the rotate example 2026-03-08 20:03:47 -07:00
75c9af91d1 mac: try and fix positioning for child windows 2026-03-08 19:15:17 -07:00
c20da369e8 try and fail to have the app be activated without setting the activation policy 2026-03-08 18:30:37 -07:00
3b78872ce8 mac: took a detour and got it working in 10.4, before accidentally fixing the remaining memory leak I think 2026-03-08 18:04:37 -07:00
4549e4f75b mac: remove nscolor release call after realizing it's likely UB and crashes high sierra 2026-03-08 17:07:48 -07:00
4319ea25b5 mac: fix a bunch of memory leaks 2026-03-08 16:05:57 -07:00
0fde05fa03 fix some parts 2026-03-08 07:06:12 +09:00
306f791641 mac: apple doesn't give us a reliable way to check if events are pending but we have to do the nextEventMatching trick anyways because the alternating pending implementation breaks opengl. 2026-03-05 22:52:25 -07:00
ea046f3a52 mac: fix memory leaks somewhat. 2026-03-05 22:41:09 -07:00
9d7a75394c mac: implement clipboard (At the cost of making the pending function a crime against god) 2026-03-05 21:58:22 -07:00
9be36b0755 mac: have key events get sent to parent 2026-03-05 20:19:19 -07:00
e2bcd7b9e9 mac: keyboard events and other nice refactors. they get sent to the opengl window but the callback isn't fired for some reason 2026-03-05 19:29:43 -07:00
39db13fa48 mac: center window when MwDEFAULT is passed 2026-03-04 23:06:56 -07:00
db577bb01f mac opengl support. proper coordinate flipping 2026-03-04 22:56:04 -07:00
f700e90d23 did some code cleanup 2026-03-04 20:47:55 -07:00
b585ad69b7 code cleanup 2026-03-04 20:44:25 -07:00
943500a7ec mac: got a bunch of events handled. failed to get resizing working though 2026-03-04 19:34:19 -07:00
0832533c51 Oops the readme is generated 2026-03-04 16:52:19 -07:00
f9c35cded4 macos note in readme should just be the version, my bad 2026-03-04 13:32:39 -07:00
2e4e2a1c7f Remove xcodetools note 2026-03-04 13:31:25 -07:00
5eeba311ab i fixed the makefiles but forgot to run the script 2026-03-04 13:22:00 -07:00
890294cd55 update macos readme 2026-03-04 13:18:01 -07:00
de1e8da6f9 fix generated mkfiles 2026-03-04 13:05:38 -07:00
e09eccbf5f refactor font.c into an MwFL section (#9)
Reviewed-on: https://gitea.nishi.boats/pyrite-dev/milsko/pulls/9
Co-authored-by: IoIxD <alphaproject217@gmail.com>
Co-committed-by: IoIxD <alphaproject217@gmail.com>
2026-03-04 13:59:28 -06:00
b3735fa364
rename Makefile.pl to configure 2026-03-05 04:09:01 +09:00
cc2d3008d0 mac: implement polygon function 2026-03-04 00:02:14 -07:00
efa43456c1 significant macos progress, now compiles/runs on monetery 2026-03-03 23:24:28 -07:00
11fec984cf
fix 2026-02-06 22:05:13 +09:00
d7db903695
msvc 2026-02-04 00:30:22 +09:00
c04f751a4f
msvc 2026-02-04 00:25:49 +09:00
280ba93cf1
hmm 2026-02-04 00:21:31 +09:00
3329184993
unused 2026-02-04 00:06:31 +09:00
4a092e71d2
testing 2026-02-04 00:02:21 +09:00
c308bd9324
test 2026-02-03 23:46:24 +09:00
282283609c
i wonder if doc gets generated 2026-02-03 23:43:08 +09:00
12f7312d40
testing jenkins 2026-02-03 23:27:27 +09:00
5bc06dc851
testing jenkins 2026-02-03 23:24:34 +09:00
7ad4d82024
c89 2026-02-02 23:02:42 +09:00
ad5aa03d11
remove non required headers 2026-01-31 20:42:09 +09:00
bbb20f081e
add MwNdarkThemeHandler 2026-01-27 18:51:57 +09:00
626294c95f
format 2026-01-27 18:50:03 +09:00
9544404f7c
fix warning 2026-01-27 18:46:12 +09:00
65c872710a it should be working now, closes #6 2026-01-27 18:12:36 +09:00
64c3cdb4a5 MwSetDarkTheme instead of MwToggleDarkTheme 2026-01-27 18:03:16 +09:00
5e492ee5b4 oops 2026-01-27 18:00:44 +09:00
ae96b127e1 fix leak 2026-01-27 17:58:52 +09:00
0cecae2dd1 better registry function 2026-01-27 17:58:30 +09:00
18457ccbcb tiny fix 2026-01-27 17:36:21 +09:00
8b28b3e1b0 might be functional 2026-01-27 17:34:25 +09:00
836b13e62e add RPN calculator demo 2026-01-27 17:02:40 +09:00
5413332506
introduce MwWidget->berserk 2026-01-23 15:29:32 +09:00
8d86f185f2
use milsko's typedefs instead in cocoa 2026-01-23 13:57:05 +09:00
b458613f87 update 2026-01-20 14:05:03 +09:00
04f1a94cb5 cocoa: attempted drawing 2026-01-14 17:13:12 -07:00
a710967115 cocoa: move interfaces to header (guarded by ifdef __OBJC__) 2026-01-14 13:47:49 -07:00
e2f34df4e3
format objective c files 2026-01-15 05:31:04 +09:00
3dec3ff0da
format 2026-01-15 05:16:47 +09:00
85994d42f1
fix issue #5 2026-01-15 05:16:27 +09:00
32f09a9af2 wayland: don't do parent draws on every event when we do'nt need to 2026-01-12 19:21:32 -07:00
d340c64ca3 wayland: fix weird regressiong 2026-01-12 18:50:33 -07:00
14e55b7f53 wayland: fix weird regression 2026-01-12 18:48:22 -07:00
69c95d5752 wayland: more fix 2026-01-12 18:18:05 -07:00
efcc176c04 cocoa: more fixes 2026-01-12 15:31:22 -07:00
e45a1f6ad8 cocoa: more fixes 2026-01-12 15:30:05 -07:00
31cc8e5a0d cocoa: fix syntax errors. Also allow cmake to compile it (untested) 2026-01-12 15:13:59 -07:00
a70f3dbb59 remove old appkit.m file that somehow got here 2026-01-12 13:07:35 -07:00
ca4adf5f39 cocoa: fill a bunch of no-brainer functions, i haven't actually tested this yet and won't until I get home but I assume the worst case scenario is that I fucked up the syntax 2026-01-12 13:04:30 -07:00
eb50af2b81
manpage says usleep is obsolete but i dont care 2026-01-13 01:00:28 +09:00
a0d1bada8f
probably left debug code 2026-01-12 18:50:55 +09:00
7e32866c0a
fix cmake 2026-01-12 06:28:43 +09:00
e8f743ed84
better 2026-01-12 06:24:48 +09:00
c61e26f028
yeah 2026-01-12 06:05:24 +09:00
e73964882e renamed appkit backend to cocoa and got something that compiles 2026-01-09 21:35:23 -07:00
da33a1a3c6 darwin: remove invalid characters 2026-01-09 14:45:12 -07:00
2d3bd9213e appkit 2026-01-09 14:43:44 -07:00
079cfa18b9
fix english 2026-01-09 07:25:05 +09:00
debdaf998e
add MW_OPENGL_NO_INCLUDE 2026-01-09 03:06:38 +09:00
1f1318d0e1 cmake: allow shared or static building 2026-01-07 12:30:18 -07:00
85df90ceaf
what did i even change? 2026-01-06 00:54:00 +09:00
e2aecbf9d4
this should be more correct 2026-01-05 23:27:18 +09:00
d3751c0bf9 submenu: just don't adjust if there's no global coordinates, there's not much of another way 2026-01-04 18:25:33 -07:00
54cdd85015 coords 2026-01-04 13:06:36 -07:00
d784770ca9 wayland: popup positioning 2026-01-04 13:01:50 -07:00
12f279e83a wayland: ensure every event callback uses the mutex 2026-01-04 11:40:34 -07:00
8cdffa12ae wayland/opengl: fix o->egl_window_native warning 2026-01-04 11:13:59 -07:00
933b5198c7 wayland/vulkan: quickly get that going 2026-01-04 11:12:57 -07:00
30a100fd28 wayland/opengl: set EGL_DEPTH_SIZE to 24 2026-01-03 19:21:03 -07:00
a148b3bedf wayland: use mutexes to ensure that MwLLDestroyImpl never conflicts with wayland events. 2026-01-03 18:27:34 -07:00
bed668b84a wayland: fix misc. crashes on the destruction of widgets 2026-01-02 14:19:48 -07:00
6183a1ccda
update license 2026-01-02 00:24:59 +09:00
f32f6cefc0 wayland: accidentally removed event_loop call from MwLLNextEventImpl 2025-12-30 22:44:04 -07:00
f3683dece3 undo HAS_OPENGL stuff 2025-12-30 22:38:01 -07:00
808495cccf wayland: misc fixes 2025-12-30 22:28:36 -07:00
6946c1eaf3 wayland: opengl support 2025-12-30 22:26:19 -07:00
029e62d765 wayland: opengl 2025-12-30 20:30:29 -07:00
a03065ae52 wayland: forgot to commit .h 2025-12-30 19:16:01 -07:00
324257c43f wayland: no pthreads needed 2025-12-30 19:15:33 -07:00
afecb04848 clipboard: don't set clipboard after pasting 2025-12-30 17:14:57 -07:00
bed63dd245 clipboard: fix syntax 2025-12-30 17:14:39 -07:00
67bd6029af wayland: finish clipboard 2025-12-30 17:12:12 -07:00
72820e87f1
rename clipboard_received to clipboard 2025-12-31 04:35:10 +09:00
d3147ac087
format 2025-12-31 04:29:27 +09:00
4bdda59693 better api for clipboard 2025-12-31 04:29:13 +09:00
823c865791
handle WM_DELETE_WINDOW better 2025-12-31 00:48:44 +09:00
3f9125d1ae
fix 2025-12-30 23:54:30 +09:00
549d235893
better 2025-12-28 21:56:45 +09:00
0daa527b1d
fix 2025-12-28 18:03:37 +09:00
0ca7f6ed8a
dispatch children_update 2025-12-28 17:41:11 +09:00
e895e96941 introduce MwNleftPadding to label 2025-12-25 15:39:54 +09:00
0d79141a49
tiny fix 2025-12-25 04:21:33 +09:00
c80987ffe4
better 2025-12-25 04:18:12 +09:00
d3a7b0a01d
oops 2025-12-25 04:03:05 +09:00
e77c4f3c38
add MwNleftPadding to SubMenu 2025-12-25 03:56:04 +09:00
22b4737c33
better separator 2025-12-25 02:27:41 +09:00
509351a0a0
fix submenu 2025-12-25 00:19:27 +09:00
86effbdfd7
fix 2025-12-24 22:52:26 +09:00
7b47524286
improve submenu 2025-12-24 13:56:08 +09:00
c8e7f58230
wrong 2025-12-23 22:11:22 +09:00
9ea54b4f88
format 2025-12-23 22:08:55 +09:00
55f82e4fbc
update 2025-12-23 22:08:49 +09:00
a23016bc05 yes 2025-12-23 18:14:00 +09:00
df99e66d87 tiny fix 2025-12-23 18:10:50 +09:00
e9fd2705d4
fix 2025-12-21 23:05:42 +09:00
a824b4fc44
oops 2025-12-21 23:04:53 +09:00
c7c8f236b0
yes 2025-12-21 23:03:33 +09:00
bdc67d6369
text shadow 2025-12-21 23:02:02 +09:00
873c75b882
fix 2025-12-21 22:21:10 +09:00
e44eaa2c16
fix 2025-12-21 22:02:33 +09:00
0d281c09ce
i will work on vms port at some point 2025-12-21 20:25:57 +09:00
2b30a06ecf
wip VMS port 2025-12-21 19:29:05 +09:00
188da6803e
adjust some stuff 2025-12-21 15:33:48 +09:00
2304b493d1
add MwNlength 2025-12-21 15:17:00 +09:00
91d9677bf7
add seven segment 2025-12-21 14:38:07 +09:00
f09960195f
submenu 2025-12-21 12:08:08 +09:00
ab9d0ffc5f
improve submenu 2025-12-21 11:53:47 +09:00
a67a0c11f8
fix 2025-12-19 23:31:05 +09:00
dc8168df12
fix 2025-12-19 22:36:49 +09:00
604ff72d6e
add MwNbitmapFont 2025-12-19 22:35:35 +09:00
a384add9e9 wayland: properly do MwLLPending and MwLLNextEvent 2025-12-18 23:50:03 -07:00
6123fd1304 wayland: implement tool windows. add destructors for protocols 2025-12-18 23:32:51 -07:00
b7488b9440 wayland: seperate MwLLPending and MwLLNextEvent 2025-12-18 19:59:40 -07:00
18511dec2f wayland: remove a few unused fields 2025-12-18 18:27:44 -07:00
59ff6f1008 wayland: add icon support 2025-12-18 18:21:57 -07:00
a27a01ce41 wayland: MwLLGetClipboardImpl. 2025-12-18 17:46:23 -07:00
b0f4713ff1 wayland: remove unused cursor_shape 2025-12-18 13:46:22 -07:00
8d4e845e7c wayland: MwLLGetScreenSize 2025-12-18 13:43:45 -07:00
aeaf0a4547 wayland: MwLLGetCursorCoordImpl 2025-12-18 13:16:16 -07:00
b366fc12a7 Merge branch 'master' of ssh://gitea.nishi.boats:2222/pyrite-dev/milsko 2025-12-18 13:15:20 -07:00
d8c08f80d6 wayland: cursor support 2025-12-18 13:15:03 -07:00
bfa0a5811e
fix 2025-12-19 04:38:29 +09:00
19f52488b8
fancy things 2025-12-19 03:57:45 +09:00
c6e7421b31 wayland: key modifiers 2025-12-18 11:36:04 -07:00
e3b3363e42 Merge branch 'master' of ssh://gitea.nishi.boats:2222/pyrite-dev/milsko 2025-12-18 11:29:12 -07:00
a815998ace wayland: fix pointer 2025-12-18 11:26:51 -07:00
75749697ba
netbsd wants pthread. idk why 2025-12-19 03:01:12 +09:00
c9c3a00ed3
unrelated changes 2025-12-19 02:55:30 +09:00
012650f06f
tiny change 2025-12-19 01:37:02 +09:00
72fbba1a74 force aliasing 2025-12-18 12:24:06 +09:00
b8a92f4ae0 wayland: buffer destroy/recreate in SetWHImpl too 2025-12-17 19:44:15 -07:00
724b008220 impl resizing in wayland 2025-12-17 19:41:05 -07:00
320de34ce8 remove opengl from wayland in favor of cairo 2025-12-17 19:14:54 -07:00
d117241ba7
math 2025-12-18 11:08:23 +09:00
1907dd5d49
optimization 2025-12-18 10:57:10 +09:00
224fc48ecd
yes 2025-12-17 21:37:01 +09:00
8bb1cbdc09
tiny fix 2025-12-15 15:55:59 +09:00
00b542428d
make it macro 2025-12-15 15:45:53 +09:00
3e4001e4f1
more proper term 2025-12-15 15:41:19 +09:00
02c21233ae
use more proper term 2025-12-15 15:27:04 +09:00
a5cd1974e4
add MwNouterPadding 2025-12-15 15:05:36 +09:00
a1ce1b56e4
fix prop and add MwNfixedSize 2025-12-15 14:30:59 +09:00
1a95ddce94
oops 2025-12-15 14:13:55 +09:00
50f11b1c69
introduce box widget 2025-12-15 14:09:30 +09:00
5003d29246
wtf 2025-12-15 12:26:15 +09:00
1853cd1e7f
fix 2025-12-15 11:42:09 +09:00
270c87bca2
care abt DESTDIR 2025-12-15 07:21:45 +09:00
dabe62d475
forgot 2025-12-15 07:10:23 +09:00
1e74356db7
method name consistency 2025-12-15 07:05:42 +09:00
bc998806ee
oops 2025-12-15 06:51:31 +09:00
cf4fdc531a
update color things 2025-12-15 06:48:40 +09:00
f9c0ec987e
improvement 2025-12-12 17:51:26 +09:00
0c8715ec9f
bugfix 2025-12-12 17:26:57 +09:00
363897df74
background pixmap 2025-12-11 01:37:13 +09:00
e57f3fd910
update 2025-12-11 00:50:50 +09:00
82f9330bef
add MwNfillArea 2025-12-10 13:26:19 +09:00
bbc27d680a
that is simply wrong 2025-12-10 12:57:40 +09:00
0c787264c6
fix some stuff 2025-12-10 11:15:52 +09:00
9a4c74ad93 Unfinished Wayland PR (#1)
moved from the github repo.

current progress:

<img width="389" alt="image.png" src="attachments/6a2cb365-7348-44b4-8fa7-9980df965a67">

Other notes:

- took the opportunity to remove MwLLSetBackground which I was told was deprecated
- Updated .gitignore to more accurately cover/remove example binaries
- Uses OpenGL as the backend.
- New LL function for swapping buffers, MwLLEndDraw
- [TODO] Uses weak linking for all libraries so that systems that don't support Wayland or even have it installed can launch without it.

Reviewed-on: https://gitea.nishi.boats/pyrite-dev/milsko/pulls/1
Co-authored-by: IoIxD <alphaproject217@gmail.com>
Co-committed-by: IoIxD <alphaproject217@gmail.com>
2025-12-09 20:11:01 -06:00
199 changed files with 30761 additions and 7094 deletions

View file

@ -1,11 +1,12 @@
---
Language: Cpp
UseTab: Always
TabWidth: 8
AlignConsecutiveAssignments:
Enabled: true
AlignConsecutiveDeclarations:
Enabled: true
AccessModifierOffset: -4
NamespaceIndentation: All
IndentWidth: 8
PointerAlignment: Left
ColumnLimit: 0
@ -13,6 +14,9 @@ AllowShortIfStatementsOnASingleLine: Always
AllowShortBlocksOnASingleLine: Never
AllowShortFunctionsOnASingleLine: Empty
AllowShortLoopsOnASingleLine: true
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
SpaceBeforeParens: Never
AlignEscapedNewlines: DontAlign
SortIncludes: false

3
.clangd Normal file
View file

@ -0,0 +1,3 @@
Completion:
HeaderInsertion: Never
ClangFormat: Tab

19
.gitignore vendored
View file

@ -5,10 +5,29 @@ examples/*/*.exe
!examples/*/
!examples/*.*
!examples/*/*.*
*.exe
*.o
*.obj
*.core
*.so
*.dll
*.lib
*.dylib
*.a
/Makefile
/build
compile_flags.txt
.cache
.DS_Store
/vms
/BorMakefile
*.err
*.zip
*.pef
*.dsk
*.bin
*.rsrc
*.finf
*.gdb

81
BorMakefile generated
View file

@ -1,81 +0,0 @@
CC = bcc32 -c
LD = bcc32
CFLAGS = -Iinclude -D_MILSKO -DUSE_GDI -DUSE_STB_TRUETYPE -DUSE_STB_IMAGE -DSTBI_NO_SIMD
LDFLAGS = -tWD
.SUFFIXES: .obj .c
all: src\Mw.dll
clean:
del /f /q external\stb_ds.obj
del /f /q external\stb_image.obj
del /f /q external\stb_truetype.obj
del /f /q src\abstract\directory.obj
del /f /q src\abstract\dynamic.obj
del /f /q src\abstract\time.obj
del /f /q src\backend\gdi.obj
del /f /q src\color.obj
del /f /q src\core.obj
del /f /q src\cursor\arrow.obj
del /f /q src\cursor\cross.obj
del /f /q src\cursor\default.obj
del /f /q src\cursor\hidden.obj
del /f /q src\cursor\text.obj
del /f /q src\default.obj
del /f /q src\dialog\colorpicker.obj
del /f /q src\dialog\directorychooser.obj
del /f /q src\dialog\filechooser.obj
del /f /q src\dialog\messagebox.obj
del /f /q src\draw.obj
del /f /q src\error.obj
del /f /q src\font\boldfont.obj
del /f /q src\font\boldttf.obj
del /f /q src\font\font.obj
del /f /q src\font\ttf.obj
del /f /q src\icon\back.obj
del /f /q src\icon\clock.obj
del /f /q src\icon\computer.obj
del /f /q src\icon\directory.obj
del /f /q src\icon\down.obj
del /f /q src\icon\error.obj
del /f /q src\icon\file.obj
del /f /q src\icon\forward.obj
del /f /q src\icon\info.obj
del /f /q src\icon\left.obj
del /f /q src\icon\news.obj
del /f /q src\icon\note.obj
del /f /q src\icon\right.obj
del /f /q src\icon\search.obj
del /f /q src\icon\up.obj
del /f /q src\icon\warning.obj
del /f /q src\lowlevel.obj
del /f /q src\string.obj
del /f /q src\text.obj
del /f /q src\unicode.obj
del /f /q src\widget\button.obj
del /f /q src\widget\checkbox.obj
del /f /q src\widget\combobox.obj
del /f /q src\widget\entry.obj
del /f /q src\widget\frame.obj
del /f /q src\widget\image.obj
del /f /q src\widget\label.obj
del /f /q src\widget\listbox.obj
del /f /q src\widget\menu.obj
del /f /q src\widget\numberentry.obj
del /f /q src\widget\opengl.obj
del /f /q src\widget\progressbar.obj
del /f /q src\widget\radiobox.obj
del /f /q src\widget\scrollbar.obj
del /f /q src\widget\separator.obj
del /f /q src\widget\submenu.obj
del /f /q src\widget\treeview.obj
del /f /q src\widget\viewport.obj
del /f /q src\widget\window.obj
del /f /q src\Mw.dll
del /f /q src\Mw.lib
src\Mw.dll: external\stb_ds.obj external\stb_image.obj external\stb_truetype.obj src\abstract\directory.obj src\abstract\dynamic.obj src\abstract\time.obj src\backend\gdi.obj src\color.obj src\core.obj src\cursor\arrow.obj src\cursor\cross.obj src\cursor\default.obj src\cursor\hidden.obj src\cursor\text.obj src\default.obj src\dialog\colorpicker.obj src\dialog\directorychooser.obj src\dialog\filechooser.obj src\dialog\messagebox.obj src\draw.obj src\error.obj src\font\boldfont.obj src\font\boldttf.obj src\font\font.obj src\font\ttf.obj src\icon\back.obj src\icon\clock.obj src\icon\computer.obj src\icon\directory.obj src\icon\down.obj src\icon\error.obj src\icon\file.obj src\icon\forward.obj src\icon\info.obj src\icon\left.obj src\icon\news.obj src\icon\note.obj src\icon\right.obj src\icon\search.obj src\icon\up.obj src\icon\warning.obj src\lowlevel.obj src\string.obj src\text.obj src\unicode.obj src\widget\button.obj src\widget\checkbox.obj src\widget\combobox.obj src\widget\entry.obj src\widget\frame.obj src\widget\image.obj src\widget\label.obj src\widget\listbox.obj src\widget\menu.obj src\widget\numberentry.obj src\widget\opengl.obj src\widget\progressbar.obj src\widget\radiobox.obj src\widget\scrollbar.obj src\widget\separator.obj src\widget\submenu.obj src\widget\treeview.obj src\widget\viewport.obj src\widget\window.obj
$(LD) $(LDFLAGS) -e$@ external\stb_ds.obj external\stb_image.obj external\stb_truetype.obj src\abstract\directory.obj src\abstract\dynamic.obj src\abstract\time.obj src\backend\gdi.obj src\color.obj src\core.obj src\cursor\arrow.obj src\cursor\cross.obj src\cursor\default.obj src\cursor\hidden.obj src\cursor\text.obj src\default.obj src\dialog\colorpicker.obj src\dialog\directorychooser.obj src\dialog\filechooser.obj src\dialog\messagebox.obj src\draw.obj src\error.obj src\font\boldfont.obj src\font\boldttf.obj src\font\font.obj src\font\ttf.obj src\icon\back.obj src\icon\clock.obj src\icon\computer.obj src\icon\directory.obj src\icon\down.obj src\icon\error.obj src\icon\file.obj src\icon\forward.obj src\icon\info.obj src\icon\left.obj src\icon\news.obj src\icon\note.obj src\icon\right.obj src\icon\search.obj src\icon\up.obj src\icon\warning.obj src\lowlevel.obj src\string.obj src\text.obj src\unicode.obj src\widget\button.obj src\widget\checkbox.obj src\widget\combobox.obj src\widget\entry.obj src\widget\frame.obj src\widget\image.obj src\widget\label.obj src\widget\listbox.obj src\widget\menu.obj src\widget\numberentry.obj src\widget\opengl.obj src\widget\progressbar.obj src\widget\radiobox.obj src\widget\scrollbar.obj src\widget\separator.obj src\widget\submenu.obj src\widget\treeview.obj src\widget\viewport.obj src\widget\window.obj -lopengl32.lib -lgdi32.lib -luser32.lib
implib src\Mw.lib src\Mw.dll
.c.obj:
$(CC) $(CFLAGS) -o$@ $<

17
CHANGELOG.txt Normal file
View file

@ -0,0 +1,17 @@
========================= 1.4 =========================
- CMakeLists.txt downgraded to version 3.13 to allow compiling on Windows XP
- CMake build now generates a pkgconfig file.
- GDI backend now natively uses GDI for text rendering
- Widgets can now be disabled with MwNdisabled
- Added `MwTabFocus` for letting a tab widget steal focus.
- New table widget (`MwTableClass`).
- Added `MwWindowShouldClose` for letting custom loops know when a window should close.
- Remove VMS build files
- Entry widgets now have blinking cursor that appears only when you hover over the widget.
- Wayland backend:
- Can now create layer surfaces (Use `MwLLMakeToolWindow` on a parentless window)
- Now properly handles keys being held down
- has drastically improved CSD (functionality wise)
- Uses KMSDRM directly for the OpenGL widget instead of wl_egl for a smoother experience
- Various overall performance improvements putting it on the same level as the X11 backend finally
- Menu widget works better under compositors that use CSD.

View file

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.25)
cmake_minimum_required(VERSION 3.13)
project(
milsko
milsko
)
include(CheckIncludeFiles)
@ -9,205 +9,505 @@ include(GNUInstallDirs)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
option(TRY_OPENGL "Try to compile OpenGL widget or not" ON)
option(TRY_VULKAN "Try to compile Vulkan widget or not" ON)
option(CLASSIC_THEME "Use classic theme" OFF)
option(BUILD_EXAMPLES "Build examples" OFF)
option(USE_STB_IMAGE "Use stb_image" ON)
option(USE_STB_TRUETYPE "Use stb_truetype" OFF)
option(USE_FREETYPE2 "Use FreeType 2" ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
file(
GLOB
SOURCES
src/*.c src/cursor/*.c src/icon/*.c src/text.c src/widget/*.c src/math/*.c src/font/*.c src/dialog/*.c src/abstract/*.c external/*.c
)
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/opengl.c")
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/vulkan.c")
if(NOT USE_STB_IMAGE)
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/external/stb_image.c")
if(WIN32)
set(CMAKE_STATIC_LIBRARY_PREFIX "")
set(CMAKE_SHARED_LIBRARY_PREFIX "")
endif()
if(NOT USE_STB_TRUETYPE)
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/external/stb_truetype.c")
option(MW_CLASSIC_THEME "Use classic theme" OFF)
option(MW_BUILD_EXAMPLES "Build examples" OFF)
option(MW_USE_STB_IMAGE "Use stb_image" ON)
option(MW_USE_STB_TRUETYPE "Use stb_truetype" OFF)
if(${CMAKE_SYSTEM_NAME} MATCHES Retro)
option(MW_BUILD_SHARED "Build a shared library" OFF)
option(MW_BUILD_STATIC "Build a static library" ON)
option(MW_TRY_OPENGL "Try to compile OpenGL widget or not" OFF)
option(MW_TRY_VULKAN "Try to compile Vulkan widget or not" OFF)
else()
option(MW_BUILD_SHARED "Build a shared library" ON)
option(MW_BUILD_STATIC "Build a static library" OFF)
option(MW_TRY_OPENGL "Try to compile OpenGL widget or not" ON)
option(MW_TRY_VULKAN "Try to compile Vulkan widget or not" ON)
endif()
option(MW_INSTALL_HEADERS "Install headers" ON)
if( ${CMAKE_SYSTEM_NAME} STREQUAL Darwin
OR ${CMAKE_SYSTEM_NAME} MATCHES Retro
OR ${CMAKE_SYSTEM_NAME} MATCHES Windows)
option(MW_USE_FREETYPE2 "Use FreeType 2" OFF)
else()
option(MW_USE_FREETYPE2 "Use FreeType 2" ON)
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL Windows)
option(MW_USE_GDI_TEXT "Use GDI for text rendering" ON)
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL Linux OR ${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD)
option(MW_USE_WAYLAND "Enable Wayland backend" ON)
endif()
file(
GLOB
SOURCES
external/libz/src/*.c src/*.c src/cursor/*.c src/icon/*.c src/widget/*.c src/text/*.c src/text/font/*.c src/dialog/*.c src/abstract/*.c external/*.c
)
if(NOT MW_USE_STB_IMAGE)
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/external/stb_image.c")
endif()
if(NOT MW_USE_STB_TRUETYPE)
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/external/stb_truetype.c")
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
list(APPEND CMAKE_REQUIRED_INCLUDES "/usr/X11R7/include")
list(APPEND CMAKE_REQUIRED_INCLUDES "/usr/pkg/include")
list(APPEND CMAKE_REQUIRED_INCLUDES "/usr/X11R7/include")
list(APPEND CMAKE_REQUIRED_INCLUDES "/usr/pkg/include")
endif()
if(TRY_OPENGL)
check_include_files(GL/gl.h HAVE_GL_GL_H)
if(HAVE_GL_GL_H)
set(BUILD_OPENGL ON)
list(APPEND SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/opengl.c")
message(STATUS "OpenGL widget has been enabled")
else()
message(WARNING "OpenGL widget has been disabled")
endif()
if(MW_TRY_OPENGL)
find_package(OpenGL)
if(OpenGL_FOUND AND NOT APPLE)
set(MW_BUILD_OPENGL ON)
message(STATUS "OpenGL widget has been enabled")
else()
message(WARNING "OpenGL widget has been disabled")
endif()
endif()
if(TRY_OPENGL)
check_include_files(vulkan/vulkan.h HAVE_VULKAN_VULKAN_H)
if(HAVE_VULKAN_VULKAN_H)
set(BUILD_VULKAN ON)
list(APPEND SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/vulkan.c")
message(STATUS "Vulkan widget has been enabled")
else()
message(WARNING "Vulkan widget has been disabled")
endif()
if(MW_TRY_VULKAN)
find_package(Vulkan)
if(${Vulkan_FOUND})
set(MW_BUILD_VULKAN ON)
message(STATUS "Vulkan widget has been enabled")
else()
message(WARNING "Vulkan widget has been disabled")
endif()
endif()
add_library(
Mw
SHARED
${SOURCES}
if(MW_BUILD_STATIC)
message(STATUS "Building Milsko as a static library")
add_library(
Mw
${SOURCES}
)
elseif(MW_BUILD_SHARED)
message(STATUS "Building Milsko as a shared library")
add_library(
Mw
SHARED
${SOURCES}
)
if(USE_STB_IMAGE)
target_compile_definitions(
Mw
PRIVATE
USE_STB_IMAGE
)
else()
file(
GLOB
IMAGE_SOURCES
external/libz/src/*.c external/libjpeg/src/*.c external/libpng/src/*.c
)
target_sources(
Mw
PRIVATE
${IMAGE_SOURCES}
)
target_include_directories(
Mw
PRIVATE
external/libz/include external/libjpeg/include external/libpng/include
)
message(ERROR "Must either build a shared library or a static library")
endif()
if(USE_STB_TRUETYPE)
target_compile_definitions(
Mw
PRIVATE
USE_STB_TRUETYPE
)
if(MW_USE_STB_IMAGE)
target_compile_definitions(
Mw
PRIVATE
USE_STB_IMAGE
)
else()
file(
GLOB
IMAGE_SOURCES
external/libjpeg/src/*.c external/libpng/src/*.c
)
target_sources(
Mw
PRIVATE
${MW_IMAGE_SOURCES}
)
target_include_directories(
Mw
PRIVATE
external/libjpeg/include external/libpng/include
)
endif()
if(USE_FREETYPE2)
target_compile_definitions(
Mw
PRIVATE
USE_FREETYPE2
)
if(MW_USE_STB_TRUETYPE)
target_compile_definitions(
Mw
PRIVATE
USE_STB_TRUETYPE
)
endif()
find_package(PkgConfig)
pkg_check_modules(FT2 REQUIRED freetype2)
list(APPEND INCLUDE_DIRS ${FT2_INCLUDE_DIRS})
list(APPEND LIBRARY_DIRS ${FT2_LIBRARY_DIRS})
list(APPEND LIBRARIES ${FT2_LIBRARIES})
if(MW_USE_FREETYPE2)
find_package(Freetype)
if(Freetype_FOUND)
message(STATUS "FreeType2 found")
target_compile_definitions(
Mw
PRIVATE
USE_FREETYPE2
)
list(APPEND INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS})
list(APPEND LIBRARY_DIRS ${FREETYPE_LIBRARY_DIRS})
else()
message(WARNING "FreeType2 not found")
endif()
endif()
if(MW_USE_GDI_TEXT)
target_compile_definitions(
Mw
PRIVATE
USE_GDI_TEXT
)
endif()
if(MW_USE_WAYLAND)
function(scan_wayland_protocol_core)
execute_process(
COMMAND wayland-scanner private-code /usr/share/wayland/wayland.xml ${CMAKE_CURRENT_SOURCE_DIR}/src/backend/wayland/wayland-core-protocol.c
OUTPUT_VARIABLE WAYLAND_SCANNER_OUTPUT
ERROR_VARIABLE WAYLAND_SCANNER_ERROR
ECHO_OUTPUT_VARIABLE
ECHO_ERROR_VARIABLE
COMMAND_ECHO STDOUT
)
target_sources(
Mw
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/backend/wayland/wayland-core-protocol.c
)
execute_process(
COMMAND wayland-scanner client-header /usr/share/wayland/wayland.xml ${CMAKE_CURRENT_SOURCE_DIR}/include/Mw/LowLevel/Wayland/wayland-core-protocol.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE WAYLAND_SCANNER_OUTPUT
ERROR_VARIABLE WAYLAND_SCANNER_ERROR
ECHO_OUTPUT_VARIABLE
ECHO_ERROR_VARIABLE
COMMAND_ECHO STDOUT
)
endfunction()
function(scan_wayland_protocol tier proto ver)
SET(proto_c ${CMAKE_CURRENT_SOURCE_DIR}/src/backend/wayland/wayland-${proto}-protocol.c)
execute_process(
COMMAND wayland-scanner private-code /usr/share/wayland-protocols/${tier}/${proto}/${proto}${ver}.xml ${proto_c}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE WAYLAND_SCANNER_OUTPUT
ERROR_VARIABLE WAYLAND_SCANNER_ERROR
ECHO_OUTPUT_VARIABLE
ECHO_ERROR_VARIABLE
COMMAND_ECHO STDOUT
)
target_sources(
Mw
PRIVATE
${proto_c}
)
execute_process(
COMMAND wayland-scanner client-header /usr/share/wayland-protocols/${tier}/${proto}/${proto}${ver}.xml ${CMAKE_CURRENT_SOURCE_DIR}/include/Mw/LowLevel/Wayland/${proto}-client-protocol.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE WAYLAND_SCANNER_OUTPUT
ERROR_VARIABLE WAYLAND_SCANNER_ERROR
ECHO_OUTPUT_VARIABLE
ECHO_ERROR_VARIABLE
COMMAND_ECHO STDOUT
)
endfunction()
function(scan_wayland_protocol_from_file proto file)
SET(proto_c ${CMAKE_CURRENT_SOURCE_DIR}/src/backend/wayland/wayland-${proto}-protocol.c)
execute_process(
COMMAND wayland-scanner private-code ${CMAKE_CURRENT_SOURCE_DIR}/resource/wayland/${file} ${proto_c}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE WAYLAND_SCANNER_OUTPUT
ERROR_VARIABLE WAYLAND_SCANNER_ERROR
ECHO_OUTPUT_VARIABLE
ECHO_ERROR_VARIABLE
COMMAND_ECHO STDOUT
)
target_sources(
Mw
PRIVATE
${proto_c}
)
execute_process(
COMMAND wayland-scanner client-header ${CMAKE_CURRENT_SOURCE_DIR}/resource/wayland/${file} ${CMAKE_CURRENT_SOURCE_DIR}/include/Mw/LowLevel/Wayland/${proto}-client-protocol.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE WAYLAND_SCANNER_OUTPUT
ERROR_VARIABLE WAYLAND_SCANNER_ERROR
ECHO_OUTPUT_VARIABLE
ECHO_ERROR_VARIABLE
COMMAND_ECHO STDOUT
)
endfunction()
check_include_files(wayland-client.h HAVE_WL_H)
check_include_files(xkbcommon/xkbcommon.h HAVE_XKBCOMMON_H)
check_include_files(cairo/cairo.h HAVE_CAIRO_H)
if(HAVE_WL_H)
if(HAVE_XKBCOMMON_H)
if(HAVE_CAIRO_H)
scan_wayland_protocol_core()
scan_wayland_protocol("stable" "xdg-shell" "")
scan_wayland_protocol("stable" "viewporter" "")
scan_wayland_protocol("stable" "tablet" "-v2")
scan_wayland_protocol("staging" "xdg-toplevel-icon" "-v1")
scan_wayland_protocol("staging" "cursor-shape" "-v1")
scan_wayland_protocol("unstable" "xdg-decoration" "-unstable-v1")
scan_wayland_protocol("unstable" "primary-selection" "-unstable-v1")
scan_wayland_protocol("unstable" "pointer-constraints" "-unstable-v1")
scan_wayland_protocol("unstable" "relative-pointer" "-unstable-v1")
scan_wayland_protocol_from_file("wlr-layer-shell" "wlr-layer-shell-unstable-v1.xml")
target_sources(
Mw
PRIVATE
src/backend/cairo.c
src/backend/wayland/wayland.c
src/backend/wayland/buffer.c
src/backend/wayland/interfaces.c
src/backend/wayland/region.c
)
target_compile_definitions(
Mw
PRIVATE
USE_WAYLAND
)
message(STATUS "Wayland backend has been enabled")
else()
message(WARNING "Wayland backend has been disabled")
endif()
else()
message(WARNING "Wayland backend has been disabled")
endif()
else()
message(WARNING "Wayland backend has been disabled")
endif()
endif()
if(APPLE AND MW_BUILD_OPENGL)
target_compile_definitions(
Mw
PRIVATE
GL_SILENCE_DEPRECATION
)
endif()
target_include_directories(
Mw
PUBLIC
include
Mw
PRIVATE
external/libz/include
)
if(CLASSIC_THEME)
target_compile_definitions(
Mw
PRIVATE
USE_CLASSIC_THEME
)
target_include_directories(
Mw
PUBLIC
include
)
if(MW_CLASSIC_THEME)
target_compile_definitions(
Mw
PRIVATE
USE_CLASSIC_THEME
)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_sources(
Mw
PRIVATE
src/backend/gdi.c
)
target_compile_definitions(
Mw
PRIVATE
USE_GDI
)
list(APPEND LIBRARIES gdi32)
else()
find_package(PkgConfig)
pkg_check_modules(X11 REQUIRED x11)
pkg_check_modules(XRENDER REQUIRED xrender)
message("Building Milsko for ${CMAKE_SYSTEM_NAME}")
if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "MSYS")
target_sources(
Mw
PRIVATE
src/backend/gdi.c
)
target_compile_definitions(
Mw
PRIVATE
USE_GDI
)
list(APPEND LIBRARIES gdi32 ole32 uuid)
if(NOT MSVC)
target_link_options(
Mw
PRIVATE
-static-libgcc
)
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# target_sources(
# Mw
# PRIVATE
# src/backend/cocoa.m
# )
target_sources(
Mw
PRIVATE
src/backend/nococoa.m
)
# target_compile_definitions(
# Mw
# PRIVATE
# USE_COCOA
# )
list(APPEND LIBRARIES objc)
target_link_options(
Mw
PRIVATE
-framework Cocoa
)
elseif(CMAKE_SYSTEM_NAME MATCHES "Retro")
target_sources(
Mw
PRIVATE
src/backend/x11.c
)
target_compile_definitions(
Mw
PRIVATE
USE_X11
)
list(APPEND INCLUDE_DIRS ${X11_INCLUDE_DIRS} ${XRENDER_INCLUDE_DIRS})
list(APPEND LIBRARY_DIRS ${X11_LIBRARY_DIRS} ${XRENDER_LIBRARY_DIRS})
list(APPEND LIBRARIES ${X11_LIBRARIES} ${XRENDER_LIBRARIES} m)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
list(APPEND LIBRARIES dl)
endif()
target_sources(
Mw
PRIVATE
src/backend/classicmacos.c
)
if(PLATFORM MATCHES retroppc)
set_target_properties(Mw PROPERTIES COMPILE_FLAGS "-ffunction-sections -mcpu=601 -Os -Wall -Wextra -Wno-unused-parameter")
set_target_properties(Mw PROPERTIES LINK_FLAGS "-Wl,-gc-sections")
endif()
list(APPEND LIBRARIES InterfaceLib WindowsLib ThreadsLib)
target_compile_definitions(
Mw
PRIVATE
CLASSIC_MAC_OS
)
else()
find_package(PkgConfig)
find_package(X11)
pkg_check_modules(DBUS dbus-1)
target_sources(
Mw
PRIVATE
src/backend/x11.c
)
if(${X11_FOUND})
list(APPEND INCLUDE_DIRS ${X11_INCLUDE_DIRS})
list(APPEND LIBRARY_DIRS ${X11_LIBRARY_DIRS})
target_compile_definitions(
Mw
PRIVATE
USE_X11
)
endif()
if(${X11_Xrender_FOUND})
list(APPEND INCLUDE_DIRS ${XRENDER_INCLUDE_DIRS})
list(APPEND LIBRARY_DIRS ${XRENDER_LIBRARY_DIRS})
target_compile_definitions(
Mw
PRIVATE
USE_XRENDER
)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
list(APPEND LIBRARIES dl)
endif()
find_package(DBus1)
if(${DBus1_FOUND})
list(APPEND INCLUDE_DIRS ${DBUS_INCLUDE_DIRS})
list(APPEND LIBRARY_DIRS ${DBUS_LIBRARY_DIRS})
target_compile_definitions(
Mw
PRIVATE
USE_DBUS
)
endif()
endif()
if(UNIX)
list(APPEND LIBRARIES m)
endif()
target_include_directories(
Mw
PRIVATE
${INCLUDE_DIRS}
Mw
PRIVATE
${INCLUDE_DIRS}
)
target_link_directories(
Mw
PRIVATE
${LIBRARY_DIRS}
Mw
PRIVATE
${LIBRARY_DIRS}
)
target_link_libraries(
Mw
PRIVATE
${LIBRARIES}
Mw
PRIVATE
${LIBRARIES}
)
if(BUILD_VULKAN)
check_include_files(vulkan/vk_enum_string_helper.h HAS_VK_ENUM_STRING_HELPER)
if(HAS_VK_ENUM_STRING_HELPER)
target_compile_definitions(
Mw
PRIVATE
HAS_VK_ENUM_STRING_HELPER
)
endif()
if(MW_BUILD_OPENGL)
target_compile_definitions(
Mw
PRIVATE
MW_OPENGL
)
endif()
if(MW_BUILD_VULKAN)
check_include_files(vulkan/vk_enum_string_helper.h HAS_VK_ENUM_STRING_HELPER)
if(HAS_VK_ENUM_STRING_HELPER)
target_compile_definitions(
Mw
PRIVATE
HAS_VK_ENUM_STRING_HELPER
)
endif()
check_include_files(vulkan/VULKAN.h HAS_VK_HEADER)
if(HAS_VK_HEADER)
target_compile_definitions(
Mw
PRIVATE
MW_VULKAN
)
endif()
endif()
target_compile_definitions(
Mw
PRIVATE
_MILSKO
Mw
PRIVATE
_MILSKO _MILSKO_BUILD
)
include(GNUInstallDirs)
install(
TARGETS Mw
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(
DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h"
TARGETS Mw
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
if(BUILD_EXAMPLES)
add_subdirectory(examples)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/resource/${PROJECT_NAME}.pc.in
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc
@ONLY
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc
DESTINATION $ENV{MINGW_PREFIX}/${CMAKE_INSTALL_DATADIR}/pkgconfig
)
if(MW_INSTALL_HEADERS)
install(
DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h"
)
endif()
if(MW_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()

105
Jenkinsfile vendored Normal file
View file

@ -0,0 +1,105 @@
pipeline {
agent {
label "built-in"
}
stages {
stage("Build document") {
when {
branch "master"
}
agent {
label "built-in"
}
steps {
sh("rm -rf include/Mw/LowLevel/Wayland")
sh("doxygen")
sh("rm -rf /var/www/milsko-doxygen")
sh("mv doxygen/html /var/www/milsko-doxygen")
}
post {
always {
notifyDiscord()
}
}
}
stage("Build") {
parallel {
stage("Build for Linux 64-bit") {
agent {
label "built-in"
}
steps {
sh("git clean -dfx")
sh("./configure --enable-opengl --enable-vulkan --without-vulkan-string-helper")
sh("make -j4")
sh("mv src/libMw.so libMw64.so")
archiveArtifacts("libMw64.so")
}
}
stage("Build for Windows 32-bit") {
agent {
label "built-in"
}
steps {
sh("git clean -dfx")
sh("./configure --enable-opengl --enable-stb-truetype --disable-freetype2 --cross --target=Windows --host=i686-w64-mingw32")
sh("make -j4")
sh("mv src/Mw.dll Mw32.dll")
sh("mv src/libMw.dll.a libMw32.dll.a")
archiveArtifacts("Mw32.dll,libMw32.dll.a")
}
}
stage("Build for Windows 64-bit") {
agent {
label "built-in"
}
steps {
sh("git clean -dfx")
sh("./configure --enable-opengl --enable-stb-truetype --disable-freetype2 --cross --target=Windows --host=x86_64-w64-mingw32")
sh("make -j4")
sh("mv src/Mw.dll Mw64.dll")
sh("mv src/libMw.dll.a libMw64.dll.a")
archiveArtifacts("Mw64.dll,libMw64.dll.a")
}
}
stage("Build for Windows 32-bit (MSVC)") {
agent {
label "2012r2"
}
steps {
bat("git clean -dfx")
bat("nmake -f NTMakefile")
bat("move /y src\\Mw.dll MwMSVC32.dll")
bat("move /y src\\Mw.lib MwMSVC32.lib")
archiveArtifacts("MwMSVC32.dll,MwMSVC32.lib")
}
}
stage("Build for Windows 32-bit (Watcom)") {
agent {
label "built-in"
}
environment {
WATCOM = "/usr/watcom"
INCLUDE = "/usr/watcom/h:/usr/watcom/h/nt"
PATH = "/usr/watcom/binl64:${env.PATH}"
}
steps {
sh("git clean -dfx")
sh("wmake -f WatMakefile")
sh("mv src/Mw.dll MwWat32.dll")
sh("mv src/Mw.lib MwWat32.lib")
archiveArtifacts("MwWat32.dll,MwWat32.lib")
sh("./tools/watcom-pack.sh")
sh("mv milsko-examples.zip milsko-examples-win32.zip")
archiveArtifacts("milsko-examples-win32.zip")
}
}
}
post {
always {
notifyDiscord()
}
}
}
}
}

View file

@ -1,24 +0,0 @@
# vim: syntax=tcl
proc run {project_name} {
if { "$project_name" == "MilskoDoxygen" } {
RunCommand "doxygen"
RunCommand "rm -rf /var/www/milsko-doxygen"
RunCommand "mv doxygen/html /var/www/milsko-doxygen"
} else {
foreach target {"Linux" "Win32" "Win64"} {
if { [file exists "Makefile"] == 1 } {
RunCommand "make distclean"
}
if { "$target" == "Linux" } {
RunCommand "./Makefile.pl --enable-opengl --enable-vulkan --without-vulkan-string-helper"
} elseif { "$target" == "Win32" } {
RunCommand "./Makefile.pl --enable-opengl --enable-stb-truetype --disable-freetype2 --cross --target=Windows --host=i686-w64-mingw32"
} elseif { "$target" == "Win64" } {
RunCommand "./Makefile.pl --enable-opengl --enable-stb-truetype --disable-freetype2 --cross --target=Windows --host=x86_64-w64-mingw32"
}
RunCommand "make clean"
RunCommand "make -j4"
}
}
}

View file

@ -1,4 +1,4 @@
Copyright (c) 2025, Pyrite development team
Copyright (c) 2025-2026, Pyrite development team
All rights reserved.
Redistribution and use in source and binary forms, with or without

271
NTMakefile generated
View file

@ -1,14 +1,34 @@
CC = cl /TC /c /nologo
LD = link /nologo
CFLAGS = /Iinclude /D_MILSKO /DUSE_GDI /DUSE_STB_TRUETYPE /DUSE_STB_IMAGE /DSTBI_NO_SIMD
LDFLAGS = /DLL
MW_CFLAGS = /Iinclude /Iexternal\libz\include /D_MILSKO /D_MILSKO_BUILD /DUSE_GDI /DUSE_STB_IMAGE /DSTBI_NO_SIMD /DUSE_GDI_TEXT /DMW_OPENGL
MW_LDFLAGS = /DLL
EXE_CFLAGS = /Iinclude
EXE_LDFLAGS =
.SUFFIXES: .obj .c
all: src\Mw.dll
all: src\Mw.dll examples\basic\box.exe examples\basic\calculator.exe examples\basic\checkbox.exe examples\basic\clipboard.exe examples\basic\colorpicker.exe examples\basic\combobox.exe examples\basic\example.exe examples\basic\filechooser.exe examples\basic\image.exe examples\basic\listbox.exe examples\basic\messagebox.exe examples\basic\periodic.exe examples\basic\progressbar.exe examples\basic\radiobox.exe examples\basic\rotate.exe examples\basic\scrollbar.exe examples\basic\sevensegment.exe examples\basic\subwindow.exe examples\basic\tab.exe examples\basic\treeview.exe examples\basic\viewport.exe examples\gldemos\boing.exe examples\gldemos\clock.exe examples\gldemos\cube.exe examples\gldemos\gears.exe examples\gldemos\triangle.exe examples\gldemos\tripaint.exe
lib: src\Mw.dll
examples: examples\basic\box.exe examples\basic\calculator.exe examples\basic\checkbox.exe examples\basic\clipboard.exe examples\basic\colorpicker.exe examples\basic\combobox.exe examples\basic\example.exe examples\basic\filechooser.exe examples\basic\image.exe examples\basic\listbox.exe examples\basic\messagebox.exe examples\basic\periodic.exe examples\basic\progressbar.exe examples\basic\radiobox.exe examples\basic\rotate.exe examples\basic\scrollbar.exe examples\basic\sevensegment.exe examples\basic\subwindow.exe examples\basic\tab.exe examples\basic\treeview.exe examples\basic\viewport.exe examples\gldemos\boing.exe examples\gldemos\clock.exe examples\gldemos\cube.exe examples\gldemos\gears.exe examples\gldemos\triangle.exe examples\gldemos\tripaint.exe
clean:
del /f /q external\libz\src\adler32.obj
del /f /q external\libz\src\compress.obj
del /f /q external\libz\src\crc32.obj
del /f /q external\libz\src\deflate.obj
del /f /q external\libz\src\gzclose.obj
del /f /q external\libz\src\gzlib.obj
del /f /q external\libz\src\gzread.obj
del /f /q external\libz\src\gzwrite.obj
del /f /q external\libz\src\infback.obj
del /f /q external\libz\src\inffast.obj
del /f /q external\libz\src\inflate.obj
del /f /q external\libz\src\inftrees.obj
del /f /q external\libz\src\trees.obj
del /f /q external\libz\src\uncompr.obj
del /f /q external\libz\src\zutil.obj
del /f /q external\stb_ds.obj
del /f /q external\stb_image.obj
del /f /q external\stb_truetype.obj
del /f /q src\abstract\charset.obj
del /f /q src\abstract\directory.obj
del /f /q src\abstract\dynamic.obj
del /f /q src\abstract\time.obj
@ -26,11 +46,6 @@ clean:
del /f /q src\dialog\filechooser.obj
del /f /q src\dialog\messagebox.obj
del /f /q src\draw.obj
del /f /q src\error.obj
del /f /q src\font\boldfont.obj
del /f /q src\font\boldttf.obj
del /f /q src\font\font.obj
del /f /q src\font\ttf.obj
del /f /q src\icon\back.obj
del /f /q src\icon\clock.obj
del /f /q src\icon\computer.obj
@ -49,9 +64,21 @@ clean:
del /f /q src\icon\warning.obj
del /f /q src\lowlevel.obj
del /f /q src\string.obj
del /f /q src\text.obj
del /f /q src\text\font\boldfont.obj
del /f /q src\text\font\boldmonottf.obj
del /f /q src\text\font\boldttf.obj
del /f /q src\text\font\font.obj
del /f /q src\text\font\monottf.obj
del /f /q src\text\font\ttf.obj
del /f /q src\text\ft2.obj
del /f /q src\text\gdi.obj
del /f /q src\text\stbtt.obj
del /f /q src\text\text.obj
del /f /q src\truetype.obj
del /f /q src\unicode.obj
del /f /q src\widget\box.obj
del /f /q src\widget\button.obj
del /f /q src\widget\calendar.obj
del /f /q src\widget\checkbox.obj
del /f /q src\widget\combobox.obj
del /f /q src\widget\entry.obj
@ -67,15 +94,235 @@ clean:
del /f /q src\widget\scrollbar.obj
del /f /q src\widget\separator.obj
del /f /q src\widget\submenu.obj
del /f /q src\widget\subwindow.obj
del /f /q src\widget\tab.obj
del /f /q src\widget\table.obj
del /f /q src\widget\treeview.obj
del /f /q src\widget\viewport.obj
del /f /q src\widget\window.obj
del /f /q src\Mw.dll
del /f /q src\Mw.lib
del /f /q examples\basic\box.obj
del /f /q examples\basic\calculator.obj
del /f /q examples\basic\checkbox.obj
del /f /q examples\basic\clipboard.obj
del /f /q examples\basic\colorpicker.obj
del /f /q examples\basic\combobox.obj
del /f /q examples\basic\example.obj
del /f /q examples\basic\filechooser.obj
del /f /q examples\basic\image.obj
del /f /q examples\basic\listbox.obj
del /f /q examples\basic\messagebox.obj
del /f /q examples\basic\periodic.obj
del /f /q examples\basic\progressbar.obj
del /f /q examples\basic\radiobox.obj
del /f /q examples\basic\rotate.obj
del /f /q examples\basic\scrollbar.obj
del /f /q examples\basic\sevensegment.obj
del /f /q examples\basic\subwindow.obj
del /f /q examples\basic\tab.obj
del /f /q examples\basic\treeview.obj
del /f /q examples\basic\viewport.obj
del /f /q examples\gldemos\boing.obj
del /f /q examples\gldemos\clock.obj
del /f /q examples\gldemos\cube.obj
del /f /q examples\gldemos\gears.obj
del /f /q examples\gldemos\triangle.obj
del /f /q examples\gldemos\tripaint.obj
del /f /q examples\basic\box.exe
del /f /q examples\basic\calculator.exe
del /f /q examples\basic\checkbox.exe
del /f /q examples\basic\clipboard.exe
del /f /q examples\basic\colorpicker.exe
del /f /q examples\basic\combobox.exe
del /f /q examples\basic\example.exe
del /f /q examples\basic\filechooser.exe
del /f /q examples\basic\image.exe
del /f /q examples\basic\listbox.exe
del /f /q examples\basic\messagebox.exe
del /f /q examples\basic\periodic.exe
del /f /q examples\basic\progressbar.exe
del /f /q examples\basic\radiobox.exe
del /f /q examples\basic\rotate.exe
del /f /q examples\basic\scrollbar.exe
del /f /q examples\basic\sevensegment.exe
del /f /q examples\basic\subwindow.exe
del /f /q examples\basic\tab.exe
del /f /q examples\basic\treeview.exe
del /f /q examples\basic\viewport.exe
del /f /q examples\gldemos\boing.exe
del /f /q examples\gldemos\clock.exe
del /f /q examples\gldemos\cube.exe
del /f /q examples\gldemos\gears.exe
del /f /q examples\gldemos\triangle.exe
del /f /q examples\gldemos\tripaint.exe
src\Mw.dll: external\stb_ds.obj external\stb_image.obj external\stb_truetype.obj src\abstract\directory.obj src\abstract\dynamic.obj src\abstract\time.obj src\backend\gdi.obj src\color.obj src\core.obj src\cursor\arrow.obj src\cursor\cross.obj src\cursor\default.obj src\cursor\hidden.obj src\cursor\text.obj src\default.obj src\dialog\colorpicker.obj src\dialog\directorychooser.obj src\dialog\filechooser.obj src\dialog\messagebox.obj src\draw.obj src\error.obj src\font\boldfont.obj src\font\boldttf.obj src\font\font.obj src\font\ttf.obj src\icon\back.obj src\icon\clock.obj src\icon\computer.obj src\icon\directory.obj src\icon\down.obj src\icon\error.obj src\icon\file.obj src\icon\forward.obj src\icon\info.obj src\icon\left.obj src\icon\news.obj src\icon\note.obj src\icon\right.obj src\icon\search.obj src\icon\up.obj src\icon\warning.obj src\lowlevel.obj src\string.obj src\text.obj src\unicode.obj src\widget\button.obj src\widget\checkbox.obj src\widget\combobox.obj src\widget\entry.obj src\widget\frame.obj src\widget\image.obj src\widget\label.obj src\widget\listbox.obj src\widget\menu.obj src\widget\numberentry.obj src\widget\opengl.obj src\widget\progressbar.obj src\widget\radiobox.obj src\widget\scrollbar.obj src\widget\separator.obj src\widget\submenu.obj src\widget\treeview.obj src\widget\viewport.obj src\widget\window.obj
$(LD) $(LDFLAGS) /OUT:$@ external\stb_ds.obj external\stb_image.obj external\stb_truetype.obj src\abstract\directory.obj src\abstract\dynamic.obj src\abstract\time.obj src\backend\gdi.obj src\color.obj src\core.obj src\cursor\arrow.obj src\cursor\cross.obj src\cursor\default.obj src\cursor\hidden.obj src\cursor\text.obj src\default.obj src\dialog\colorpicker.obj src\dialog\directorychooser.obj src\dialog\filechooser.obj src\dialog\messagebox.obj src\draw.obj src\error.obj src\font\boldfont.obj src\font\boldttf.obj src\font\font.obj src\font\ttf.obj src\icon\back.obj src\icon\clock.obj src\icon\computer.obj src\icon\directory.obj src\icon\down.obj src\icon\error.obj src\icon\file.obj src\icon\forward.obj src\icon\info.obj src\icon\left.obj src\icon\news.obj src\icon\note.obj src\icon\right.obj src\icon\search.obj src\icon\up.obj src\icon\warning.obj src\lowlevel.obj src\string.obj src\text.obj src\unicode.obj src\widget\button.obj src\widget\checkbox.obj src\widget\combobox.obj src\widget\entry.obj src\widget\frame.obj src\widget\image.obj src\widget\label.obj src\widget\listbox.obj src\widget\menu.obj src\widget\numberentry.obj src\widget\opengl.obj src\widget\progressbar.obj src\widget\radiobox.obj src\widget\scrollbar.obj src\widget\separator.obj src\widget\submenu.obj src\widget\treeview.obj src\widget\viewport.obj src\widget\window.obj opengl32.lib gdi32.lib user32.lib
examples\basic\box.exe: examples\basic\box.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\basic\box.obj src\Mw.lib
examples\basic\box.obj: examples/basic/box.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/basic/box.c
examples\basic\calculator.exe: examples\basic\calculator.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\basic\calculator.obj src\Mw.lib
examples\basic\calculator.obj: examples/basic/calculator.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/basic/calculator.c
examples\basic\checkbox.exe: examples\basic\checkbox.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\basic\checkbox.obj src\Mw.lib
examples\basic\checkbox.obj: examples/basic/checkbox.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/basic/checkbox.c
examples\basic\clipboard.exe: examples\basic\clipboard.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\basic\clipboard.obj src\Mw.lib
examples\basic\clipboard.obj: examples/basic/clipboard.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/basic/clipboard.c
examples\basic\colorpicker.exe: examples\basic\colorpicker.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\basic\colorpicker.obj src\Mw.lib
examples\basic\colorpicker.obj: examples/basic/colorpicker.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/basic/colorpicker.c
examples\basic\combobox.exe: examples\basic\combobox.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\basic\combobox.obj src\Mw.lib
examples\basic\combobox.obj: examples/basic/combobox.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/basic/combobox.c
examples\basic\example.exe: examples\basic\example.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\basic\example.obj src\Mw.lib
examples\basic\example.obj: examples/basic/example.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/basic/example.c
examples\basic\filechooser.exe: examples\basic\filechooser.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\basic\filechooser.obj src\Mw.lib
examples\basic\filechooser.obj: examples/basic/filechooser.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/basic/filechooser.c
examples\basic\image.exe: examples\basic\image.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\basic\image.obj src\Mw.lib
examples\basic\image.obj: examples/basic/image.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/basic/image.c
examples\basic\listbox.exe: examples\basic\listbox.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\basic\listbox.obj src\Mw.lib
examples\basic\listbox.obj: examples/basic/listbox.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/basic/listbox.c
examples\basic\messagebox.exe: examples\basic\messagebox.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\basic\messagebox.obj src\Mw.lib
examples\basic\messagebox.obj: examples/basic/messagebox.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/basic/messagebox.c
examples\basic\periodic.exe: examples\basic\periodic.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\basic\periodic.obj src\Mw.lib
examples\basic\periodic.obj: examples/basic/periodic.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/basic/periodic.c
examples\basic\progressbar.exe: examples\basic\progressbar.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\basic\progressbar.obj src\Mw.lib
examples\basic\progressbar.obj: examples/basic/progressbar.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/basic/progressbar.c
examples\basic\radiobox.exe: examples\basic\radiobox.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\basic\radiobox.obj src\Mw.lib
examples\basic\radiobox.obj: examples/basic/radiobox.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/basic/radiobox.c
examples\basic\rotate.exe: examples\basic\rotate.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\basic\rotate.obj src\Mw.lib
examples\basic\rotate.obj: examples/basic/rotate.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/basic/rotate.c
examples\basic\scrollbar.exe: examples\basic\scrollbar.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\basic\scrollbar.obj src\Mw.lib
examples\basic\scrollbar.obj: examples/basic/scrollbar.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/basic/scrollbar.c
examples\basic\sevensegment.exe: examples\basic\sevensegment.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\basic\sevensegment.obj src\Mw.lib
examples\basic\sevensegment.obj: examples/basic/sevensegment.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/basic/sevensegment.c
examples\basic\subwindow.exe: examples\basic\subwindow.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\basic\subwindow.obj src\Mw.lib
examples\basic\subwindow.obj: examples/basic/subwindow.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/basic/subwindow.c
examples\basic\tab.exe: examples\basic\tab.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\basic\tab.obj src\Mw.lib
examples\basic\tab.obj: examples/basic/tab.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/basic/tab.c
examples\basic\treeview.exe: examples\basic\treeview.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\basic\treeview.obj src\Mw.lib
examples\basic\treeview.obj: examples/basic/treeview.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/basic/treeview.c
examples\basic\viewport.exe: examples\basic\viewport.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\basic\viewport.obj src\Mw.lib
examples\basic\viewport.obj: examples/basic/viewport.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/basic/viewport.c
examples\gldemos\boing.exe: examples\gldemos\boing.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\gldemos\boing.obj src\Mw.lib opengl32.lib glu32.lib
examples\gldemos\boing.obj: examples/gldemos/boing.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/gldemos/boing.c
examples\gldemos\clock.exe: examples\gldemos\clock.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\gldemos\clock.obj src\Mw.lib opengl32.lib glu32.lib
examples\gldemos\clock.obj: examples/gldemos/clock.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/gldemos/clock.c
examples\gldemos\cube.exe: examples\gldemos\cube.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\gldemos\cube.obj src\Mw.lib opengl32.lib glu32.lib
examples\gldemos\cube.obj: examples/gldemos/cube.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/gldemos/cube.c
examples\gldemos\gears.exe: examples\gldemos\gears.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\gldemos\gears.obj src\Mw.lib opengl32.lib glu32.lib
examples\gldemos\gears.obj: examples/gldemos/gears.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/gldemos/gears.c
examples\gldemos\triangle.exe: examples\gldemos\triangle.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\gldemos\triangle.obj src\Mw.lib opengl32.lib glu32.lib
examples\gldemos\triangle.obj: examples/gldemos/triangle.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/gldemos/triangle.c
examples\gldemos\tripaint.exe: examples\gldemos\tripaint.obj src\Mw.dll
$(LD) $(EXE_LDFLAGS) /OUT:$@ examples\gldemos\tripaint.obj src\Mw.lib opengl32.lib glu32.lib
examples\gldemos\tripaint.obj: examples/gldemos/tripaint.c
$(CC) $(EXE_CFLAGS) /Fo$@ examples/gldemos/tripaint.c
src\Mw.dll: external\libz\src\adler32.obj external\libz\src\compress.obj external\libz\src\crc32.obj external\libz\src\deflate.obj external\libz\src\gzclose.obj external\libz\src\gzlib.obj external\libz\src\gzread.obj external\libz\src\gzwrite.obj external\libz\src\infback.obj external\libz\src\inffast.obj external\libz\src\inflate.obj external\libz\src\inftrees.obj external\libz\src\trees.obj external\libz\src\uncompr.obj external\libz\src\zutil.obj external\stb_ds.obj external\stb_image.obj external\stb_truetype.obj src\abstract\charset.obj src\abstract\directory.obj src\abstract\dynamic.obj src\abstract\time.obj src\backend\gdi.obj src\color.obj src\core.obj src\cursor\arrow.obj src\cursor\cross.obj src\cursor\default.obj src\cursor\hidden.obj src\cursor\text.obj src\default.obj src\dialog\colorpicker.obj src\dialog\directorychooser.obj src\dialog\filechooser.obj src\dialog\messagebox.obj src\draw.obj src\icon\back.obj src\icon\clock.obj src\icon\computer.obj src\icon\directory.obj src\icon\down.obj src\icon\error.obj src\icon\file.obj src\icon\forward.obj src\icon\info.obj src\icon\left.obj src\icon\news.obj src\icon\note.obj src\icon\right.obj src\icon\search.obj src\icon\up.obj src\icon\warning.obj src\lowlevel.obj src\string.obj src\text\font\boldfont.obj src\text\font\boldmonottf.obj src\text\font\boldttf.obj src\text\font\font.obj src\text\font\monottf.obj src\text\font\ttf.obj src\text\ft2.obj src\text\gdi.obj src\text\stbtt.obj src\text\text.obj src\truetype.obj src\unicode.obj src\widget\box.obj src\widget\button.obj src\widget\calendar.obj src\widget\checkbox.obj src\widget\combobox.obj src\widget\entry.obj src\widget\frame.obj src\widget\image.obj src\widget\label.obj src\widget\listbox.obj src\widget\menu.obj src\widget\numberentry.obj src\widget\opengl.obj src\widget\progressbar.obj src\widget\radiobox.obj src\widget\scrollbar.obj src\widget\separator.obj src\widget\submenu.obj src\widget\subwindow.obj src\widget\tab.obj src\widget\table.obj src\widget\treeview.obj src\widget\viewport.obj src\widget\window.obj
$(LD) $(MW_LDFLAGS) /OUT:$@ external\libz\src\adler32.obj external\libz\src\compress.obj external\libz\src\crc32.obj external\libz\src\deflate.obj external\libz\src\gzclose.obj external\libz\src\gzlib.obj external\libz\src\gzread.obj external\libz\src\gzwrite.obj external\libz\src\infback.obj external\libz\src\inffast.obj external\libz\src\inflate.obj external\libz\src\inftrees.obj external\libz\src\trees.obj external\libz\src\uncompr.obj external\libz\src\zutil.obj external\stb_ds.obj external\stb_image.obj external\stb_truetype.obj src\abstract\charset.obj src\abstract\directory.obj src\abstract\dynamic.obj src\abstract\time.obj src\backend\gdi.obj src\color.obj src\core.obj src\cursor\arrow.obj src\cursor\cross.obj src\cursor\default.obj src\cursor\hidden.obj src\cursor\text.obj src\default.obj src\dialog\colorpicker.obj src\dialog\directorychooser.obj src\dialog\filechooser.obj src\dialog\messagebox.obj src\draw.obj src\icon\back.obj src\icon\clock.obj src\icon\computer.obj src\icon\directory.obj src\icon\down.obj src\icon\error.obj src\icon\file.obj src\icon\forward.obj src\icon\info.obj src\icon\left.obj src\icon\news.obj src\icon\note.obj src\icon\right.obj src\icon\search.obj src\icon\up.obj src\icon\warning.obj src\lowlevel.obj src\string.obj src\text\font\boldfont.obj src\text\font\boldmonottf.obj src\text\font\boldttf.obj src\text\font\font.obj src\text\font\monottf.obj src\text\font\ttf.obj src\text\ft2.obj src\text\gdi.obj src\text\stbtt.obj src\text\text.obj src\truetype.obj src\unicode.obj src\widget\box.obj src\widget\button.obj src\widget\calendar.obj src\widget\checkbox.obj src\widget\combobox.obj src\widget\entry.obj src\widget\frame.obj src\widget\image.obj src\widget\label.obj src\widget\listbox.obj src\widget\menu.obj src\widget\numberentry.obj src\widget\opengl.obj src\widget\progressbar.obj src\widget\radiobox.obj src\widget\scrollbar.obj src\widget\separator.obj src\widget\submenu.obj src\widget\subwindow.obj src\widget\tab.obj src\widget\table.obj src\widget\treeview.obj src\widget\viewport.obj src\widget\window.obj opengl32.lib gdi32.lib ole32.lib uuid.lib user32.lib advapi32.lib
.c.obj:
$(CC) $(CFLAGS) /Fo$@ $<
$(CC) $(MW_CFLAGS) /Fo$@ $<

View file

@ -1,13 +1,14 @@
Greetings - Welcome to the Milsko GUI Toolkit (Version pre-1.0)
Greetings - Welcome to the Milsko GUI Toolkit (Version 1.4)
This document contains a brief summary of the contents of this source
distributions and building instructions for Milsko GUI Toolkit.
Requirements
Milsko requires the Windows environment with GDI (so anything NT or 9x) or
the Unix-like environment with X11 for runtime.
Milsko requires either
* A Windows environment with GDI (so anything NT or 9x)
* A Unix-like environment with Wayland and/or X11 for runtime.
To build Milsko for Windows, you must have one of following compilers:
* Visual C++ 6.0 or newer
@ -15,7 +16,7 @@ the Unix-like environment with X11 for runtime.
* Open Watcom 2.0 or newer
* MinGW-w64
and for Unix-like:
and for Unix-like and MacOS:
* GNU C Compiler
* Clang
@ -61,8 +62,10 @@ D. MinGW-w64/GCC/Clang
1) Determine if you need Vulkan and/or OpenGL.
2) Run `./Makefile.pl'.
For help, run `./Makefile.pl --help'.
2) Either:
a.) Run `./configure'. For help, run `./configure --help'.
b.) Use CMake; i.e. `cmake -B build`. (if contributing, name the build
folder build as that's what's included in the .gitignore)
3) Run `make'.

463
WatMakefile generated
View file

@ -1,13 +1,33 @@
CC = wcc386 -bt=nt -q -bd
CC = wcc386 -bt=nt -q
LD = wlink option quiet
CFLAGS = -i=include -d_MILSKO -dUSE_GDI -dUSE_STB_TRUETYPE -dUSE_STB_IMAGE -dSTBI_NO_SIMD
LDFLAGS = system nt_dll
all: src/Mw.dll
MW_CFLAGS = -bd -i=include -i=external/libz/include -d_MILSKO -d_MILSKO_BUILD -dUSE_GDI -dUSE_STB_IMAGE -dSTBI_NO_SIMD -dUSE_GDI_TEXT -dMW_OPENGL
MW_LDFLAGS = system nt_dll
EXE_CFLAGS = -i=include
EXE_LDFLAGS = system nt
all: src/Mw.dll examples/basic/box.exe examples/basic/calculator.exe examples/basic/checkbox.exe examples/basic/clipboard.exe examples/basic/colorpicker.exe examples/basic/combobox.exe examples/basic/example.exe examples/basic/filechooser.exe examples/basic/image.exe examples/basic/listbox.exe examples/basic/messagebox.exe examples/basic/periodic.exe examples/basic/progressbar.exe examples/basic/radiobox.exe examples/basic/rotate.exe examples/basic/scrollbar.exe examples/basic/sevensegment.exe examples/basic/subwindow.exe examples/basic/tab.exe examples/basic/treeview.exe examples/basic/viewport.exe examples/gldemos/boing.exe examples/gldemos/clock.exe examples/gldemos/cube.exe examples/gldemos/gears.exe examples/gldemos/triangle.exe examples/gldemos/tripaint.exe
lib: src/Mw.dll
examples: examples/basic/box.exe examples/basic/calculator.exe examples/basic/checkbox.exe examples/basic/clipboard.exe examples/basic/colorpicker.exe examples/basic/combobox.exe examples/basic/example.exe examples/basic/filechooser.exe examples/basic/image.exe examples/basic/listbox.exe examples/basic/messagebox.exe examples/basic/periodic.exe examples/basic/progressbar.exe examples/basic/radiobox.exe examples/basic/rotate.exe examples/basic/scrollbar.exe examples/basic/sevensegment.exe examples/basic/subwindow.exe examples/basic/tab.exe examples/basic/treeview.exe examples/basic/viewport.exe examples/gldemos/boing.exe examples/gldemos/clock.exe examples/gldemos/cube.exe examples/gldemos/gears.exe examples/gldemos/triangle.exe examples/gldemos/tripaint.exe
clean: .SYMBOLIC
%erase external/libz/src/adler32.obj
%erase external/libz/src/compress.obj
%erase external/libz/src/crc32.obj
%erase external/libz/src/deflate.obj
%erase external/libz/src/gzclose.obj
%erase external/libz/src/gzlib.obj
%erase external/libz/src/gzread.obj
%erase external/libz/src/gzwrite.obj
%erase external/libz/src/infback.obj
%erase external/libz/src/inffast.obj
%erase external/libz/src/inflate.obj
%erase external/libz/src/inftrees.obj
%erase external/libz/src/trees.obj
%erase external/libz/src/uncompr.obj
%erase external/libz/src/zutil.obj
%erase external/stb_ds.obj
%erase external/stb_image.obj
%erase external/stb_truetype.obj
%erase src/abstract/charset.obj
%erase src/abstract/directory.obj
%erase src/abstract/dynamic.obj
%erase src/abstract/time.obj
@ -25,11 +45,6 @@ clean: .SYMBOLIC
%erase src/dialog/filechooser.obj
%erase src/dialog/messagebox.obj
%erase src/draw.obj
%erase src/error.obj
%erase src/font/boldfont.obj
%erase src/font/boldttf.obj
%erase src/font/font.obj
%erase src/font/ttf.obj
%erase src/icon/back.obj
%erase src/icon/clock.obj
%erase src/icon/computer.obj
@ -48,9 +63,21 @@ clean: .SYMBOLIC
%erase src/icon/warning.obj
%erase src/lowlevel.obj
%erase src/string.obj
%erase src/text.obj
%erase src/text/font/boldfont.obj
%erase src/text/font/boldmonottf.obj
%erase src/text/font/boldttf.obj
%erase src/text/font/font.obj
%erase src/text/font/monottf.obj
%erase src/text/font/ttf.obj
%erase src/text/ft2.obj
%erase src/text/gdi.obj
%erase src/text/stbtt.obj
%erase src/text/text.obj
%erase src/truetype.obj
%erase src/unicode.obj
%erase src/widget/box.obj
%erase src/widget/button.obj
%erase src/widget/calendar.obj
%erase src/widget/checkbox.obj
%erase src/widget/combobox.obj
%erase src/widget/entry.obj
@ -66,142 +93,414 @@ clean: .SYMBOLIC
%erase src/widget/scrollbar.obj
%erase src/widget/separator.obj
%erase src/widget/submenu.obj
%erase src/widget/subwindow.obj
%erase src/widget/tab.obj
%erase src/widget/table.obj
%erase src/widget/treeview.obj
%erase src/widget/viewport.obj
%erase src/widget/window.obj
%erase src/Mw.dll
%erase src/Mw.lib
%erase examples/basic/box.obj
%erase examples/basic/calculator.obj
%erase examples/basic/checkbox.obj
%erase examples/basic/clipboard.obj
%erase examples/basic/colorpicker.obj
%erase examples/basic/combobox.obj
%erase examples/basic/example.obj
%erase examples/basic/filechooser.obj
%erase examples/basic/image.obj
%erase examples/basic/listbox.obj
%erase examples/basic/messagebox.obj
%erase examples/basic/periodic.obj
%erase examples/basic/progressbar.obj
%erase examples/basic/radiobox.obj
%erase examples/basic/rotate.obj
%erase examples/basic/scrollbar.obj
%erase examples/basic/sevensegment.obj
%erase examples/basic/subwindow.obj
%erase examples/basic/tab.obj
%erase examples/basic/treeview.obj
%erase examples/basic/viewport.obj
%erase examples/gldemos/boing.obj
%erase examples/gldemos/clock.obj
%erase examples/gldemos/cube.obj
%erase examples/gldemos/gears.obj
%erase examples/gldemos/triangle.obj
%erase examples/gldemos/tripaint.obj
%erase examples/basic/box.exe
%erase examples/basic/calculator.exe
%erase examples/basic/checkbox.exe
%erase examples/basic/clipboard.exe
%erase examples/basic/colorpicker.exe
%erase examples/basic/combobox.exe
%erase examples/basic/example.exe
%erase examples/basic/filechooser.exe
%erase examples/basic/image.exe
%erase examples/basic/listbox.exe
%erase examples/basic/messagebox.exe
%erase examples/basic/periodic.exe
%erase examples/basic/progressbar.exe
%erase examples/basic/radiobox.exe
%erase examples/basic/rotate.exe
%erase examples/basic/scrollbar.exe
%erase examples/basic/sevensegment.exe
%erase examples/basic/subwindow.exe
%erase examples/basic/tab.exe
%erase examples/basic/treeview.exe
%erase examples/basic/viewport.exe
%erase examples/gldemos/boing.exe
%erase examples/gldemos/clock.exe
%erase examples/gldemos/cube.exe
%erase examples/gldemos/gears.exe
%erase examples/gldemos/triangle.exe
%erase examples/gldemos/tripaint.exe
src/Mw.dll: external/stb_ds.obj external/stb_image.obj external/stb_truetype.obj src/abstract/directory.obj src/abstract/dynamic.obj src/abstract/time.obj src/backend/gdi.obj src/color.obj src/core.obj src/cursor/arrow.obj src/cursor/cross.obj src/cursor/default.obj src/cursor/hidden.obj src/cursor/text.obj src/default.obj src/dialog/colorpicker.obj src/dialog/directorychooser.obj src/dialog/filechooser.obj src/dialog/messagebox.obj src/draw.obj src/error.obj src/font/boldfont.obj src/font/boldttf.obj src/font/font.obj src/font/ttf.obj src/icon/back.obj src/icon/clock.obj src/icon/computer.obj src/icon/directory.obj src/icon/down.obj src/icon/error.obj src/icon/file.obj src/icon/forward.obj src/icon/info.obj src/icon/left.obj src/icon/news.obj src/icon/note.obj src/icon/right.obj src/icon/search.obj src/icon/up.obj src/icon/warning.obj src/lowlevel.obj src/string.obj src/text.obj src/unicode.obj src/widget/button.obj src/widget/checkbox.obj src/widget/combobox.obj src/widget/entry.obj src/widget/frame.obj src/widget/image.obj src/widget/label.obj src/widget/listbox.obj src/widget/menu.obj src/widget/numberentry.obj src/widget/opengl.obj src/widget/progressbar.obj src/widget/radiobox.obj src/widget/scrollbar.obj src/widget/separator.obj src/widget/submenu.obj src/widget/treeview.obj src/widget/viewport.obj src/widget/window.obj
$(LD) $(LDFLAGS) option implib=src/Mw.lib name $@ file external/stb_ds.obj file external/stb_image.obj file external/stb_truetype.obj file src/abstract/directory.obj file src/abstract/dynamic.obj file src/abstract/time.obj file src/backend/gdi.obj file src/color.obj file src/core.obj file src/cursor/arrow.obj file src/cursor/cross.obj file src/cursor/default.obj file src/cursor/hidden.obj file src/cursor/text.obj file src/default.obj file src/dialog/colorpicker.obj file src/dialog/directorychooser.obj file src/dialog/filechooser.obj file src/dialog/messagebox.obj file src/draw.obj file src/error.obj file src/font/boldfont.obj file src/font/boldttf.obj file src/font/font.obj file src/font/ttf.obj file src/icon/back.obj file src/icon/clock.obj file src/icon/computer.obj file src/icon/directory.obj file src/icon/down.obj file src/icon/error.obj file src/icon/file.obj file src/icon/forward.obj file src/icon/info.obj file src/icon/left.obj file src/icon/news.obj file src/icon/note.obj file src/icon/right.obj file src/icon/search.obj file src/icon/up.obj file src/icon/warning.obj file src/lowlevel.obj file src/string.obj file src/text.obj file src/unicode.obj file src/widget/button.obj file src/widget/checkbox.obj file src/widget/combobox.obj file src/widget/entry.obj file src/widget/frame.obj file src/widget/image.obj file src/widget/label.obj file src/widget/listbox.obj file src/widget/menu.obj file src/widget/numberentry.obj file src/widget/opengl.obj file src/widget/progressbar.obj file src/widget/radiobox.obj file src/widget/scrollbar.obj file src/widget/separator.obj file src/widget/submenu.obj file src/widget/treeview.obj file src/widget/viewport.obj file src/widget/window.obj library clib3r.lib library opengl32.lib library gdi32.lib library user32.lib
examples/basic/box.exe: examples/basic/box.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/basic/box.obj library clib3r.lib library src/Mw.lib
examples/basic/box.obj: examples/basic/box.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/basic/box.c
examples/basic/calculator.exe: examples/basic/calculator.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/basic/calculator.obj library clib3r.lib library src/Mw.lib
examples/basic/calculator.obj: examples/basic/calculator.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/basic/calculator.c
examples/basic/checkbox.exe: examples/basic/checkbox.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/basic/checkbox.obj library clib3r.lib library src/Mw.lib
examples/basic/checkbox.obj: examples/basic/checkbox.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/basic/checkbox.c
examples/basic/clipboard.exe: examples/basic/clipboard.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/basic/clipboard.obj library clib3r.lib library src/Mw.lib
examples/basic/clipboard.obj: examples/basic/clipboard.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/basic/clipboard.c
examples/basic/colorpicker.exe: examples/basic/colorpicker.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/basic/colorpicker.obj library clib3r.lib library src/Mw.lib
examples/basic/colorpicker.obj: examples/basic/colorpicker.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/basic/colorpicker.c
examples/basic/combobox.exe: examples/basic/combobox.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/basic/combobox.obj library clib3r.lib library src/Mw.lib
examples/basic/combobox.obj: examples/basic/combobox.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/basic/combobox.c
examples/basic/example.exe: examples/basic/example.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/basic/example.obj library clib3r.lib library src/Mw.lib
examples/basic/example.obj: examples/basic/example.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/basic/example.c
examples/basic/filechooser.exe: examples/basic/filechooser.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/basic/filechooser.obj library clib3r.lib library src/Mw.lib
examples/basic/filechooser.obj: examples/basic/filechooser.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/basic/filechooser.c
examples/basic/image.exe: examples/basic/image.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/basic/image.obj library clib3r.lib library src/Mw.lib
examples/basic/image.obj: examples/basic/image.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/basic/image.c
examples/basic/listbox.exe: examples/basic/listbox.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/basic/listbox.obj library clib3r.lib library src/Mw.lib
examples/basic/listbox.obj: examples/basic/listbox.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/basic/listbox.c
examples/basic/messagebox.exe: examples/basic/messagebox.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/basic/messagebox.obj library clib3r.lib library src/Mw.lib
examples/basic/messagebox.obj: examples/basic/messagebox.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/basic/messagebox.c
examples/basic/periodic.exe: examples/basic/periodic.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/basic/periodic.obj library clib3r.lib library src/Mw.lib
examples/basic/periodic.obj: examples/basic/periodic.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/basic/periodic.c
examples/basic/progressbar.exe: examples/basic/progressbar.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/basic/progressbar.obj library clib3r.lib library src/Mw.lib
examples/basic/progressbar.obj: examples/basic/progressbar.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/basic/progressbar.c
examples/basic/radiobox.exe: examples/basic/radiobox.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/basic/radiobox.obj library clib3r.lib library src/Mw.lib
examples/basic/radiobox.obj: examples/basic/radiobox.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/basic/radiobox.c
examples/basic/rotate.exe: examples/basic/rotate.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/basic/rotate.obj library clib3r.lib library src/Mw.lib
examples/basic/rotate.obj: examples/basic/rotate.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/basic/rotate.c
examples/basic/scrollbar.exe: examples/basic/scrollbar.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/basic/scrollbar.obj library clib3r.lib library src/Mw.lib
examples/basic/scrollbar.obj: examples/basic/scrollbar.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/basic/scrollbar.c
examples/basic/sevensegment.exe: examples/basic/sevensegment.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/basic/sevensegment.obj library clib3r.lib library src/Mw.lib
examples/basic/sevensegment.obj: examples/basic/sevensegment.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/basic/sevensegment.c
examples/basic/subwindow.exe: examples/basic/subwindow.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/basic/subwindow.obj library clib3r.lib library src/Mw.lib
examples/basic/subwindow.obj: examples/basic/subwindow.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/basic/subwindow.c
examples/basic/tab.exe: examples/basic/tab.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/basic/tab.obj library clib3r.lib library src/Mw.lib
examples/basic/tab.obj: examples/basic/tab.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/basic/tab.c
examples/basic/treeview.exe: examples/basic/treeview.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/basic/treeview.obj library clib3r.lib library src/Mw.lib
examples/basic/treeview.obj: examples/basic/treeview.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/basic/treeview.c
examples/basic/viewport.exe: examples/basic/viewport.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/basic/viewport.obj library clib3r.lib library src/Mw.lib
examples/basic/viewport.obj: examples/basic/viewport.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/basic/viewport.c
examples/gldemos/boing.exe: examples/gldemos/boing.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/gldemos/boing.obj library clib3r.lib library src/Mw.lib library opengl32.lib library glu32.lib
examples/gldemos/boing.obj: examples/gldemos/boing.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/gldemos/boing.c
examples/gldemos/clock.exe: examples/gldemos/clock.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/gldemos/clock.obj library clib3r.lib library src/Mw.lib library opengl32.lib library glu32.lib
examples/gldemos/clock.obj: examples/gldemos/clock.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/gldemos/clock.c
examples/gldemos/cube.exe: examples/gldemos/cube.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/gldemos/cube.obj library clib3r.lib library src/Mw.lib library opengl32.lib library glu32.lib
examples/gldemos/cube.obj: examples/gldemos/cube.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/gldemos/cube.c
examples/gldemos/gears.exe: examples/gldemos/gears.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/gldemos/gears.obj library clib3r.lib library src/Mw.lib library opengl32.lib library glu32.lib
examples/gldemos/gears.obj: examples/gldemos/gears.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/gldemos/gears.c
examples/gldemos/triangle.exe: examples/gldemos/triangle.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/gldemos/triangle.obj library clib3r.lib library src/Mw.lib library opengl32.lib library glu32.lib
examples/gldemos/triangle.obj: examples/gldemos/triangle.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/gldemos/triangle.c
examples/gldemos/tripaint.exe: examples/gldemos/tripaint.obj src/Mw.dll
$(LD) $(EXE_LDFLAGS) name $@ file examples/gldemos/tripaint.obj library clib3r.lib library src/Mw.lib library opengl32.lib library glu32.lib
examples/gldemos/tripaint.obj: examples/gldemos/tripaint.c
$(CC) $(EXE_CFLAGS) -fo=$@ examples/gldemos/tripaint.c
src/Mw.dll: external/libz/src/adler32.obj external/libz/src/compress.obj external/libz/src/crc32.obj external/libz/src/deflate.obj external/libz/src/gzclose.obj external/libz/src/gzlib.obj external/libz/src/gzread.obj external/libz/src/gzwrite.obj external/libz/src/infback.obj external/libz/src/inffast.obj external/libz/src/inflate.obj external/libz/src/inftrees.obj external/libz/src/trees.obj external/libz/src/uncompr.obj external/libz/src/zutil.obj external/stb_ds.obj external/stb_image.obj external/stb_truetype.obj src/abstract/charset.obj src/abstract/directory.obj src/abstract/dynamic.obj src/abstract/time.obj src/backend/gdi.obj src/color.obj src/core.obj src/cursor/arrow.obj src/cursor/cross.obj src/cursor/default.obj src/cursor/hidden.obj src/cursor/text.obj src/default.obj src/dialog/colorpicker.obj src/dialog/directorychooser.obj src/dialog/filechooser.obj src/dialog/messagebox.obj src/draw.obj src/icon/back.obj src/icon/clock.obj src/icon/computer.obj src/icon/directory.obj src/icon/down.obj src/icon/error.obj src/icon/file.obj src/icon/forward.obj src/icon/info.obj src/icon/left.obj src/icon/news.obj src/icon/note.obj src/icon/right.obj src/icon/search.obj src/icon/up.obj src/icon/warning.obj src/lowlevel.obj src/string.obj src/text/font/boldfont.obj src/text/font/boldmonottf.obj src/text/font/boldttf.obj src/text/font/font.obj src/text/font/monottf.obj src/text/font/ttf.obj src/text/ft2.obj src/text/gdi.obj src/text/stbtt.obj src/text/text.obj src/truetype.obj src/unicode.obj src/widget/box.obj src/widget/button.obj src/widget/calendar.obj src/widget/checkbox.obj src/widget/combobox.obj src/widget/entry.obj src/widget/frame.obj src/widget/image.obj src/widget/label.obj src/widget/listbox.obj src/widget/menu.obj src/widget/numberentry.obj src/widget/opengl.obj src/widget/progressbar.obj src/widget/radiobox.obj src/widget/scrollbar.obj src/widget/separator.obj src/widget/submenu.obj src/widget/subwindow.obj src/widget/tab.obj src/widget/table.obj src/widget/treeview.obj src/widget/viewport.obj src/widget/window.obj
$(LD) $(MW_LDFLAGS) option implib=src/Mw.lib name $@ file external/libz/src/adler32.obj file external/libz/src/compress.obj file external/libz/src/crc32.obj file external/libz/src/deflate.obj file external/libz/src/gzclose.obj file external/libz/src/gzlib.obj file external/libz/src/gzread.obj file external/libz/src/gzwrite.obj file external/libz/src/infback.obj file external/libz/src/inffast.obj file external/libz/src/inflate.obj file external/libz/src/inftrees.obj file external/libz/src/trees.obj file external/libz/src/uncompr.obj file external/libz/src/zutil.obj file external/stb_ds.obj file external/stb_image.obj file external/stb_truetype.obj file src/abstract/charset.obj file src/abstract/directory.obj file src/abstract/dynamic.obj file src/abstract/time.obj file src/backend/gdi.obj file src/color.obj file src/core.obj file src/cursor/arrow.obj file src/cursor/cross.obj file src/cursor/default.obj file src/cursor/hidden.obj file src/cursor/text.obj file src/default.obj file src/dialog/colorpicker.obj file src/dialog/directorychooser.obj file src/dialog/filechooser.obj file src/dialog/messagebox.obj file src/draw.obj file src/icon/back.obj file src/icon/clock.obj file src/icon/computer.obj file src/icon/directory.obj file src/icon/down.obj file src/icon/error.obj file src/icon/file.obj file src/icon/forward.obj file src/icon/info.obj file src/icon/left.obj file src/icon/news.obj file src/icon/note.obj file src/icon/right.obj file src/icon/search.obj file src/icon/up.obj file src/icon/warning.obj file src/lowlevel.obj file src/string.obj file src/text/font/boldfont.obj file src/text/font/boldmonottf.obj file src/text/font/boldttf.obj file src/text/font/font.obj file src/text/font/monottf.obj file src/text/font/ttf.obj file src/text/ft2.obj file src/text/gdi.obj file src/text/stbtt.obj file src/text/text.obj file src/truetype.obj file src/unicode.obj file src/widget/box.obj file src/widget/button.obj file src/widget/calendar.obj file src/widget/checkbox.obj file src/widget/combobox.obj file src/widget/entry.obj file src/widget/frame.obj file src/widget/image.obj file src/widget/label.obj file src/widget/listbox.obj file src/widget/menu.obj file src/widget/numberentry.obj file src/widget/opengl.obj file src/widget/progressbar.obj file src/widget/radiobox.obj file src/widget/scrollbar.obj file src/widget/separator.obj file src/widget/submenu.obj file src/widget/subwindow.obj file src/widget/tab.obj file src/widget/table.obj file src/widget/treeview.obj file src/widget/viewport.obj file src/widget/window.obj library clib3r.lib library opengl32.lib library gdi32.lib library ole32.lib library uuid.lib library user32.lib library advapi32.lib
external/libz/src/adler32.obj: external/libz/src/adler32.c
$(CC) $(MW_CFLAGS) -fo=$@ external/libz/src/adler32.c
external/libz/src/compress.obj: external/libz/src/compress.c
$(CC) $(MW_CFLAGS) -fo=$@ external/libz/src/compress.c
external/libz/src/crc32.obj: external/libz/src/crc32.c
$(CC) $(MW_CFLAGS) -fo=$@ external/libz/src/crc32.c
external/libz/src/deflate.obj: external/libz/src/deflate.c
$(CC) $(MW_CFLAGS) -fo=$@ external/libz/src/deflate.c
external/libz/src/gzclose.obj: external/libz/src/gzclose.c
$(CC) $(MW_CFLAGS) -fo=$@ external/libz/src/gzclose.c
external/libz/src/gzlib.obj: external/libz/src/gzlib.c
$(CC) $(MW_CFLAGS) -fo=$@ external/libz/src/gzlib.c
external/libz/src/gzread.obj: external/libz/src/gzread.c
$(CC) $(MW_CFLAGS) -fo=$@ external/libz/src/gzread.c
external/libz/src/gzwrite.obj: external/libz/src/gzwrite.c
$(CC) $(MW_CFLAGS) -fo=$@ external/libz/src/gzwrite.c
external/libz/src/infback.obj: external/libz/src/infback.c
$(CC) $(MW_CFLAGS) -fo=$@ external/libz/src/infback.c
external/libz/src/inffast.obj: external/libz/src/inffast.c
$(CC) $(MW_CFLAGS) -fo=$@ external/libz/src/inffast.c
external/libz/src/inflate.obj: external/libz/src/inflate.c
$(CC) $(MW_CFLAGS) -fo=$@ external/libz/src/inflate.c
external/libz/src/inftrees.obj: external/libz/src/inftrees.c
$(CC) $(MW_CFLAGS) -fo=$@ external/libz/src/inftrees.c
external/libz/src/trees.obj: external/libz/src/trees.c
$(CC) $(MW_CFLAGS) -fo=$@ external/libz/src/trees.c
external/libz/src/uncompr.obj: external/libz/src/uncompr.c
$(CC) $(MW_CFLAGS) -fo=$@ external/libz/src/uncompr.c
external/libz/src/zutil.obj: external/libz/src/zutil.c
$(CC) $(MW_CFLAGS) -fo=$@ external/libz/src/zutil.c
external/stb_ds.obj: external/stb_ds.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ external/stb_ds.c
external/stb_image.obj: external/stb_image.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ external/stb_image.c
external/stb_truetype.obj: external/stb_truetype.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ external/stb_truetype.c
src/abstract/charset.obj: src/abstract/charset.c
$(CC) $(MW_CFLAGS) -fo=$@ src/abstract/charset.c
src/abstract/directory.obj: src/abstract/directory.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/abstract/directory.c
src/abstract/dynamic.obj: src/abstract/dynamic.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/abstract/dynamic.c
src/abstract/time.obj: src/abstract/time.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/abstract/time.c
src/backend/gdi.obj: src/backend/gdi.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/backend/gdi.c
src/color.obj: src/color.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/color.c
src/core.obj: src/core.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/core.c
src/cursor/arrow.obj: src/cursor/arrow.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/cursor/arrow.c
src/cursor/cross.obj: src/cursor/cross.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/cursor/cross.c
src/cursor/default.obj: src/cursor/default.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/cursor/default.c
src/cursor/hidden.obj: src/cursor/hidden.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/cursor/hidden.c
src/cursor/text.obj: src/cursor/text.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/cursor/text.c
src/default.obj: src/default.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/default.c
src/dialog/colorpicker.obj: src/dialog/colorpicker.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/dialog/colorpicker.c
src/dialog/directorychooser.obj: src/dialog/directorychooser.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/dialog/directorychooser.c
src/dialog/filechooser.obj: src/dialog/filechooser.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/dialog/filechooser.c
src/dialog/messagebox.obj: src/dialog/messagebox.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/dialog/messagebox.c
src/draw.obj: src/draw.c
$(CC) $(CFLAGS) -fo=$@ $<
src/error.obj: src/error.c
$(CC) $(CFLAGS) -fo=$@ $<
src/font/boldfont.obj: src/font/boldfont.c
$(CC) $(CFLAGS) -fo=$@ $<
src/font/boldttf.obj: src/font/boldttf.c
$(CC) $(CFLAGS) -fo=$@ $<
src/font/font.obj: src/font/font.c
$(CC) $(CFLAGS) -fo=$@ $<
src/font/ttf.obj: src/font/ttf.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/draw.c
src/icon/back.obj: src/icon/back.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/icon/back.c
src/icon/clock.obj: src/icon/clock.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/icon/clock.c
src/icon/computer.obj: src/icon/computer.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/icon/computer.c
src/icon/directory.obj: src/icon/directory.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/icon/directory.c
src/icon/down.obj: src/icon/down.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/icon/down.c
src/icon/error.obj: src/icon/error.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/icon/error.c
src/icon/file.obj: src/icon/file.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/icon/file.c
src/icon/forward.obj: src/icon/forward.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/icon/forward.c
src/icon/info.obj: src/icon/info.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/icon/info.c
src/icon/left.obj: src/icon/left.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/icon/left.c
src/icon/news.obj: src/icon/news.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/icon/news.c
src/icon/note.obj: src/icon/note.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/icon/note.c
src/icon/right.obj: src/icon/right.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/icon/right.c
src/icon/search.obj: src/icon/search.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/icon/search.c
src/icon/up.obj: src/icon/up.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/icon/up.c
src/icon/warning.obj: src/icon/warning.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/icon/warning.c
src/lowlevel.obj: src/lowlevel.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/lowlevel.c
src/string.obj: src/string.c
$(CC) $(CFLAGS) -fo=$@ $<
src/text.obj: src/text.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/string.c
src/text/font/boldfont.obj: src/text/font/boldfont.c
$(CC) $(MW_CFLAGS) -fo=$@ src/text/font/boldfont.c
src/text/font/boldmonottf.obj: src/text/font/boldmonottf.c
$(CC) $(MW_CFLAGS) -fo=$@ src/text/font/boldmonottf.c
src/text/font/boldttf.obj: src/text/font/boldttf.c
$(CC) $(MW_CFLAGS) -fo=$@ src/text/font/boldttf.c
src/text/font/font.obj: src/text/font/font.c
$(CC) $(MW_CFLAGS) -fo=$@ src/text/font/font.c
src/text/font/monottf.obj: src/text/font/monottf.c
$(CC) $(MW_CFLAGS) -fo=$@ src/text/font/monottf.c
src/text/font/ttf.obj: src/text/font/ttf.c
$(CC) $(MW_CFLAGS) -fo=$@ src/text/font/ttf.c
src/text/ft2.obj: src/text/ft2.c
$(CC) $(MW_CFLAGS) -fo=$@ src/text/ft2.c
src/text/gdi.obj: src/text/gdi.c
$(CC) $(MW_CFLAGS) -fo=$@ src/text/gdi.c
src/text/stbtt.obj: src/text/stbtt.c
$(CC) $(MW_CFLAGS) -fo=$@ src/text/stbtt.c
src/text/text.obj: src/text/text.c
$(CC) $(MW_CFLAGS) -fo=$@ src/text/text.c
src/truetype.obj: src/truetype.c
$(CC) $(MW_CFLAGS) -fo=$@ src/truetype.c
src/unicode.obj: src/unicode.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/unicode.c
src/widget/box.obj: src/widget/box.c
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/box.c
src/widget/button.obj: src/widget/button.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/button.c
src/widget/calendar.obj: src/widget/calendar.c
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/calendar.c
src/widget/checkbox.obj: src/widget/checkbox.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/checkbox.c
src/widget/combobox.obj: src/widget/combobox.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/combobox.c
src/widget/entry.obj: src/widget/entry.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/entry.c
src/widget/frame.obj: src/widget/frame.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/frame.c
src/widget/image.obj: src/widget/image.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/image.c
src/widget/label.obj: src/widget/label.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/label.c
src/widget/listbox.obj: src/widget/listbox.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/listbox.c
src/widget/menu.obj: src/widget/menu.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/menu.c
src/widget/numberentry.obj: src/widget/numberentry.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/numberentry.c
src/widget/opengl.obj: src/widget/opengl.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/opengl.c
src/widget/progressbar.obj: src/widget/progressbar.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/progressbar.c
src/widget/radiobox.obj: src/widget/radiobox.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/radiobox.c
src/widget/scrollbar.obj: src/widget/scrollbar.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/scrollbar.c
src/widget/separator.obj: src/widget/separator.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/separator.c
src/widget/submenu.obj: src/widget/submenu.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/submenu.c
src/widget/subwindow.obj: src/widget/subwindow.c
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/subwindow.c
src/widget/tab.obj: src/widget/tab.c
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/tab.c
src/widget/table.obj: src/widget/table.c
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/table.c
src/widget/treeview.obj: src/widget/treeview.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/treeview.c
src/widget/viewport.obj: src/widget/viewport.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/viewport.c
src/widget/window.obj: src/widget/window.c
$(CC) $(CFLAGS) -fo=$@ $<
$(CC) $(MW_CFLAGS) -fo=$@ src/widget/window.c

View file

@ -2,6 +2,11 @@
our $target = `uname -s`;
$target =~ s/\r?\n$//;
# MSYS with MinGW gives us some other shit idk
if (index($target, "MINGW") != -1) {
$target = "Windows";
}
foreach my $l (@ARGV) {
if ($l =~ /^--.+$/) {
}
@ -12,13 +17,15 @@ 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 $incdir = "-I include";
our $cflags = "-fPIC -D_MILSKO";
our $incdir2 = "";
our $cflags = "-fPIC -D_MILSKO -D_MILSKO_BUILD -fvisibility=hidden";
our $libdir = "";
our $ldflags = "";
our $math = "-lm";
our $shared = "-shared";
our @shared = "-shared";
our @backends = ();
our $library_prefix = "lib";
@ -37,35 +44,81 @@ require("./pl/utils.pl");
param_set("classic-theme", 0);
param_set("stb-image", 1);
param_set("stb-truetype", 0);
param_set("freetype2", 1);
param_set("xrender", 1);
param_set("opengl", 0);
param_set("vulkan", 0);
param_set("vulkan-string-helper", 1);
param_set("shared", 1);
param_set("static", 1);
param_set("examples", 1);
# (option that only makes sense on x11)
param_set("allow-sloppy-focus", 0);
my %features = (
"classic-theme" => "use classic theme",
"stb-image" => "use stb_image instead of libjpeg/libpng",
"stb-image" => "use stb_image, instead use libjpeg/libpng",
"stb-truetype" => "use stb_truetype",
"freetype2" => "use FreeType2",
"xrender" => "use XRender",
"gdi-text" => "(Windows only) use GDI Text",
"xrender" => "(X11 only) use XRender",
"opengl" => "build OpenGL widget",
"vulkan" => "build Vulkan widget",
"vulkan-string-helper" => "use Vulkan string helper",
"shared" => "build shared library",
"static" => "build static library"
"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"
);
my @features_keys = (
"1classic-theme", "1stb-image",
"1stb-truetype", "1freetype2",
"1stb-truetype", "1freetype2", "1gdi-text",
"1opengl", "2xrender",
"1vulkan", "2vulkan-string-helper",
"1shared", "1static"
"1shared", "1static",
"1wayland", "1gnustep",
"1dbus"
);
sub def_platform {
if($target eq "Windows") {
param_set("freetype2", 0);
param_set("stb-truetype", 0);
} 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")){
param_set("wayland", 1);
}
param_set("dbus", 1);
}
if($target eq "NetBSD" || $target eq "OpenBSD") {
param_set("x11", 1);
}
if($target eq "Windows") {
param_set("gdi-text", 1);
} else {
param_set("gdi-text", 0);
}
}
foreach my $l (@ARGV) {
if ($l =~ /^--target=(.+)$/) {
$target = $1;
}
}
def_platform();
foreach my $l (@ARGV) {
if ($l =~ /^--with-([^=]+)=(.+)$/) {
param_set($1, $2);
@ -76,15 +129,18 @@ foreach my $l (@ARGV) {
elsif ($l =~ /^--(?:without|disable)-(.+)$/) {
param_set($1, 0);
}
elsif ($l =~ /^--target=(.+)$/) {
$target = $1;
}
elsif ($l =~ /^--host=(.+)$/) {
$host = $1 . "-";
}
elsif ($l =~ /^--cflags=(.+)$/) {
add_cflags($1);
}
elsif ($l eq "--cross") {
$cross = 1;
}
elsif ($l eq "--tiny") {
param_set("tiny",1);
}
elsif (($l eq "-h") or ($l eq "--help")) {
print("Milsko Toolkit Configuration Utility\n");
print("\n");
@ -95,6 +151,8 @@ foreach my $l (@ARGV) {
print(" --prefix=PREFIX Installation prefix\n");
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(" --cross Indicate cross compilation\n");
print("\n");
print("Features:\n");
@ -152,36 +210,41 @@ foreach my $e (param_list()) {
print("Enabled: " . join(" ", @l) . "\n");
$cc =~ s/\*host\*/$host/;
$cxx =~ s/\*host\*/$host/;
$ar =~ s/\*host\*/$host/;
open(OUT, ">", "Makefile");
print(OUT "PREFIX = ${prefix}\n");
print(OUT "AR = ${ar}\n");
print(OUT "CC = ${cc}\n");
print(OUT "INCDIR = ${incdir}\n");
print(OUT "CXX = ${cxx}\n");
print(OUT "INCDIR = ${incdir} ${incdir2}\n");
print(OUT "CFLAGS = ${cflags}\n");
print(OUT "LIBDIR = ${libdir}\n");
print(OUT "LDFLAGS = ${ldflags}\n");
print(OUT "LIBS = ${math} ${libs}\n");
print(OUT "MATH = ${math}\n");
print(OUT "SHARED = ${shared}\n");
print(OUT "SHARED = @{shared}\n");
print(OUT "\n");
print(OUT ".PHONY: all format clean distclean lib examples install\n");
print(OUT "\n");
print(OUT "all: lib examples\n");
print(OUT "\n");
print(OUT "install: lib\n");
print(OUT " mkdir -p \$(PREFIX)/lib \$(PREFIX)/include\n");
print(OUT " -cp src/${library_prefix}Mw${library_suffix} \$(PREFIX)/lib/\n");
print(OUT " -cp src/libMw.a \$(PREFIX)/lib/\n");
print(OUT " cp -rf include \$(PREFIX)/\n");
print(OUT
" mkdir -p \$(DESTDIR)\$(PREFIX)/lib \$(DESTDIR)\$(PREFIX)/include\n");
print(OUT
" -cp src/${library_prefix}Mw${library_suffix} \$(DESTDIR)\$(PREFIX)/lib/\n"
);
print(OUT " -cp src/libMw.a \$(DESTDIR)\$(PREFIX)/lib/\n");
print(OUT " cp -rf include \$(DESTDIR)\$(PREFIX)/\n");
print(OUT "\n");
print(OUT "format:\n");
print(OUT
" clang-format --verbose -i `find src include -name \"*.c\" -or -name \"*.h\"`\n"
" clang-format --verbose -i `find tools src include examples \"(\" -name \"*.c\" -or -name \"*.cc\" -or -name \"*.h\" -or -name \"*.m\" \")\" -and -not -name \"*ttf.c\"`\n"
);
print(OUT
" perltidy -b -bext=\"/\" --paren-tightness=2 `find tools pl Makefile.pl -name \"*.pl\"`\n"
" perltidy -b -bext=\"/\" --paren-tightness=2 `find tools pl configure -name \"*.pl\"`\n"
);
print(OUT "\n");
print(OUT "lib:");
@ -195,11 +258,15 @@ if (param_get("static")) {
print(OUT "\n");
print(OUT "\n");
if (param_get("shared")) {
my $linker = "CC";
if (grep(/^haiku$/, @backends)) {
$linker = "CXX";
}
print( OUT "src/${library_prefix}Mw${library_suffix}: "
. join(" ", @library_targets)
. "\n");
print(OUT
" \$(CC) \$(SHARED) \$(LDFLAGS\) \$(LIBDIR) -o src/${library_prefix}Mw${library_suffix} "
" \$($linker) \$(SHARED) \$(LDFLAGS\) \$(LIBDIR) -o src/${library_prefix}Mw${library_suffix} "
. join(" ", @library_targets)
. " \$(LIBS)\n");
print(OUT "\n");
@ -212,47 +279,82 @@ if (param_get("static")) {
foreach my $l (@library_targets) {
my $warn = "-Wall -Wextra -Wno-sign-compare -Wno-unused-value";
my $s = $l;
my $compiler = "CC";
my $o = $object_suffix;
$o =~ s/\./\\\./g;
$s =~ s/$o$/.c/;
if ($l =~ /cocoa/) {
$s =~ s/$o$/.m/;
}
elsif ($l =~ /haiku/) {
$s =~ s/$o$/.cc/;
$compiler = "CXX";
}
else {
$s =~ s/$o$/.c/;
}
if ($l =~ /^external\//) {
$warn = "";
}
print(OUT "${l}: ${s}\n");
print(OUT " \$(CC) $warn \$(CFLAGS\) \$\(INCDIR) -c -o ${l} ${s}\n");
print(OUT " \$($compiler) $warn \$\(INCDIR) \$(CFLAGS\) -c -o ${l} ${s}\n");
}
print(OUT "\n");
print(OUT "\n");
print(OUT "examples: " . join(" ", @examples_targets) . "\n");
print(OUT "\n");
foreach my $l (@examples_targets) {
my $libs = "";
my $s = $l;
my $o = $executable_suffix;
$o =~ s/\./\\\./g;
$s =~ s/$o$//;
if (param_get("examples")) {
print(OUT "examples: " . join(" ", @examples_targets) . "\n");
print(OUT "\n");
foreach my $l (@examples_targets) {
my $libs = "";
my $s = $l;
my $o = $executable_suffix;
$o =~ s/\./\\\./g;
$s =~ s/$o$//;
if (defined($examples_libs{$l})) {
$libs = $examples_libs{$l};
}
if (defined($examples_libs{$l})) {
$libs = $examples_libs{$l};
}
print(OUT
"${l}: ${s}${object_suffix} src/${library_prefix}Mw${library_suffix}\n"
);
print(OUT
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"
);
}
if (grep(/^cocoa$/, @backends)) {
print(OUT
" \$(CC) -L./src \$\(LIBDIR) -o ${l} ${s}${object_suffix} -lMw ${math} ${libs}\n"
);
}
else {
print(OUT
" \$(CC) -L src -Wl,-R./src \$\(LIBDIR) -o ${l} ${s}${object_suffix} -lMw ${math} ${libs}\n"
);
print(OUT "${s}${object_suffix}: ${s}.c\n");
print(OUT
" \$(CC) -c \$\(INCDIR) -o ${s}${object_suffix} ${s}.c -lMw ${math}\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"
);
}
print(OUT "${s}${object_suffix}: ${s}.c\n");
print(OUT
" \$(CC) -c \$\(INCDIR) -o ${s}${object_suffix} ${s}.c -lMw ${math}\n"
);
}
}
print(OUT "\n");
print(OUT "clean:\n");
print(OUT
" rm -f */*.o */*/*.o */*/*/*.o */*.exe */*/*.exe */*/*/*.exe src/*.so src/*.dll src/*.a "
" rm -f */*.o */*/*.o */*/*/*.o */*.exe */*/*.exe */*/*/*.exe src/*.so src/*.dll src/*.dylib src/*.a "
. join(" ", @examples_targets)
. "\n");
print(OUT "\n");

25
doc/BACKENDDEV.md Normal file
View file

@ -0,0 +1,25 @@
# Backend dev
The basic process of creating a new Milsko backend is
- Adding a new include header into `include/Mw/LowLevel`. It must include;
- `struct _MwLLBackendName`: Any details about a window or a subwidget
- `struct _MwLLBackendNameColor`: An 8-bit RGB Color. You'll probably never impl this, this is for platforms like X11/GDI where they have a secondary color representation that can be stored.
- `struct _MwLLBackendNamePixmap`: Self-explanatory. This is also used for the soft gradients in the modern theme.
- `MwLLBackendNameCallInitImpl(void)` called by `MwLibraryInit` to address and platform globals.
- Note that all of those structs are actually unions. They should all start with their `MwLLCommon...` equivalants.
- Fill out `Mw/LowLevel.h` appopriately, adding an include to your new file and the structs in the appropriate unions. These need to be guarded by a `USE_BACKENDNAME` macro which you'll define later when you modify the build system.
- Creating a new impl file in `src/backend`
- Backends actually return a table of function pointers that you have to implement with static functions. Your file should end with `#include "call.c"` and then `CALL(BackendName);`, and somewhere you should have the impl for `MwLLBackendNameCallInitImpl(void)`.
- Prefer to keep the backend file to one file if you can, though obviously exceptions like the Wayland backend exist because it's simply too complex to sanely stuff into one file.
- Add `MwLLBackendNameCallInitImpl` to the `MwLibraryInit` impl in `src/core.c`.
- Add a new enum variation to `MwLLBackends` in `Mw/Include/LowLevel.h`; your impl of `MwLLCreateImpl` will set `common.type` to this so the user can check which backend they're on (important for platforms with multiple supported backends).
- Either
- a.) Modify `CMakeLists.txt` for your platform.
- b.) Add a new perl file in `pl/ostype` that `./configure` can reference, and modify `pl/rules.pl`; If you don't know how to use perl it's fine, just copy a file like the `Linux.pl` or `Windows.pl`, the functions you'll have to change for your platform are self explanatory. Ensure it ends with `1;`.
- c.) Both.
- Both are recommended, but some platforms like Classic Mac OS can't be used with the `./configure` script, and that's fine.
The functions you'll have to impl are too many to list here so you should start by just copying `x11.c` and then replacing all the function impls with your own.
\*\*Pay attention to some of these functions' comments in LowLevel.h as they might not be as you expect; for example, `MwLLSetDarkThemeImpl` is for setting the accent color to dark theme on platforms like modern Windows (dark theme itself is set with `MwSetInteger(handle, MwNdarktheme, 1)`).

View file

@ -1,5 +0,0 @@
# LowLevel.h function tips
@warning This is mainly for developers
1. `MwLLSetSizeHints`, `MwLLMakeBorderless`, `MwLLMakeToolWindow`, `MwLLMakePopup` have to be called between `MwLLBeginStateChange` and `MwLLEndStateChange`

20
doc/TIERS.md Normal file
View file

@ -0,0 +1,20 @@
# Tiers
Ports of Milsko are grouped into three "tiers" in terms of their support.
- **Tier 1**: Before every new release of Milsko, these platforms will be tested to make sure they have full support, and the CI will test them.
- **Tier 2**: These might be outdated or not updated in awhile, they might only compile under a specific version/commit of Milsko. Authors of these backends will be made aware of these updates.
- **Tier 3**: These are outright unfinished. Only use these if you're a developer.
Currently, the Tier 1 backends are:
- Windows 9x+/NT 4.0+
- Any Unix/Linux system that supports X11 or Wayland.
There are currently no Tier 2 backends.
Tier 3 backends are:
- Mac OS X 10.4+ with Cocoa
- Mac OS 7-9, PowerPC (68k support not planned).
- Haiku

9
doc/TINYCONFIG.md Normal file
View file

@ -0,0 +1,9 @@
# Tiny Config
Milsko's configure script supports the `--tiny` option for building the tiniest possible Milsko library (~400kb as of writing). Currently, what it does is:
- Add `-Oz` to the cflags
- (clang only) add `-flto=thin` to the cflags and linker flags
- Build stb-image with `STB_IMAGE_STATIC` (this is why you get warnings with stb_image when you use it)
- (Linux) Disable the Wayland backend
- (Linux) Disable dbus integration

View file

@ -1 +1,7 @@
add_subdirectory(basic)
if(${MW_TRY_OPENGL})
add_subdirectory(gldemos)
endif()
if(${MW_TRY_VULKAN})
add_subdirectory(vkdemos)
endif()

View file

@ -1,22 +1,26 @@
file(
GLOB
EXAMPLES_BASIC_SOURCES
*.c
GLOB
EXAMPLES_BASIC_SOURCES
*.c
)
foreach(PATH IN LISTS EXAMPLES_BASIC_SOURCES)
get_filename_component(TARGET ${PATH} NAME_WE)
add_executable(${TARGET} ${PATH})
target_link_libraries(
${TARGET}
PRIVATE
Mw
)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_link_libraries(
${TARGET}
PRIVATE
m
)
endif()
get_filename_component(TARGET ${PATH} NAME_WE)
if(CMAKE_SYSTEM_NAME MATCHES Retro)
add_application(${TARGET} ${PATH})
else()
add_executable(${TARGET} MACOSX_BUNDLE ${PATH})
endif()
target_link_libraries(
${TARGET}
PRIVATE
Mw
)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_link_libraries(
${TARGET}
PRIVATE
m
)
endif()
endforeach()

74
examples/basic/box.c Normal file
View file

@ -0,0 +1,74 @@
#include <Mw/Milsko.h>
MwWidget window, box;
void MWAPI resize(MwWidget handle, void* user, void* client) {
int ww = MwGetInteger(handle, MwNwidth);
int wh = MwGetInteger(handle, MwNheight);
(void)user;
(void)client;
MwVaApply(box,
MwNwidth, ww,
MwNheight, wh,
NULL);
}
int main() {
MwWidget box2, box3, box4;
MwLibraryInit();
window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 600, 200,
MwNtitle, "box",
NULL);
box = MwVaCreateWidget(MwBoxClass, "box", window, 0, 0, 0, 0,
MwNpadding, 10,
MwNmargin, 10,
NULL);
box2 = MwVaCreateWidget(MwBoxClass, "box2", box, 0, 0, 0, 0,
MwNmargin, 10,
MwNorientation, MwVERTICAL,
NULL);
box3 = MwVaCreateWidget(MwBoxClass, "box3", box, 0, 0, 0, 0,
MwNmargin, 10,
MwNorientation, MwVERTICAL,
NULL);
box4 = MwVaCreateWidget(MwBoxClass, "box4", box, 0, 0, 0, 0,
MwNmargin, 10,
MwNorientation, MwVERTICAL,
MwNfixedSize, 40,
NULL);
MwVaCreateWidget(MwButtonClass, "btn1", box2, 0, 0, 0, 0,
MwNbackground, "#a00",
NULL);
MwVaCreateWidget(MwButtonClass, "btn2", box2, 0, 0, 0, 0,
MwNbackground, "#0a0",
MwNratio, 2,
NULL);
MwVaCreateWidget(MwButtonClass, "btn3", box2, 0, 0, 0, 0,
MwNbackground, "#00a",
NULL);
MwVaCreateWidget(MwButtonClass, "btn4", box3, 0, 0, 0, 0,
MwNbackground, "#a0a",
NULL);
MwVaCreateWidget(MwButtonClass, "btn5", box4, 0, 0, 0, 0,
MwNbackground, "#0aa",
NULL);
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
resize(window, NULL, NULL);
MwLoop(window);
}

185
examples/basic/calculator.c Normal file
View file

@ -0,0 +1,185 @@
#include <Mw/Milsko.h>
MwWidget widgets[18];
MwWidget inp;
/* probably enough for most tasks */
double stack[512];
int sp = 0;
static void MWAPI resize(MwWidget handle, void* client, void* user) {
int ww = MwGetInteger(handle, MwNwidth);
int wh = MwGetInteger(handle, MwNheight) - MwGetInteger(inp, MwNheight);
int i;
MwVaApply(inp,
MwNwidth, ww,
NULL);
for(i = 0; i < sizeof(widgets) / sizeof(widgets[0]); i++) {
int x = i % 4;
int y = i / 4;
if(widgets[i] != NULL) {
MwVaApply(widgets[i],
MwNwidth, ww / 4,
MwNheight, wh / 5,
MwNx, ww / 4 * x,
MwNy, wh / 5 * y + MwGetInteger(inp, MwNheight),
NULL);
}
}
}
static void MWAPI activate(MwWidget handle, void* client, void* user) {
const char* n = MwGetText(handle, MwNtext);
if(('0' <= n[0] && n[0] <= '9') || n[0] == '.') {
const char* s = MwGetText(inp, MwNtext);
char* r;
if(n[0] == '.' && s != NULL) {
int i;
for(i = 0; s[i] != 0; i++) {
if(s[i] == '.') return;
}
}
if(s == NULL) s = "";
r = MwStringConcat(s, n);
MwVaApply(inp,
MwNtext, r,
NULL);
free(r);
} else if(n[0] == 'E') {
const char* s = MwGetText(inp, MwNtext);
if(s != NULL) {
stack[sp++] = atof(s);
MwVaApply(inp,
MwNtext, "",
NULL);
}
} else if(n[0] == 'C') {
MwVaApply(inp,
MwNtext, "",
NULL);
} else if(n[0] == '+' || n[0] == '-' || n[0] == '*' || n[0] == '/') {
if(sp >= 2) {
double sv = stack[--sp];
double fv = stack[--sp];
double v;
char buf[256];
if(n[0] == '+') {
v = fv + sv;
} else if(n[0] == '-') {
v = fv - sv;
} else if(n[0] == '*') {
v = fv * sv;
} else if(n[0] == '/') {
v = fv / sv;
}
MwStringPrintIntoBuffer(buf, 256, "%g", v);
MwVaApply(inp,
MwNtext, buf,
NULL);
}
}
}
int main() {
MwWidget w;
int i;
for(i = 0; i < sizeof(widgets) / sizeof(widgets[0]); i++) widgets[i] = NULL;
MwLibraryInit();
w = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 150, 150,
MwNtitle, "Calculator",
NULL);
inp = MwCreateWidget(MwEntryClass, "entry", w, 0, 0, 0, 24);
widgets[0] = MwVaCreateWidget(MwButtonClass, "7", w, 0, 0, 0, 0,
MwNtext, "7",
NULL);
widgets[1] = MwVaCreateWidget(MwButtonClass, "8", w, 0, 0, 0, 0,
MwNtext, "8",
NULL);
widgets[2] = MwVaCreateWidget(MwButtonClass, "9", w, 0, 0, 0, 0,
MwNtext, "9",
NULL);
widgets[3] = MwVaCreateWidget(MwButtonClass, "/", w, 0, 0, 0, 0,
MwNtext, "/",
NULL);
widgets[4] = MwVaCreateWidget(MwButtonClass, "4", w, 0, 0, 0, 0,
MwNtext, "4",
NULL);
widgets[5] = MwVaCreateWidget(MwButtonClass, "5", w, 0, 0, 0, 0,
MwNtext, "5",
NULL);
widgets[6] = MwVaCreateWidget(MwButtonClass, "6", w, 0, 0, 0, 0,
MwNtext, "6",
NULL);
widgets[7] = MwVaCreateWidget(MwButtonClass, "*", w, 0, 0, 0, 0,
MwNtext, "*",
NULL);
widgets[8] = MwVaCreateWidget(MwButtonClass, "1", w, 0, 0, 0, 0,
MwNtext, "1",
NULL);
widgets[9] = MwVaCreateWidget(MwButtonClass, "2", w, 0, 0, 0, 0,
MwNtext, "2",
NULL);
widgets[10] = MwVaCreateWidget(MwButtonClass, "3", w, 0, 0, 0, 0,
MwNtext, "3",
NULL);
widgets[11] = MwVaCreateWidget(MwButtonClass, "-", w, 0, 0, 0, 0,
MwNtext, "-",
NULL);
widgets[12] = MwVaCreateWidget(MwButtonClass, "0", w, 0, 0, 0, 0,
MwNtext, "0",
NULL);
widgets[13] = MwVaCreateWidget(MwButtonClass, ".", w, 0, 0, 0, 0,
MwNtext, ".",
NULL);
widgets[16] = MwVaCreateWidget(MwButtonClass, "E", w, 0, 0, 0, 0,
MwNtext, "E",
NULL);
widgets[15] = MwVaCreateWidget(MwButtonClass, "+", w, 0, 0, 0, 0,
MwNtext, "+",
NULL);
widgets[17] = MwVaCreateWidget(MwButtonClass, "C", w, 0, 0, 0, 0,
MwNtext, "C",
NULL);
for(i = 0; i < sizeof(widgets) / sizeof(widgets[0]); i++) {
if(widgets[i] != NULL) MwAddUserHandler(widgets[i], MwNactivateHandler, activate, NULL);
}
MwAddUserHandler(w, MwNresizeHandler, resize, NULL);
resize(w, NULL, NULL);
MwLoop(w);
}

View file

@ -4,10 +4,10 @@ int main() {
MwWidget window;
MwLibraryInit();
window = MwVaCreateWidget(MwWindowClass, "test", NULL, MwDEFAULT, MwDEFAULT, 8 + 16 + 8 + 16 * 10 + 8, 8 + 16 + 8 + 16 + 8,
MwNtitle, "checkbox",
NULL);
MwNtitle, "checkbox",
NULL);
MwVaCreateWidget(MwCheckBoxClass, "cb1", window, 8, 8, 16, 16,
NULL);

View file

@ -0,0 +1,78 @@
#include <Mw/Milsko.h>
MwWidget window, instructions, text1, text2, cur_text;
static void MWAPI resize(MwWidget handle, void* user_data, void* call_data) {
unsigned int w, h;
(void)user_data;
(void)call_data;
w = MwGetInteger(handle, MwNwidth);
h = MwGetInteger(handle, MwNheight);
MwVaApply(instructions,
MwNy, 50,
MwNwidth, w - 50 * 2,
MwNheight, h - 125 - 50 * 3,
NULL);
MwVaApply(text1,
MwNy, 150,
MwNwidth, w - 25 * 2,
MwNheight, h - 125 - 50 * 3,
NULL);
MwVaApply(text2,
MwNy, 250,
MwNwidth, w - 25 * 2,
MwNheight, h - 125 - 50 * 3,
NULL);
}
static void MWAPI clipboard(MwWidget handle, void* user_data, void* call_data) {
char* clipboard = call_data;
(void)handle;
(void)user_data;
if(clipboard != NULL) {
MwVaApply(cur_text, MwNtext, clipboard, NULL);
MwForceRender(cur_text);
}
}
static void MWAPI tick(MwWidget handle, void* user_data, void* call_data) {
cur_text = text1;
MwGetClipboard(handle, MwCLIPBOARD_MAIN);
cur_text = text2;
MwGetClipboard(handle, MwCLIPBOARD_PRIMARY);
MwForceRender(window);
}
int main() {
MwLibraryInit();
window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 400, 400,
MwNtitle, "clipboard",
NULL);
instructions = MwVaCreateWidget(MwLabelClass, "button", window, 50, 50, 300, 125,
MwNtext, "clipboard contents will show up below.",
NULL);
text1 = MwVaCreateWidget(MwLabelClass, "label", window, 25, 150, 300, 75,
MwNtext, "",
NULL);
text2 = MwVaCreateWidget(MwLabelClass, "label2", window, 25, 250, 300, 75,
MwNtext, "",
NULL);
cur_text = text1;
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
MwAddUserHandler(window, MwNclipboardHandler, clipboard, NULL);
MwAddUserHandler(instructions, MwNclipboardHandler, clipboard, NULL);
MwAddUserHandler(cur_text, MwNclipboardHandler, clipboard, NULL);
MwAddUserHandler(window, MwNtickHandler, tick, NULL);
resize(window, NULL, NULL);
MwLoop(window);
}

View file

@ -1,11 +1,10 @@
#include <Mw/Milsko.h>
MwWidget cpicker;
MwWidget fpicker;
MwWidget window;
MwWidget button;
void color_callback(MwWidget handle, void* user_data, void* call_data) {
void MWAPI file_callback(MwWidget handle, void* user_data, void* call_data) {
char hexColor[8];
MwRGB* rgb = call_data;
@ -15,20 +14,20 @@ void color_callback(MwWidget handle, void* user_data, void* call_data) {
rgb->red &= 0xff;
rgb->green &= 0xff;
rgb->blue &= 0xff;
sprintf(hexColor, "#%02X%02X%02X", rgb->red, rgb->green, rgb->blue);
MwStringPrintIntoBuffer(hexColor, 8, "#%02X%02X%02X", rgb->red, rgb->green, rgb->blue);
MwSetText(window, MwNbackground, hexColor);
}
void color_picker(MwWidget handle, void* user_data, void* call_data) {
void MWAPI file_picker(MwWidget handle, void* user_data, void* call_data) {
MwWidget cpicker = MwColorPicker(window, "cpicker");
(void)handle;
(void)user_data;
(void)call_data;
MwAddUserHandler(cpicker, MwNcolorChosenHandler, color_callback, NULL);
MwAddUserHandler(cpicker, MwNcolorChosenHandler, file_callback, NULL);
MwSetText(cpicker, MwNbackground, MwDefaultBackground);
MwSetText(cpicker, MwNbackground, MwGetInteger(cpicker, MwNdarkTheme) ? MwDefaultDarkBackground : MwDefaultBackground);
}
int main() {
@ -36,14 +35,14 @@ int main() {
window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT,
MwDEFAULT, 640, 480, MwNtitle, "color picker", NULL);
MwSetText(window, MwNbackground, "#000000");
MwSetText(window, MwNbackground, MwGetInteger(window, MwNdarkTheme) ? MwDefaultBackground : MwDefaultDarkBackground);
button = MwVaCreateWidget(MwButtonClass, "button", window, 160, 180, 320, 120,
MwNtext, "change window background",
NULL);
MwSetText(button, MwNbackground, MwDefaultBackground);
MwSetText(button, MwNbackground, MwGetInteger(window, MwNdarkTheme) ? MwDefaultBackground : MwDefaultDarkBackground);
MwAddUserHandler(button, MwNactivateHandler, color_picker, NULL);
MwAddUserHandler(button, MwNactivateHandler, file_picker, NULL);
MwLoop(window);
}

View file

@ -1,13 +1,13 @@
#include <Mw/Milsko.h>
int main(){
int main() {
MwWidget w, cb;
MwLibraryInit();
w = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 5 + 320 + 5, 5 + 24 + 5,
MwNtitle, "combobox",
NULL);
MwNtitle, "combobox",
NULL);
cb = MwCreateWidget(MwComboBoxClass, "combobox", w, 5, 5, 320, 24);

View file

@ -1,8 +1,8 @@
#include <Mw/Milsko.h>
MwWidget window, menu, button, button2, button3, button4;
MwWidget window, menu, button, button2, button3, button4, button5, button6, button7;
void handler(MwWidget handle, void* user_data, void* call_data) {
void MWAPI handler(MwWidget handle, void* user_data, void* call_data) {
(void)handle;
(void)user_data;
(void)call_data;
@ -10,17 +10,37 @@ void handler(MwWidget handle, void* user_data, void* call_data) {
printf("hello world!\n");
}
int toggle = 0;
void handler_dark(MwWidget handle, void* user_data, void* call_data) {
void MWAPI handler_theme(MwWidget handle, void* user_data, void* call_data) {
(void)handle;
(void)user_data;
(void)call_data;
toggle = toggle ? 0 : 1;
MwToggleDarkTheme(window, toggle);
MwVaApply(window,
MwNdarkTheme, MwGetInteger(window, MwNdarkTheme) == 0 ? 1 : 0,
NULL);
}
void resize(MwWidget handle, void* user_data, void* call_data) {
void MWAPI handler_look(MwWidget handle, void* user_data, void* call_data) {
(void)handle;
(void)user_data;
(void)call_data;
MwVaApply(window,
MwNmodernLook, MwGetInteger(window, MwNmodernLook) == 0 ? 1 : 0,
NULL);
}
void MWAPI handler_font(MwWidget handle, void* user_data, void* call_data) {
(void)handle;
(void)user_data;
(void)call_data;
MwVaApply(window,
MwNbitmapFont, MwGetInteger(window, MwNbitmapFont) == 0 ? 1 : 0,
NULL);
}
void MWAPI resize(MwWidget handle, void* user_data, void* call_data) {
unsigned int w, h, mh;
(void)user_data;
@ -31,23 +51,42 @@ void resize(MwWidget handle, void* user_data, void* call_data) {
MwVaApply(button,
MwNy, 50 + mh,
MwNwidth, w - 50 * 2,
MwNwidth, (w - 50 * 2) / 4,
MwNheight, h - 125 - 50 * 3,
NULL);
MwVaApply(button2,
MwNx, 50 + (w - 50 * 2) / 4,
MwNy, 50 + mh,
MwNwidth, (w - 50 * 2) / 4,
MwNheight, h - 125 - 50 * 3,
NULL);
MwVaApply(button3,
MwNx, 50 + (w - 50 * 2) / 4 * 2,
MwNy, 50 + mh,
MwNwidth, (w - 50 * 2) / 4,
MwNheight, h - 125 - 50 * 3,
NULL);
MwVaApply(button7,
MwNx, 50 + (w - 50 * 2) / 4 * 3,
MwNy, 50 + mh,
MwNwidth, (w - 50 * 2) / 4,
MwNheight, h - 125 - 50 * 3,
NULL);
MwVaApply(button4,
MwNx, 50 + (w - 50 * 2) / 3 * 0,
MwNy, h - 50 - 125 + mh,
MwNwidth, (w - 50 * 2) / 3,
NULL);
MwVaApply(button3,
MwVaApply(button5,
MwNx, 50 + (w - 50 * 2) / 3 * 1,
MwNy, h - 50 - 125 + mh,
MwNwidth, (w - 50 * 2) / 3,
NULL);
MwVaApply(button4,
MwVaApply(button6,
MwNx, 50 + (w - 50 * 2) / 3 * 2,
MwNy, h - 50 - 125 + mh,
MwNwidth, (w - 50 * 2) / 3,
@ -63,30 +102,42 @@ int main() {
MwNtitle, "hello world",
NULL);
menu = MwCreateWidget(MwMenuClass, "menu", window, 0, 0, 0, 0);
button = MwVaCreateWidget(MwButtonClass, "button", window, 50, 50, 300, 125,
MwNtext, "toggle dark theme",
button = MwVaCreateWidget(MwButtonClass, "button", window, 50, 50, 100, 125,
MwNtext, "theme",
NULL);
button2 = MwVaCreateWidget(MwButtonClass, "button", window, 50, 225, 100, 125,
button2 = MwVaCreateWidget(MwButtonClass, "button", window, 150, 50, 100, 125,
MwNtext, "look",
NULL);
button3 = MwVaCreateWidget(MwButtonClass, "button", window, 250, 50, 100, 125,
MwNtext, "font",
NULL);
button4 = MwVaCreateWidget(MwButtonClass, "button", window, 50, 225, 100, 125,
MwNtext, "lorem ipsum",
MwNbackground, "#f66",
MwNforeground, "#000",
NULL);
button3 = MwVaCreateWidget(MwButtonClass, "button", window, 150, 225, 100, 125,
button5 = MwVaCreateWidget(MwButtonClass, "button", window, 150, 225, 100, 125,
MwNtext, "lorem ipsum",
MwNbackground, "#6f6",
MwNforeground, "#000",
NULL);
button4 = MwVaCreateWidget(MwButtonClass, "button", window, 250, 225, 100, 125,
button6 = MwVaCreateWidget(MwButtonClass, "button", window, 250, 225, 100, 125,
MwNtext, "lorem ipsum",
MwNbackground, "#66f",
MwNforeground, "#000",
NULL);
button7 = MwVaCreateWidget(MwButtonClass, "button", window, 250, 50, 100, 125,
MwNtext, "disabled",
MwNdisabled, 1,
NULL);
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
MwAddUserHandler(button, MwNactivateHandler, handler_dark, NULL);
MwAddUserHandler(button2, MwNactivateHandler, handler, NULL);
MwAddUserHandler(button3, MwNactivateHandler, handler, NULL);
MwAddUserHandler(button, MwNactivateHandler, handler_theme, NULL);
MwAddUserHandler(button2, MwNactivateHandler, handler_look, NULL);
MwAddUserHandler(button3, MwNactivateHandler, handler_font, NULL);
MwAddUserHandler(button4, MwNactivateHandler, handler, NULL);
MwAddUserHandler(button5, MwNactivateHandler, handler, NULL);
MwAddUserHandler(button6, MwNactivateHandler, handler, NULL);
resize(window, NULL, NULL);

View file

@ -0,0 +1,70 @@
#include <Mw/Milsko.h>
MwWidget fpicker;
MwWidget window;
MwWidget button;
MwWidget mb;
MwBool fpicker_wait = MwFALSE;
MwBool msgbox_wait = MwFALSE;
void MWAPI ok(MwWidget handle, void* user, void* call) {
(void)handle;
(void)call;
msgbox_wait = MwFALSE;
}
void MWAPI file_callback(MwWidget handle, void* user_data, void* call_data) {
mb = MwMessageBox(handle, call_data, "File chosen", MwMB_ICONERROR | MwMB_BUTTONOK);
(void)user_data;
MwAddUserHandler(MwMessageBoxGetChild(mb, MwMB_BUTTONOK), MwNactivateHandler, ok, mb);
MwAddUserHandler(mb, MwNcloseHandler, ok, mb);
msgbox_wait = MwTRUE;
while(msgbox_wait) {
MwStep(mb);
}
fpicker_wait = MwFALSE;
}
void MWAPI file_picker(MwWidget handle, void* user_data, void* call_data) {
fpicker = MwFileChooserEx(handle, "file chooser", 0);
(void)handle;
(void)user_data;
(void)call_data;
MwAddUserHandler(fpicker, MwNfileChosenHandler, file_callback, NULL);
MwSetText(fpicker, MwNbackground, MwGetInteger(fpicker, MwNdarkTheme) ? MwDefaultDarkBackground : MwDefaultBackground);
fpicker_wait = MwTRUE;
while(fpicker_wait) {
MwStep(fpicker);
}
MwDestroyWidget(fpicker);
MwDestroyWidget(mb);
}
int main() {
MwLibraryInit();
window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT,
MwDEFAULT, 640, 480, MwNtitle, "color picker", NULL);
MwSetText(window, MwNbackground, MwGetInteger(window, MwNdarkTheme) ? MwDefaultBackground : MwDefaultDarkBackground);
button = MwVaCreateWidget(MwButtonClass, "button", window, 160, 180, 320, 120,
MwNtext, "select file",
NULL);
MwSetText(button, MwNbackground, MwGetInteger(window, MwNdarkTheme) ? MwDefaultBackground : MwDefaultDarkBackground);
MwAddUserHandler(button, MwNactivateHandler, file_picker, NULL);
MwLoop(window);
}

View file

@ -1,20 +1,20 @@
#include <Mw/Milsko.h>
int main() {
MwWidget window, image, image2, image3;
MwWidget window, image, image2, image3;
MwLLPixmap px, px2, px3;
MwLibraryInit();
window = MwVaCreateWidget(MwWindowClass, "window", NULL, MwDEFAULT, MwDEFAULT, 500, 500,
MwNtitle, "image image",
NULL);
image = MwCreateWidget(MwImageClass, "image", window, 50, 50, 200, 400);
image2 = MwCreateWidget(MwImageClass, "image", window, 250, 50, 200, 200);
image3 = MwCreateWidget(MwImageClass, "image", window, 250, 250, 200, 200);
px = MwLoadImage(window, "examples/picture.png");
px2 = MwLoadImage(window, "examples/picture.jpg");
px3 = MwLoadImage(window, "resource/logo/logo.png");
window = MwVaCreateWidget(MwWindowClass, "window", NULL, MwDEFAULT, MwDEFAULT, 500, 500,
MwNtitle, "image image",
NULL);
image = MwCreateWidget(MwImageClass, "image", window, 50, 50, 200, 400);
image2 = MwCreateWidget(MwImageClass, "image", window, 250, 50, 200, 200);
image3 = MwCreateWidget(MwImageClass, "image", window, 250, 250, 200, 200);
px = MwLoadImage(window, "examples/picture.png");
px2 = MwLoadImage(window, "examples/picture.jpg");
px3 = MwLoadImage(window, "resource/logo/logo.png");
if(px == NULL) px = MwLoadImage(window, "../examples/picture.png");
if(px2 == NULL) px2 = MwLoadImage(window, "../examples/picture.jpg");

View file

@ -2,67 +2,60 @@
#include "../harvard.c"
MwWidget wmain;
MwWidget w_main;
void destroy(MwWidget handle, void* user, void* call) {
void MWAPI destroy(MwWidget handle, void* user, void* call) {
(void)handle;
(void)call;
MwMessageBoxDestroy(user);
MwDestroyWidget(user);
}
void activate(MwWidget handle, void* user, void* call) {
void MWAPI activate(MwWidget handle, void* user, void* call) {
char msg[256];
MwWidget msgbox;
(void)user;
sprintf(msg, "You pressed: %s", MwListBoxGet(handle, *(int*)call));
MwStringPrintIntoBuffer(msg, 256, "You pressed: %s", MwListBoxGet(handle, *(int*)call));
msgbox = MwMessageBox(wmain, msg, "wow", MwMB_ICONINFO | MwMB_BUTTONOK);
msgbox = MwMessageBox(w_main, msg, "wow", MwMB_ICONINFO | MwMB_BUTTONOK);
MwAddUserHandler(MwMessageBoxGetChild(msgbox, MwMB_BUTTONOK), MwNactivateHandler, destroy, msgbox);
}
int main() {
MwWidget lb;
int len = sizeof(harvard) / sizeof(harvard[0]) - 1;
int i;
MwListBoxPacket* packet;
int index;
MwWidget lb;
int len = sizeof(harvard) / sizeof(harvard[0]) - 1;
int i;
int index;
MwLLPixmap px;
MwLibraryInit();
wmain = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 640, 480,
MwNtitle, "listbox",
NULL);
lb = MwCreateWidget(MwListBoxClass, "listbox", wmain, 5, 5, 630, 470);
w_main = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 640, 480,
MwNtitle, "listbox",
NULL);
lb = MwCreateWidget(MwListBoxClass, "listbox", w_main, 5, 5, 630, 470);
px = MwLoadIcon(lb, MwIconInfo);
MwSetInteger(lb, MwNleftPadding, 20);
packet = MwListBoxCreatePacket();
index = MwListBoxPacketInsert(packet, -1);
MwListBoxPacketSet(packet, index, 0, "Harvard sentence");
MwListBoxPacketSet(packet, index, 1, "Length");
index = MwListBoxSet(lb, -1, 0, "Harvard sentence");
MwListBoxSet(lb, index, -1, "Length");
for(i = 0; i < len; i++) {
char sz[16];
sprintf(sz, "%d", (int)strlen(harvard[i]));
index = MwListBoxPacketInsert(packet, -1);
MwListBoxPacketSetIcon(packet, index, px);
MwListBoxPacketSet(packet, index, 0, harvard[i]);
MwListBoxPacketSet(packet, index, 1, sz);
MwStringPrintIntoBuffer(sz, 16, "%d", (int)strlen(harvard[i]));
index = MwListBoxSet(lb, -1, 0, harvard[i]);
MwListBoxSet(lb, index, -1, sz);
MwListBoxSetIcon(lb, index, px);
}
MwAddUserHandler(lb, MwNactivateHandler, activate, NULL);
MwAddUserHandler(lb, MwNlistBoxActivateHandler, activate, NULL);
MwVaApply(lb,
MwNhasHeading, 1,
NULL);
MwListBoxSetWidth(lb, 0, -128);
MwListBoxInsert(lb, -1, packet);
MwListBoxDestroyPacket(packet);
MwLoop(wmain);
MwLoop(w_main);
}

View file

@ -1,30 +1,32 @@
#include <Mw/Milsko.h>
void ok(MwWidget handle, void* user, void* call) {
void MWAPI ok(MwWidget handle, void* user, void* call) {
(void)handle;
(void)call;
MwMessageBoxDestroy(user);
MwDestroyWidget(user);
}
void spawn(MwWidget handle, void* user, void* call) {
void MWAPI spawn(MwWidget handle, void* user, void* call) {
MwWidget mb = MwMessageBox(user, "news has arrived!", "title", MwMB_ICONNEWS | MwMB_BUTTONOK);
(void)handle;
(void)call;
MwAddUserHandler(MwMessageBoxGetChild(mb, MwMB_BUTTONOK), MwNactivateHandler, ok, mb);
MwAddUserHandler(mb, MwNcloseHandler, ok, mb);
}
void spawn2(MwWidget handle, void* user, void* call) {
void MWAPI spawn2(MwWidget handle, void* user, void* call) {
MwWidget mb = MwMessageBox(user, "something went wrong!", "title", MwMB_ICONERROR | MwMB_BUTTONOK);
(void)handle;
(void)call;
MwAddUserHandler(MwMessageBoxGetChild(mb, MwMB_BUTTONOK), MwNactivateHandler, ok, mb);
MwAddUserHandler(mb, MwNcloseHandler, ok, mb);
}
void spawn3(MwWidget handle, void* user, void* call) {
void MWAPI spawn3(MwWidget handle, void* user, void* call) {
int i;
(void)handle;
@ -33,6 +35,7 @@ void spawn3(MwWidget handle, void* user, void* call) {
for(i = 0; i <= MwMB_ICONCLOCK; i++) {
MwWidget mb = MwMessageBox(user, "messagebox test", "title", i | MwMB_BUTTONOK);
MwAddUserHandler(MwMessageBoxGetChild(mb, MwMB_BUTTONOK), MwNactivateHandler, ok, mb);
MwAddUserHandler(mb, MwNcloseHandler, ok, mb);
}
}
@ -41,10 +44,10 @@ int main() {
MwLibraryInit();
msg = MwVaCreateWidget(MwWindowClass, "test", NULL, MwDEFAULT, MwDEFAULT, 300, 100, MwNtitle, "test", NULL);
btn = MwVaCreateWidget(MwButtonClass, "button", msg, 8, 8, 300 - 16, (100 - 16) / 2, MwNtext, "press me!", NULL);
btn2 = MwVaCreateWidget(MwButtonClass, "button", msg, 8, 8 + (100 - 16) / 2, (300 - 16) / 2, (100 - 16) / 2, MwNtext, "press me!", NULL);
btn3 = MwVaCreateWidget(MwButtonClass, "button", msg, 8 + (300 - 16) / 2, 8 + (100 - 16) / 2, (300 - 16) / 2, (100 - 16) / 2, MwNtext, "press me!", NULL);
msg = MwVaCreateWidget(MwWindowClass, "test", NULL, MwDEFAULT, MwDEFAULT, 300, 100, MwNtitle, "test", NULL);
btn = MwVaCreateWidget(MwButtonClass, "button", msg, 8, 8, 300 - 16, (100 - 16) / 2, MwNtext, "press me!", NULL);
btn2 = MwVaCreateWidget(MwButtonClass, "button", msg, 8, 8 + (100 - 16) / 2, (300 - 16) / 2, (100 - 16) / 2, MwNtext, "press me!", NULL);
btn3 = MwVaCreateWidget(MwButtonClass, "button", msg, 8 + (300 - 16) / 2, 8 + (100 - 16) / 2, (300 - 16) / 2, (100 - 16) / 2, MwNtext, "press me!", NULL);
MwAddUserHandler(btn, MwNactivateHandler, spawn, msg);
MwAddUserHandler(btn2, MwNactivateHandler, spawn2, msg);

326
examples/basic/periodic.c Normal file
View file

@ -0,0 +1,326 @@
#include <Mw/Milsko.h>
#include <stdarg.h>
#define Columns 5
#define Padding 20
#define PaddingContent 2
MwWidget window, menu, table;
MwMenu e;
static void MWAPI resize(MwWidget handle, void* user, void* call) {
int w = MwGetInteger(window, MwNwidth);
int h = MwGetInteger(window, MwNheight);
MwVaApply(table,
MwNx, Padding,
MwNy, MwGetInteger(menu, MwNheight) + Padding,
MwNwidth, w - Padding * 2,
MwNheight, h - MwGetInteger(menu, MwNheight) - Padding * 2,
NULL);
}
static void MWAPI resize_content(MwWidget handle, void* user, void* call) {
MwWidget* ws = MwGetChildren(handle);
if(ws != NULL) {
int pw = MwGetInteger(ws[0], "IpWidth");
int ph = MwGetInteger(ws[0], "IpHeight");
if(pw < 0) {
pw += MwGetInteger(handle, MwNwidth);
} else if(pw == 0) {
pw = MwGetInteger(handle, MwNwidth);
}
if(ph < 0) {
ph += MwGetInteger(handle, MwNheight);
} else if(ph == 0) {
ph = MwGetInteger(handle, MwNheight);
}
MwVaApply(ws[0],
MwNx, (MwGetInteger(handle, MwNwidth) - pw) / 2,
MwNy, (MwGetInteger(handle, MwNheight) - ph) / 2,
MwNwidth, pw,
MwNheight, ph,
NULL);
free(ws);
}
}
static void MWAPI resize_frame(MwWidget handle, void* user, void* call) {
MwWidget* ws = MwGetChildren(handle);
if(ws != NULL) {
int w = MwGetInteger(handle, MwNwidth);
int h = MwGetInteger(handle, MwNheight);
if(ws[0] != NULL) {
MwVaApply(ws[0],
MwNx, MwDefaultBorderWidth(handle) + PaddingContent,
MwNy, MwDefaultBorderWidth(handle) + PaddingContent,
MwNwidth, w - (MwDefaultBorderWidth(handle) + PaddingContent) * 2,
MwNheight, h - (MwDefaultBorderWidth(handle) + PaddingContent) * 2,
NULL);
}
free(ws);
}
}
static MwWidget frame(const char* name, int width, int height, MwClass cl, ...) {
MwWidget f = MwVaCreateWidget(MwFrameClass, "frame", table, 0, 0, 0, 0,
MwNhasBorder, 1,
MwNinverted, 1,
NULL);
MwWidget table = MwVaCreateWidget(MwBoxClass, "table", f, 0, 0, 0, 0,
MwNorientation, MwVERTICAL,
NULL);
MwWidget label = MwVaCreateWidget(MwLabelClass, "label", table, 0, 0, 0, 0,
MwNtext, name,
MwNalignment, MwALIGNMENT_BEGINNING,
MwNfixedSize, 20,
NULL);
va_list va;
if(cl != NULL) {
MwWidget frame = MwCreateWidget(MwFrameClass, "frame", table, 0, 0, 0, 0);
MwWidget w;
va_start(va, cl);
w = MwVaListCreateWidget(cl, "widget", frame, 0, 0, 0, 0, va);
va_end(va);
MwVaApply(w,
"IpWidth", width,
"IpHeight", height,
NULL);
MwAddUserHandler(frame, MwNresizeHandler, resize_content, NULL);
MwVaApply(f,
"VhandledWidget", w,
MwNcolumnSpan, MwGetInteger(w, MwNcolumnSpan),
MwNrowSpan, MwGetInteger(w, MwNrowSpan),
NULL);
}
MwAddUserHandler(f, MwNresizeHandler, resize_frame, NULL);
resize_frame(f, NULL, NULL);
return f;
}
static MwWidget child(MwWidget w) {
return MwGetVoid(w, "VhandledWidget");
}
static void MWAPI menu_handler(MwWidget handle, void* user, void* call) {
if(call == e) MwDestroyWidget(window);
}
int main() {
int i, j;
MwWidget f, w, b;
MwLLPixmap px;
int index;
MwMenu m, m2;
void* v;
MwRect rc;
MwLibraryInit();
window = MwVaCreateWidget(MwWindowClass, "window", NULL, MwDEFAULT, MwDEFAULT, 800, 800,
MwNtitle, "Milsko Periodic Table",
NULL);
MwGetScreenSize(window, &rc);
if(rc.height < 800) {
MwVaApply(window,
MwNx, (rc.width - (rc.height - 64)) / 2,
MwNy, (rc.height - (rc.height - 64)) / 2,
MwNwidth, rc.height - 64,
MwNheight, rc.height - 64,
NULL);
}
px = MwLoadIcon(window, MwIconError);
menu = MwCreateWidget(MwMenuClass, "menu", window, 0, 0, 0, 0);
m = MwMenuAdd(menu, NULL, "File");
MwMenuAdd(menu, m, "New");
MwMenuAdd(menu, m, "Open");
MwMenuAdd(menu, m, "Save");
MwMenuAdd(menu, m, "Save As");
MwMenuAdd(menu, m, "Print");
e = MwMenuAdd(menu, m, "Exit");
m = MwMenuAdd(menu, NULL, "Edit");
MwMenuAdd(menu, m, "Undo");
MwMenuAdd(menu, m, "----");
MwMenuAdd(menu, m, "Cut");
MwMenuAdd(menu, m, "Copy");
MwMenuAdd(menu, m, "Paste");
MwMenuAdd(menu, m, "----");
MwMenuAdd(menu, m, "Clear");
MwMenuAdd(menu, m, "Delete");
m = MwMenuAdd(menu, NULL, "View");
MwMenuAdd(menu, m, "Stack");
MwMenuAdd(menu, m, "Tile");
MwMenuAdd(menu, m, "----");
MwMenuAdd(menu, m, "Day");
MwMenuAdd(menu, m, "Week");
MwMenuAdd(menu, m, "Month");
MwMenuAdd(menu, m, "Year");
m = MwMenuAdd(menu, NULL, "Options");
m2 = MwMenuAdd(menu, m, "Font");
MwMenuAdd(menu, m2, "Small");
MwMenuAdd(menu, m2, "Medium");
MwMenuAdd(menu, m2, "Large");
m2 = MwMenuAdd(menu, m, "Direction");
MwMenuAdd(menu, m2, "Up");
MwMenuAdd(menu, m2, "Down");
MwMenuAdd(menu, m2, "Left");
MwMenuAdd(menu, m2, "Right");
MwMenuAdd(menu, m, "Case Sensitive");
MwMenuAdd(menu, m, "Word Wrap");
m = MwMenuAdd(menu, NULL, "?Help");
MwMenuAdd(menu, m, "On Context");
MwMenuAdd(menu, m, "On Window");
MwMenuAdd(menu, m, "Tutorial");
MwMenuAdd(menu, m, "On Version");
MwAddUserHandler(menu, MwNmenuHandler, menu_handler, NULL);
table = MwVaCreateWidget(MwTableClass, "table", window, 0, 0, 0, 0,
MwNwaitLayout, 1,
MwNcolumns, 5,
NULL);
f = frame("Button", -PaddingContent, -PaddingContent, MwBoxClass,
MwNorientation, MwVERTICAL,
NULL);
b = MwVaCreateWidget(MwButtonClass, "btn", child(f), 0, 0, 0, 0,
MwNtext, "Press me",
NULL);
b = MwVaCreateWidget(MwButtonClass, "btn_disabled", child(f), 0, 0, 0, 0,
MwNtext, "Cannot press me",
MwNdisabled, 1,
NULL);
MwVaCreateWidget(MwLabelClass, "label", table, 0, 0, 0, 0,
MwNbold, 1,
MwNtext, "The Periodic Table of Milsko Widgets",
MwNcolumnSpan, Columns - 2,
NULL);
for(i = 0; i < 2; i++) {
f = frame(i == 0 ? "CheckBox" : "RadioBox", -PaddingContent, -PaddingContent, MwBoxClass,
MwNmargin, PaddingContent,
NULL);
w = child(f);
b = MwVaCreateWidget(MwBoxClass, "table1", w, 0, 0, 0, 0,
MwNorientation, MwVERTICAL,
MwNfixedSize, 16,
NULL);
for(j = 0; j < 6; j++) MwVaCreateWidget(i == 0 ? MwCheckBoxClass : MwRadioBoxClass, i == 0 ? "cb" : "rb", b, 0, 0, 0, 0, MwNdisabled, (j == 5) ? 1 : 0, NULL);
b = MwVaCreateWidget(MwBoxClass, "table1", w, 0, 0, 0, 0,
MwNorientation, MwVERTICAL,
NULL);
for(j = 0; j < 6; j++) {
char buf[32];
sprintf(buf, "%sBox %d", i == 0 ? "Check" : "Radio", j + 1);
MwVaCreateWidget(MwLabelClass, "label", b, 0, 0, 0, 0,
MwNtext, buf,
MwNalignment, MwALIGNMENT_BEGINNING,
NULL);
}
}
f = frame("Calendar", -PaddingContent, -PaddingContent, MwCalendarClass,
MwNscale, 1,
NULL);
f = frame("ComboBox", -PaddingContent, 24, MwComboBoxClass, NULL);
w = child(f);
MwComboBoxAdd(w, -1, "Hello!");
f = frame("Entry", -PaddingContent, 24, MwEntryClass, NULL);
f = frame("Image", -PaddingContent, -PaddingContent, MwImageClass,
MwNpixmap, px,
NULL);
f = frame("Label", -PaddingContent, -PaddingContent, MwLabelClass,
MwNtext, "Epic text\nNewline can be used too!",
NULL);
f = frame("ListBox", -PaddingContent, -PaddingContent, MwListBoxClass,
MwNhasHeading, 1,
NULL);
w = child(f);
index = MwListBoxSet(w, -1, 0, "Epic title...");
index = MwListBoxSet(w, -1, 0, "Hello");
f = frame("NumberEntry", -PaddingContent, 24, MwNumberEntryClass, NULL);
f = frame("ProgressBar", -PaddingContent, 24, MwProgressBarClass,
MwNvalue, 25,
NULL);
f = frame("ScrollBar", -PaddingContent, 16, MwScrollBarClass,
MwNorientation, MwHORIZONTAL,
NULL);
f = frame("Separator", -PaddingContent, -PaddingContent, MwSeparatorClass, NULL);
f = frame("SubWindow", -PaddingContent, -PaddingContent, MwViewportClass,
MwNcolumnSpan, 2,
NULL);
w = child(f);
MwViewportSetSize(w, 512, 512);
MwVaCreateWidget(MwSubWindowClass, "swnd", MwViewportGetViewport(w), 32, 32, 256, 128,
MwNtitle, "Sub window",
NULL);
MwVaCreateWidget(MwSubWindowClass, "swnd", MwViewportGetViewport(w), 64, 64, 256, 128,
MwNtitle, "Sub window 2",
NULL);
f = frame("Tab", -PaddingContent, -PaddingContent, MwTabClass,
MwNcolumnSpan, 2,
NULL);
w = child(f);
MwSetText(MwTabAdd(w, "ABC"), MwNbackground, "#f00");
MwSetText(MwTabAdd(w, "DEF"), MwNbackground, "#0f0");
MwSetText(MwTabAdd(w, "GHI"), MwNbackground, "#00f");
f = frame("TreeView", -PaddingContent, -PaddingContent, MwTreeViewClass, NULL);
w = child(f);
v = MwTreeViewAdd(w, NULL, NULL, "abc");
v = MwTreeViewAdd(w, v, NULL, "def");
v = MwTreeViewAdd(w, v, NULL, "ghi");
f = frame("Viewport", -PaddingContent, -PaddingContent, MwViewportClass, NULL);
w = child(f);
MwViewportSetSize(w, 256, 256);
MwVaCreateWidget(MwButtonClass, "btn", MwViewportGetViewport(w), 64, 64, 128, 128,
MwNtext, "Thing",
NULL);
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
resize(window, NULL, NULL);
MwVaApply(table,
MwNwaitLayout, 0,
NULL);
MwLoop(window);
MwLLDestroyPixmap(px);
}

View file

@ -5,12 +5,12 @@ int main() {
MwLibraryInit();
w = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 5 + 640 + 5, 5 + 32 + 5,
MwNtitle, "progress bar",
NULL);
p = MwVaCreateWidget(MwProgressBarClass, "progress", w, 5, 5, 640, 32,
MwNvalue, 25,
NULL);
w = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 5 + 640 + 5, 5 + 32 + 5,
MwNtitle, "progress bar",
NULL);
p = MwVaCreateWidget(MwProgressBarClass, "progress", w, 5, 5, 640, 32,
MwNvalue, 25,
NULL);
(void)p;

View file

@ -6,8 +6,8 @@ int main() {
MwLibraryInit();
window = MwVaCreateWidget(MwWindowClass, "test", NULL, MwDEFAULT, MwDEFAULT, 8 + 16 + 8 + 16 * 10 + 8, 8 + 16 + 8 + 16 + 8,
MwNtitle, "radiobox",
NULL);
MwNtitle, "radiobox",
NULL);
MwVaCreateWidget(MwRadioBoxClass, "cb1", window, 8, 8, 16, 16,
NULL);

View file

@ -14,7 +14,7 @@ double deg = 0;
int ww, wh;
void handler(MwWidget w, void* user, void* client) {
void MWAPI handler(MwWidget w, void* user, void* client) {
int i;
double cdeg = deg;
@ -44,7 +44,7 @@ void handler(MwWidget w, void* user, void* client) {
deg += 120.0 / (1000.0 / MwWaitMS);
}
void resize(MwWidget w, void* user, void* client) {
void MWAPI resize(MwWidget w, void* user, void* client) {
(void)w;
(void)user;
(void)client;
@ -55,13 +55,13 @@ void resize(MwWidget w, void* user, void* client) {
int main() {
MwWidget window;
int i;
int i;
MwLibraryInit();
window = MwVaCreateWidget(MwWindowClass, "window", NULL, MwDEFAULT, MwDEFAULT, (ww = 500), (wh = 500),
MwNtitle, "rotate",
NULL);
MwNtitle, "rotate",
NULL);
for(i = 0; i < (int)(sizeof(buttons) / sizeof(buttons[0])); i++) {
const char* color = "";

View file

@ -1,15 +1,14 @@
#include <Mw/Milsko.h>
int main() {
MwWidget window;
int i;
int i;
MwLibraryInit();
window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 500, 500,
MwNtitle, "main",
NULL);
MwNtitle, "main",
NULL);
for(i = 0; i < 500 / 16; i++) {
MwVaCreateWidget(MwScrollBarClass, "scroll", window, 16 * i, 0, 16, 500,

View file

@ -0,0 +1,23 @@
#include <Mw/Milsko.h>
int main() {
MwWidget wnd, label;
int W = 480, H = 40;
MwLibraryInit();
wnd = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, W, H,
MwNtitle, "seven segment",
NULL);
label = MwVaCreateWidget(MwLabelClass, "label", wnd, 0, 0, W, H,
MwNtext, " 123456:78.90 abcdef",
MwNsevenSegment, 1,
MwNalignment, MwALIGNMENT_BEGINNING,
MwNlength, 8,
NULL);
MwLabelSetSevenSegment(label, 0, (1 << 0) | (1 << 3) | (1 << 6));
MwLoop(wnd);
}

View file

@ -0,0 +1,52 @@
#include <Mw/Milsko.h>
#define Shift 16
static void MWAPI resize(MwWidget handle, void* user, void* client) {
MwWidget f = MwSubWindowGetFrame(handle);
MwVaApply(user,
MwNwidth, MwGetInteger(f, MwNwidth),
MwNheight, MwGetInteger(f, MwNheight),
NULL);
}
int main() {
MwWidget w;
int i;
MwLLPixmap px[6];
MwLibraryInit();
w = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 800, 600,
MwNtitle, "subwindow",
NULL);
px[0] = MwLoadIcon(w, MwIconClock);
px[1] = MwLoadIcon(w, MwIconError);
px[2] = MwLoadIcon(w, MwIconInfo);
px[3] = MwLoadIcon(w, MwIconNews);
px[4] = MwLoadIcon(w, MwIconNote);
px[5] = MwLoadIcon(w, MwIconWarning);
for(i = 0; i < 16; i++) {
char buf[32];
MwWidget sw, f, img;
sprintf(buf, "Sub window %d", i);
sw = MwVaCreateWidget(MwSubWindowClass, "swnd", w, i * Shift, i * Shift, 128, 128,
MwNtitle, buf,
MwNiconPixmap, px[rand() % 6],
NULL);
f = MwSubWindowGetFrame(sw);
img = MwVaCreateWidget(MwImageClass, "img", f, 0, 0, MwGetInteger(f, MwNwidth), MwGetInteger(f, MwNheight),
MwNpixmap, px[rand() % 6],
NULL);
MwAddUserHandler(sw, MwNresizeHandler, resize, img);
}
MwLoop(w);
}

43
examples/basic/tab.c Normal file
View file

@ -0,0 +1,43 @@
#include <Mw/Milsko.h>
MwWidget tab;
static void MWAPI resize(MwWidget handle, void* user, void* client) {
MwVaApply(tab,
MwNwidth, MwGetInteger(handle, MwNwidth),
MwNheight, MwGetInteger(handle, MwNheight),
NULL);
}
int main() {
MwWidget w;
int i;
MwLLPixmap px[6];
MwLibraryInit();
w = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 800, 600,
MwNtitle, "subwindow",
NULL);
tab = MwCreateWidget(MwTabClass, "tab", w, 0, 0, 800, 600);
for(i = 0; i < 16; i++) {
char buf[32];
MwWidget sw, f, img;
sprintf(buf, "Tab %d", i);
MwTabAdd(tab, buf);
}
MwVaApply(MwTabGetFrame(tab, "Tab 1"),
MwNiconPixmap, MwLoadIcon(tab, MwIconWarning),
NULL);
MwAddUserHandler(w, MwNresizeHandler, resize, NULL);
resize(w, NULL, NULL);
MwLoop(w);
}

View file

@ -2,34 +2,34 @@
MwWidget wmain;
void destroy(MwWidget handle, void* user, void* call) {
void MWAPI destroy(MwWidget handle, void* user, void* call) {
(void)handle;
(void)call;
MwMessageBoxDestroy(user);
MwDestroyWidget(user);
}
void activate(MwWidget handle, void* user, void* call) {
void MWAPI activate(MwWidget handle, void* user, void* call) {
char msg[256];
MwWidget msgbox;
(void)user;
sprintf(msg, "You pressed: %s", MwTreeViewGet(handle, call));
MwStringPrintIntoBuffer(msg, 256, "You pressed: %s", MwTreeViewGet(handle, call));
msgbox = MwMessageBox(wmain, msg, "wow", MwMB_ICONINFO | MwMB_BUTTONOK);
MwAddUserHandler(MwMessageBoxGetChild(msgbox, MwMB_BUTTONOK), MwNactivateHandler, destroy, msgbox);
}
int main(){
MwWidget tv;
int main() {
MwWidget tv;
MwLLPixmap px;
int i;
void* p = NULL, *r;
int i;
void * p = NULL, *r;
MwLibraryInit();
wmain = MwCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 5 + 640 + 5, 5 + 480 + 5);
tv = MwCreateWidget(MwTreeViewClass, "tree", wmain, 5, 5, 640, 480);
tv = MwCreateWidget(MwTreeViewClass, "tree", wmain, 5, 5, 640, 480);
px = MwLoadIcon(tv, MwIconInfo);
@ -37,7 +37,7 @@ int main(){
MwAddUserHandler(tv, MwNactivateHandler, activate, NULL);
for(i = 0; i < 10; i++){
for(i = 0; i < 10; i++) {
void* old = p;
MwTreeViewAdd(tv, old, px, "World");

View file

@ -2,7 +2,7 @@
MwWidget vp;
static void resize(MwWidget handle, void* user, void* call) {
static void MWAPI resize(MwWidget handle, void* user, void* call) {
int w = MwGetInteger(handle, MwNwidth);
int h = MwGetInteger(handle, MwNheight);
@ -10,8 +10,8 @@ static void resize(MwWidget handle, void* user, void* call) {
(void)call;
MwVaApply(vp,
MwNwidth, w - 10,
MwNheight, h - 10,
MwNwidth, w - 10 - 100,
MwNheight, h - 10 - 100,
NULL);
}
@ -23,7 +23,7 @@ int main() {
w = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 640, 480, MwNtitle, "test", NULL);
vp = MwCreateWidget(MwViewportClass, "vp", w, 5, 5, 630, 470);
vp = MwCreateWidget(MwViewportClass, "vp", w, 5 + 50, 5 + 50, 640 - 10 - 100, 480 - 10 - 100);
px = MwLoadImage(vp, "examples/picture.png");

View file

@ -0,0 +1,27 @@
file(
GLOB
EXAMPLES_GL_SOURCES
*.c
)
find_package(OpenGL)
foreach(PATH IN LISTS EXAMPLES_GL_SOURCES)
get_filename_component(TARGET ${PATH} NAME_WE)
if(${TARGET} STREQUAL "glutlayer")
continue()
endif()
add_executable(${TARGET} MACOSX_BUNDLE ${PATH})
target_link_libraries(
${TARGET}
PRIVATE
Mw
OpenGL::GL OpenGL::GLU
)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_link_libraries(
${TARGET}
PRIVATE
m
)
endif()
endforeach()

View file

@ -13,7 +13,7 @@ double deg2rad(double deg) {
return (360.0 - deg) / 180.0 * M_PI;
}
void tick(MwWidget handle, void* user, void* call) {
void MWAPI tick(MwWidget handle, void* user, void* call) {
time_t t = time(NULL);
int i;
double rad;
@ -32,10 +32,10 @@ void tick(MwWidget handle, void* user, void* call) {
char buf[512];
tm = localtime(&t);
sprintf(buf, "%s %02d %s", mon[tm->tm_mon], tm->tm_mday, wday[tm->tm_wday]);
MwStringPrintIntoBuffer(buf, 512, "%s %02d %s", mon[tm->tm_mon], tm->tm_mday, wday[tm->tm_wday]);
MwSetText(ldate, MwNtext, buf);
sprintf(buf, "%02d:%02d %s", tm->tm_hour % 12, tm->tm_min, tm->tm_hour >= 12 ? "PM" : "AM");
MwStringPrintIntoBuffer(buf, 512, "%02d:%02d %s", tm->tm_hour % 12, tm->tm_min, tm->tm_hour >= 12 ? "PM" : "AM");
MwSetText(ltime, MwNtext, buf);
render = 1;
@ -104,7 +104,7 @@ void tick(MwWidget handle, void* user, void* call) {
MwOpenGLSwapBuffer(opengl);
}
void resize(MwWidget handle, void* user, void* call) {
void MWAPI resize(MwWidget handle, void* user, void* call) {
int w = MwGetInteger(handle, MwNwidth);
int h = MwGetInteger(handle, MwNheight);
@ -142,10 +142,10 @@ int main() {
NULL);
bgcolor = MwParseColor(window, MwGetText(window, MwNbackground));
MwGetColor(bgcolor, &br, &bg, &bb);
MwColorGet(bgcolor, &br, &bg, &bb);
fgcolor = MwParseColor(window, MwGetText(window, MwNforeground));
MwGetColor(fgcolor, &fr, &fg, &fb);
MwColorGet(fgcolor, &fr, &fg, &fb);
opengl = MwCreateWidget(MwOpenGLClass, "clock", window, 0, 0, 100, 100);

View file

@ -1,7 +1,13 @@
#define TITLE "cube"
#include "glutlayer.c"
#if defined(__APPLE__)
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h>
#include <GL/glu.h>
#endif
static double deg = 0;
@ -15,12 +21,18 @@ static void draw(void) {
glRotatef(deg, 0, 0, 1);
for(i = 0; i < 6; i++) {
if(i == 0) glColor3f(1, 0, 0);
if(i == 1) glColor3f(0, 1, 0);
if(i == 2) glColor3f(1, 1, 0);
if(i == 3) glColor3f(0, 0, 1);
if(i == 4) glColor3f(1, 0, 1);
if(i == 5) glColor3f(0, 1, 1);
if(i == 0)
glColor3f(1, 0, 0);
if(i == 1)
glColor3f(0, 1, 0);
if(i == 2)
glColor3f(1, 1, 0);
if(i == 3)
glColor3f(0, 0, 1);
if(i == 4)
glColor3f(1, 0, 1);
if(i == 5)
glColor3f(0, 1, 1);
glBegin(GL_QUADS);
glNormal3f(0, 1, 0);
@ -30,9 +42,12 @@ static void draw(void) {
glVertex3f(1, 1, -1);
glEnd();
if(i < 3) glRotatef(90, 0, 0, 1);
if(i == 3) glRotatef(90, 1, 0, 0);
if(i == 4) glRotatef(180, 0, 0, 1);
if(i < 3)
glRotatef(90, 0, 0, 1);
if(i == 3)
glRotatef(90, 1, 0, 0);
if(i == 4)
glRotatef(180, 0, 0, 1);
}
glPopMatrix();
}

View file

@ -231,13 +231,13 @@ static void init(void) {
static void key(int k) {
(void)k;
if(k == MwLLKeyLeft) {
if(k == MwKEY_LEFT) {
view_roty += 5.0;
} else if(k == MwLLKeyRight) {
} else if(k == MwKEY_RIGHT) {
view_roty -= 5.0;
} else if(k == MwLLKeyUp) {
} else if(k == MwKEY_UP) {
view_rotx += 5.0;
} else if(k == MwLLKeyDown) {
} else if(k == MwKEY_DOWN) {
view_rotx -= 5.0;
}
}

View file

@ -9,7 +9,7 @@ static void reshape(int width, int height);
static void init(void);
static void key(int k);
static void tick(MwWidget handle, void* user, void* client) {
static void MWAPI tick(MwWidget handle, void* user, void* client) {
(void)handle;
(void)user;
(void)client;
@ -20,7 +20,7 @@ static void tick(MwWidget handle, void* user, void* client) {
MwOpenGLSwapBuffer(opengl);
}
static void resize(MwWidget handle, void* user, void* client) {
static void MWAPI resize(MwWidget handle, void* user, void* client) {
int ww, wh;
(void)user;
@ -37,7 +37,7 @@ static void resize(MwWidget handle, void* user, void* client) {
reshape(ww, wh);
}
static void key_pressed(MwWidget handle, void* user, void* client) {
static void MWAPI key_pressed(MwWidget handle, void* user, void* client) {
(void)handle;
(void)user;
@ -53,18 +53,21 @@ int main() {
MwNtitle, TITLE,
NULL);
opengl = MwCreateWidget(MwOpenGLClass, "opengl", window, 50, 50, 400, 400);
if(!opengl) {
MwMessageBox(NULL, "Unable to create OpenGL window.", "Error", MwMB_ICONERROR);
} else {
MwOpenGLMakeCurrent(opengl);
MwOpenGLMakeCurrent(opengl);
init();
reshape(400, 400);
init();
reshape(400, 400);
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
MwAddUserHandler(opengl, MwNtickHandler, tick, NULL);
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
MwAddUserHandler(opengl, MwNtickHandler, tick, NULL);
MwAddTickList(opengl);
MwAddTickList(opengl);
MwAddUserHandler(opengl, MwNkeyHandler, key_pressed, NULL);
MwAddUserHandler(opengl, MwNkeyHandler, key_pressed, NULL);
}
MwLoop(window);
}

View file

@ -6,7 +6,7 @@ int ow, oh;
double deg = 0;
double dir = 1;
void resize(MwWidget handle, void* user_data, void* call_data) {
void MWAPI resize(MwWidget handle, void* user_data, void* call_data) {
unsigned int w, h;
(void)user_data;
@ -27,7 +27,7 @@ void resize(MwWidget handle, void* user_data, void* call_data) {
NULL);
}
void tick(MwWidget handle, void* user_data, void* call_data) {
void MWAPI tick(MwWidget handle, void* user_data, void* call_data) {
(void)handle;
(void)user_data;
(void)call_data;
@ -61,7 +61,7 @@ void tick(MwWidget handle, void* user_data, void* call_data) {
deg += 120.0 / (1000.0 / MwWaitMS) * dir;
}
void activate(MwWidget handle, void* user_data, void* call_data) {
void MWAPI activate(MwWidget handle, void* user_data, void* call_data) {
(void)handle;
(void)user_data;
(void)call_data;

View file

@ -17,7 +17,7 @@ int ct = 0;
int click = 0;
int mx, my;
static void tick(MwWidget handle, void* user, void* call) {
static void MWAPI tick(MwWidget handle, void* user, void* call) {
int i;
int w = MwGetInteger(opengl, MwNwidth);
int h = MwGetInteger(opengl, MwNheight);
@ -50,13 +50,13 @@ static void tick(MwWidget handle, void* user, void* call) {
MwOpenGLSwapBuffer(opengl);
}
static void mouse(MwWidget handle, void* user, void* call) {
MwLLMouse* mouse = call;
static void MWAPI mouse(MwWidget handle, void* user, void* call) {
MwMouse* mouse = call;
(void)handle;
(void)user;
if(mouse->button == MwLLMouseLeft) {
if(mouse->button == MwMOUSE_LEFT) {
t[ct].points[click * 2 + 0] = mouse->point.x;
t[ct].points[click * 2 + 1] = mouse->point.y;
click++;
@ -82,7 +82,7 @@ static void mouse(MwWidget handle, void* user, void* call) {
for(i = 0; i < ct; i++) t[i] = old[i];
free(old);
}
} else if(mouse->button == MwLLMouseRight) {
} else if(mouse->button == MwMOUSE_RIGHT) {
if(click > 0) {
click = 0;
} else if(ct > 0) {
@ -91,7 +91,7 @@ static void mouse(MwWidget handle, void* user, void* call) {
}
}
static void mouse_move(MwWidget handle, void* user, void* call) {
static void MWAPI mouse_move(MwWidget handle, void* user, void* call) {
MwPoint* point = call;
(void)handle;
@ -108,14 +108,14 @@ static void mouse_move(MwWidget handle, void* user, void* call) {
int main() {
MwSizeHints hints;
MwWidget window, viewport;
MwWidget window, viewport;
MwLibraryInit();
window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 640, 480,
MwNtitle, "tripaint",
NULL);
viewport = MwCreateWidget(MwViewportClass, "viewport", window, 5, 5, 630, 470 - 16 - 5);
window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 640, 480,
MwNtitle, "tripaint",
NULL);
viewport = MwCreateWidget(MwViewportClass, "viewport", window, 5, 5, 630, 470 - 16 - 5);
hints.min_width = hints.max_width = 640;
hints.min_height = hints.max_height = 480;
@ -125,13 +125,12 @@ int main() {
MwNtext, "Press left click to draw triangle, right click to undo",
NULL);
MwViewportSetSize(viewport, 1024, 768);
t = malloc(sizeof(*t));
opengl = MwCreateWidget(MwOpenGLClass, "opengl", MwViewportGetViewport(viewport), 0, 0, 1024, 768);
opengl = MwCreateWidget(MwOpenGLClass, "opengl", viewport, 0, 0, 1024, 768);
MwAddUserHandler(window, MwNtickHandler, tick, NULL);
MwAddUserHandler(opengl, MwNtickHandler, tick, NULL);
MwAddUserHandler(opengl, MwNmouseDownHandler, mouse, NULL);
MwAddUserHandler(opengl, MwNmouseMoveHandler, mouse_move, NULL);

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,30 @@
file(
GLOB
EXAMPLES_VULKAN_SOURCES
*.c
)
find_package(Vulkan)
if(${Vulkan_FOUND})
foreach(PATH IN LISTS EXAMPLES_VULKAN_SOURCES)
get_filename_component(TARGET ${PATH} NAME_WE)
add_executable(${TARGET} MACOSX_BUNDLE ${PATH})
target_include_directories(
${TARGET}
PRIVATE
${Vulkan_INCLUDE_DIR}
)
target_link_libraries(
${TARGET}
PRIVATE
Mw
)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_link_libraries(
${TARGET}
PRIVATE
m
)
endif()
endforeach()
endif()

View file

@ -1,11 +1,3 @@
/**
* this example is quite minimal, you may need to modify it if your graphics card is more esoteric
*
* ioixd maintains this file. nishi doesn't know vulkan at all
*/
#include "Mw/Error.h"
#include <Mw/Milsko.h>
#include <Mw/Widget/Vulkan.h>
@ -17,7 +9,7 @@
char buffer[512];
char* string_VkResult(VkResult res) {
sprintf(buffer, "%d", res);
MwStringPrintIntoBuffer(buffer, 512, "%d", res);
return &buffer[0];
}
@ -27,6 +19,8 @@ MwWidget window, vulkan;
int ow = 300;
int oh = 250;
double timer = 0;
PFN_vkGetInstanceProcAddr _vkGetInstanceProcAddr;
VkInstance instance;
VkDevice device;
@ -65,7 +59,7 @@ VkSwapchainCreateInfoKHR swapchainCreateInfo = {};
PFN_##name _##name = (PFN_##name)_vkGetInstanceProcAddr(instance, #name); \
assert(_##name);
void tick(MwWidget handle, void* user_data, void* call_data) {
void MWAPI tick(MwWidget handle, void* user_data, void* call_data) {
(void)handle;
(void)user_data;
(void)call_data;
@ -75,9 +69,10 @@ void tick(MwWidget handle, void* user_data, void* call_data) {
VkSubmitInfo submitInfo = {};
VkPresentInfoKHR presentInfo = {};
VkClearValue clearColor = {{{0.0f, 0.0f, 0.0f, 1.0f}}};
VkClearValue clearColor = {{{sin(timer) / 10., cos(timer) / 10., atan(timer) / 10., 1.0f}}};
uint32_t vertexCount = 3;
uint32_t instanceCount = 1;
timer += (float)(rand() % 1000) / 1000.;
VkPipelineStageFlags waitStages[] = {VK_PIPELINE_STAGE_2_VERTEX_SHADER_BIT};
@ -229,43 +224,16 @@ void vulkan_setup(MwWidget handle) {
VkSemaphoreCreateInfo semaphoreInfo = {};
VkFenceCreateInfo fenceInfo = {};
MwErrorEnum err = MwEsuccess;
_vkGetInstanceProcAddr = MwVulkanGetField(handle, MwVulkanField_GetInstanceProcAddr, &err);
if(err != MwEsuccess) {
printf("Error getting vkGetInstanceProcAddr!\n%s\n", MwGetLastError());
}
instance = MwVulkanGetField(handle, MwVulkanField_Instance, &err);
if(err != MwEsuccess) {
printf("Error getting vulkan instance!\n%s\n", MwGetLastError());
}
device = MwVulkanGetField(handle, MwVulkanField_LogicalDevice, &err);
if(err != MwEsuccess) {
printf("Error getting VkDevice!\n%s\n", MwGetLastError());
}
physicalDevice = MwVulkanGetField(handle, MwVulkanField_PhysicalDevice, &err);
if(err != MwEsuccess) {
printf("Error getting physical device!\n%s\n", MwGetLastError());
}
graphicsQueue = MwVulkanGetField(handle, MwVulkanField_GraphicsQueue, &err);
if(err != MwEsuccess) {
printf("Error getting graphics queue!\n%s\n", MwGetLastError());
}
presentQueue = MwVulkanGetField(handle, MwVulkanField_PresentQueue, &err);
if(err != MwEsuccess) {
printf("Error getting present queue!\n%s\n", MwGetLastError());
}
surface = MwVulkanGetField(handle, MwVulkanField_Surface, &err);
if(err != MwEsuccess) {
printf("Error getting surface!\n%s\n", MwGetLastError());
}
presentQueueIndex = MwVulkanGetField(handle, MwVulkanField_PresentQueueIndex, &err);
if(err != MwEsuccess) {
printf("Error getting present queue index!\n%s\n", MwGetLastError());
}
graphicsQueueIndex = MwVulkanGetField(handle, MwVulkanField_GraphicsQueueIndex, &err);
if(err != MwEsuccess) {
printf("Error getting graphics queue index!\n%s\n", MwGetLastError());
}
int err = 0;
_vkGetInstanceProcAddr = MwVulkanGetField(handle, MwVULKANFIELD_GETINSTANCEPROCADDR, &err);
instance = MwVulkanGetField(handle, MwVULKANFIELD_INSTANCE, &err);
device = MwVulkanGetField(handle, MwVULKANFIELD_LOGICALDEVICE, &err);
physicalDevice = MwVulkanGetField(handle, MwVULKANFIELD_PHYSICALDEVICE, &err);
graphicsQueue = MwVulkanGetField(handle, MwVULKANFIELD_GRAPHICSQUEUE, &err);
presentQueue = MwVulkanGetField(handle, MwVULKANFIELD_PRESENTQUEUE, &err);
surface = MwVulkanGetField(handle, MwVULKANFIELD_SURFACE, &err);
presentQueueIndex = MwVulkanGetField(handle, MwVULKANFIELD_PRESENTQUEUEINDEX, &err);
graphicsQueueIndex = MwVulkanGetField(handle, MwVULKANFIELD_GRAPHICSQUEUEINDEX, &err);
LOAD_VK_FUNCTION(vkCreateShaderModule);
LOAD_VK_FUNCTION(vkCreatePipelineLayout);
@ -649,9 +617,9 @@ int main() {
MwNtitle, "hello world",
NULL);
MwVulkanEnableExtension(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
vulkan = MwCreateWidget(MwVulkanClass, "vulkan", window, 50, 50, ow, oh);
vulkan = MwVaCreateWidget(MwVulkanClass, "vulkan", window, 50, 50, ow, oh,
MwNvulkanExtension, VK_KHR_SWAPCHAIN_EXTENSION_NAME,
NULL);
MwAddUserHandler(window, MwNtickHandler, tick, NULL);

View file

@ -0,0 +1,22 @@
/*!
* @file Mw/Abstract/CharSet.h
* @brief CharSet
*/
#ifndef __MW_ABSTRACT_CHARSET_H__
#define __MW_ABSTRACT_CHARSET_H__
#include <Mw/MachDep.h>
#ifdef __cplusplus
extern "C" {
#endif
MWDECL char* MWAPI MwACPToUTF8(const char* input);
MWDECL char* MWAPI MwUTF8ToACP(const char* input);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -17,32 +17,32 @@ extern "C" {
* @param path Path
* @return Handle
*/
MWDECL void* MwDirectoryOpen(const char* path);
MWDECL void* MWAPI MwDirectoryOpen(const char* path);
/*!
* @brief Closes a directory
* @param handle Handle
*/
MWDECL void MwDirectoryClose(void* handle);
MWDECL void MWAPI MwDirectoryClose(void* handle);
/*!
* @brief Reads a directory
* @param handle Handle
* @return Directory entry
*/
MWDECL MwDirectoryEntry* MwDirectoryRead(void* handle);
MWDECL MwDirectoryEntry* MWAPI MwDirectoryRead(void* handle);
/*!
* @brief Frees a directory entry
* @param entry Entry
*/
MWDECL void MwDirectoryFreeEntry(MwDirectoryEntry* entry);
MWDECL void MWAPI MwDirectoryFreeEntry(MwDirectoryEntry* entry);
/*!
* @brief Gets a current directory
* @param Directory
*/
MWDECL char* MwDirectoryCurrent(void);
MWDECL char* MWAPI MwDirectoryCurrent(void);
/*!
* @brief Joins 2 paths
@ -50,7 +50,7 @@ MWDECL char* MwDirectoryCurrent(void);
* @param b Path
* @return Path
*/
MWDECL char* MwDirectoryJoin(char* a, char* b);
MWDECL char* MWAPI MwDirectoryJoin(char* a, char* b);
#ifdef __cplusplus
}

View file

@ -16,20 +16,20 @@ extern "C" {
* @param path Path
* @return Handle
*/
MWDECL void* MwDynamicOpen(const char* path);
MWDECL void* MWAPI MwDynamicOpen(const char* path);
/*!
* @brief Gets a symbol from the dynamic library
* @param handle Handle
* @param symbol Symbol
*/
MWDECL void* MwDynamicSymbol(void* handle, const char* symbol);
MWDECL void* MWAPI MwDynamicSymbol(void* handle, const char* symbol);
/*!
* @brief Closes a dynamic library
* @param handle Handle
*/
MWDECL void MwDynamicClose(void* handle);
MWDECL void MWAPI MwDynamicClose(void* handle);
#ifdef __cplusplus
}

View file

@ -15,13 +15,13 @@ extern "C" {
* @brief Sleeps for milliseconds
* @param ms Milliseconds
*/
MWDECL void MwTimeSleep(int ms);
MWDECL void MWAPI MwTimeSleep(int ms);
/*!
* @brief Gets a monotonic time
* @return Monotonic time
*/
MWDECL long MwTimeGetTick(void);
MWDECL long MWAPI MwTimeGetTick(void);
#ifdef __cplusplus
}

View file

@ -31,8 +31,8 @@ typedef uint16_t MwU16;
typedef int8_t MwI8;
typedef uint8_t MwU8;
#define OTHER_TYPES_DEFINED
#elif __GNUC__ > 2
#define MW_OTHER_TYPES_DEFINED
#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) || defined(__clang__))
typedef long long MwI64;
typedef unsigned long long MwU64;
#elif defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
@ -48,18 +48,18 @@ typedef unsigned __int16 MwU16;
typedef __int8 MwI8;
typedef unsigned __int8 MwU8;
#define OTHER_TYPES_DEFINED
#define MW_OTHER_TYPES_DEFINED
#else
/* out of hope */
typedef long MwI64;
typedef unsigned long MwU64;
#endif
#ifdef OTHER_TYPES_DEFINED
#undef OTHER_TYPES_DEFINED
#ifdef MW_OTHER_TYPES_DEFINED
#undef MW_OTHER_TYPES_DEFINED
#else
typedef int MwI32;
typedef unsigned int MwU32;
typedef int MwI32;
typedef unsigned int MwU32;
typedef short MwI16;
typedef unsigned short MwU16;
@ -76,10 +76,10 @@ struct _MwPoint {
};
struct _MwRect {
int x;
int y;
unsigned int width;
unsigned int height;
int x;
int y;
int width;
int height;
};
struct _MwSizeHints {

View file

@ -99,4 +99,44 @@ enum MwMB_ICON {
*/
#define MwMB_BUTTONYESNOCANCEL (MwMB_BUTTONYES | MwMB_BUTTONNO | MwMB_BUTTONCANCEL)
/* Whether or not GetXY/SetXY works with global or local coordinates */
enum MwCOORDINATE {
MwCOORDINATE_GLOBAL = 0,
MwCOORDINATE_LOCAL,
};
/* The clipboard type that MwGetClipboard should return */
enum MwCLIPBOARD {
/* the clipboard that is present on every platform that supports it */
MwCLIPBOARD_MAIN = 0,
/* the "primary" clipboard that Wayland stores to emulate X11's behavior. */
MwCLIPBOARD_PRIMARY,
};
enum MwMOUSE {
MwMOUSE_LEFT = 1,
MwMOUSE_MIDDLE,
MwMOUSE_RIGHT,
MwMOUSE_WHEELUP,
MwMOUSE_WHEELDOWN
};
#define MwKEY_FLAG 0x80000000
#define MwKEY_CONTROL_FLAG MwKEY_FLAG | 0x40000000
#define MwKEY_ALT_FLAG MwKEY_FLAG | 0x20000000
enum MwKEY {
MwKEY_BACKSPACE = MwKEY_FLAG | 1,
MwKEY_LEFT,
MwKEY_RIGHT,
MwKEY_UP,
MwKEY_DOWN,
MwKEY_ENTER,
MwKEY_ESCAPE,
MwKEY_LEFTSHIFT,
MwKEY_RIGHTSHIFT,
MwKEY_ALT,
MwKEY_CONTROL
};
#endif

View file

@ -37,6 +37,17 @@
#define MwDispatch3(x, y, z) \
if(!x->destroyed && x->widget_class != NULL && x->widget_class->y != NULL) x->widget_class->y(x, z)
/*!
* @warning Used internally
* @brief Dispatches the handler of widget class
* @param x Widget
* @param y Handler name
* @param z Argument
* @param w Argument
*/
#define MwDispatch4(x, y, z, w) \
if(!x->destroyed && x->widget_class != NULL && x->widget_class->y != NULL) x->widget_class->y(x, z, w)
#define MwWaitMS 30
#define MwDoubleClickTimeout 250
@ -49,7 +60,7 @@ extern "C" {
* @brief Initializes the Milsko Toolkit
* @return `0` if successful
*/
MWDECL int MwLibraryInit(void);
MWDECL int MWAPI MwLibraryInit(void);
/*!
* @brief Creates a widget
@ -62,7 +73,7 @@ MWDECL int MwLibraryInit(void);
* @param height Height
* @return Widget
*/
MWDECL MwWidget MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height);
MWDECL MwWidget MWAPI MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height);
/*!
* @brief Creates a widget
@ -76,7 +87,7 @@ MWDECL MwWidget MwCreateWidget(MwClass widget_class, const char* name, MwWidget
* @param ... Same with MwVaApply
* @return Widget
*/
MWDECL MwWidget MwVaCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, ...);
MWDECL MwWidget MWAPI MwVaCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, ...);
/*!
* @brief Creates a widget
@ -90,13 +101,13 @@ MWDECL MwWidget MwVaCreateWidget(MwClass widget_class, const char* name, MwWidge
* @param va Same with MwVaListApply
* @return Widget
*/
MWDECL MwWidget MwVaListCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, va_list va);
MWDECL MwWidget MWAPI MwVaListCreateWidget(MwClass widget_class, const char* name, MwWidget parent, int x, int y, unsigned int width, unsigned int height, va_list va);
/*!
* @brief Destroys the widget and its child widgets
* @param handle Widget
*/
MWDECL void MwDestroyWidget(MwWidget handle);
MWDECL void MWAPI MwDestroyWidget(MwWidget handle);
/*!
* @brief Executes a method specific to the widget (varadic version).
@ -104,7 +115,7 @@ MWDECL void MwDestroyWidget(MwWidget handle);
* @param handle Widget
* @param ... Widget function arguments.
*/
MWDECL void MwVaWidgetExecute(MwWidget handle, const char* func_name, void* out, ...);
MWDECL void MWAPI MwVaWidgetExecute(MwWidget handle, const char* func_name, void* out, ...);
/*!
* @brief Executes a method specific to the widget (va_list version).
@ -112,27 +123,27 @@ MWDECL void MwVaWidgetExecute(MwWidget handle, const char* func_name, void* out,
* @param handle Widget
* @param va Widget function arguments.
*/
MWDECL void MwVaListWidgetExecute(MwWidget handle, const char* func_name, void* out, va_list va);
MWDECL void MWAPI MwVaListWidgetExecute(MwWidget handle, const char* func_name, void* out, va_list va);
/*!
* @brief Runs the main loop
* @param handle Widget
*/
MWDECL void MwLoop(MwWidget handle);
MWDECL void MWAPI MwLoop(MwWidget handle);
/*!
* @brief Runs the single step
* @param handle Widget
* @return `0` if successful
*/
MWDECL int MwStep(MwWidget handle);
MWDECL int MWAPI MwStep(MwWidget handle);
/*!
* @brief Check if any event is pending
* @param handle Widget
* @return `1` if any event is pending
*/
MWDECL int MwPending(MwWidget handle);
MWDECL int MWAPI MwPending(MwWidget handle);
/*!
* @brief Sets an integer property
@ -140,7 +151,7 @@ MWDECL int MwPending(MwWidget handle);
* @param key Key
* @param n Value
*/
MWDECL void MwSetInteger(MwWidget handle, const char* key, int n);
MWDECL void MWAPI MwSetInteger(MwWidget handle, const char* key, int n);
/*!
* @brief Sets a text property
@ -148,7 +159,7 @@ MWDECL void MwSetInteger(MwWidget handle, const char* key, int n);
* @param key Key
* @param value Value
*/
MWDECL void MwSetText(MwWidget handle, const char* key, const char* value);
MWDECL void MWAPI MwSetText(MwWidget handle, const char* key, const char* value);
/*!
* @brief Sets a void pointer property
@ -156,7 +167,7 @@ MWDECL void MwSetText(MwWidget handle, const char* key, const char* value);
* @param key Key
* @param value Value
*/
MWDECL void MwSetVoid(MwWidget handle, const char* key, void* value);
MWDECL void MWAPI MwSetVoid(MwWidget handle, const char* key, void* value);
/*!
* @brief Gets the integer property
@ -164,7 +175,7 @@ MWDECL void MwSetVoid(MwWidget handle, const char* key, void* value);
* @param key Key
* @return Value
*/
MWDECL int MwGetInteger(MwWidget handle, const char* key);
MWDECL int MWAPI MwGetInteger(MwWidget handle, const char* key);
/*!
* @brief Gets the text property
@ -172,7 +183,7 @@ MWDECL int MwGetInteger(MwWidget handle, const char* key);
* @param key Key
* @return Value
*/
MWDECL const char* MwGetText(MwWidget handle, const char* key);
MWDECL const char* MWAPI MwGetText(MwWidget handle, const char* key);
/*!
* @brief Gets the void pointer property
@ -180,28 +191,28 @@ MWDECL const char* MwGetText(MwWidget handle, const char* key);
* @param key Key
* @return Value
*/
MWDECL void* MwGetVoid(MwWidget handle, const char* key);
MWDECL void* MWAPI MwGetVoid(MwWidget handle, const char* key);
/*!
* @brief Sets the default property
* @param handle Widget
* @warning This is called when widget is created
*/
MWDECL void MwSetDefault(MwWidget handle);
MWDECL void MWAPI MwSetDefault(MwWidget handle);
/*!
* @brief Sets the properties
* @param handle Widget
* @param ... Properties
*/
MWDECL void MwVaApply(MwWidget handle, ...);
MWDECL void MWAPI MwVaApply(MwWidget handle, ...);
/*!
* @brief Sets properties
* @param handle Widget
* @param va Properties
*/
MWDECL void MwVaListApply(MwWidget handle, va_list va);
MWDECL void MWAPI MwVaListApply(MwWidget handle, va_list va);
/*!
* @brief Sets a user handler
@ -210,7 +221,7 @@ MWDECL void MwVaListApply(MwWidget handle, va_list va);
* @param handler Handler
* @param user_data User data passed to handler
*/
MWDECL void MwAddUserHandler(MwWidget handle, const char* key, MwUserHandler handler, void* user_data);
MWDECL void MWAPI MwAddUserHandler(MwWidget handle, const char* key, MwUserHandler handler, void* user_data);
/*!
* @brief Dispatches the user handler
@ -218,7 +229,7 @@ MWDECL void MwAddUserHandler(MwWidget handle, const char* key, MwUserHandler han
* @param key Key
* @param handler_data Handler data passed to handler
*/
MWDECL void MwDispatchUserHandler(MwWidget handle, const char* key, void* handler_data);
MWDECL void MWAPI MwDispatchUserHandler(MwWidget handle, const char* key, void* handler_data);
/*!
* @brief Sets an error handler
@ -226,122 +237,166 @@ MWDECL void MwDispatchUserHandler(MwWidget handle, const char* key, void* handle
* @param handler Handler
* @param user_data User data passed to handler
*/
MWDECL void MwSetErrorHandler(MwErrorHandler handler, void* user_data);
MWDECL void MWAPI MwSetErrorHandler(MwErrorHandler handler, void* user_data);
/*!
* @brief Dispatches the error handler
* @param code Error code
* @param message Error message
*/
MWDECL void MwDispatchError(int code, const char* message);
/*!
* @brief Gets the before_step of widget
* @param handle Widget
* @param jmpbuf jmp_buf
*/
MWDECL void MwGetBeforeStep(MwWidget handle, jmp_buf* jmpbuf);
MWDECL void MWAPI MwDispatchError(int code, const char* message);
/*!
* @brief Forcefully makes widget render
* @param handle Widget
*/
MWDECL void MwForceRender(MwWidget handle);
MWDECL void MWAPI MwForceRender(MwWidget handle);
/*!
* @brief Forcefully makes widget render
* @param handle Widget
* @param ptr Ignored
*/
MWDECL void MwForceRender2(MwWidget handle, void* ptr);
MWDECL void MWAPI MwForceRender2(MwWidget handle, void* ptr);
/*!
* @brief Adds an widget to tick handler list
* @param handle Widget
*/
MWDECL void MwAddTickList(MwWidget handle);
MWDECL void MWAPI MwAddTickList(MwWidget handle);
/*!
* @brief Focus the widget
* @param handle Widget
*/
MWDECL void MwFocus(MwWidget handle);
MWDECL void MWAPI MwFocus(MwWidget handle);
/*!
* @brief Grabs the pointer
* @param handle Widget
* @param toggle Toggle
*/
MWDECL void MwGrabPointer(MwWidget handle, int toggle);
MWDECL void MWAPI MwGrabPointer(MwWidget handle, int toggle);
/*!
* @brief Hides the cursor
* @param handle Widget
*/
MWDECL void MwHideCursor(MwWidget handle);
MWDECL void MWAPI MwHideCursor(MwWidget handle);
/*!
* @brief Toggles the dark theme
* @param handle Widget
* @param toggle Toggle
* @deprecated Use MwNdarkTheme instead
*/
MWDECL void MwToggleDarkTheme(MwWidget handle, int toggle);
MWDECL void MWAPI MwSetDarkTheme(MwWidget handle, int toggle);
/*!
* @brief Gets the parent widget
* @param handle Widget
* @return Parent widget
*/
MWDECL MwWidget MwGetParent(MwWidget handle);
MWDECL MwWidget MWAPI MwGetParent(MwWidget handle);
/*!
* @brief Show widget
* @param handle Widget
* @param toggle Toggle
*/
MWDECL void MwShow(MwWidget handle, int toggle);
MWDECL void MWAPI MwShow(MwWidget handle, int toggle);
/*!
* @brief Reparents widget
* @param handle Widget
* @param new_parent New parent
*/
MWDECL void MwReparent(MwWidget handle, MwWidget new_parent);
MWDECL void MWAPI MwReparent(MwWidget handle, MwWidget new_parent);
/*!
* @brief Gets class of widget
* @param handle Widget
* @return Class
*/
MWDECL MwClass MwGetClass(MwWidget handle);
MWDECL MwClass MWAPI MwGetClass(MwWidget handle);
/*!
* @brief Gets name of widget
* @param handle Widget
* @return Name
*/
MWDECL const char* MwGetName(MwWidget handle);
MWDECL const char* MWAPI MwGetName(MwWidget handle);
/*!
* @brief Gets children of widget
* @param handle Widget
* @return Children (NULL-terminated array)
*/
MWDECL MwWidget* MwGetChildren(MwWidget handle);
MWDECL MwWidget* MWAPI MwGetChildren(MwWidget handle);
/*!
* @brief Gets the cursor coordinate
* @param handle Widget
* @param point Point
*/
MWDECL void MwGetCursorCoord(MwWidget handle, MwPoint* point);
MWDECL void MWAPI MwGetCursorCoord(MwWidget handle, MwPoint* point);
/*!
* @brief Gets the screen size
* @param handle Widget
* @param rect Rectangle
*/
MWDECL void MwGetScreenSize(MwWidget handle, MwRect* rect);
MWDECL void MWAPI MwGetScreenSize(MwWidget handle, MwRect* rect);
/*!
* @brief Reports whether a widget reports global or local coordinates upon GetXY/SetXY. Anything with a parent reports local, and most backends report global coordinates being supported for top level windows, but some (Wayland) do not.
* @param handle Widget
*/
MWDECL int MWAPI MwGetCoordinateType(MwWidget handle);
/*!
* @brief Queue to get clipboard content
* @param handle Widget
* @param clipboard_type The Clipboard Type to get. See MwClipboardType. This is ignored on backends that aren't X11/Wayland, so if you're unsure, just use MwClipboardMain
*/
MWDECL void MWAPI MwGetClipboard(MwWidget handle, int clipboard_type);
/*!
* @brief Set user pointer
* @param handle Widget
* @param user User pointer
*/
MWDECL void MWAPI MwSetUser(MwWidget handle, void* user);
/*!
* @brief Get user pointer
* @param handle Widget
* @return User pointer
*/
MWDECL void* MWAPI MwGetUser(MwWidget handle);
/*!
* @brief Free the widget
* @param handle Widget
* @warning This is used internally!
* @note You can call this on toplevel widget safely if you're sure no event loops will be ran, e.g. after `MwLoop`.
*/
MWDECL void MWAPI MwFreeWidget(MwWidget handle);
/*!
* @brief Gets the frame of the widget
* @param handle Widget
* @param rect Frame
*/
MWDECL void MWAPI MwGetFrame(MwWidget handle, MwRect* rect);
#ifdef _MILSKO
MWDECL void MwForceRender_Internal(MwWidget handle);
MWDECL void MwForceRender2_Internal(MwWidget handle, void* ptr);
#define MwForceRender MwForceRender_Internal
#define MwForceRender2 MwForceRender2_Internal
#endif
#ifdef __cplusplus
}

View file

@ -32,6 +32,16 @@ MWDECL const char* MwDefaultSubBackground;
*/
MWDECL const char* MwDefaultSubForeground;
/*!
* @brief Default title background color
*/
MWDECL const char* MwDefaultTitleBackground;
/*!
* @brief Default title foreground color
*/
MWDECL const char* MwDefaultTitleForeground;
/*!
* @brief Default dark theme background color
*/
@ -52,11 +62,32 @@ MWDECL const char* MwDefaultDarkSubBackground;
*/
MWDECL const char* MwDefaultDarkSubForeground;
/*!
* @brief Default dark theme title background color
*/
MWDECL const char* MwDefaultDarkTitleBackground;
/*!
* @brief Default dark theme title foreground color
*/
MWDECL const char* MwDefaultDarkTitleForeground;
/*!
* @brief Default shadow difference
*/
MWDECL const int MwDefaultShadow;
/*!
* @brief Gets default border width
* @param handle Widget
*/
MWDECL int MwDefaultBorderWidth(MwWidget handle);
MWDECL int MWAPI MwDefaultBorderWidth(MwWidget handle);
/*!
* @brief Gets default thin border width
* @param handle Widget
*/
MWDECL int MwDefaultThinBorderWidth(MwWidget handle);
#ifdef __cplusplus
}

View file

@ -18,7 +18,7 @@ extern "C" {
* @param title Title text
* @return Widget
*/
MWDECL MwWidget MwColorPicker(MwWidget handle, const char* title);
MWDECL MwWidget MWAPI MwColorPicker(MwWidget handle, const char* title);
#ifdef __cplusplus
}

View file

@ -18,7 +18,7 @@ extern "C" {
* @param title Title text
* @return Widget
*/
MWDECL MwWidget MwDirectoryChooser(MwWidget handle, const char* title);
MWDECL MwWidget MWAPI MwDirectoryChooser(MwWidget handle, const char* title);
#ifdef __cplusplus
}

View file

@ -18,7 +18,7 @@ extern "C" {
* @param title Title text
* @return Widget
*/
MWDECL MwWidget MwFileChooser(MwWidget handle, const char* title);
MWDECL MwWidget MWAPI MwFileChooser(MwWidget handle, const char* title);
/*!
* @brief Creates a file chooser
@ -27,7 +27,7 @@ MWDECL MwWidget MwFileChooser(MwWidget handle, const char* title);
* @param dir Show directory only or not
* @return Widget
*/
MwWidget MwFileChooserEx(MwWidget handle, const char* title, int dir);
MWDECL MwWidget MWAPI MwFileChooserEx(MwWidget handle, const char* title, int dir);
#ifdef __cplusplus
}

View file

@ -20,20 +20,14 @@ extern "C" {
* @param flag Flag
* @return Widget
*/
MWDECL MwWidget MwMessageBox(MwWidget handle, const char* text, const char* title, unsigned int flag);
MWDECL MwWidget MWAPI MwMessageBox(MwWidget handle, const char* text, const char* title, unsigned int flag);
/*!
* @brief Gets a child of the message box
* @param handle Widget
* @param child Child
*/
MWDECL MwWidget MwMessageBoxGetChild(MwWidget handle, int child);
/*!
* @brief Destroys the message box
* @param handle Widget
*/
MWDECL void MwMessageBoxDestroy(MwWidget handle);
MWDECL MwWidget MWAPI MwMessageBoxGetChild(MwWidget handle, int child);
#ifdef __cplusplus
}

View file

@ -19,7 +19,20 @@ extern "C" {
* @param text Color text
* @return Color
*/
MWDECL MwLLColor MwParseColor(MwWidget handle, const char* text);
MWDECL MwLLColor MWAPI MwParseColor(MwWidget handle, const char* text);
/*!
* @brief Parses a color text
* @param text Color text
* @param rgb RGB
*/
MWDECL void MWAPI MwParseColorNoAllocate(const char* text, MwRGB* rgb);
/*!
* @brief Initialize color table
* @warning This is called in MwLibraryInit - you do not have to call this
*/
MWDECL void MWAPI MwColorTableInit(void);
/*!
* @brief Lighten a color
@ -30,7 +43,7 @@ MWDECL MwLLColor MwParseColor(MwWidget handle, const char* text);
* @param b Blue
* @return Color
*/
MWDECL MwLLColor MwLightenColor(MwWidget handle, MwLLColor color, int r, int g, int b);
MWDECL MwLLColor MWAPI MwLightenColor(MwWidget handle, MwLLColor color, int r, int g, int b);
/*!
* @brief Draws a filled rectangle
@ -38,7 +51,7 @@ MWDECL MwLLColor MwLightenColor(MwWidget handle, MwLLColor color, int r, int g,
* @param rect Rectangle area
* @param color Color
*/
MWDECL void MwDrawRect(MwWidget handle, MwRect* rect, MwLLColor color);
MWDECL void MWAPI MwDrawRect(MwWidget handle, MwRect* rect, MwLLColor color);
/*!
* @brief Draws a filled rectangle that fades to a darker color
@ -46,7 +59,7 @@ MWDECL void MwDrawRect(MwWidget handle, MwRect* rect, MwLLColor color);
* @param rect Rectangle area
* @param color Color
*/
MWDECL void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color);
MWDECL void MWAPI MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color);
/*!
* @brief Draws a frame
@ -56,7 +69,18 @@ MWDECL void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color);
* @param invert Invert the 3D border color or not
* @warning `rect` gets changed to the area of rectangle inside
*/
MWDECL void MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert);
MWDECL void MWAPI MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert);
/*!
* @brief Draws a frame
* @param handle Widget
* @param rect Rectangle area
* @param color Color
* @param invert Invert the 3D border color or not
* @param border Border
* @warning `rect` gets changed to the area of rectangle inside
*/
MWDECL void MWAPI MwDrawFrameWithBorder(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border);
/*!
* @brief Does the DrawFrame/DrawRect combo used for drawing widget.
@ -66,7 +90,7 @@ MWDECL void MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int inve
* @param invert Invert the 3D border color or not
* @warning `rect` gets changed to the area of rectangle inside
*/
MWDECL void MwDrawWidgetBack(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border);
MWDECL void MWAPI MwDrawWidgetBack(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border);
/*!
* @brief Draws a triangle
@ -75,7 +99,7 @@ MWDECL void MwDrawWidgetBack(MwWidget handle, MwRect* rect, MwLLColor color, int
* @param color Color
* @param invert Invert the 3D border color or not
*/
MWDECL void MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int direction);
MWDECL void MWAPI MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int direction);
/*!
* @brief Draws a frame with specified border width
@ -88,7 +112,7 @@ MWDECL void MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int i
* @param same Same as dark color
* @warning `rect` gets changed to the area of rectangle inside
*/
MWDECL void MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border, int diff, int same);
MWDECL void MWAPI MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border, int diff, int same);
/*!
* @brief Creates a pixmap from image
@ -96,7 +120,7 @@ MWDECL void MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int in
* @param path Path
* @return Pixmap
*/
MWDECL MwLLPixmap MwLoadImage(MwWidget handle, const char* path);
MWDECL MwLLPixmap MWAPI MwLoadImage(MwWidget handle, const char* path);
/*!
* @brief Get color components
@ -105,7 +129,7 @@ MWDECL MwLLPixmap MwLoadImage(MwWidget handle, const char* path);
* @param green Pointer to green color
* @param blue Pointer to blue color
*/
MWDECL void MwGetColor(MwLLColor color, int* red, int* green, int* blue);
MWDECL void MWAPI MwColorGet(MwLLColor color, int* red, int* green, int* blue);
/*!
* @brief Creates a pixmap from raw data
@ -115,17 +139,28 @@ MWDECL void MwGetColor(MwLLColor color, int* red, int* green, int* blue);
* @param height Height
* @return Pixmap
*/
MWDECL MwLLPixmap MwLoadRaw(MwWidget handle, unsigned char* rgb, int width, int height);
MWDECL MwLLPixmap MWAPI MwLoadRaw(MwWidget handle, unsigned char* rgb, int width, int height);
/*!
* @brief Creates a pixmap from raw data
* @param handle Widget
* @brief Updates a pixmap using raw data
* @param pixmap Pixmap to update
* @param rgb RGBA data
* @param width Width
* @param height Height
* @return Pixmap
*/
MWDECL void MwReloadRaw(MwWidget handle, unsigned char* rgb, int width, int height, MwLLPixmap pixmap);
MWDECL void MWAPI MwPixmapReloadRaw(MwLLPixmap pixmap, unsigned char* rgb);
/*!
* @brief Gets the raw data of pixmap
* @param pixmap Pixmap
* @return RGBA data
*/
MWDECL unsigned char* MWAPI MwPixmapGetRaw(MwLLPixmap pixmap);
/*!
* @brief Gets the size of pixmap
* @param pixmap Pixmap
* @param rect Size
*/
MWDECL void MWAPI MwPixmapGetSize(MwLLPixmap pixmap, MwRect* rect);
/*!
* @brief Creates a pixmap from XPM data
@ -133,7 +168,7 @@ MWDECL void MwReloadRaw(MwWidget handle, unsigned char* rgb, int width, int heig
* @param data Data
* @return Pixmap
*/
MWDECL MwLLPixmap MwLoadXPM(MwWidget handle, char** data);
MWDECL MwLLPixmap MWAPI MwLoadXPM(MwWidget handle, char** data);
/*!
* @brief Creates a pixmap from icon data
@ -141,7 +176,7 @@ MWDECL MwLLPixmap MwLoadXPM(MwWidget handle, char** data);
* @param data Data
* @return Pixmap
*/
MWDECL MwLLPixmap MwLoadIcon(MwWidget handle, MwU32* data);
MWDECL MwLLPixmap MWAPI MwLoadIcon(MwWidget handle, MwU32* data);
/*!
* @brief Draws a diamond
@ -150,36 +185,38 @@ MWDECL MwLLPixmap MwLoadIcon(MwWidget handle, MwU32* data);
* @param color Color
* @param invert Invert the 3D border color or not
*/
MWDECL void MwDrawDiamond(MwWidget handle, MwRect* rect, MwLLColor color, int invert);
MWDECL void MWAPI MwDrawDiamond(MwWidget handle, MwRect* rect, MwLLColor color, int invert);
/* text.c */
/*!
* @brief Draws a text
* @param handle Widget
* @param ttf TTF, NULLable
* @param point Center point of the text
* @param text Text
* @param bold Bold
* @param align Align
* @param color Color
*/
MWDECL void MwDrawText(MwWidget handle, MwPoint* point, const char* text, int bold, int align, MwLLColor color);
MWDECL void MWAPI MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, int align, MwLLColor color);
/*!
* @brief Calculates a text width
* @param handle Widget
* @param text Text
* @param font Font, NULLable
* @return Text width
*/
MWDECL int MwTextWidth(MwWidget handle, const char* text);
MWDECL int MWAPI MwTextWidth(MwWidget handle, MwFLFont font, const char* text);
/*!
* @brief Calculates a text height
* @param handle Widget
* @param text Text
* @param font Font, NULLable
* @return Text height
*/
MWDECL int MwTextHeight(MwWidget handle, const char* text);
MWDECL int MWAPI MwTextHeight(MwWidget handle, MwFLFont font, const char* text);
/* color.c */
@ -189,7 +226,14 @@ MWDECL int MwTextHeight(MwWidget handle, const char* text);
* @param color Color name
* @return Color
*/
MWDECL MwLLColor MwParseColorName(MwWidget handle, const char* color);
MWDECL MwLLColor MWAPI MwParseColorName(MwWidget handle, const char* color);
/*!
* @brief Parses a color name
* @param color Color name
* @param rgb RGB
*/
MWDECL void MWAPI MwParseColorNameNoAllocate(const char* color, MwRGB* rgb);
#ifdef __cplusplus
}

View file

@ -1,29 +0,0 @@
/*!
* @file Mw/Error.h
* @brief Error codes
*/
#ifndef __MW_ERROR_H__
#define __MW_ERROR_H__
#include <Mw/MachDep.h>
/*!
* @brief Error code enumeration
*/
typedef enum MwErrorEnum_T {
/*!
* @brief No error
*/
MwEsuccess = 0,
/*!
* @brief There was an error
*/
MwEerror,
} MwErrorEnum;
/*!
* @brief Get the last error
*/
MWDECL const char* MwGetLastError(void);
#endif

View file

@ -18,13 +18,13 @@ extern "C" {
* @param size Data size
* @return Font handle
*/
MWDECL void* MwFontLoad(unsigned char* data, unsigned int size);
MWDECL void* MWAPI MwFontLoad(unsigned char* data, unsigned int size);
/*!
* @brief Frees a font handle
* @param handle Handle
*/
MWDECL void MwFontFree(void* handle);
MWDECL void MWAPI MwFontFree(void* handle);
#ifdef __cplusplus
}

View file

@ -6,10 +6,10 @@
#ifndef __MW_LOWLEVEL_H__
#define __MW_LOWLEVEL_H__
#include <Mw/BaseTypes.h>
#include <Mw/MachDep.h>
typedef struct _MwLLHandler* MwLLHandler;
typedef struct _MwLLMouse MwLLMouse;
typedef struct _MwLLCommon* MwLLCommon;
typedef struct _MwLLCommonColor* MwLLCommonColor;
typedef struct _MwLLCommonPixmap* MwLLCommonPixmap;
@ -17,38 +17,91 @@ typedef struct _MwLLCommonPixmap* MwLLCommonPixmap;
typedef union _MwLL* MwLL;
typedef union _MwLLColor* MwLLColor;
typedef union _MwLLPixmap* MwLLPixmap;
typedef struct _MwFLFont* MwFLFont;
#else
typedef void* MwLL;
typedef void* MwLLColor;
typedef void* MwLLPixmap;
typedef void* MwFLFont;
#endif
enum MwLLBackends {
MwLLBackendX11 = 0,
MwLLBackendGDI,
MwLLBackendWayland,
MwLLBackendCocoa,
MwLLBackendHaiku
};
struct _MwLLCommon {
void* user;
int copy_buffer;
int type;
void* user;
int copy_buffer;
int type;
int coordinate_type;
MwBool supports_transparency;
MwLLHandler handler;
};
struct _MwLLCommonColor {
int red;
int green;
int blue;
MwU8 red;
MwU8 green;
MwU8 blue;
};
struct _MwLLCommonPixmap {
int width;
int height;
unsigned char* raw;
void* user;
};
#ifdef USE_DBUS
typedef struct _MwLLDBusFuncTable {
void* lib;
void (*dbus_error_init)(DBusError* error);
DBusConnection* (*dbus_bus_get)(DBusBusType type, DBusError* error);
dbus_bool_t (*dbus_error_is_set)(const DBusError* error);
void (*dbus_error_free)(DBusError* error);
DBusMessage* (*dbus_message_new_method_call)(const char* bus_name, const char* path, const char* iface, const char* method);
void (*dbus_message_iter_init_append)(DBusMessage* message, DBusMessageIter* iter);
dbus_bool_t (*dbus_message_iter_append_basic)(DBusMessageIter* iter, int type, const void* value);
void (*dbus_connection_flush)(DBusConnection* connection);
dbus_bool_t (*dbus_connection_read_write)(DBusConnection* connection, int timeout_milliseconds);
DBusMessage* (*dbus_connection_send_with_reply_and_block)(DBusConnection* connection, DBusMessage* message, int timeout_milliseconds, DBusError* error);
DBusMessage* (*dbus_connection_pop_message)(DBusConnection* connection);
void (*dbus_bus_add_match)(DBusConnection* connection, const char* rule, DBusError* error);
void (*dbus_message_unref)(DBusMessage* message);
dbus_bool_t (*dbus_message_iter_init)(DBusMessage* message, DBusMessageIter* iter);
dbus_bool_t (*dbus_message_is_signal)(DBusMessage* message, const char* iface, const char* signal_name);
int (*dbus_message_iter_get_arg_type)(DBusMessageIter* iter);
void (*dbus_message_iter_recurse)(DBusMessageIter* iter, DBusMessageIter* sub);
void (*dbus_message_iter_next)(DBusMessageIter* iter);
void (*dbus_connection_unref)(DBusConnection* connection);
void (*dbus_message_iter_get_basic)(DBusMessageIter* iter, void* value);
} MwLLDBusFuncTable;
typedef struct _MwLLDBusContext {
DBusConnection* dbus_conn;
DBusError dbus_err;
DBusMessage* dbus_msg;
DBusMessage* dbus_reply;
} MwLLDBusContext;
typedef void (*MwLLDBusPortalPollListener)(MwLL handle, MwU32 new_value);
/* setup the dbus func table. Returns false and prints a warning if dbus couldn't be found. */
MWDECL MwBool MwLLDBusFuncSetup(MwLLDBusFuncTable* tbl);
MWDECL MwBool MwLLDBusNewContext(MwLLDBusFuncTable* tbl, MwLLDBusContext* ctx);
MWDECL MwBool MwLLDBusPortalGet(MwLLDBusFuncTable* tbl, MwLLDBusContext* ctx, const char* portal, const char* namespace, const char* key, void* out);
MWDECL MwBool MwLLDBusPortalWatch(MwLLDBusFuncTable* tbl, MwLLDBusContext* ctx, const char* portal);
MWDECL MwBool MwLLDBusPortalPoll(MwLLDBusFuncTable* tbl, MwLLDBusContext* ctx, MwLL handle, const char* portal, const char* namespace, const char* key, MwLLDBusPortalPollListener);
MWDECL void MwLLDBusFreeContext(MwLLDBusFuncTable* tbl, MwLLDBusContext* ctx);
#endif
#ifdef _MILSKO
#ifdef USE_X11
#include <Mw/LowLevel/X11.h>
@ -59,6 +112,15 @@ struct _MwLLCommonPixmap {
#ifdef USE_WAYLAND
#include <Mw/LowLevel/Wayland.h>
#endif
#ifdef USE_COCOA
#include <Mw/LowLevel/Cocoa.h>
#endif
#ifdef CLASSIC_MAC_OS
#include <Mw/LowLevel/ClassicMacOS.h>
#endif
#ifdef USE_HAIKU
#include <Mw/LowLevel/Haiku.h>
#endif
union _MwLL {
struct _MwLLCommon common;
@ -70,6 +132,16 @@ union _MwLL {
#endif
#ifdef USE_WAYLAND
struct _MwLLWayland wayland;
struct _MwLLCairo cairo;
#endif
#ifdef USE_COCOA
struct _MwLLCocoa cocoa;
#endif
#ifdef CLASSIC_MAC_OS
struct _MwLLClassicMacOS cmacos;
#endif
#ifdef USE_HAIKU
struct _MwLLHaiku haiku;
#endif
};
@ -82,7 +154,13 @@ union _MwLLColor {
struct _MwLLGDIColor gdi;
#endif
#ifdef USE_WAYLAND
struct _MwLLWaylandColor wayland;
struct _MwLLCairoColor wayland;
#endif
#ifdef USE_COCOA
struct _MwLLCocoaColor cocoa;
#endif
#ifdef USE_HAIKU
struct _MwLLHaikuColor haiku;
#endif
};
@ -96,6 +174,16 @@ union _MwLLPixmap {
#endif
#ifdef USE_WAYLAND
struct _MwLLWaylandPixmap wayland;
struct _MwLLCairoPixmap cairo; /* same structure but we do this for code clarity */
#endif
#ifdef USE_COCOA
struct _MwLLCocoaPixmap cocoa;
#endif
#ifdef CLASSIC_MAC_OS
struct _MwLLClassicMacOSPixmap cmacos;
#endif
#ifdef USE_HAIKU
struct _MwLLHaikuPixmap haiku;
#endif
};
#endif
@ -104,37 +192,6 @@ union _MwLLPixmap {
#define MwLLDispatch(x, y, z) \
if(x->common.handler != NULL && x->common.handler->y != NULL) x->common.handler->y(x, z)
#define MwLLKeyMask (1 << 31)
enum MwLLKeyEnum {
MwLLKeyBackSpace = MwLLKeyMask | 1,
MwLLKeyLeft,
MwLLKeyRight,
MwLLKeyUp,
MwLLKeyDown,
MwLLKeyEnter,
MwLLKeyEscape,
MwLLKeyLeftShift,
MwLLKeyRightShift,
MwLLKeyAlt,
MwLLKeyControl
};
#define MwLLControlMask MwLLKeyMask | (1 << 30)
#define MwLLAltMask MwLLKeyMask | (1 << 29)
enum MwLLMouseEnum {
MwLLMouseLeft = 1,
MwLLMouseMiddle,
MwLLMouseRight,
MwLLMouseWheelUp,
MwLLMouseWheelDown
};
struct _MwLLMouse {
MwPoint point;
int button;
};
struct _MwLLHandler {
void (*draw)(MwLL handle, void* data);
void (*up)(MwLL handle, void* data);
@ -146,8 +203,24 @@ struct _MwLLHandler {
void (*key_released)(MwLL handle, void* data);
void (*focus_in)(MwLL handle, void* data);
void (*focus_out)(MwLL handle, void* data);
void (*clipboard)(MwLL handle, void* data);
void (*dark_theme)(MwLL handle, void* data);
void (*drag_and_drop)(MwLL handle, void* data);
};
struct _MwLLTextDispatchTable {
int (*drawText)(MwWidget handle, MwPoint* point, const char* text, int bold, int align, MwLLColor color);
int (*textWidth)(MwWidget handle, const char* text);
int (*textHeight)(MwWidget handle, int count);
void* (*fontLoad)(unsigned char* data, unsigned int size);
void (*fontFree)(void* handle);
};
#define MwFLFlagMonospace (1 << 0)
#define MwFLFlagBold (1 << 1)
#define MwFLFlagBitmap (1 << 2)
#define MwFLBuildFont(x) ((MwFLFont)(void*)(size_t)(x))
#ifdef __cplusplus
extern "C" {
#endif
@ -162,7 +235,17 @@ MWDECL void (*MwLLDestroy)(MwLL handle);
MWDECL void (*MwLLPolygon)(MwLL handle, MwPoint* points, int points_count, MwLLColor color);
MWDECL void (*MwLLLine)(MwLL handle, MwPoint* points, MwLLColor color);
/*!
* @brief Begin drawing sequence
* @param handle Handle
*/
MWDECL void (*MwLLBeginDraw)(MwLL handle);
/*!
* @brief End drawing sequence
* @param handle Handle
*/
MWDECL void (*MwLLEndDraw)(MwLL handle);
MWDECL MwLLColor (*MwLLAllocColor)(MwLL handle, int r, int g, int b);
@ -187,26 +270,105 @@ MWDECL void (*MwLLSetIcon)(MwLL handle, MwLLPixmap pixmap);
MWDECL void (*MwLLForceRender)(MwLL handle);
MWDECL void (*MwLLSetCursor)(MwLL handle, MwCursor* image, MwCursor* mask);
/*!
* @brief Detach handle and make it toplevel window
* @param handle Handle
* @param point Point to be detached at, relative from the parent handle
*/
MWDECL void (*MwLLDetach)(MwLL handle, MwPoint* point);
MWDECL void (*MwLLShow)(MwLL handle, int show);
MWDECL void (*MwLLSetSizeHints)(MwLL handle, int minx, int miny, int maxx, int maxy);
MWDECL void (*MwLLMakeBorderless)(MwLL handle, int toggle);
/*!
* @brief Make handle "tool" window, e.g. Submenu, combobox menu, and etc.
* @param handle Handle
*/
MWDECL void (*MwLLMakeToolWindow)(MwLL handle);
MWDECL void (*MwLLMakePopup)(MwLL handle, MwLL parent);
/*!
* @brief Begin changing state (has to be called before `MwLLSetSizeHints`, `MwLLMakeBorderless`, `MwLLMakeToolWindow`, and `MwLLMakePopup`)
* @param handle Handle
*/
MWDECL void (*MwLLBeginStateChange)(MwLL handle);
/*!
* @brief End changing state
* @param handle Handle
*/
MWDECL void (*MwLLEndStateChange)(MwLL handle);
MWDECL void (*MwLLFocus)(MwLL handle);
/*!
* @brief Grab pointer, and keep moving pointer to center of handle
* @param handle Handle
* @param toggle Toggle
*/
MWDECL void (*MwLLGrabPointer)(MwLL handle, int toggle);
MWDECL void (*MwLLSetClipboard)(MwLL handle, const char* text);
MWDECL char* (*MwLLGetClipboard)(MwLL handle);
MWDECL void (*MwLLSetClipboard)(MwLL handle, const char* text, int clipboard_type);
MWDECL void (*MwLLGetClipboard)(MwLL handle, int clipboard_type);
MWDECL void (*MwLLGetCursorCoord)(MwLL handle, MwPoint* point);
MWDECL void (*MwLLGetScreenSize)(MwLL handle, MwRect* rect);
/*!
* @brief Setup drag and drop capabilities, should the user request it with MwNacceptsDnD
* @param handle Handle
*/
MWDECL void (*MwLLSetupDragAndDrop)(MwLL handle);
/*!
* @brief Set any extra parameters for dark theme
* @param handle Handle
* @param toggle Toggle
* @warning Do not run `handle->common.handler->dark_theme` when this function gets called
* @warning This is for stuff like, i.e. setting the accent color on modern Windows. The user themselves sets dark theme with MwNdarkTheme.
*/
MWDECL void (*MwLLSetDarkTheme)(MwLL handle, int toggle);
/*!
* @brief Whether or not the platform should default to modern theme.
* @param handle Handle
* @return whether to default.
*/
MWDECL MwBool (*MwLLDoModern)(MwLL handle);
MWDECL void (*MwLLRaise)(MwLL handle);
MWDECL void (*MwLLClip)(MwLL handle, MwRect* rect);
/* font renderer */
MWDECL void MwFLSetup(void);
#ifdef USE_FREETYPE2
MWDECL int MwFL_FT2Setup(void);
#endif
#ifdef USE_STB_TRUETYPE
MWDECL int MwFL_STBTTSetup(void);
#endif
#ifdef USE_GDI_TEXT
MWDECL int MwFL_GDISetup(void);
#endif
MWDECL int (*MwFLDrawText)(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, MwLLColor color);
MWDECL int (*MwFLTextWidth)(MwFLFont ttf, const char* text);
MWDECL int (*MwFLTextHeight)(MwFLFont ttf, int count);
MWDECL int (*MwFLTextHeightWithText)(MwFLFont ttf, const char* text);
MWDECL void* (*MwFLFontLoad)(unsigned char* data, unsigned int size, int px);
MWDECL void (*MwFLFontFree)(void* handle);
#ifdef _WIN32
MWDECL void *MwLL_winmmLib;
MWDECL long (__stdcall* MwLL_PFN_timeGetTime)(void);
MWDECL unsigned int (__stdcall* MwLL_PFN_timeBeginPeriod)(unsigned int period);
#endif
#ifdef __cplusplus
}
#endif

229
include/Mw/LowLevel/Cairo.h Normal file
View file

@ -0,0 +1,229 @@
/*!
* @file Mw/LowLevel/Cairo.h
* @brief Cairo Backend
* @warning This is used MEGA internally.
*/
#ifndef __MW_LOWLEVEL_CAIRO_H__
#define __MW_LOWLEVEL_CAIRO_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/LowLevel.h>
#include <Mw/Abstract/Dynamic.h>
#include <cairo/cairo.h>
#ifdef __cplusplus
extern "C" {
#endif
MWDECL int MwLLCairoCallInit(void);
#ifdef __cplusplus
}
#endif
#define CSD_BORDER_FRAME_LEFT 5
#define CSD_BORDER_FRAME_RIGHT 5
#define CSD_BORDER_FRAME_TOP 23
#define CSD_BORDER_FRAME_BOTTOM 4
typedef struct cairo_call_table {
void* cairo_lib;
void (*cairo_set_line_width)(cairo_t* cr,
double width);
void (*cairo_scale)(cairo_t* cr,
double sx,
double sy);
cairo_t* (*cairo_create)(cairo_surface_t* target);
void (*cairo_move_to)(cairo_t* cr,
double x,
double y);
void (*cairo_rectangle)(cairo_t* cr,
double x,
double y,
double width,
double height);
void (*cairo_new_path)(cairo_t* cr);
void (*cairo_set_line_cap)(cairo_t* cr,
cairo_line_cap_t line_cap);
void (*cairo_set_source_rgba)(cairo_t* cr,
double red,
double green,
double blue,
double alpha);
void (*cairo_set_source_rgb)(cairo_t* cr,
double red,
double green,
double blue);
void (*cairo_reset_clip)(cairo_t* cr);
unsigned char* (*cairo_image_surface_get_data)(cairo_surface_t* surface);
void (*cairo_line_to)(cairo_t* cr,
double x,
double y);
cairo_status_t (*cairo_surface_write_to_png)(cairo_surface_t* surface, const char* filename);
void (*cairo_surface_destroy)(cairo_surface_t* surface);
cairo_surface_t* (*cairo_image_surface_create_for_data)(unsigned char* data,
cairo_format_t format,
int width,
int height,
int stride);
cairo_surface_t* (*cairo_image_surface_create)(cairo_format_t format,
int width,
int height);
void (*cairo_destroy)(cairo_t* cr);
cairo_pattern_t* (*cairo_get_source)(cairo_t* cr);
void (*cairo_close_path)(cairo_t* cr);
void (*cairo_paint)(cairo_t* cr);
void (*cairo_surface_flush)(cairo_surface_t* surface);
void (*cairo_clip)(cairo_t* cr);
void (*cairo_save)(cairo_t* cr);
void (*cairo_restore)(cairo_t* cr);
void (*cairo_surface_mark_dirty)(cairo_surface_t* surface);
void (*cairo_stroke)(cairo_t* cr);
void (*cairo_set_source_surface)(cairo_t* cr,
cairo_surface_t* surface,
double x,
double y);
void (*cairo_fill)(cairo_t* cr);
void (*cairo_pattern_set_filter)(cairo_pattern_t* pattern,
cairo_filter_t filter);
void (*cairo_set_antialias)(cairo_t*, cairo_antialias_t);
void (*cairo_set_operator)(cairo_t* cr, cairo_operator_t op);
} cairo_call_table_t;
extern cairo_call_table_t cairo_call_tbl;
/* defined inline right here so that it doesn't conflict with the other macros */
MwInline int cairo_load_funcs() {
#ifdef __APPLE__
cairo_call_tbl.cairo_lib = MwDynamicOpen("libcairo.dylib");
#else
cairo_call_tbl.cairo_lib = MwDynamicOpen("libcairo.so");
#endif
if(!cairo_call_tbl.cairo_lib) {
printf("(libcairo not found, cannot use Wayland or Cairo backend.)\n");
return 1;
}
#define CAIRO_FUNC(x) \
cairo_call_tbl.x = MwDynamicSymbol(cairo_call_tbl.cairo_lib, #x); \
if(!cairo_call_tbl.x) { \
printf("WARNING: Could use Wayland/Cairo backend if " #x " was not found. Do you have libcairo?\n"); \
return 1; \
};
CAIRO_FUNC(cairo_set_line_width);
CAIRO_FUNC(cairo_scale);
CAIRO_FUNC(cairo_create);
CAIRO_FUNC(cairo_move_to);
CAIRO_FUNC(cairo_rectangle);
CAIRO_FUNC(cairo_new_path);
CAIRO_FUNC(cairo_set_line_cap);
CAIRO_FUNC(cairo_set_antialias);
CAIRO_FUNC(cairo_set_source_rgba);
CAIRO_FUNC(cairo_set_source_rgb);
CAIRO_FUNC(cairo_reset_clip);
CAIRO_FUNC(cairo_image_surface_get_data);
CAIRO_FUNC(cairo_line_to);
CAIRO_FUNC(cairo_surface_write_to_png);
CAIRO_FUNC(cairo_surface_destroy);
CAIRO_FUNC(cairo_image_surface_create_for_data);
CAIRO_FUNC(cairo_image_surface_create);
CAIRO_FUNC(cairo_destroy);
CAIRO_FUNC(cairo_get_source);
CAIRO_FUNC(cairo_close_path);
CAIRO_FUNC(cairo_paint);
CAIRO_FUNC(cairo_surface_flush);
CAIRO_FUNC(cairo_clip);
CAIRO_FUNC(cairo_save);
CAIRO_FUNC(cairo_restore);
CAIRO_FUNC(cairo_surface_mark_dirty);
CAIRO_FUNC(cairo_stroke);
CAIRO_FUNC(cairo_set_source_surface);
CAIRO_FUNC(cairo_fill);
CAIRO_FUNC(cairo_set_operator);
CAIRO_FUNC(cairo_pattern_set_filter);
#undef CAIRO_FUNC
return 0;
}
#define cairo_set_line_width cairo_call_tbl.cairo_set_line_width
#define cairo_scale cairo_call_tbl.cairo_scale
#define cairo_create cairo_call_tbl.cairo_create
#define cairo_move_to cairo_call_tbl.cairo_move_to
#define cairo_rectangle cairo_call_tbl.cairo_rectangle
#define cairo_new_path cairo_call_tbl.cairo_new_path
#define cairo_set_line_cap cairo_call_tbl.cairo_set_line_cap
#define cairo_set_antialias cairo_call_tbl.cairo_set_antialias
#define cairo_set_source_rgba cairo_call_tbl.cairo_set_source_rgba
#define cairo_set_source_rgb cairo_call_tbl.cairo_set_source_rgb
#define cairo_reset_clip cairo_call_tbl.cairo_reset_clip
#define cairo_image_surface_get_data cairo_call_tbl.cairo_image_surface_get_data
#define cairo_line_to cairo_call_tbl.cairo_line_to
#define cairo_surface_write_to_png cairo_call_tbl.cairo_surface_write_to_png
#define cairo_surface_destroy cairo_call_tbl.cairo_surface_destroy
#define cairo_image_surface_create_for_data cairo_call_tbl.cairo_image_surface_create_for_data
#define cairo_image_surface_create cairo_call_tbl.cairo_image_surface_create
#define cairo_destroy cairo_call_tbl.cairo_destroy
#define cairo_get_source cairo_call_tbl.cairo_get_source
#define cairo_close_path cairo_call_tbl.cairo_close_path
#define cairo_paint cairo_call_tbl.cairo_paint
#define cairo_surface_flush cairo_call_tbl.cairo_surface_flush
#define cairo_clip cairo_call_tbl.cairo_clip
#define cairo_save cairo_call_tbl.cairo_save
#define cairo_restore cairo_call_tbl.cairo_restore
#define cairo_surface_mark_dirty cairo_call_tbl.cairo_surface_mark_dirty
#define cairo_stroke cairo_call_tbl.cairo_stroke
#define cairo_set_source_surface cairo_call_tbl.cairo_set_source_surface
#define cairo_fill cairo_call_tbl.cairo_fill
#define cairo_set_operator cairo_call_tbl.cairo_set_operator
#define cairo_pattern_set_filter cairo_call_tbl.cairo_pattern_set_filter
struct _MwLLCairo {
struct _MwLLCommon common;
cairo_surface_t* front_cs;
cairo_surface_t* back_cs;
cairo_t* front_cairo;
cairo_t* back_cairo;
/* The cairo to actually use for draw operations. Typically is front_cairo, but wayland's MwLLBeginDraw can change this to the back_cairo so it can be used to draw window decorations. */
cairo_t* selected_cairo;
int x;
int y;
int width;
int height;
MwBool toplevel;
MwLL parent;
};
struct _MwLLCairoColor {
struct _MwLLCommonColor common;
};
struct _MwLLCairoPixmap {
struct _MwLLCommonPixmap common;
cairo_surface_t* cs;
};
void MwLLCairoFrontSetup(struct _MwLLCairo* cairo, MwU8* data, MwU32 width, MwU32 height);
void MwLLCairoBackSetup(struct _MwLLCairo* cairo, MwU8* data, MwU32 width, MwU32 height);
void MwLLCairoFrontDestroy(struct _MwLLCairo* cairo);
void MwLLCairoBackDestroy(struct _MwLLCairo* cairo);
void MwLLCairoPolygon(struct _MwLLCairo handle, MwPoint* points, int points_count, MwLLColor color);
void MwLLCairoLine(struct _MwLLCairo handle, MwPoint* points, MwLLColor color);
MwLLPixmap MwLLCairoCreatePixmap(struct _MwLLCairo handle, unsigned char* data, int width, int height);
void MwLLCairoPixmapUpdate(MwLLPixmap handle);
void MwLLCairoDestroyPixmap(MwLLPixmap pixmap);
void MwLLCairoDrawPixmap(struct _MwLLCairo handle, MwRect* rect, MwLLPixmap pixmap);
void MwLLCairoDestroy(struct _MwLLCairo handle);
#endif

View file

@ -0,0 +1,43 @@
/*!
* @file Mw/LowLevel/ClassicMacOS.h
* @brief ClassicMacOS Backend
* @warning This is used internally
*/
#ifndef __MW_LOWLEVEL_ClassicMacOS_H__
#define __MW_LOWLEVEL_ClassicMacOS_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/LowLevel.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _MwLLClassicMacOS {
struct _MwLLCommon common;
MwLL parent;
WindowRef window;
ControlHandle control;
EventRecord event;
Rect winRect;
};
struct _MwLLClassicMacOSColor {
struct _MwLLCommonColor common;
};
struct _MwLLClassicMacOSPixmap {
struct _MwLLCommonPixmap common;
BitMap bmp;
};
MWDECL int MwLLClassicMacOSCallInit(void);
#ifdef __cplusplus
}
#endif
#endif

189
include/Mw/LowLevel/Cocoa.h Normal file
View file

@ -0,0 +1,189 @@
/*!
* @file Mw/LowLevel/Cocoa.h
* @brief Work in progress Cocoa Backend
* @warning This is used internally.
*/
#ifndef __MW_LOWLEVEL_COCOA_H__
#define __MW_LOWLEVEL_COCOA_H__
#include <Mw/LowLevel.h>
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
typedef struct {
enum {
COCOA_DRAW_COMMAND_POLY = 0,
COCOA_DRAW_COMMAND_LINES,
COCOA_DRAW_COMMAND_PIXMAP,
} type;
union {
struct {
MwPoint* points;
int points_count;
struct _MwLLCommonColor color;
} poly;
struct {
MwPoint* points;
struct _MwLLCommonColor color;
} lines;
struct {
MwRect rect;
MwLLPixmap pixmap;
} pixmap;
};
} draw_command;
#ifdef __OBJC__
#import <AppKit/AppKit.h>
#import <Foundation/Foundation.h>
#import <Foundation/NSGeometry.h>
@interface MilskoCocoaApplication : NSApplication {
MwBool doPending;
}
- (MwBool)pending;
@end
// Note: implements NSApplicationDelegate
@interface MilskoCocoaApplicationDelegate : NSObject {
MilskoCocoaApplication* appl;
}
- (MilskoCocoaApplicationDelegate*)initWithAppl:(MilskoCocoaApplication*)appl;
@end
@interface MilskoCocoaWindow : NSWindow {
}
@end
// Note: implements NSWindowDelegate
@interface MilskoCocoaWindowDelegate : NSObject {
NSWindow* w;
}
- (MilskoCocoaWindowDelegate*)initWithWin:(NSWindow*)win;
@end
/*
So we want to associate each NSWindow with its corresponding MwLL handle. The
conventional way of doing this is through "associative pointers", however
this is a feature that Apple added in 10.6 (marketted back then as "Objective
C 2" iirc). For 10.4 compatibility, we have to do a bit of an ugly hack that
might seem like horrifically undefined behavior, but I've tested this on
both 10.4 and modern Mac OS and as long as we're careful there's no
problems: we override NSView, use NSView's "frame" property to store the
pointer, and then override functions appropriately so that this frame is never
actually used. This can then be attached to an NSWindow with addSubview and
retrieved appropriately.
*/
@interface MilskoFakePointer : NSView {
void* ptr;
}
- (void)setPointer:(void*)ptr;
- (void*)pointer;
@end
@interface MilskoCocoaPixmap : NSObject {
@public
MwBool valid;
int width;
int height;
unsigned char* buf;
NSImage* image;
NSBitmapImageRep* rep;
}
+ (MilskoCocoaPixmap*)newWithWidth:(int)width height:(int)height;
- (void)updateWithData:(unsigned char*)data;
- (void)destroy;
/* using @property to create instance variables fucks up 10.4 gcc for some
* reason? */
- (NSImage*)image;
@end
@interface MilskoCocoaView : NSView {
MwBool _child;
@public
draw_command* commands;
}
- (void)destroy;
- (void)setChild;
@end
@interface MilskoCocoaSubView : MilskoCocoaView {
}
@end
@interface MilskoCocoa : NSObject {
@public
MilskoCocoaApplication* application;
MwBool _forceRender;
MwBool _eventsPending;
MwBool isClosing;
NSWindow* window;
NSRect rect;
MilskoCocoaView* view;
MwLL parent;
MilskoFakePointer* handle;
unsigned int strHash;
NSEvent* lastEvent;
MilskoCocoaPixmap* cursorPixmap;
NSCursor* cursor;
NSModalSession modalSession;
MwBool pointerLocked;
MwBool mouseMoved;
MwBool rejectFirstTest;
}
- (void)destroy;
- (void)sendClipboardEvent;
- (MwLL)getParent;
- (NSView*)getView;
- (NSWindow*)getWindow;
- (void)nudge;
- (void)pushCursor;
- (void)popCursor;
- (MilskoFakePointer*)getHandle;
@end
#define OBJC(x) x
#else
#define OBJC(x) void*
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct _MwLLCocoa {
struct _MwLLCommon common;
OBJC(MilskoCocoa*)
real;
};
struct _MwLLCocoaColor {
struct _MwLLCommonColor common;
};
struct _MwLLCocoaPixmap {
struct _MwLLCommonPixmap common;
OBJC(MilskoCocoaPixmap*)
real;
};
MWDECL int MwLLCocoaCallInit(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -10,6 +10,10 @@
#include <Mw/TypeDefs.h>
#include <Mw/LowLevel.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _MwLLGDI {
struct _MwLLCommon common;
@ -19,8 +23,12 @@ struct _MwLLGDI {
HCURSOR cursor;
HICON icon;
HRGN clip;
int grabbed;
int force_render;
int get_clipboard;
int get_darktheme;
};
struct _MwLLGDIColor {
@ -41,4 +49,8 @@ struct _MwLLGDIPixmap {
MWDECL int MwLLGDICallInit(void);
MWDECL HCURSOR MwLLGDICreateCursor(MwCursor* image, MwCursor* mask);
#ifdef __cplusplus
}
#endif
#endif

173
include/Mw/LowLevel/Haiku.h Normal file
View file

@ -0,0 +1,173 @@
/*!
* @file Mw/LowLevel/Haiku.h
* @brief Haiku Backend
* @warning This is used internally
*/
#ifndef __MW_LOWLEVEL_HAIKU_H__
#define __MW_LOWLEVEL_HAIKU_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/LowLevel.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
class MwApplication;
class MwView;
class MwWindow;
class MwApplication : public BApplication {
public:
MwApplication(MwRect rc, MwLL handle);
~MwApplication();
void MessageReceived(BMessage* message);
};
class MwView : public BView {
public:
MwLL handle;
BLocker* locker;
uint32 buttons;
BBitmap* bitmap;
MwView(MwLL handle, BRect rc, uint32 resizingMode, uint32 flags);
~MwView();
void MessageReceived(BMessage* message);
void PostMessage(BMessage* message);
void PostMessage(uint32 command);
status_t SendMessage(BMessage* message);
status_t SendMessage(uint32 command);
void Invalidate();
void AttachedToWindow();
void Draw(BRect updateRect);
void FrameResized(float width, float height);
void MouseDown(BPoint point);
void MouseUp(BPoint point);
void MouseMoved(BPoint point, uint32 transit, const BMessage* message);
void SetColor(MwLLColor color);
};
class MwWindow : public BWindow {
public:
MwWindow(BRect rc, window_type type, uint32 flags);
void MessageReceived(BMessage* message);
void FrameMoved(BPoint newLocation);
bool QuitRequested();
};
typedef BBitmap MwBBitmap;
#else
typedef void MwApplication;
typedef void MwView;
typedef void MwWindow;
typedef void MwBBitmap;
#endif
typedef union _MwLLHaikuEvent MwLLHaikuEvent;
enum BAPP_MW_WHAT {
BAPP_MW_DESTROY = 0
};
enum BVIEW_MW_WHAT {
BVIEW_MW_DESTROY = 0,
BVIEW_MW_DETACH,
BVIEW_MW_RESIZE,
BVIEW_MW_MOVE,
BVIEW_MW_SHOW,
BVIEW_MW_HIDE,
BVIEW_MW_SET_COLOR,
BVIEW_MW_POLYGON,
BVIEW_MW_LINE,
BVIEW_MW_BITMAP,
BVIEW_MW_RENDER,
BVIEW_MW_RAISE,
BVIEW_MW_GET_MOUSE
};
enum BWIN_MW_WHAT {
BWIN_MW_DESTROY = 0,
BWIN_MW_SET_TITLE,
BWIN_MW_SET_TYPE
};
enum MwLLHAIKU_EVENT {
MwLLHAIKU_EVENT_DRAW = 0,
MwLLHAIKU_EVENT_CLOSE,
MwLLHAIKU_EVENT_FRAMERESIZED,
MwLLHAIKU_EVENT_FRAMEMOVED,
MwLLHAIKU_EVENT_MOUSEDOWN,
MwLLHAIKU_EVENT_MOUSEUP,
MwLLHAIKU_EVENT_MOUSEMOVED
};
struct _MwLLHaikuEventMouse {
int type;
MwPoint point;
int button;
};
struct _MwLLHaikuEventFrameResized {
int type;
float width;
float height;
};
struct _MwLLHaikuEventFrameMoved {
int type;
MwPoint point;
};
union _MwLLHaikuEvent {
int type;
struct _MwLLHaikuEventMouse mouse;
struct _MwLLHaikuEventFrameResized frame_resized;
struct _MwLLHaikuEventFrameMoved frame_moved;
};
struct _MwLLHaiku {
struct _MwLLCommon common;
int type;
int x;
int y;
int width;
int height;
MwLL parent;
MwApplication* app;
MwWindow* window;
MwView* view;
thread_id app_thread;
int force_render;
MwLLHaikuEvent* events;
};
struct _MwLLHaikuColor {
struct _MwLLCommonColor common;
};
struct _MwLLHaikuPixmap {
struct _MwLLCommonPixmap common;
MwBBitmap* bitmap;
};
MWDECL int MwLLHaikuCallInit(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,8 +1,7 @@
/*!
* @file Mw/LowLevel/Wayland.h
* @brief Work in progress Wayland Backend
* @brief Wayland Backend
* @warning This is used internally.
* @warning This is disabled by default.
*/
#ifndef __MW_LOWLEVEL_WAYLAND_H__
#define __MW_LOWLEVEL_WAYLAND_H__
@ -10,112 +9,509 @@
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/LowLevel.h>
#include <Mw/Abstract/Dynamic.h>
#include <wayland-client-protocol.h>
#include <wayland-egl.h>
#include <EGL/egl.h>
#include <GL/gl.h>
#include <GL/glext.h>
#include <Mw/LowLevel/Cairo.h>
#include <wayland-client.h>
#include <xkbcommon/xkbcommon.h>
#include <pthread.h>
#ifdef __cplusplus
extern "C" {
#endif
MWDECL int MwLLWaylandCallInit(void);
#ifndef WL_PROTOCOLS_DEFINED
#define WL_PROTOCOLS_DEFINED
#include "Wayland/xdg-shell-client-protocol.h"
#include "Wayland/xdg-decoration-client-protocol.h"
#include "Wayland/cursor-shape-client-protocol.h"
#ifdef __cplusplus
}
#endif
#define CSD_BORDER_FRAME_LEFT 5
#define CSD_BORDER_FRAME_RIGHT 5
#define CSD_BORDER_FRAME_TOP 23
#define CSD_BORDER_FRAME_BOTTOM 4
struct _MwLLWayland;
#include <wayland-client-core.h>
#if WAYLAND_LOAD_OPENGL
#include <EGL/egl.h>
#include <wayland-egl-core.h>
#endif
typedef struct wayland_call_table {
void* lib;
void* xkb_lib;
#ifdef USE_DBUS
MwLLDBusFuncTable dbus;
MwBool has_dbus;
#endif
int (*wl_display_dispatch)(struct wl_display* display);
int (*wl_display_dispatch_pending)(struct wl_display* display);
void (*wl_display_disconnect)(struct wl_display* display);
void (*wl_display_cancel_read)(struct wl_display* display);
int (*wl_display_prepare_read)(struct wl_display* display);
int (*wl_display_read_events)(struct wl_display* display);
int (*wl_display_flush)(struct wl_display* display);
int (*wl_display_get_fd)(struct wl_display* display);
int (*wl_display_roundtrip)(struct wl_display* display);
int (*wl_proxy_add_listener)(struct wl_proxy* proxy, void (**implementation)(void), void* data);
void (*wl_proxy_destroy)(struct wl_proxy* proxy);
void (*wl_log_set_handler_client)(wl_log_func_t handler);
struct wl_proxy* (*wl_proxy_marshal_flags)(struct wl_proxy* proxy, uint32_t opcode,
const struct wl_interface* interface,
uint32_t version,
uint32_t flags, ...);
struct wl_display* (*wl_display_connect)(const char* name);
uint32_t (*wl_proxy_get_version)(struct wl_proxy* proxy);
struct wl_display* (*wl_display_connect_to_fd)(int fd);
int (*wl_display_get_error)(struct wl_display* display);
struct xkb_context* (*xkb_context_new)(enum xkb_context_flags flags);
void (*xkb_context_unref)(struct xkb_context* context);
struct xkb_state* (*xkb_state_new)(struct xkb_keymap* keymap);
void (*xkb_state_unref)(struct xkb_state* state);
struct xkb_keymap* (*xkb_keymap_new_from_string)(struct xkb_context* context, const char* string, enum xkb_keymap_format format, enum xkb_keymap_compile_flags flags);
xkb_level_index_t (*xkb_keymap_num_levels_for_key)(struct xkb_keymap* keymap, xkb_keycode_t key, xkb_layout_index_t layout);
int (*xkb_keymap_key_get_syms_by_level)(struct xkb_keymap* keymap, xkb_keycode_t key, xkb_layout_index_t layout, xkb_level_index_t level, const xkb_keysym_t** syms_out);
xkb_layout_index_t (*xkb_state_key_get_layout)(struct xkb_state* state, xkb_keycode_t key);
void (*xkb_keymap_unref)(struct xkb_keymap* keymap);
} wayland_call_table_t;
extern wayland_call_table_t wl_call_tbl;
#ifdef MW_VULKAN
extern MwBool MwWaylandVulkan;
#else
#define MwWaylandVulkan 0
#endif
MWDECL MwBool MwWaylandCairoOnly;
/* defined inline right here so that it doesn't conflict with the other macros */
MwInline int wayland_load_funcs() {
#ifdef __APPLE__
wl_call_tbl.lib = MwDynamicOpen("libwayland-client.dylib");
#else
wl_call_tbl.lib = MwDynamicOpen("libwayland-client.so");
#endif
if(!wl_call_tbl.lib) {
printf("(libwayland-client not found, falling back to X11)\n");
return 1;
}
#ifdef __APPLE__
wl_call_tbl.xkb_lib = MwDynamicOpen("libxkbcommon.dylib");
#else
wl_call_tbl.xkb_lib = MwDynamicOpen("libxkbcommon.so");
#endif
if(!wl_call_tbl.xkb_lib) {
printf("(libxkbcommon not found, cannot use Wayland backend.)\n");
return 1;
}
#define WAYLAND_FUNC(x) \
wl_call_tbl.x = MwDynamicSymbol(wl_call_tbl.lib, #x); \
if(!wl_call_tbl.x) { \
printf("WARNING: Could use Wayland backend if " #x " was found.\n"); \
return 1; \
};
WAYLAND_FUNC(wl_display_dispatch)
WAYLAND_FUNC(wl_display_dispatch_pending)
WAYLAND_FUNC(wl_display_disconnect)
WAYLAND_FUNC(wl_display_cancel_read)
WAYLAND_FUNC(wl_display_prepare_read)
WAYLAND_FUNC(wl_display_read_events)
WAYLAND_FUNC(wl_display_flush)
WAYLAND_FUNC(wl_display_get_fd)
WAYLAND_FUNC(wl_display_roundtrip)
WAYLAND_FUNC(wl_proxy_add_listener)
WAYLAND_FUNC(wl_proxy_destroy)
WAYLAND_FUNC(wl_log_set_handler_client)
WAYLAND_FUNC(wl_proxy_marshal_flags)
WAYLAND_FUNC(wl_display_connect)
WAYLAND_FUNC(wl_proxy_get_version)
WAYLAND_FUNC(wl_display_connect_to_fd)
WAYLAND_FUNC(wl_display_get_error)
#undef WAYLAND_FUNC
#define XKB_FUNC(x) \
wl_call_tbl.x = MwDynamicSymbol(wl_call_tbl.xkb_lib, #x); \
if(!wl_call_tbl.x) { \
printf("WARNING: Could use Wayland backend if " #x " was found. Do you have libxkbcommon?\n"); \
return 1; \
};
XKB_FUNC(xkb_state_unref)
XKB_FUNC(xkb_context_new)
XKB_FUNC(xkb_context_unref)
XKB_FUNC(xkb_state_new)
XKB_FUNC(xkb_keymap_new_from_string)
XKB_FUNC(xkb_keymap_unref)
XKB_FUNC(xkb_keymap_num_levels_for_key)
XKB_FUNC(xkb_keymap_key_get_syms_by_level)
XKB_FUNC(xkb_state_key_get_layout)
#undef XKB_FUNC
if(cairo_load_funcs() != 0) {
return 1;
}
#ifdef USE_DBUS
wl_call_tbl.has_dbus = MwLLDBusFuncSetup(&wl_call_tbl.dbus);
#endif
return 0;
}
#define wl_display_dispatch wl_call_tbl.wl_display_dispatch
#define wl_display_dispatch_pending wl_call_tbl.wl_display_dispatch_pending
#define wl_display_disconnect wl_call_tbl.wl_display_disconnect
#define wl_display_cancel_read wl_call_tbl.wl_display_cancel_read
#define wl_display_prepare_read wl_call_tbl.wl_display_prepare_read
#define wl_display_read_events wl_call_tbl.wl_display_read_events
#define wl_display_flush wl_call_tbl.wl_display_flush
#define wl_display_get_fd wl_call_tbl.wl_display_get_fd
#define wl_display_roundtrip wl_call_tbl.wl_display_roundtrip
#define wl_proxy_add_listener wl_call_tbl.wl_proxy_add_listener
#define wl_proxy_destroy wl_call_tbl.wl_proxy_destroy
#define wl_log_set_handler_client wl_call_tbl.wl_log_set_handler_client
#define wl_proxy_marshal_flags wl_call_tbl.wl_proxy_marshal_flags
#define wl_display_connect wl_call_tbl.wl_display_connect
#define wl_proxy_get_version wl_call_tbl.wl_proxy_get_version
#define wl_display_connect_to_fd wl_call_tbl.wl_display_connect_to_fd
#define wl_display_get_error wl_call_tbl.wl_display_get_error
#define xkb_state_unref wl_call_tbl.xkb_state_unref
#define xkb_context_new wl_call_tbl.xkb_context_new
#define xkb_context_unref wl_call_tbl.xkb_context_unref
#define xkb_state_new wl_call_tbl.xkb_state_new
#define xkb_keymap_new_from_string wl_call_tbl.xkb_keymap_new_from_string
#define xkb_keymap_unref wl_call_tbl.xkb_keymap_unref
#define xkb_keymap_num_levels_for_key wl_call_tbl.xkb_keymap_num_levels_for_key
#define xkb_keymap_key_get_syms_by_level wl_call_tbl.xkb_keymap_key_get_syms_by_level
#define xkb_state_key_get_layout wl_call_tbl.xkb_state_key_get_layout
#ifndef WL_PROTOCOLS_DEFINED
#define WL_PROTOCOLS_DEFINED
#include "Wayland/wayland-core-protocol.h"
#include "Wayland/xdg-shell-client-protocol.h"
#include "Wayland/viewporter-client-protocol.h"
#include "Wayland/xdg-decoration-client-protocol.h"
#include "Wayland/cursor-shape-client-protocol.h"
#include "Wayland/primary-selection-client-protocol.h"
#include "Wayland/pointer-constraints-client-protocol.h"
#include "Wayland/relative-pointer-client-protocol.h"
#include "Wayland/xdg-toplevel-icon-client-protocol.h"
#include "Wayland/wlr-layer-shell-client-protocol.h"
#endif
typedef struct wayland_protocol {
void* listener;
void* context;
} wayland_protocol_t;
typedef wayland_protocol_t*(wl_setup_func)(MwU32, struct _MwLLWayland*);
typedef wayland_protocol_t*(wl_setup_func)(MwU32, struct _MwLLWayland*, MwU32 version);
typedef void(wl_destroy_func)(struct _MwLLWayland* wayland, wayland_protocol_t* data);
typedef struct wayland_protocol_callback_table {
wl_setup_func* setup;
wl_destroy_func* destroy;
} wayland_protocol_callback_table_t;
struct _MwLLWaylandTopLevel {
struct xdg_surface* xdg_surface;
struct xdg_toplevel* xdg_top_level;
struct xdg_toplevel_listener xdg_toplevel_listener;
struct xdg_surface_listener xdg_surface_listener;
MwBool maxim_state;
MwBool compositor_created;
MwBool xdg_wm_base_created;
MwBool xdg_surface_created;
struct wl_subsurface* ssurface;
struct wl_subcompositor* scompositor;
};
struct _MwLLWaylandSublevel {
struct wl_subsurface* subsurface;
struct wl_subcompositor* subcompositor;
MwLL parent;
struct xdg_surface* xdg_surface;
};
struct _MwLLWaylandPopup {
struct xdg_surface* xdg_surface;
struct xdg_popup* xdg_popup;
struct xdg_positioner* xdg_positioner;
struct xdg_surface_listener xdg_surface_listener;
struct xdg_wm_base* xdg_wm_base;
MwLL topmost_parent;
};
struct _MwLLWaylandLayerSurface {
struct zwlr_layer_surface_v1* surface;
};
/* Shared set of anything needed for a shm buffer. */
struct _MwLLWaylandShmBuffer {
struct wl_shm* shm;
struct wl_shm_pool* shm_pool;
struct wl_buffer* shm_buffer;
struct wl_shm_pool* shm_pool_back;
struct wl_buffer* shm_buffer_back;
struct wl_surface* surface;
struct wl_output* output;
MwU8* buf;
MwU8* buf_back;
MwU64 buf_size;
int fd;
int fd_back;
MwBool setup;
};
enum _MwLLWaylandType {
MwLL_WAYLAND_UNKNOWN = 0,
MwLL_WAYLAND_TOPLEVEL,
MwLL_WAYLAND_SUBLEVEL,
MwLL_WAYLAND_POPUP,
MwLL_WAYLAND_LAYER_SURFACE,
};
typedef struct wl_clipboard_device_context {
struct {
struct wl_data_device* wl;
struct zwp_primary_selection_device_v1* zwp;
} device;
struct {
struct wl_data_offer* wl;
struct zwp_primary_selection_offer_v1* zwp;
} offer;
MwLL ll;
// struct wl_seat* seat;
} wl_clipboard_device_context_t;
struct _MwLLWayland {
struct _MwLLCommon common;
struct _MwLLCairo cairo;
union {
/* Pointer for data that's only loaded if the widget is a toplevel */
struct _MwLLWaylandTopLevel* toplevel;
/* Pointer for data that's only loaded if the widget is a sublevel */
struct _MwLLWaylandSublevel* sublevel;
/* Pointer for data that's only loaded if the widget is a popup */
struct _MwLLWaylandPopup* popup;
/* Pointer for data that's only loaded if the widget is a layer surface */
struct _MwLLWaylandLayerSurface* layer_surface;
};
enum _MwLLWaylandType type;
enum _MwLLWaylandType type_to_be;
MwRect clipping_rect;
MwBool no;
MwBool changing;
MwBool detatching;
MwPoint detach_point;
MwBool did_initial_resize;
MwBool is_toplevel;
MwBool is_clipping;
MwRect clip;
/* Map of Wayland interfaces to their relevant setup functions. */
struct {
char* key;
wayland_protocol_callback_table_t* value;
}* wl_protocol_setup_map;
/* Map of Wayland interfaces to any information we keep about them once we've registered them. */
struct {
char* key;
wayland_protocol_t* value;
}* wl_protocol_map;
MwBool do_csd;
MwBool has_decorations;
char title[256];
struct xkb_context* xkb_context;
struct xkb_keymap* xkb_keymap;
struct xkb_state* xkb_state;
MwBool compositor_created;
MwBool xdg_wm_base_created;
MwBool xdg_surface_created;
};
struct _MwLLWayland {
struct _MwLLCommon common;
/* Pointer for data that's only loaded if the widget is a toplevel */
struct _MwLLWaylandTopLevel* toplevel;
enum {
MWLL_WAYLAND_TOPLEVEL = 0,
MWLL_WAYLAND_SUBLEVEL = 1, /* Sublevels are surfaces that have the toplevel as a parent. They could be implemented as subsurfaces if we ever switch away from OpenGL. Some parts of the code also call them subwidgets. */
} type;
/* Map of Wayland interfaces to their relevant setup functions. */
struct {
const char* key;
wl_setup_func* value;
}* wl_protocol_setup_map;
/* Map of Wayland interfaces to any information we keep about them once we've registered them. */
struct {
const char* key;
wayland_protocol_t* value;
}* wl_protocol_map;
struct wl_display* display;
struct wl_registry* registry;
struct wl_compositor* compositor;
struct wl_subcompositor* subcompositor;
struct wl_surface* surface;
struct wl_registry_listener registry_listener;
struct wl_event_queue* event_queue;
struct wl_region* o_region;
struct wl_region* region;
struct wl_output* output;
EGLNativeWindowType egl_window_native;
EGLDisplay egl_display;
EGLContext egl_context;
EGLSurface egl_surface;
EGLConfig egl_config;
struct wp_viewport* vp;
MwBool do_lock_pointer;
struct zwp_pointer_constraints_v1* pointer_constraints;
struct zwp_relative_pointer_manager_v1* relative_pointer_manager;
struct zwp_relative_pointer_v1* relative_pointer;
struct zwp_locked_pointer_v1* locked_pointer;
MwBool pointer_constrained;
MwBool valid;
#ifdef USE_DBUS
MwLLDBusContext dbus;
#endif
MwBool dark_theme_detection;
MwU32 dark_theme;
/* clipboard related stuff.
* Note that unlike most interfaces, we don't keep zwp_primary_selection stuff in a wayland_protocol_t because we use wl_data_device as a fallback and want to have it share memory space.*/
struct {
struct wl_data_device_manager* wl;
struct zwp_primary_selection_device_manager_v1* zwp;
} clipboard_manager;
union {
struct wl_data_source* wl;
struct zwp_primary_selection_source_v1* zwp;
} clipboard_source;
char* clipboard_buffer;
MwBool supports_zwp;
MwBool zwp_setup;
uint32_t clipboard_serial;
wl_clipboard_device_context_t** clipboard_devices_wl;
wl_clipboard_device_context_t** clipboard_devices_zwp;
struct wl_pointer* pointer;
MwU32 pointer_serial;
struct wl_seat* pointer_seat;
struct wl_keyboard* keyboard;
MwU32 keyboard_serial;
MwU64 events_pending;
MwU32 mod_state;
MwLL* sublevels; /* stb_ds managed array of any sublevels */
MwBool configured; /* Whether or not xdg_toplevel_configure has run once */
MwBool egl_setup; /* Whether or not EGL has been set up */
MwBool has_set_xy /* Whether or not MwSetXY has been called */;
int resize_counter; /* Counter that's for a hack in event_loop */
MwU32 x, y, ww, wh; /* Window position */
MwU32 lw, lh; /* Last known window position */
MwPoint cur_mouse_pos; /* Currently known mouse position */
MwBool held_down;
struct timeval timer;
MwU64 cooldown_timer;
MwU64 cooldown_timer_epoch;
MwI32 x, y;
MwI32 ox, oy;
MwU32 ww, wh; /* Window position */
MwPoint cur_mouse_pos; /* Currently known mouse position */
MwLL currentlyHeldWidget;
MwLL focusedWidget;
int resizing;
int setting_wh;
MwU32 mw, mh; /* Monitor width and height as advertised by wl_output.mode */
MwLL parent;
MwLL topmost_parent; /* The parent at the top of all the other parents. Usually a toplevel. */
MwBool force_render;
MwBool did_event_loop_early;
MwBool dispatching_resize;
MwBool is_toplevel_menu;
struct _MwLLWaylandShmBuffer framebuffer;
struct _MwLLWaylandShmBuffer backbuffer;
struct _MwLLWaylandShmBuffer cursor;
struct _MwLLWaylandShmBuffer* icon;
MwLLPixmap icon_pixmap;
pthread_mutex_t eventsMutex;
int cancelEvent;
int numCallbacksRunning;
uint32_t last_time;
MwBool moving;
MwI64 keyboard_rate;
MwI32 keyboard_delay;
int last_pressed_key;
MwBool holding_key;
MwU64 next_elapsed;
long start_time;
long end_time;
};
struct _MwLLWaylandColor {
struct _MwLLCommonColor common;
};
struct _MwLLWaylandPixmap {
struct _MwLLCommonPixmap common;
GLuint texture;
MwBool texture_deleted;
};
#define _MwLLWaylandPixmap _MwLLCairoPixmap
/* Setup the framebuffer with the saved width/height */
void MwLLWaylandFramebufferSetup(struct _MwLLWayland* wayland);
/* Destroy the framebuffer */
void MwLLWaylandFramebufferDestroy(struct _MwLLWayland* handle);
/* Setup the framebuffer with the saved width/height */
void MwLLWaylandBackbufferSetup(struct _MwLLWayland* wayland);
/* Destroy the backbuffer */
void MwLLWaylandBackbufferDestroy(struct _MwLLWayland* handle);
void MwLLWaylandBufferSetup(struct _MwLLWaylandShmBuffer* buffer, MwU32 width, MwU32 height);
void MwLLWaylandBufferUpdate(MwLL self, struct _MwLLWaylandShmBuffer* buffer);
void MwLLWaylandBufferDestroy(struct _MwLLWaylandShmBuffer* buffer);
void MwLLWaylandRegionSetup(MwLL handle);
void MwLLWaylandRegionInvalidate(MwLL handle);
void MwLLWaylandHangUntilConfigured(MwLL handle);
MwBool MwLLWaylandWidgetIsDestroyed(MwLL self);
void MwLLWaylandWidgetUndestroy(MwLL self);
/* Function for setting up the callbacks/structs that will be registered upon the relevant interfaces being found. */
void MwLLWaylandSetupCallbacks(struct _MwLLWayland* wayland);
void MwLLWaylandClipboardRead(wl_clipboard_device_context_t* ctx, int clipboard_type);
/* Flush Wayland events */
void MwLLWaylandFlush(MwLL handle);
/* Standard procedure before event callbacks in Wayland */
#define WAYLAND_EVENT_OP_START(self) \
if(MwLLWaylandWidgetIsDestroyed(self)) { \
return; \
}
/* Footer for WAYLAND_EVENT_OP_START */
#define WAYLAND_EVENT_OP_END(self)
#define WIDGET_CHECK(handle) \
if(!handle->wayland.valid) { \
return; \
}
/* the two decoration manager constructs */
typedef struct zxdg_decoration_manager_v1_context {
struct zxdg_decoration_manager_v1* manager;
struct zxdg_toplevel_decoration_v1* decoration;
} zxdg_decoration_manager_v1_context_t;
extern struct zwp_relative_pointer_v1_listener MwLLWaylandRelativePointerListener;
#endif

View file

@ -17,6 +17,10 @@
#include <X11/extensions/Xrender.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct _MwLLX11 {
struct _MwLLCommon common;
@ -29,9 +33,18 @@ struct _MwLLX11 {
GC gc;
Colormap colormap;
Atom wm_delete;
Atom wm_protocols;
Atom utf8_string;
Atom compound_text;
Atom text;
Atom clipboard;
Atom selection;
XIM xim;
XIC xic;
long clipboard_time;
int clipboard_pending; /* 1 if UTF8_STRING, 2 if COMPOUND_TEXT, 3 if TEXT, 4 if STRING, otherwise 0 */
int top;
int toplevel;
int grabbed;
@ -48,6 +61,12 @@ struct _MwLLX11 {
unsigned long blue_mask;
unsigned long blue_max;
unsigned long blue_shift;
#ifdef USE_DBUS
MwLLDBusContext dbus;
#endif
MwBool dark_theme_detection;
};
struct _MwLLX11Color {
@ -71,4 +90,8 @@ struct _MwLLX11Pixmap {
MWDECL int MwLLX11CallInit(void);
MWDECL Cursor MwLLX11CreateCursor(Display* display, MwCursor* image, MwCursor* mask);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -9,7 +9,6 @@
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <setjmp.h>
#include <sys/types.h>
#include <assert.h>
#include <math.h>
@ -17,11 +16,16 @@
#include <ctype.h>
#include <time.h>
#include <sys/stat.h>
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199409L
#include <wchar.h>
#define MW_HAS_WCHAR
#endif
#ifdef _WIN32
#include <direct.h>
#ifdef _MILSKO
#include <windows.h>
#include <mmsystem.h>
#ifndef GWLP_USERDATA
#define GWLP_USERDATA GWL_USERDATA
#define GWLP_WNDPROC GWL_WNDPROC
@ -37,27 +41,82 @@
#define GET_WHEEL_DELTA_WPARAM(x) ((short)HIWORD(x))
#endif
#endif
#elif defined(CLASSIC_MAC_OS)
#include <unistd.h>
#include <MacTypes.h>
#include <CFBundle.h>
#include <CodeFragments.h>
#include <Timer.h>
#include <MacWindows.h>
#include <TextEdit.h>
#include <Dialogs.h>
#else
#include <unistd.h>
#include <pwd.h>
#include <dlfcn.h>
#include <signal.h>
#include <dirent.h>
#include <fcntl.h>
#include <limits.h>
#endif
#if defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__)
#include <dirent.h>
#include <dlfcn.h>
#endif
#ifdef __HAIKU__
#ifdef __cplusplus
#include <Window.h>
#include <View.h>
#include <Screen.h>
#include <Application.h>
#include <Locker.h>
#include <Picture.h>
#include <Bitmap.h>
#endif
#include <OS.h>
#endif
#ifdef __APPLE__
#include <mach/clock.h>
#include <mach/mach.h>
#endif
#ifdef USE_DBUS
#include <dbus/dbus.h>
#endif
#ifndef M_PI
#define M_PI 3.14159265
#endif
#if defined(_MILSKO) && defined(_WIN32)
/* Windows */
#if defined(_MILSKO) && defined(_MILSKO_BUILD) && defined(_WIN32)
#define MWDECL extern __declspec(dllexport)
#elif defined(_WIN32)
#define MWDECL extern __declspec(dllimport)
/* GCC/Clang */
/* First check if we have __has_attribute and can check for the existence of visibility */
#elif defined(__has_attribute)
#if __has_attribute(visibility)
#define MWDECL extern __attribute__((visibility("default")))
#else
#define MWDECL extern
#endif
/* It might be that we're on an old version of GCC (like the one Apple ships with older versions of Mac OS).
* If we're on gcc 3 or above, assume it's there
*/
#elif __GNUC__ >= 3
#define MWDECL extern __attribute__((visibility("default")))
#else
/* all else fails */
#define MWDECL extern
#endif
#if defined(_WIN32)
#define MWAPI __cdecl
#else
#define MWAPI
#endif
#define MwInline static __inline

View file

@ -12,16 +12,17 @@
#include <Mw/Core.h>
#include <Mw/Default.h>
#include <Mw/Font.h>
#include <Mw/Error.h>
#include <Mw/Constants.h>
#include <Mw/Unicode.h>
#include <Mw/String.h>
#include <Mw/Draw.h>
#include <Mw/Version.h>
#include <Mw/TrueType.h>
#include <Mw/Abstract/Dynamic.h>
#include <Mw/Abstract/Directory.h>
#include <Mw/Abstract/Time.h>
#include <Mw/Abstract/CharSet.h>
#include <Mw/Resource/Icon.h>
#include <Mw/Resource/Cursor.h>
@ -32,23 +33,28 @@
#include <Mw/Dialog/DirectoryChooser.h>
#include <Mw/Dialog/ColorPicker.h>
#include <Mw/Widget/Window.h>
#include <Mw/Widget/Menu.h>
#include <Mw/Widget/SubMenu.h>
#include <Mw/Widget/Box.h>
#include <Mw/Widget/Button.h>
#include <Mw/Widget/Label.h>
#include <Mw/Widget/Calendar.h>
#include <Mw/Widget/CheckBox.h>
#include <Mw/Widget/ComboBox.h>
#include <Mw/Widget/Entry.h>
#include <Mw/Widget/Frame.h>
#include <Mw/Widget/Image.h>
#include <Mw/Widget/Entry.h>
#include <Mw/Widget/ScrollBar.h>
#include <Mw/Widget/NumberEntry.h>
#include <Mw/Widget/Viewport.h>
#include <Mw/Widget/Label.h>
#include <Mw/Widget/ListBox.h>
#include <Mw/Widget/Menu.h>
#include <Mw/Widget/NumberEntry.h>
#include <Mw/Widget/ProgressBar.h>
#include <Mw/Widget/RadioBox.h>
#include <Mw/Widget/ScrollBar.h>
#include <Mw/Widget/Separator.h>
#include <Mw/Widget/ComboBox.h>
#include <Mw/Widget/SubMenu.h>
#include <Mw/Widget/SubWindow.h>
#include <Mw/Widget/Tab.h>
#include <Mw/Widget/Table.h>
#include <Mw/Widget/TreeView.h>
#include <Mw/Widget/Viewport.h>
#include <Mw/Widget/Window.h>
#endif

View file

@ -42,6 +42,26 @@ MWDECL unsigned char MwBoldTTFData[];
*/
MWDECL unsigned int MwBoldTTFDataSize;
/*!
* @brief Default monospace TTF font data
*/
MWDECL unsigned char MwMonospaceTTFData[];
/*!
* @brief Default monospace TTF font size
*/
MWDECL unsigned int MwMonospaceTTFDataSize;
/*!
* @brief Default bold monospace TTF font data
*/
MWDECL unsigned char MwBoldMonospaceTTFData[];
/*!
* @brief Default bold monospace TTF font size
*/
MWDECL unsigned int MwBoldMonospaceTTFDataSize;
#ifdef __cplusplus
}
#endif

View file

@ -17,7 +17,7 @@ extern "C" {
* @param str String
* @return String
*/
MWDECL char* MwStringDuplicate(const char* str);
MWDECL char* MWAPI MwStringDuplicate(const char* str);
/*!
* @brief Concatenates 2 strings
@ -25,21 +25,36 @@ MWDECL char* MwStringDuplicate(const char* str);
* @param str2 String
* @return String
*/
MWDECL char* MwStringConcat(const char* str1, const char* str2);
MWDECL char* MWAPI MwStringConcat(const char* str1, const char* str2);
/*!
* @brief Converts size to string
* @param out Output
* @param size Size
*/
MWDECL void MwStringSize(char* out, MwOffset size);
MWDECL void MWAPI MwStringSize(char* out, MwOffset size);
/*!
* @brief Converts time to string
* @param out Output
* @param t Time
*/
MWDECL void MwStringTime(char* out, time_t t);
MWDECL void MWAPI MwStringTime(char* out, time_t t);
/*!
* @brief Prints up to n characters into a bufferMwStringPrintIntoBuffer.
* @note On compilers that support C99, this uses vsnprintf to safely print into a buffer; on compilers that don't, vsprintf is used.
* @param out Buffer
* @param size Max size
*/
MWDECL void MWAPI MwStringPrintIntoBuffer(char* out, MwU32 size, const char* fmt, ...);
/*!
* @brief Check if the given key is UTF8
* @param key Input
* @return whether its utf8
*/
MWDECL MwBool MWAPI MwStringIsKeyUTF8(MwU32 key);
#ifdef __cplusplus
}

View file

@ -31,36 +31,74 @@
#define MwNshowArrows "IshowArrows"
#define MwNpadding "Ipadding"
#define MwNborderWidth "IborderWidth"
#define MwNfillArea "IfillArea"
#define MwNratio "Iratio"
#define MwNfixedSize "IfixedSize"
#define MwNmargin "Imargin"
#define MwNbitmapFont "IbitmapFont"
#define MwNsevenSegment "IsevenSegment"
#define MwNlength "Ilength"
#define MwNforceInverted "IforceInverted"
#define MwNisRounded "IisRounded"
#define MwNdarkTheme "IdarkTheme"
#define MwNuseMonospace "IuseMonospace"
#define MwNdarkThemeAutomatic "IdarkThemeAutomatic"
#define MwNyear "Iyear"
#define MwNmonth "Imonth"
#define MwNdate "Idate"
#define MwNday "Iday"
#define MwNwaitLayout "IwaitLayout"
#define MwNscale "Iscale"
#define MwNcolumns "Icolumns"
#define MwNcolumnSpan "IcolumnSpan"
#define MwNrowSpan "IrowSpan"
#define MwNdisabled "Idisabled"
#define MwNacceptsDnD "IacceptsDnD"
#define MwNtitle "Stitle"
#define MwNtext "Stext"
#define MwNbackground "Sbackground"
#define MwNsubBackground "SsubBackground"
#define MwNtitleBackground "StitleBackground"
#define MwNforeground "Sforeground"
#define MwNsubForeground "SsubForeground"
#define MwNtitleForeground "StitleForeground"
#define MwNvulkanExtension "SEvulkanExtension"
#define MwNvulkanLayer "SEvulkanLayer"
#define MwNvulkanConfig "VEvulkanConfig"
#define MwNpixmap "Vpixmap"
#define MwNiconPixmap "ViconPixmap"
#define MwNsizeHints "VsizeHints"
#define MwNfont "Vfont"
#define MwNboldFont "VboldFont"
#define MwNbackgroundPixmap "VbackgroundPixmap"
#define MwNmonospaceFont "VmonospaceFont"
#define MwNboldMonospaceFont "VboldMonospaceFont"
#define MwNactivateHandler "Cactivate" /* NULL/int* (MwListBox)/void* (MwTreeView) */
#define MwNresizeHandler "Cresize" /* NULL */
#define MwNtickHandler "Ctick" /* NULL */
#define MwNmenuHandler "Cmenu" /* MwMenu */
#define MwNmouseDownHandler "CmouseDown" /* MwLLMouse* */
#define MwNmouseUpHandler "CmouseUp" /* same as MwNmouseDownHandler */
#define MwNmouseMoveHandler "CmouseMove" /* MwPoint* */
#define MwNchangedHandler "Cchanged" /* NULL/int* (MwComboBox) */
#define MwNkeyHandler "Ckey" /* int* (MwLLKeyEnum or character code) */
#define MwNkeyReleaseHandler "CkeyRelease" /* same as MwNkeyHandler */
#define MwNcloseHandler "Cclose" /* NULL */
#define MwNfocusInHandler "CfocusIn" /* NULL */
#define MwNfocusOutHandler "CfocusOut" /* NULL */
#define MwNfileChosenHandler "CfileChosen" /* char* */
#define MwNdirectoryChosenHandler "CdirectoryChosen" /* char* */
#define MwNcolorChosenHandler "CcolorChosen" /* MwRGB* */
#define MwNdrawHandler "Cdraw" /* NULL */
#define MwNactivateHandler "Cactivate"
#define MwNlistBoxActivateHandler "ClistBoxActivate"
#define MwNtreeViewActivateHandler "CtreeViewActivate"
#define MwNresizeHandler "Cresize"
#define MwNtickHandler "Ctick"
#define MwNmenuHandler "Cmenu"
#define MwNmouseDownHandler "CmouseDown"
#define MwNmouseUpHandler "CmouseUp"
#define MwNmouseMoveHandler "CmouseMove"
#define MwNchangedHandler "Cchanged"
#define MwNcomboBoxChangedHandler "CcomboBoxChanged"
#define MwNkeyHandler "Ckey"
#define MwNkeyReleaseHandler "CkeyRelease"
#define MwNcloseHandler "Cclose"
#define MwNfocusInHandler "CfocusIn"
#define MwNfocusOutHandler "CfocusOut"
#define MwNfileChosenHandler "CfileChosen"
#define MwNdirectoryChosenHandler "CdirectoryChosen"
#define MwNcolorChosenHandler "CcolorChosen"
#define MwNdrawHandler "Cdraw"
#define MwNclipboardHandler "Cclipboard"
#define MwNdarkThemeHandler "CdarkTheme"
#define MwNdragAndDropHandler "CdragAndDrop"
#endif

33
include/Mw/TrueType.h Normal file
View file

@ -0,0 +1,33 @@
/*!
* @file Mw/TrueType.h
* @brief TrueType utilities
*/
#ifndef __MW_TRUETYPE_H__
#define __MW_TRUETYPE_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Get the TrueType font information
* @param data Font data
* @param size Font size
* @return Information
*/
MWDECL MwTTFInfo MwTTFGetInfo(unsigned char* data, int size);
/*!
* @brief Free the TrueType font information
* @param info Information
*/
MWDECL void MwTTFFreeInfo(MwTTFInfo info);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -20,10 +20,18 @@ typedef struct _MwViewport* MwViewport;
typedef struct _MwListBox* MwListBox;
typedef struct _MwComboBox* MwComboBox;
typedef struct _MwTreeView* MwTreeView;
typedef struct _MwScrollBar* MwScrollBar;
typedef struct _MwLabel* MwLabel;
typedef struct _MwLabelSegment MwLabelSegment;
typedef struct _MwListBoxEntry MwListBoxEntry;
typedef struct _MwTreeViewEntry MwTreeViewEntry;
typedef struct _MwDirectoryEntry MwDirectoryEntry;
typedef struct _MwListBoxPacket MwListBoxPacket;
typedef struct _MwBox* MwBox;
typedef struct _MwSubWindow* MwSubWindow;
typedef struct _MwTab* MwTab;
typedef struct _MwTable* MwTable;
typedef struct _MwMouse MwMouse;
typedef struct _MwTTFInfo* MwTTFInfo;
#ifdef _MILSKO
typedef struct _MwWidget* MwWidget;
#else
@ -31,12 +39,17 @@ typedef void* MwWidget;
#endif
typedef void (*MwHandler)(MwWidget handle);
typedef int (*MwHandlerWithStatus)(MwWidget handle);
typedef void (*MwHandlerProps)(MwWidget handle, char** key);
typedef void (*MwHandlerProp)(MwWidget handle, const char* key);
typedef void (*MwHandlerChildrenUpdate)(MwWidget handle, MwWidget child, int new_child);
typedef void (*MwHandlerChildrenProp)(MwWidget handle, MwWidget child, const char* key);
typedef void (*MwHandlerKey)(MwWidget handle, int key);
typedef void (*MwHandlerMouse)(MwWidget handle, void* ptr);
typedef void (*MwUserHandler)(MwWidget handle, void* user_data, void* call_data);
typedef void (*MwErrorHandler)(int code, const char* message, void* user_data);
typedef void (*MwHandlerExecute)(MwWidget handle, const char* name, void* out, va_list args);
typedef void (*MwHandlerClipboardReceived)(MwWidget handle, const char* data);
typedef void(MWAPI* MwUserHandler)(MwWidget handle, void* user_data, void* call_data);
typedef void(MWAPI* MwErrorHandler)(int code, const char* message, void* user_data);
struct _MwTextKeyValue {
char* key;
@ -69,7 +82,6 @@ struct _MwVoidKeyValue {
struct _MwWidget {
char* name;
MwLLColor bgcolor;
int dark_theme;
MwLL lowlevel;
MwWidget parent;
@ -79,12 +91,13 @@ struct _MwWidget {
int pressed;
MwPoint mouse_point;
int close;
jmp_buf before_step;
int prop_event;
void* internal;
void* opaque;
void* user;
void (*draw_inject)(MwWidget handle);
void (*destroy_inject)(MwWidget handle);
MwIntegerKeyValue* integer;
MwTextKeyValue* text;
@ -95,6 +108,21 @@ struct _MwWidget {
MwWidget* tick_list;
int destroyed;
void* root_font;
void* root_boldfont;
void* root_monofont;
void* root_boldmonofont;
int top_step;
MwWidget* draw_queue;
MwWidget* resize_queue;
MwWidget* monitored_entries;
int berserk;
long last_tick;
MwBool is_menu;
};
#endif
@ -103,12 +131,16 @@ struct _MwMenu {
int keep;
MwWidget wsub;
MwMenu* sub;
void* opaque;
int cleaned;
};
struct _MwEntry {
int cursor;
int right;
int length;
int active;
int cursor_blink_timer;
MwPoint mouse;
};
@ -162,6 +194,22 @@ struct _MwTreeView {
MwPoint pressed;
};
struct _MwScrollBar {
MwPoint point;
int drag;
int pos;
};
struct _MwLabel {
MwLabelSegment* segment;
MwHandler draw;
};
struct _MwLabelSegment {
int key;
unsigned char value;
};
struct _MwDirectoryEntry {
char* name;
int type;
@ -169,27 +217,66 @@ struct _MwDirectoryEntry {
time_t mtime;
};
struct _MwListBoxPacket {
MwLLPixmap* pixmaps;
char*** names;
struct _MwBox {
int layout;
};
struct _MwTable {
int layout;
MwWidget* widgets;
};
struct _MwSubWindow {
MwWidget frame;
MwWidget minimize;
MwWidget maximize;
MwWidget close;
int maximized;
int minimized;
int x;
int y;
int width;
int height;
MwPoint cursor_start;
MwPoint base;
};
struct _MwTab {
MwWidget* frames;
char** names;
};
struct _MwMouse {
MwPoint point;
int button;
};
struct _MwTTFInfo {
char* family;
int weight;
};
struct _MwClass {
MwHandlerWithStatus create;
MwHandler destroy;
MwHandler draw;
MwHandler click;
MwHandler parent_resize;
MwHandlerProp prop_change;
MwHandler mouse_move;
MwHandlerMouse mouse_up;
MwHandlerMouse mouse_down;
MwHandlerKey key;
MwHandlerExecute execute;
MwHandler tick;
void* reserved3;
void* reserved4;
void* reserved5;
MwHandlerWithStatus create;
MwHandler destroy;
MwHandler draw;
MwHandler click;
MwHandler parent_resize;
MwHandlerProp prop_change;
MwHandler mouse_move;
MwHandlerMouse mouse_up;
MwHandlerMouse mouse_down;
MwHandlerKey key;
MwHandlerExecute execute;
MwHandler tick;
MwHandler resize;
MwHandlerChildrenUpdate children_update;
MwHandlerChildrenProp children_prop_change;
MwHandlerClipboardReceived clipboard;
MwHandlerProps props_change;
MwHandler drag_and_drop;
void* reserved2;
void* reserved3;
};
#endif

View file

@ -18,14 +18,14 @@ extern "C" {
* @brief output Output
* @return Bytes this multibyte takes
*/
MWDECL int MwUTF8ToUTF32(const char* input, int* output);
MWDECL int MWAPI MwUTF8ToUTF32(const char* input, int* output);
/*!
* @brief Calculates UTF-8 string length
* @brief input Input
* @return Length
*/
MWDECL int MwUTF8Length(const char* input);
MWDECL int MWAPI MwUTF8Length(const char* input);
/*!
* @brief Copies UTF-8 string to other string
@ -36,7 +36,7 @@ MWDECL int MwUTF8Length(const char* input);
* @brief len Length
* @return Copied length in bytes
*/
MWDECL int MwUTF8Copy(const char* src, int srcskip, char* dst, int dstskip, int len);
MWDECL int MWAPI MwUTF8Copy(const char* src, int srcskip, char* dst, int dstskip, int len);
/*!
* @brief Converts UTF-32 to UTF-8
@ -44,7 +44,7 @@ MWDECL int MwUTF8Copy(const char* src, int srcskip, char* dst, int dstskip, int
* @brief output Output
* @return Bytes this wide byte takes
*/
MWDECL int MwUTF32ToUTF8(int input, char* output);
MWDECL int MWAPI MwUTF32ToUTF8(int input, char* output);
#ifdef __cplusplus
}

View file

@ -8,16 +8,26 @@
/*!
* @brief Major version
*/
#define MwMAJOR 0
#define MwMAJOR 1
/*!
* @brief Minor version
*/
#define MwMINOR 0
#define MwMINOR 3
/*!
* @brief Patchlevel of version, if patchlevel_alphabet is a or bigger, this value is calculated by `patchlevel_alphabet - 'a' + 1`. Otherwise 0
*/
#define MwPATCH 0
/*!
* @brief Version in string
*/
#define MwVERSION "pre-1.0"
#define MwVERSION "1.4"
/*!
* @brief Version in string
*/
MWDECL const char* MwVersionString;
#endif

24
include/Mw/Widget/Box.h Normal file
View file

@ -0,0 +1,24 @@
/*!
* @file Mw/Widget/Box.h
* @brief Box widget
*/
#ifndef __MW_WIDGET_BOX_H__
#define __MW_WIDGET_BOX_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Box widget class
*/
MWDECL MwClass MwBoxClass;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,24 @@
/*!
* @file Mw/Widget/Calendar.h
* @brief Calendar widget
*/
#ifndef __MW_WIDGET_CALENDAR_H__
#define __MW_WIDGET_CALENDAR_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Calendar widget class
*/
MWDECL MwClass MwCalendarClass;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -7,6 +7,7 @@
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {

View file

@ -7,6 +7,7 @@
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
@ -17,6 +18,17 @@ extern "C" {
*/
MWDECL MwClass MwLabelClass;
/*!
* @brief Sets the custom data for seven segment
* @param handle Widget
* @param index Index
* @param data Data, `GFEDCBA` as 7-bit value
* @note See https://en.wikipedia.org/wiki/File:7_Segment_Display_with_Labeled_Segments.svg for what alphabets mean here
* */
MwInline void MwLabelSetSevenSegment(MwWidget handle, int index, int data) {
MwVaWidgetExecute(handle, "mwLabelSetSevenSegment", NULL, index, data);
}
#ifdef __cplusplus
}
#endif

View file

@ -19,50 +19,29 @@ extern "C" {
MWDECL MwClass MwListBoxClass;
/*!
* @brief Creates a listbox packet
* @return Packet
*/
MWDECL MwListBoxPacket* MwListBoxCreatePacket(void);
/*!
* @brief Destroys a listbox packet
* @param packet Packet
*/
MWDECL void MwListBoxDestroyPacket(MwListBoxPacket* packet);
/*!
* @brief Inserts a new item to a packet
* @param packet Packet
* @param index Index
* @return Index
*/
MWDECL int MwListBoxPacketInsert(MwListBoxPacket* packet, int index);
/*!
* @brief Sets a column of item in a packet
* @param packet Packet
* @param index Index
* @brief Sets item on the listbox
* @param handle Widget
* @param row Row
* @param col Column
* @param text Text
* @return Index
*/
MWDECL void MwListBoxPacketSet(MwListBoxPacket* packet, int index, int col, const char* text);
MwInline int MwListBoxSet(MwWidget handle, int row, int col, const char* text) {
int out;
MwVaWidgetExecute(handle, "mwListBoxSet", (void*)&out, row, col, text);
return out;
}
/*!
* @brief Sets an icon of item in a packet
* @param packet Packet
* @brief Sets the icon of the row
* @param handle Widget
* @param index Index
* @param icon Icon
*/
MWDECL void MwListBoxPacketSetIcon(MwListBoxPacket* packet, int index, MwLLPixmap icon);
/*!
* @brief Inserts item on the listbox
* @param handle Widget
* @param index Index
* @param packet Packet
*/
MwInline void MwListBoxInsert(MwWidget handle, int index, void* packet) {
MwVaWidgetExecute(handle, "mwListBoxInsert", NULL, index, packet);
MwInline void MwListBoxSetIcon(MwWidget handle, int index, MwLLPixmap icon) {
MwVaWidgetExecute(handle, "mwListBoxSetIcon", NULL, index, icon);
}
/*!

View file

@ -5,20 +5,29 @@
#ifndef __MW_WIDGET_OPENGL_H__
#define __MW_WIDGET_OPENGL_H__
#include <Mw/Core.h>
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#if !defined(MW_OPENGL_NO_INCLUDE) && !defined(__gl_h_)
#ifdef _WIN32
#include <windows.h>
#elif defined(__APPLE__)
#else
#include <GL/glx.h>
#endif
#if defined(__APPLE__)
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h>
#include <GL/glu.h>
#endif
#ifndef GLAPIENTRY
#define GLAPIENTRY APIENTRY
#endif
#endif
#ifdef __cplusplus
extern "C" {

View file

@ -18,8 +18,25 @@ extern "C" {
*/
MWDECL MwClass MwSubMenuClass;
MwInline void MwSubMenuAppear(MwWidget handle, MwMenu menu, MwPoint* point) {
MwVaWidgetExecute(handle, "mwSubMenuAppear", NULL, menu, point);
/*!
* @brief Makes submenu appear
* @param handle Handle
* @param menu Menu
* @param point Point
* @param diff_calc Toggles different way to calculate positiion
*/
MwInline void MwSubMenuAppear(MwWidget handle, MwMenu menu, MwPoint* point, int diff_calc) {
MwVaWidgetExecute(handle, "mwSubMenuAppear", NULL, menu, point, diff_calc);
}
/*!
* @brief Calculates the size of submenu
* @param handle Handle
* @param menu Menu
* @param rect Size
*/
MwInline void MwSubMenuGetSize(MwWidget handle, MwMenu menu, MwRect* rect) {
MwVaWidgetExecute(handle, "mwSubMenuGetSize", NULL, menu, rect);
}
#ifdef __cplusplus

View file

@ -0,0 +1,36 @@
/*!
* @file Mw/Widget/SubWindow.h
* @brief SubWindow widget
*/
#ifndef __MW_WIDGET_SUBWINDOW_H__
#define __MW_WIDGET_SUBWINDOW_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief SubWindow widget class
*/
MWDECL MwClass MwSubWindowClass;
/*!
* @brief Get parent widget where widgets should be placed
* @param handle Widget
* @return Widget
*/
MwInline MwWidget MwSubWindowGetFrame(MwWidget handle) {
MwWidget out;
MwVaWidgetExecute(handle, "mwSubWindowGetFrame", &out);
return out;
}
#ifdef __cplusplus
}
#endif
#endif

59
include/Mw/Widget/Tab.h Normal file
View file

@ -0,0 +1,59 @@
/*!
* @file Mw/Widget/Tab.h
* @brief Tab widget
*/
#ifndef __MW_WIDGET_TAB_H__
#define __MW_WIDGET_TAB_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Tab widget class
*/
MWDECL MwClass MwTabClass;
/*!
* @brief Adds a tab
* @param handle Widget
* @param name Tab name
* @return Frame
*/
MwInline MwWidget MwTabAdd(MwWidget handle, const char* name) {
MwWidget out;
MwVaWidgetExecute(handle, "mwTabAdd", &out, name);
return out;
}
/*!
* @brief Gets a tab frame
* @param handle Widget
* @param name Tab name
* @return Frame
*/
MwInline MwWidget MwTabGetFrame(MwWidget handle, const char* name) {
MwWidget out;
MwVaWidgetExecute(handle, "mwTabGetFrame", &out, name);
return out;
}
/*!
* @brief Focus on a tab frame
* @param handle Widget
* @param name Tab name
* @return Frame
*/
MwInline void MwTabFocus(MwWidget handle, const char* name) {
MwVaWidgetExecute(handle, "mwTabFocus", NULL, name);
}
#ifdef __cplusplus
}
#endif
#endif

24
include/Mw/Widget/Table.h Normal file
View file

@ -0,0 +1,24 @@
/*!
* @file Mw/Widget/Table.h
* @brief Table widget
*/
#ifndef __MW_WIDGET_TABLE_H__
#define __MW_WIDGET_TABLE_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Table widget class
*/
MWDECL MwClass MwTableClass;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -90,6 +90,19 @@ MwInline void MwTreeViewSetOpened(MwWidget handle, void* item, int opened) {
MwVaWidgetExecute(handle, "mwTreeViewSetOpened", NULL, item, opened);
}
/*!
* @brief Gets the opened state of ithe item
* @param handle Widget
* @param item Item
* @return Opened or not
*/
MwInline int MwTreeViewGetOpened(MwWidget handle, void* item) {
int out;
MwVaWidgetExecute(handle, "mwTreeViewGetOpened", (void*)&out, item);
return out;
}
#ifdef __cplusplus
}
#endif

View file

@ -11,17 +11,18 @@
#ifndef __MW_WIDGET_VULKAN_H__
#define __MW_WIDGET_VULKAN_H__
#if !defined(_WIN32) && !defined(__linux__) && !defined(__FreeBSD__) && !defined(__NetBSD__)
#if defined(MW_VULKAN) && !defined(_WIN32) && !defined(__linux__) && !defined(__FreeBSD__) && !defined(__NetBSD__)
#error Vulkan is unsupported on the requested platform.
#endif
#if !defined(MW_VULKAN_NO_INCLUDE)
#include <vulkan/vulkan.h>
#include <vulkan/vulkan_core.h>
#endif
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/Core.h>
#include <Mw/Error.h>
#ifdef __cplusplus
extern "C" {
@ -33,95 +34,76 @@ extern "C" {
MWDECL MwClass MwVulkanClass;
/*!
* @brief Add an extension to the list of extensions to enable prior to initialization.
* @warning This must be called before MwCreateWidget.
* @brief Configuration options that can be passed to setup parts of the Vulkan widget.
*/
MWDECL void MwVulkanEnableExtension(const char* ext_name);
/*!
* @brief Add an layer to the list of layers to enable prior to initialization.
* @warning This must be called before MwCreateWidget.
*/
MWDECL void MwVulkanEnableLayer(const char* ext_name);
/*!
* @brief Configuration options that can be passed to setup Vulkan before a widget is created.
*/
typedef struct MwVulkanConfig_T {
typedef struct _MwVulkanConfig {
/*!
* @brief Vulkan API version (default: VK_API_VERSION_1_0)
*/
uint32_t api_version;
MwU32 api_version;
/*!
* @brief Vulkan version (default: VK_VERSION_1_0)
*/
uint32_t vk_version;
MwU32 vk_version;
/*!
* @brief Whether or not to enable validation layers (default: false)
*/
VkBool32 validation_layers;
int validation_layers;
} MwVulkanConfig;
/*!
* @brief Configure Vulkan prior to initializing the widget.
* @warning This must be called before MwCreateWidget.
* @warning The configuration provided will be used for future initializations of the Vulkan widget (unless it's changed)
*/
MWDECL void MwVulkanConfigure(MwVulkanConfig cfg);
/*!
* @brief Field that can be gotten from Vulkan.
*/
typedef enum MwVulkanField_T {
enum MwVULKANFIELD {
/*!
* @brief The address of the vulkan widget's vkGetInstanceProcAddr function (PFN_vkGetInstanceProcAddr)
*/
MwVulkanField_GetInstanceProcAddr = 0,
MwVULKANFIELD_GETINSTANCEPROCADDR = 0,
/*!
* @brief The address of the vulkan widget's instance (VkInstance)
*/
MwVulkanField_Instance,
MwVULKANFIELD_INSTANCE,
/*!
* @brief The address of the vulkan widget's surface (VkSurfaceKHR)
*/
MwVulkanField_Surface,
MwVULKANFIELD_SURFACE,
/*!
* @brief The address of the vulkan widget's physical device (VkPhysicalDevice)
*/
MwVulkanField_PhysicalDevice,
MwVULKANFIELD_PHYSICALDEVICE,
/*!
* @brief The address of the vulkan widget's logical device (VkDevice)
*/
MwVulkanField_LogicalDevice,
MwVULKANFIELD_LOGICALDEVICE,
/*!
* @brief The address of the index that the vulkan widget uses for the graphics queue (uint32_t *)
*/
MwVulkanField_GraphicsQueueIndex,
MwVULKANFIELD_GRAPHICSQUEUEINDEX,
/*!
* @brief The address of the index that the vulkan widget uses for the present queue (uint32_t *)
*/
MwVulkanField_PresentQueueIndex,
MwVulkanField_GraphicsQueue,
MwVULKANFIELD_PRESENTQUEUEINDEX,
MwVULKANFIELD_GRAPHICSQUEUE,
/*!
* @brief The address of the vulkan widget's graphics queue (VkQueue)
*/
MwVulkanField_PresentQueue,
} MwVulkanField;
MwVULKANFIELD_PRESENTQUEUE,
};
/*!
* @brief Function for getting a field from within Vulkan.
* @warning Consult the documentation for MwVulkanField to know what type is expected for out.
* @note Consult the documentation for MwVULKANFIELD to know what type is expected for output.
*/
MwInline void* MwVulkanGetField(MwWidget handle, MwVulkanField field, MwErrorEnum* out) {
MwInline void* MwVulkanGetField(MwWidget handle, int field, int* err) {
void* field_out;
MwVaWidgetExecute(handle, "mwVulkanGetField", &field_out, field, out);
MwVaWidgetExecute(handle, "mwVulkanGetField", &field_out, field, err);
return field_out;
}
/*!
* @brief Return whether Vulkan is installed on the target platform.
*/
MWDECL VkBool32 MwVulkanSupported(void);
MWDECL int MWAPI MwVulkanSupported(void);
#ifdef __cplusplus
}

View file

@ -27,6 +27,17 @@ MwInline void MwWindowMakeBorderless(MwWidget handle, int toggle) {
MwVaWidgetExecute(handle, "mwWindowMakeBorderless", NULL, toggle);
}
/*!
* @brief Whether the window should close
* @param handle Widget
* @return bool
*/
MwInline MwBool MwWindowShouldClose(MwWidget handle) {
MwBool res = MwFALSE;
MwVaWidgetExecute(handle, "mwWindowShouldClose", NULL, &res);
return res;
}
#ifdef __cplusplus
}
#endif

View file

@ -1,4 +1,4 @@
<?xml version="1.0"?>
<?xml version="1.0" ?>
<!--
Basically, you have to implement 10+n types:
- Integer (int)
@ -38,79 +38,160 @@
<short name="green" unsigned="yes" />
<short name="blue" unsigned="yes" />
</struct>
<struct name="MwMouse">
<struct defname="MwPoint" name="point" />
<integer name="button" />
</struct>
<struct name="MwVulkanConfig">
<integer name="api_version" unsigned="yes" />
<integer name="vk_version" unsigned="yes" />
<integer name="validation_layers" />
</struct>
</structs>
<!--
All widgets have:
- MwNbackground
- MwNforeground
- MwNx
- MwNy
- MwNwidth
- MwNheight
- MwNborderWidth
All widgets have properties that are common="yes".
Integer properties must be prefixed with I.
String properties must be prefixed with S.
Handler properties must be prefixed with C.
Other properties must be prefixed with V.
"Early" properties must have letter "E" as 2nd letter.
e.g. vulkanExtension would be SEvulkanExtension
-->
<properties>
<integer name="x" />
<integer name="y" />
<integer name="width" />
<integer name="height" />
<integer name="x" common="yes" />
<integer name="y" common="yes" />
<integer name="width" common="yes" />
<integer name="height" common="yes" />
<integer name="orientation" />
<integer name="minValue" />
<integer name="maxValue" />
<integer name="value" />
<integer name="changedBy" />
<integer name="areaShown" />
<integer name="checked" />
<integer name="checked" boolean="yes" />
<integer name="alignment" />
<integer name="bold" />
<integer name="main" />
<integer name="bold" boolean="yes" />
<integer name="main" boolean="yes" />
<integer name="leftPadding" />
<integer name="hasHeading" />
<integer name="hasBorder" />
<integer name="inverted" />
<integer name="modernLook" />
<integer name="waitMS" />
<integer name="hideInput" />
<integer name="singleClickSelectable" />
<integer name="flat" />
<integer name="showArrows" />
<integer name="hasHeading" boolean="yes" />
<integer name="hasBorder" boolean="yes" />
<integer name="inverted" boolean="yes" />
<integer name="modernLook" common="yes" boolean="yes" />
<integer name="hideInput" boolean="yes" />
<integer name="singleClickSelectable" boolean="yes" />
<integer name="flat" boolean="yes" />
<integer name="showArrows" boolean="yes" />
<integer name="padding" />
<integer name="borderWidth" />
<integer name="borderWidth" common="yes" />
<integer name="ratio" common="yes" />
<integer name="fixedSize" common="yes" />
<integer name="margin" />
<integer name="bitmapFont" common="yes" boolean="yes" />
<integer name="sevenSegment" boolean="yes" />
<integer name="length" />
<integer name="forceInverted" common="yes" boolean="yes" />
<integer name="isRounded" common="yes" boolean="yes" />
<integer name="darkTheme" common="yes" boolean="yes" />
<integer name="useMonospace" common="yes" boolean="yes" />
<integer name="fillArea" />
<integer name="darkThemeAutomatic" common="yes" boolean="yes" />
<integer name="year" />
<integer name="month" />
<integer name="date" />
<integer name="day" />
<integer name="waitLayout" />
<integer name="scale" />
<integer name="columns" />
<integer name="columnSpan" column="yes" />
<integer name="rowSpan" column="yes" />
<!-- waitMS is a special property, only applies to toplevel widget -->
<integer name="waitMS" common="yes" />
<string name="title" />
<string name="text" />
<string name="background" />
<string name="foreground" />
<string name="background" common="yes" />
<string name="subBackground" common="yes" />
<string name="titleBackground" common="yes" />
<string name="foreground" common="yes" />
<string name="subForeground" common="yes" />
<string name="titleForeground" common="yes" />
<!-- Early string properties -->
<string name="vulkanExtension" early="yes" />
<string name="vulkanLayer" early="yes" />
<pixmap name="pixmap" />
<pixmap name="iconPixmap" />
<struct defname="MwSizeHints" pointer="yes" name="sizeHints" />
<pointer name="font" />
<pointer name="boldFont" />
<pixmap name="backgroundPixmap" common="yes" />
<pointer name="monospaceFont" />
<pointer name="boldMonospaceFont" />
<handler name="activate" />
<handler name="resize" />
<handler name="tick" />
<handler name="menu" />
<handler name="mouseDown" />
<handler name="mouseUp" />
<handler name="mouseMove" />
<handler name="changed" />
<handler name="key" />
<handler name="keyRelease" />
<handler name="close" />
<handler name="focusIn" />
<handler name="focusOut" />
<handler name="fileChosen" />
<handler name="directoryChosen" />
<handler name="colorChosen" />
<handler name="draw" />
<!-- Early void properties -->
<struct
defname="MwVulkanConfig"
early="yes"
pointer="yes"
name="vulkanConfig"
/>
</properties>
<handlers>
<handler name="activate" />
<handler name="listBoxActivate">
<integer pointer="yes" />
</handler>
<handler name="treeViewActivate">
<pointer />
</handler>
<handler name="resize" common="yes" />
<handler name="tick" common="yes" />
<handler name="menu">
<pointer />
</handler>
<handler name="mouseDown" common="yes">
<struct defname="MwMouse" pointer="yes" />
</handler>
<handler name="mouseUp" common="yes">
<struct defname="MwMouse" pointer="yes" />
</handler>
<handler name="mouseMove" common="yes">
<struct defname="MwPoint" pointer="yes" />
</handler>
<handler name="changed" />
<handler name="comboBoxChanged">
<integer pointer="yes" />
</handler>
<handler name="key" common="yes">
<integer pointer="yes" />
</handler>
<handler name="keyRelease" common="yes">
<integer pointer="yes" />
</handler>
<handler name="close" />
<handler name="focusIn" common="yes" />
<handler name="focusOut" common="yes" />
<handler name="fileChosen">
<string />
</handler>
<handler name="directoryChosen">
<string />
</handler>
<handler name="colorChosen">
<struct defname="MwRGB" pointer="yes" />
</handler>
<handler name="draw" />
<handler name="clipboard" common="yes">
<string />
</handler>
<handler name="darkTheme" common="yes">
<integer pointer="yes" />
</handler>
</handlers>
<enumerations>
<enumeration name="MwDIRECTION">
<integer name="MwNORTH">0</integer>
@ -136,22 +217,67 @@
<integer name="MwMB_ICONERROR" />
<integer name="MwMB_ICONCLOCK" />
</enumeration>
<enumeration name="MwCOORDINATE">
<integer name="MwCOORDINATE_GLOBAL">0</integer>
<integer name="MwCOORDINATE_LOCAL" />
</enumeration>
<enumeration name="MwCLIPBOARD">
<integer name="MwCLIPBOARD_MAIN">0</integer>
<integer name="MwCLIPBOARD_PRIMARY" />
</enumeration>
<enumeration name="MwMOUSE">
<integer name="MwMOUSE_LEFT">1</integer>
<integer name="MwMOUSE_MIDDLE" />
<integer name="MwMOUSE_RIGHT" />
<integer name="MwMOUSE_WHEELUP" />
<integer name="MwMOUSE_WHEELDOWN" />
</enumeration>
<enumeration name="MwKEY">
<integer name="MwKEY_BACKSPACE">0x80000001</integer>
<integer name="MwKEY_LEFT" />
<integer name="MwKEY_RIGHT" />
<integer name="MwKEY_UP" />
<integer name="MwKEY_DOWN" />
<integer name="MwKEY_ENTER" />
<integer name="MwKEY_ESCAPE" />
<integer name="MwKEY_LEFTSHIFT" />
<integer name="MwKEY_RIGHTSHIFT" />
<integer name="MwKEY_ALT" />
<integer name="MwKEY_CONTROL" />
</enumeration>
<enumeration name="MwVULKANFIELD">
<integer name="MwVULKANFIELD_GETINSTANCEPROCADDR">0</integer>
<integer name="MwVULKANFIELD_INSTANCE" />
<integer name="MwVULKANFIELD_SURFACE" />
<integer name="MwVULKANFIELD_PHYSICALDEVICE" />
<integer name="MwVULKANFIELD_LOGICALDEVICE" />
<integer name="MwVULKANFIELD_GRAPHICSQUEUEINDEX" />
<integer name="MwVULKANFIELD_PRESENTQUEUEINDEX" />
<integer name="MwVULKANFIELD_GRAPHICSQUEUE" />
<integer name="MwVULKANFIELD_PRESENTQUEUE" />
</enumeration>
</enumerations>
<!-- You can assume all constants are unsigned -->
<constants>
<integer name="MwDEFAULT">0x0fffffff</integer>
<integer name="MwMB_ICONMASK">0xf</integer>
<integer name="MwMB_BUTTONMASK">0xf0</integer>
<integer name="MwMB_BUTTONOK">0x10</integer>
<integer name="MwMB_BUTTONCANCEL">0x20</integer>
<integer name="MwMB_BUTTONYES">0x40</integer>
<integer name="MwMB_BUTTONNO">0x80</integer>
<integer name="MwKEY_FLAG">0x80000000</integer>
<integer name="MwKEY_CONTROL_FLAG">0xc0000000</integer>
<integer name="MwKEY_ALT_FLAG">0xa0000000</integer>
</constants>
<headers>
<header name="ColorChooser">
<header name="Dialog/ColorPicker">
<functions>
<function name="MwColorChooser">
<function name="MwColorPicker">
<return>
<widget />
<widget type="Window" />
</return>
<arguments>
<widget name="handle" />
@ -340,7 +466,7 @@
<widget name="handle" />
</arguments>
</function>
<function name="MwToggleDarkTheme">
<function name="MwSetDarkTheme">
<arguments>
<widget name="handle" />
<integer name="toggle" />
@ -389,22 +515,69 @@
<struct defname="MwRect" pointer="yes" name="rect" />
</arguments>
</function>
</functions>
</header>
<header name="Error">
<functions>
<function name="MwGetLastError">
<function name="MwGetClipboard">
<arguments>
<widget name="handle" />
<integer enumname="MwClipboardType" name="clipboard_type" />
</arguments>
</function>
<function name="MwGetClass">
<return>
<string />
<class />
</return>
<arguments>
<widget name="handle" />
</arguments>
</function>
<function name="MwSetUser">
<arguments>
<widget name="handle" />
<pointer name="user" />
</arguments>
</function>
<function name="MwGetUser">
<return>
<pointer />
</return>
<arguments>
<widget name="handle" />
</arguments>
</function>
<function name="MwFreeWidget">
<arguments>
<widget name="handle" />
</arguments>
</function>
</functions>
</header>
<header name="FileChooser">
<header name="Dialog/FileChooser">
<functions>
<function name="MwFileChooser">
<return>
<widget />
<widget type="Window" />
</return>
<arguments>
<widget name="handle" />
<string name="title" />
</arguments>
</function>
<function name="MwFileChooserEx">
<return>
<widget type="Window" />
</return>
<arguments>
<widget name="handle" />
<string name="title" />
<integer name="dir" />
</arguments>
</function>
</functions>
</header>
<header name="Dialog/DirectoryChooser">
<functions>
<function name="MwDirectoryChooser">
<return>
<widget type="Window" />
</return>
<arguments>
<widget name="handle" />
@ -413,11 +586,11 @@
</function>
</functions>
</header>
<header name="MessageBox">
<header name="Dialog/MessageBox">
<functions>
<function name="MwMessageBox">
<return>
<widget />
<widget type="Window" />
</return>
<arguments>
<widget name="handle" />
@ -428,83 +601,74 @@
</function>
<function name="MwMessageBoxGetChild">
<return>
<widget />
<widget type="Button" />
</return>
<arguments>
<widget name="handle" />
<widget name="handle" type="Window" />
<integer name="child" />
</arguments>
</function>
<function name="MwMessageBoxDestroy">
<arguments>
<widget name="handle" />
</arguments>
</function>
</functions>
</header>
<header name="Widget/ListBox.h">
<functions>
<function name="MwListBoxCreatePacket">
<return>
<pointer />
</return>
</function>
<function name="MwListBoxDestroyPacket">
<arguments>
<pointer name="packet" />
</arguments>
</function>
<function name="MwListBoxPacketInsert">
<return>
<integer />
</return>
<arguments>
<pointer name="packet" />
<integer name="index" />
</arguments>
</function>
<function name="MwListBoxPacketSet">
<arguments>
<pointer name="packet" />
<integer name="index" />
<integer name="col" />
<string name="text" />
</arguments>
</function>
<function name="MwListBoxPacketSetIcon">
<arguments>
<pointer name="packet" />
<integer name="index" />
<pixmap name="icon" />
</arguments>
</function>
</functions>
</header>
</headers>
<!-- Widget functions are prefixed with mw<widget name> -->
<widgets>
<widget name="Box">
<properties>
<property name="orientation" />
<property name="margin" />
<property name="padding" />
<property name="hasBorder" />
<property name="inverted" />
<property name="waitLayout" />
</properties>
</widget>
<widget name="Button">
<properties>
<property name="pixmap" />
<property name="text" />
<property name="flat" />
<property name="padding" />
<property name="fillArea" />
</properties>
<handlers>
<handler name="activate" />
<handler name="changed" />
</handlers>
</widget>
<widget name="Calendar">
<properties>
<property name="year" />
<property name="month" />
<property name="date" />
<property name="day" />
<property name="scale" />
</properties>
</widget>
<widget name="CheckBox">
<properties>
<property name="checked" />
</properties>
<handlers>
<handler name="changed" />
</handlers>
</widget>
<widget name="Entry">
<properties>
<property name="text" />
<property name="hideInput" />
</properties>
<handlers>
<handler name="activate" />
<handler name="changed" />
</handlers>
</widget>
<widget name="Frame">
<properties>
<property name="hasBorder" />
<property name="inverted" />
<property name="iconPixmap" />
</properties>
</widget>
<widget name="Image">
@ -512,6 +676,7 @@
<property name="pixmap" />
<property name="hasBorder" />
<property name="inverted" />
<property name="fillArea" />
</properties>
</widget>
<widget name="Label">
@ -519,7 +684,18 @@
<property name="text" />
<property name="alignment" />
<property name="bold" />
<property name="sevenSegment" />
<property name="length" />
<property name="leftPadding" />
</properties>
<functions>
<function name="SetSevenSegment">
<arguments>
<integer name="index" />
<integer name="data" />
</arguments>
</function>
</functions>
</widget>
<widget name="ListBox">
<properties>
@ -527,11 +703,24 @@
<property name="hasHeading" />
<property name="singleClickSelectable" />
</properties>
<handlers>
<handler name="listBoxActivate" />
</handlers>
<functions>
<function name="Insert">
<function name="Set">
<return>
<integer />
</return>
<arguments>
<integer name="row" />
<integer name="col" />
<string name="text" />
</arguments>
</function>
<function name="SetIcon">
<arguments>
<integer name="index" />
<pointer name="packet" />
<pixmap name="icon" />
</arguments>
</function>
<function name="Delete">
@ -557,6 +746,9 @@
</functions>
</widget>
<widget name="Menu">
<handlers>
<handler name="menu" />
</handlers>
<functions>
<function name="Add">
<return>
@ -573,20 +765,10 @@
<properties>
<property name="text" />
</properties>
</widget>
<widget name="OpenGL">
<functions>
<function name="MakeCurrent" />
<function name="GetProcAddress">
<return>
<pointer />
</return>
<arguments>
<string name="name" />
</arguments>
</function>
<function name="SwapBuffer" />
</functions>
<handlers>
<handler name="activate" />
<handler name="changed" />
</handlers>
</widget>
<widget name="ScrollBar">
<properties>
@ -596,8 +778,10 @@
<property name="minValue" />
<property name="maxValue" />
<property name="orientation" />
<property name="showArrows" />
</properties>
<handlers>
<handler name="changed" />
</handlers>
<functions>
<function name="GetVisibleLength">
<return>
@ -607,11 +791,21 @@
</functions>
</widget>
<widget name="SubMenu">
<properties>
<property name="leftPadding" />
</properties>
<functions>
<function name="Appear">
<arguments>
<pointer name="menu" />
<struct defname="MwPoint" pointer="yes" name="point" />
<integer name="diff_calc" />
</arguments>
</function>
<function name="GetSize">
<arguments>
<pointer name="menu" />
<struct defname="MwRect" pointer="yes" name="rect" />
</arguments>
</function>
</functions>
@ -640,6 +834,12 @@
<property name="hasBorder" />
<property name="inverted" />
</properties>
<handlers>
<handler name="colorChosen" />
<handler name="fileChosen" />
<handler name="directoryChosen" />
<handler name="close" />
</handlers>
<functions>
<function name="MakeBorderless" />
</functions>
@ -655,12 +855,18 @@
<properties>
<property name="checked" />
</properties>
<handlers>
<handler name="changed" />
</handlers>
</widget>
<widget name="ComboBox">
<properties>
<property name="areaShown" />
<property name="value" />
</properties>
<handlers>
<handler name="comboBoxChanged" />
</handlers>
<functions>
<function name="Add">
<integer name="index" />
@ -673,17 +879,124 @@
<property name="leftPadding" />
<property name="singleClickSelectable" />
</properties>
<handlers>
<handler name="treeViewActivate" />
</handlers>
<functions>
<function name="Add">
<pointer name="parent" />
<pixmap name="pixmap" />
<string name="item" />
<arguments>
<pointer name="parent" />
<pixmap name="pixmap" />
<string name="item" />
</arguments>
</function>
<function name="Delete">
<pointer name="item" />
<arguments>
<pointer name="item" />
</arguments>
</function>
<function name="SetOpened">
<arguments>
<pointer name="item" />
<integer name="opened" />
</arguments>
</function>
<function name="GetOpened">
<return>
<integer />
</return>
<arguments>
<pointer name="item" />
</arguments>
</function>
<function name="Reset" />
</functions>
</widget>
<widget name="SubWindow">
<properties>
<property name="iconPixmap" />
<property name="title" />
</properties>
<handlers>
<handler name="close" />
</handlers>
<functions>
<function name="GetFrame">
<return>
<widget />
</return>
</function>
</functions>
</widget>
<widget name="Table">
<properties>
<property name="columns" />
<property name="margin" />
<property name="padding" />
<property name="hasBorder" />
<property name="inverted" />
<property name="waitLayout" />
</properties>
</widget>
<widget name="Tab">
<properties>
<property name="value" />
</properties>
<handlers>
<handler name="changed" />
</handlers>
<functions>
<function name="Add">
<return>
<widget />
</return>
<arguments>
<string name="name" />
</arguments>
</function>
<function name="GetFrame">
<return>
<widget />
</return>
<arguments>
<string name="name" />
</arguments>
</function>
<function name="Focus">
<arguments>
<string name="name" />
</arguments>
</function>
</functions>
</widget>
<!-- They are not alphabetically sorted for reasons -->
<widget name="OpenGL">
<functions>
<function name="MakeCurrent" />
<function name="GetProcAddress">
<return>
<pointer />
</return>
<arguments>
<string name="name" />
</arguments>
</function>
<function name="SwapBuffer" />
</functions>
</widget>
<widget name="Vulkan">
<functions>
<function name="GetField">
<return>
<pointer />
</return>
<arguments>
<integer enumname="MwVulkanField" name="field" />
<integer pointer="yes" name="output" />
</arguments>
</function>
</functions>
</widget>
</widgets>
</milsko>

12
pl/ostype/ClassicMacOS.pl Normal file
View file

@ -0,0 +1,12 @@
use_backend("classicmacos");
print(
"Compiling for Classic Mac OS via ./configure currently outputs a broken executable and it only supports PowerPC. Help is wanted. In the mean time, use CMake."
);
$cc = $ENV{RETRO68_TOOLCHAIN_PATH} . "/bin/powerpc-apple-macos-gcc";
$ar = $ENV{RETRO68_TOOLCHAIN_PATH} . "/bin/powerpc-apple-macos-ar";
add_cflags("-DCLASSIC_MAC_OS");
add_cflags("-DSTBI_NO_THREAD_LOCALS");
1;

10
pl/ostype/Darwin.pl Normal file
View file

@ -0,0 +1,10 @@
$library_suffix = ".dylib";
set_shared_flag("-dynamiclib");
#use_backend("cocoa");
new_object("src/backend/nococoa.m");
add_cflags("-DSTBI_NO_THREAD_LOCALS");
add_ldflags("-framework Cocoa -lobjc");
1;

19
pl/ostype/FreeBSD.pl Normal file
View file

@ -0,0 +1,19 @@
my @enabled_backends = ();
add_incdir2("-I/usr/local/include");
add_libdir("-L/usr/local/lib -Wl,-R/usr/local/lib");
if (param_get("wayland") && not(param_get("tiny"))) {
push(@enabled_backends, "wayland");
}
if (param_get("x11")) {
push(@enabled_backends, "x11");
}
use_backend(@enabled_backends);
add_libs("-lpthread");
add_cflags("-DUSE_DBUS");
1;

3
pl/ostype/Haiku.pl Normal file
View file

@ -0,0 +1,3 @@
use_backend("haiku");
1;

Some files were not shown because too many files have changed in this diff Show more