Compare commits

..

328 Commits

Author SHA1 Message Date
Jeff Carr fecbab8d69 clean go mod
Signed-off-by: Jeff Carr <jcarr@wit.com>
2024-01-14 20:13:34 -06:00
Pietro Gagliardi fea45b2d5b
Merge pull request #521 from kojix2/patch-1
Update Ruby bindings
2021-01-02 00:39:49 -05:00
kojix2 ab9fcbf6ee
Update Ruby bindings
(#519)
2020-12-30 01:02:42 +09:00
Pietro Gagliardi f3982618e7
Merge pull request #517 from timgates42/bugfix_typo_platform
docs: Fix simple typo, plaform -> platform
2020-10-02 10:29:32 -04:00
Tim Gates ce8c2dc22c
docs: Fix simple typo, plaform -> platform
There is a small typo in windows/_rc2bin/winapi.hpp, windows/winapi.hpp.

Should read `platform` rather than `plaform`.
2020-09-30 07:05:44 +10:00
Pietro Gagliardi 34d1d0ac48
Merge pull request #500 from L4r0x/table-mem-leak
Fix memory leak in uiTable setEditable on unix.
2020-06-07 21:09:04 -04:00
Pietro Gagliardi 4ee9c47ddc Looks like meson now requires a newer ninja than what ships with whatever version of whatever Debian-derived distribution Azure Pipelines uses. Use ninja from pip instead (it's a special distribution maintained by the SciPy guys, apparently). 2020-06-07 21:05:16 -04:00
Lars Wrenger 6b124b6f55 Fix memory leak in uiTable setEditable on unix.
GtkTreePath was not freed correctly.
2020-06-07 20:41:31 +02:00
Lars Wrenger 54567bd4f6 Fix memory leak uiTable setEditable on unix.
The tree_model_path was not freed correctly.
2020-06-07 17:13:36 +02:00
Pietro Gagliardi a0a980712e
Merge pull request #480 from rjopek/patch-1
Update README.md
2020-01-01 11:35:45 -05:00
Rafał Jopek 9e8bda22a7
Update README.md
Removed outdated link, original project restored.
2019-12-29 19:40:51 +01:00
Pietro Gagliardi e8a4562744
Merge pull request #479 from jaens/patch-1
Remove pylibui-cffi from README
2019-12-29 09:58:45 -05:00
Jaen bd420fed73
Remove pylibui-cffi from README
The owner has archived the repository, which I assume means it's unmaintained.
2019-12-27 12:09:44 -08:00
Pietro Gagliardi 1b05846892 Fixed a use-before-initialize bug in unix/area.c. This was present from the start, and was an error in my Go code conversion; oops. Fixes #472. 2019-09-15 22:53:23 -04:00
Pietro Gagliardi 17486fd175 More notes. 2019-05-05 23:39:16 -04:00
Pietro Gagliardi ee3dbefcf6
Merge pull request #463 from lailton/master
Harbour version
2019-04-23 09:09:58 -04:00
Harbour Developer 73742a0210
Harbour version 2019-04-23 01:46:20 -03:00
Pietro Gagliardi 28755bdbc0 Make the AppVeyor badge always reflect master.
Let's stop sending mixed signals about the build status in the CI environment; Travis and AppVeyor both used "the latest build" by default, and not "master", and apparently this confused people. See https://news.ycombinator.com/item?id=16331432 for an example.
2019-04-17 23:16:05 -04:00
Pietro Gagliardi 6247f94a74 Fixed the only-on-tags check. This documentation is unclear. 2019-04-07 23:38:28 -04:00
Pietro Gagliardi ab58d0053c Oh, I had to make the connectiona vailable to use on all pipelines. 2019-04-07 23:31:08 -04:00
Pietro Gagliardi 88a3267cdd Merge branch 'meson'
This switches the build system from CMake to Meson. This also switches from Travis CI to Azure Pipelines.

Fixes #450.
Fixes #449.
2019-04-07 23:24:01 -04:00
Pietro Gagliardi 425c920952 And updated the README with both the Azure Pipelines badge and Meson merge date. We're good to go! 2019-04-07 23:22:09 -04:00
Pietro Gagliardi c9ae167d90 I'm a dumb 2019-04-07 23:08:08 -04:00
Pietro Gagliardi 1761f99e81 Triple oops, maybe?? 2019-04-07 23:03:43 -04:00
Pietro Gagliardi 7fb9cfae21 Double oops 2019-04-07 23:01:50 -04:00
Pietro Gagliardi 50f019abef Oops 2019-04-07 23:00:50 -04:00
Pietro Gagliardi d62e767056 That didn't work; try it with template syntax instead. 2019-04-07 22:58:21 -04:00
Pietro Gagliardi 6d1e1d7f26 Try to fix Azure Pipelines. I won't be able to make a tag to test the binaries until I merge back in, but I can't figure out how to set the default branch with YAML configurations (unless I have to do it on master), so. 2019-04-07 22:55:28 -04:00
Pietro Gagliardi e8daaf659e windows/direct2d: fix ID2D1RenderTarget::GetPixelFormat() and ID2D1RenderTarget::GetSize() typedefs in MinGW-w64 ABI workaround
MinGW-w64 recently added manual workarounds directly into the class via overloads that make existing Direct2D code source-compatible. However, that exposed an error in my definition of the typedefs I was using in my own workaround: both of these methods are const, even in MSVC, but I neglected to include the const qualifier. I'm not sure how this code compiled in the past, but now the overload resolution engine finds no match.

I want to remain compatible with versions of MinGW-w64 old enough to not have their fix, so our fix remains.

Fixes #446.
2019-04-07 21:56:35 -04:00
Pietro Gagliardi 9c164a2c5c Okay, at this point I'm betting pushd/popd just don't work on AppVeyor's cmd.exe. I'm betting it has to do with popd /? showing me the output of call /? instead. Just use cd. 2019-04-07 21:03:20 -04:00
Pietro Gagliardi 73e4e58c80 Okay, let's see if it's because of the multiline scripts. 2019-04-07 20:53:32 -04:00
Pietro Gagliardi 0b319032b6 Other way 2019-04-07 20:44:19 -04:00
Pietro Gagliardi fbdd84ac86 Not sure why popd is exiting with status 1... 2019-04-07 20:43:49 -04:00
Pietro Gagliardi d08ab7d260 Double oops. But this should work now! 2019-04-07 20:35:56 -04:00
Pietro Gagliardi 6e915321cc Oops 2019-04-07 20:29:46 -04:00
Pietro Gagliardi 52f07b0533 No reason pip shouldn't work... 2019-04-07 20:23:07 -04:00
Pietro Gagliardi acc0586fd6 Okay so .appveyor.yml cmd scripts must not have multiline commands, ugh. 2019-04-07 20:16:04 -04:00
Pietro Gagliardi 3f815718b1 Oops 2019-04-07 18:17:10 -04:00
Pietro Gagliardi 3037d7b87f Completely update the AppVeyor proejct. It now only handles MinGW and VS2013 builds, and uses YAML better. Partially based on guidance in the meson documentation. 2019-04-07 18:15:45 -04:00
Pietro Gagliardi 69bfbbf19c And set up tagging and GitHub releases. That'll be all for the Azure Pipelines configuration; now we just need the AppVeyor configuration. 2019-04-07 17:47:30 -04:00
Pietro Gagliardi 102693e1be Wrong backup 2019-04-07 17:22:10 -04:00
Pietro Gagliardi 36594e3759 Okay, so it seems I can't insert template names as matrix fields, and I'd rather not have a bunch of tiny jobs for all these different templates. So forget it for now. 2019-04-07 17:20:52 -04:00
Pietro Gagliardi 5492d34bce Do I need to use variables.? 2019-04-07 17:13:59 -04:00
Pietro Gagliardi a0ef6f6ca7 Okay, I guess I need to use the full pathname for templates? 2019-04-07 17:09:45 -04:00
Pietro Gagliardi c0c9a3ae92 Ah 2019-04-07 17:06:23 -04:00
Pietro Gagliardi 9af82be7f7 Oops again 2019-04-07 17:03:50 -04:00
Pietro Gagliardi ac26cf7521 Oops 2019-04-07 17:02:32 -04:00
Pietro Gagliardi c2eb806992 Start the matrixification 2019-04-07 17:01:28 -04:00
Pietro Gagliardi 9b483d972d Wrote a script to diff all the jobs we have so I can matrix-ify them. 2019-04-07 16:34:22 -04:00
Pietro Gagliardi 0969f43196 Delete the now-merged files. 2019-04-07 16:12:12 -04:00
Pietro Gagliardi b85c5c542a Merged all the files back together. 2019-04-07 16:11:59 -04:00
Pietro Gagliardi 851bbfe74f And the MinGW-w64 in Ubuntu 16.04 is too old. Oh well. 2019-04-07 16:06:17 -04:00
Pietro Gagliardi 93383cd45a Oh, the altenratives use win32 by default. 2019-04-07 15:57:53 -04:00
Pietro Gagliardi 46459dc8b2 OK then, it's a meson bug. Also -win32 doesn't have C++11 threads :| 2019-04-07 15:52:41 -04:00
Pietro Gagliardi 31a91d6fc0 Hm. 2019-04-07 15:45:27 -04:00
Pietro Gagliardi 8b908aedc1 Oops, MinGW-w64 isn't installed by default. 2019-04-07 15:34:40 -04:00
Pietro Gagliardi 2dcdbe02c9 Let's try using Linxu MinGW-w64. 2019-04-07 15:32:01 -04:00
Pietro Gagliardi 87bdb4e736 Moved the linux 386 steps to azure-pipelines_linux. Next up is trying the MinGW-w64 setup again, but using the MinGW-w64 in Linux instead of Windows. 2019-04-07 14:28:08 -04:00
Pietro Gagliardi 30a363baf1 Normalized template filenames and split the 64-bit apt-get step into its own template. 2019-04-07 14:24:16 -04:00
Pietro Gagliardi 9dc7a2bc7f Try to speed up the build process by consolidating all the apt-get installs into one. These 386 binaries do work, at least. 2019-04-07 14:04:57 -04:00
Pietro Gagliardi 85544275d0 All right, now split all those steps into its own file, clean up all the debugging nonsense, and apply it to the static build as well. Let's hope the artifacts are useful! 2019-04-07 13:45:02 -04:00
Pietro Gagliardi dffdb63f01 All right, that's the full list of packages. Now let's actually try this! 2019-04-07 13:27:48 -04:00
Pietro Gagliardi 9660c15fd1 More missing packages 2019-04-07 13:13:44 -04:00
Pietro Gagliardi b2c44efd7f More complete package list 2019-04-07 13:07:37 -04:00
Pietro Gagliardi d53d68226d I guess we'll need to do this :/ 2019-04-07 13:02:23 -04:00
Pietro Gagliardi 3813e520b5 Urgh. I guess we'll have to try downgrading? 2019-04-07 12:51:19 -04:00
Pietro Gagliardi b6ba770c12 Okay let's try this now 2019-04-07 12:05:05 -04:00
Pietro Gagliardi 9fad02d689 ?????? 2019-04-07 11:55:41 -04:00
Pietro Gagliardi f7d6d2db89 Oops; also I might have one last trick up my sleeves... 2019-04-07 11:49:46 -04:00
Pietro Gagliardi ef87e00543 Let's try other stuff 2019-04-07 11:44:28 -04:00
Pietro Gagliardi 8b9fa82616 Oops 2019-04-07 11:37:58 -04:00
Pietro Gagliardi cebfec8c2c Try doing what the wiki suggests. 2019-04-07 11:35:05 -04:00
Pietro Gagliardi e33612e1c9 One more shot here 2019-04-07 11:25:27 -04:00
Pietro Gagliardi 4e3a69c5f3 Not yet 2019-04-07 11:20:12 -04:00
Pietro Gagliardi c2f79d98c5 Okay I think we've got it this time???? 2019-04-07 11:15:56 -04:00
Pietro Gagliardi 9f1b19eb93 Try something else 2019-04-07 11:06:55 -04:00
Pietro Gagliardi a0ce3f1793 Try some more things 2019-04-07 10:57:11 -04:00
Pietro Gagliardi 3129cd7b46 OKay, let's use apt-cache to see how the packages here are set up. We'll go up the chain. 2019-04-07 10:19:44 -04:00
Pietro Gagliardi 416f4b4f70 Let's try installing libgtk-3-0:amd64 just for the heck of it 2019-04-07 09:06:49 -04:00
Pietro Gagliardi a564d66304 Oops, missed a spot. Good night for real. 2019-04-07 04:01:27 -04:00
Pietro Gagliardi d8781c961f One more, because I should have slept an hour ago. Not all those packages are lib32-able, and apparently libc6-i386 is a thing. 2019-04-07 03:57:26 -04:00
Pietro Gagliardi 08abc9972c Oh it's lib32 stuff. There used to be a metapackage for this why did they get rid of it 2019-04-07 03:50:07 -04:00
Pietro Gagliardi 16849b0a57 Okay, that had no effect, so follow the chain again: libgl1-mesa-dri:i386 -> libllvm6.0:i386 2019-04-07 03:40:16 -04:00
Pietro Gagliardi 8634048aba Okay, looks like for it to take effect I also need --no-upgrade. 2019-04-07 03:35:01 -04:00
Pietro Gagliardi f6022bdcc0 Okay, we have to run sudo apt-get update without --no-download. Try to force apt-get install to ignore updates. 2019-04-07 03:30:05 -04:00
Pietro Gagliardi e98a50b51c Shot in the dark; I'm starting to think the problem really is just outdated packages. 2019-04-07 03:23:44 -04:00
Pietro Gagliardi 1372d0d128 Follow the chain: libeg1-mesa:i386 -> libgl1-mesa-dri:i386 2019-04-07 03:15:42 -04:00
Pietro Gagliardi 92f0163563 Follow the chain: libwayland-egl1-mesa:i386 -> libegl1-mesa:i386 2019-04-07 03:06:24 -04:00
Pietro Gagliardi 574971c58d Yep that's what I thought; it tried to update the entire system instead :| Let's check the apt-cache policy. 2019-04-07 03:00:16 -04:00
Pietro Gagliardi b2d3d7f29d Okay, some people say apt-get upgrade is also needed. I'm doubtful, but let's try it. 2019-04-07 02:49:34 -04:00
Pietro Gagliardi 9c62325367 What is held 2019-04-07 02:45:37 -04:00
Pietro Gagliardi 2ee12f0bcb Okay we do want GCC 5 after all, and also ugh in general 2019-04-07 02:36:45 -04:00
Pietro Gagliardi e66257a2b5 Okay which version of GCC do we want 2019-04-07 02:33:53 -04:00
Pietro Gagliardi 6b2453ab4d Okay, that wasn't quite right; we don't want GCC 5, and I'm not sure why it doesn't want to install GTK+ 3 itself... 2019-04-07 02:30:47 -04:00
Pietro Gagliardi 6f26d869f2 Oops 2019-04-07 02:24:47 -04:00
Pietro Gagliardi 6e688b6476 Okay, that wasn't quite right... 2019-04-07 02:22:20 -04:00
Pietro Gagliardi 5452f8258f Let's try a Linux 386 build next! NumPy uses Docker; let's see if the Travis CI thing we did works here too instead. 2019-04-07 02:12:35 -04:00
Pietro Gagliardi 60687e6aff So apparently only macosx10.13 is valid?! Just use the default SDK. 2019-04-07 02:02:32 -04:00
Pietro Gagliardi efd7e8d07d Okay, so MinGW-w64 on Azure Pipelines is a non-starter. Let's find out what the macOS SDKs are *actually* called. 2019-04-07 01:57:47 -04:00
Pietro Gagliardi 23a0a041f0 ??? 2019-04-07 01:50:53 -04:00
Pietro Gagliardi f7c1515ae1 Roadblocks roadblocks 2019-04-07 01:43:31 -04:00
Pietro Gagliardi 5ded8398ba Bleh 2019-04-07 01:38:02 -04:00
Pietro Gagliardi 29b9e820da Some more guesswork. I have an idea... 2019-04-07 01:34:20 -04:00
Pietro Gagliardi d994dcb0b0 Hmmm 2019-04-07 01:29:44 -04:00
Pietro Gagliardi 4ec1a642a2 Getting closer... 2019-04-07 01:23:07 -04:00
Pietro Gagliardi 58cdf151a5 Ah, Write-Host was the key 2019-04-07 01:20:09 -04:00
Pietro Gagliardi 98e814f013 Grrr 2019-04-07 01:17:28 -04:00
Pietro Gagliardi e9792a2216 Oops again 2019-04-07 01:13:53 -04:00
Pietro Gagliardi 21591e4f6f Hm, Chocolatey is being annoying... 2019-04-07 01:11:18 -04:00
Pietro Gagliardi 651d502624 That didn't quite work 2019-04-07 00:43:41 -04:00
Pietro Gagliardi d3c553c424 Okay, things are not quite working right (and I forgot about shared builds not being available on MinGW-w64). Set up the next round of debugging early, and debug our PowerShell now. 2019-04-07 00:39:27 -04:00
Pietro Gagliardi a8f643c09c Sigh 2019-04-07 00:31:54 -04:00
Pietro Gagliardi 40100a17d1 Oops 2019-04-07 00:22:19 -04:00
Pietro Gagliardi 1500c750b6 Let's try MinGW-w64! 2019-04-07 00:19:28 -04:00
Pietro Gagliardi 21d4ad54b6 Part 2 of previous change 2019-04-06 23:56:05 -04:00
Pietro Gagliardi 26449f444f Executive decision: only run Ninja builds on CI. I only use these anyway, and this will let CI builds and releases go faster. If something breaks for other people, they will report bugs anyway, as they already have... 2019-04-06 23:53:40 -04:00
Pietro Gagliardi 31adbb419e Move the old Travis file out of the way and get rid of most of it. We still need some of its contents, but we will be getting rid of Travis entirely. 2019-04-06 21:13:16 -04:00
Pietro Gagliardi 6ba124ba83 Oops, let's not clobber Windows artifacts. 2019-04-06 20:58:56 -04:00
Pietro Gagliardi 8d90ae1dc9 And another oops, but I confirmed the archive commands look right, so let's go for real now. 2019-04-06 20:52:38 -04:00
Pietro Gagliardi 08096e13a4 Oops again 2019-04-06 20:45:14 -04:00
Pietro Gagliardi c1a0e2e3b6 Oops 2019-04-06 20:34:45 -04:00
Pietro Gagliardi f49253cbf8 Now try Windows artifacts. 2019-04-06 20:24:41 -04:00
Pietro Gagliardi 7e30a2afc1 Oops 2019-04-06 20:06:25 -04:00
Pietro Gagliardi 2584e82191 Moved the linux/darwn pipeline out of the way so we can start working on the Windows one. Also more TODOs. 2019-04-06 19:33:53 -04:00
Pietro Gagliardi 0c410022bb Oops 2019-04-06 19:28:33 -04:00
Pietro Gagliardi 988ca49e41 Split the Linux artifact rules into a template and try them on macOS and static builds too. 2019-04-06 19:26:35 -04:00
Pietro Gagliardi 963f230196 Okay, so we apparently need to explicitly Publish the artifacts we staged if we want to download them (in the final pipeline, this will be replaced with a GitHub step). 2019-04-06 16:16:45 -04:00
Pietro Gagliardi 20409b7599 Oops 2019-04-06 01:09:58 -04:00
Pietro Gagliardi fec8042cfa Sigh 2019-04-06 01:06:13 -04:00
Pietro Gagliardi 58753f8478 One more shot 2019-04-06 01:02:43 -04:00
Pietro Gagliardi 2c73c4f175 Jiggle Azure Pipelines 2/2 2019-04-06 00:54:25 -04:00
Pietro Gagliardi 318bc1437d Jiggle Azure Pipelines 1/2 2019-04-06 00:54:10 -04:00
Pietro Gagliardi 8be1b9603a Try again again 2019-04-06 00:51:25 -04:00
Pietro Gagliardi 494962b330 Try again 2019-04-06 00:49:11 -04:00
Pietro Gagliardi 7692103f7f Split the example names into a variable and echoed the commands for archiving so I can make sure everything is right. 2019-04-06 00:46:18 -04:00
Pietro Gagliardi f929365b6e Temporarily wipe azure-pipelines.yml and start testing the release setup. 2019-04-05 22:20:48 -04:00
Pietro Gagliardi a9fb246d74 More macOS options. 2019-04-05 20:52:26 -04:00
Pietro Gagliardi 7082146f9e Oops again 2019-04-05 20:26:27 -04:00
Pietro Gagliardi aa0753ffc7 Oops 2019-04-05 20:19:35 -04:00
Pietro Gagliardi 47948df5de Speed up Ninja downloading on Mac. 2019-04-05 11:20:15 -04:00
Pietro Gagliardi 15ffbeaa8a Oops 2019-04-05 10:42:43 -04:00
Pietro Gagliardi 77193006b9 Added the first Darwin build, to make sure everything works. 2019-04-05 10:40:24 -04:00
Pietro Gagliardi dbed420d32 Oops 2019-04-05 01:44:47 -04:00
Pietro Gagliardi ef7a341ec7 Split the meson setp into its own template. 2019-04-05 01:42:23 -04:00
Pietro Gagliardi cd2d5ea78e Even more templateization, including splitting the Python and meson steps into templates. The next template will be the Meson template, and that will be fun :V 2019-04-05 01:29:43 -04:00
Pietro Gagliardi 7a108adc4a Consolidated download and install steps. 2019-04-05 00:54:51 -04:00
Pietro Gagliardi ef7b698205 Ugh 2019-04-04 22:57:46 -04:00
Pietro Gagliardi 5ec9a2fbc0 Oops 2019-04-04 22:56:36 -04:00
Pietro Gagliardi a6b48771d5 Fix Windows ninja. 2019-04-04 22:55:23 -04:00
Pietro Gagliardi 04964839f2 Well that answers that 2019-04-04 22:40:18 -04:00
Pietro Gagliardi 15856e15da Why 2019-04-04 22:36:08 -04:00
Pietro Gagliardi 91e7473d00 Fix VS2015 vcvarsall. Will do ninja next. 2019-04-04 22:32:07 -04:00
Pietro Gagliardi 57b11c7ce8 Oops 2019-04-04 22:26:15 -04:00
Pietro Gagliardi 31970127b6 Fix VS2015 build. Ugh. 2019-04-04 22:24:20 -04:00
Pietro Gagliardi 8a090bd90b Added VS2015. 2019-04-04 21:59:11 -04:00
Pietro Gagliardi 994a37e336 Added 32-bit MSVC2017 builds. 2019-04-04 21:08:09 -04:00
Pietro Gagliardi 7e83ba9ffe Completed the matrix a bit more for 64-bit builds. Need to do the 32-bit VS2017 builds and all the VS2015 and macOS builds next. 2019-04-04 20:27:45 -04:00
Pietro Gagliardi 07dfea4a4f More TODOs. 2019-04-04 11:31:47 -04:00
Pietro Gagliardi d280aa40cb Jiggle Azure Pipelines again. 2019-04-04 11:23:58 -04:00
Pietro Gagliardi b480050550 Jiggle Azure Pipelines. 2019-04-04 11:21:00 -04:00
Pietro Gagliardi 7d22d84584 Deduplicate the install latest meson steps. 2019-04-04 11:02:59 -04:00
Pietro Gagliardi f23ba94d70 Properly specify job names. 2019-04-04 10:49:31 -04:00
Pietro Gagliardi d6c30352ee Split each of the build types into their own job. 2019-04-04 10:46:59 -04:00
Pietro Gagliardi 60df014315 Saved all the pages I had open on Azure Pipelines while writing what I have now, so I can restart Firefox as well as look these up later. 2019-04-04 01:17:01 -04:00
Pietro Gagliardi 9889477a25 It turns out the Ninja in CMake is either too old or a CI fluke that the VC env overrides. Try again. 2019-04-04 00:20:10 -04:00
Pietro Gagliardi e1abd02ed2 Don't use the VS backend with GCC. 2019-04-03 10:31:44 -04:00
Pietro Gagliardi 4afebf4d8e Try again again. 2019-04-03 10:20:07 -04:00
Pietro Gagliardi 466f542bd3 Try again. 2019-04-03 10:11:57 -04:00
Pietro Gagliardi 30a8cbf8b1 Fixed VS2017 build for now. 2019-04-03 10:05:00 -04:00
Pietro Gagliardi 514b8ecbc6 So apparently Azure Pipelines comes with Ninja as part of CMake. Ok. 2019-04-02 23:21:59 -04:00
Pietro Gagliardi 0da0240875 Oops 2019-04-02 23:18:02 -04:00
Pietro Gagliardi ce3fa7485f Okay, manually devenv. 2019-04-02 23:15:19 -04:00
Pietro Gagliardi 68901322d4 Okay, try to make it use Visual Studio =P 2019-04-02 22:13:02 -04:00
Pietro Gagliardi 6e0a8915af Try a Windows build. 2019-04-02 22:09:43 -04:00
Pietro Gagliardi 9f814dd47f Fix apt-get invocation on Azure. 2019-04-02 11:03:13 -04:00
Pietro Gagliardi af03601fde Follow the proper Python instructions in https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/python?view=azure-devops for our Azure Pipelines file. 2019-04-02 10:41:17 -04:00
Pietro Gagliardi 5ad39011ce Try again 2019-04-02 10:29:08 -04:00
Pietro Gagliardi 7dfc11f645 Try to set up meson on Travis. 2019-04-02 10:22:40 -04:00
Pietro Gagliardi 0ad8c85de0 Fixred meson installation. 2019-04-01 11:03:08 -04:00
Pietro Gagliardi 151ee9a52e Try an initial build. 2019-04-01 10:58:03 -04:00
Pietro Gagliardi 8586ca35cb Merge branch 'master' into meson 2019-03-31 23:50:29 -04:00
Pietro Gagliardi 2aea38b446 Always build everything. 2019-03-31 23:50:05 -04:00
Pietro Gagliardi 0b6b68c6a1 Added codedate to azure-pipelines.yml. 2019-03-31 23:45:53 -04:00
Pietro Gagliardi 54e90aaafd Merge branch 'master' into meson 2019-03-31 23:44:56 -04:00
Pietro Gagliardi bca7dacd31 Set up CI with Azure Pipelines [skip ci] 2019-03-31 23:38:39 -04:00
Pietro Gagliardi 07f04f1cc8 Updated the README to talk about Meson. Now we have to just set up the CI and all is good to merge. 2019-03-31 21:07:46 -04:00
Pietro Gagliardi f7907f38c6 Decided to just deal with the name tester instead of test for now. It's not that important to block merging. 2019-03-31 11:09:16 -04:00
Pietro Gagliardi ff3d39213e Decided to just build everything by default and not have separate all or examples targets since we don't really have much control over what's a top-level target anyway (and ninja on its own == ninja all). Also set layout to flat by default, since it keeps everything together, which will lead to less surprising behavior on Windows and is more useful for our release packages. 2019-03-31 11:04:20 -04:00
Pietro Gagliardi 35750c41fe Removed the TODO on the spurious MSVC warning; it's a meson bug and I've filed it now. When I rewrite the README, I'll link that bug. 2019-03-31 01:02:00 -04:00
Pietro Gagliardi 5c0f542222 Removed TODO about incremental linking; I checked meson's source code and the way I'm specifying to turn it off is indeed the way to turn it off (and in fact is how it's disabled with --buildtype=minsize as well, so). 2019-03-30 17:56:47 -04:00
Pietro Gagliardi 31ca852cef Demote various MESONTODOs to TODOs now that I filed issues for them with mesonbuild/meson. Almost done! 2019-03-30 15:43:33 -04:00
Pietro Gagliardi 629074d269 Slightly refactored a TODO. 2019-03-30 14:17:13 -04:00
Pietro Gagliardi 223972f87b Removed the MESONTODO for Haiku (*_machine.system() already supports this) and DESTDIR (Meson handles this for us; see https://mesonbuild.com/Installing.html#destdir-support). 2019-03-30 11:36:51 -04:00
Pietro Gagliardi 5c8dd4e7c3 Demote the TODO about 32-bit Mac from a MESONTODO to a normal TODO, meaning it doesn't block merging this branch back. Turns out we're not 32-bit compliant anymore :/ I'll handle that separately. 2019-03-30 11:30:55 -04:00
Pietro Gagliardi 4023e1bba3 Removed the TODO on meson dist; that's documented at https://mesonbuild.com/Creating-releases.html. Also deduplicated some TODOs. 2019-03-29 11:47:17 -04:00
Pietro Gagliardi 257536103f Clean up specification of Windows dependency listp also suggested by TheQwertiest in freenode #mesonbuild. Also more TODOs. 2019-03-29 11:03:07 -04:00
Pietro Gagliardi 7ea8c33547 Removed TODO about bulk Windows libraries as the answer is no; thanks TheQwertiest in freenode #mesonbuild. 2019-03-29 10:46:27 -04:00
Pietro Gagliardi 53c2fe9d00 Properly specified -lm and -ldl on Unix. 2019-03-29 09:35:38 -04:00
Pietro Gagliardi d62775ad02 And migrated the last missing bit from the CMakeLists.txt into meson.build; thanks to someone from freenode #mesonbuild. No more CMake files! 2019-03-28 20:18:05 -04:00
Pietro Gagliardi 81e25f76f2 Moved the binary PIC as a TODO and marked merge blockers as MESONTODO. Also removed a stale cmake-era TODO, because the manifest distribution idea it had will eventually be part of the uires tool. 2019-03-27 21:34:09 -04:00
Pietro Gagliardi 70fe716d06 Removed bit about PIC in libraries; meson builds shared libraries as PIC always (and by default in the future, should the need to not have a PIC shared library arise). Executables will be a bit harder due to meson versioning. 2019-03-27 21:02:50 -04:00
Pietro Gagliardi 922dca4f1e Resolved \$ORIGIN question; thanks to someone in freenode #cmake. 2019-03-27 10:19:40 -04:00
Pietro Gagliardi 65b97b6836 Pruned unnecessary stuff from _wip/examples_drawtext_CMakeLists.txt. Not sure what's going to happen to these examples, but we're going to have to keep this particular file around until that's decided. 2019-03-27 01:11:01 -04:00
Pietro Gagliardi e1d6f35ef0 And settled examples/CMakeLists.txt. 2019-03-27 01:09:54 -04:00
Pietro Gagliardi 99f2b8f5ad And settled test/CMakeLists.txt; nothing there that needed to be moved. 2019-03-27 01:07:03 -04:00
Pietro Gagliardi f6ef61cdee And settled common/CMakeLists.txt (it also had nothing that needed to be moved). 2019-03-27 01:05:57 -04:00
Pietro Gagliardi 8b37a98170 Settled unix/CMakeLists.txt (was already complete in unix/meson.build) and darwin/CMakeLists.txt (just had one other thing needing to be moved). 2019-03-27 01:02:50 -04:00
Pietro Gagliardi 6a5fedf3f4 Settled windows/CMakeLists.txt. 2019-03-27 00:59:32 -04:00
Pietro Gagliardi f65caac1ce More CMakeLists.txt cleanup. What's left in the top-level CMakeLists.txt is gonna take a while to put back properly... 2019-03-27 00:56:43 -04:00
Pietro Gagliardi beba7470f4 Started cleaning out the CMakeLists.txt. meson automatically includes -fomit-frame-pointer for the address sanitizer, so no extra work needed. 2019-03-27 00:46:34 -04:00
Pietro Gagliardi b3232cc50c Cleaned up the comment at the top of meson.build, removing stale information and converting remaining loose ends into explicit TODOs. 2019-03-26 22:10:48 -04:00
Pietro Gagliardi 77f3b41940 Removed a stale TODO and moved notes about Windows flags into its own file because these probably won't be handled any time soon... 2019-03-26 22:06:20 -04:00
Pietro Gagliardi c940b85b84 Removed TODOs about finding the best wya to do things, as either there is none or the way I was doing it was already the right way (as with -mmacosx-version-min, judging from the repo code). 2019-03-26 22:03:39 -04:00
Pietro Gagliardi fec83e72bf Clean up add_project_arguments()/add_project_link_arguments() invocations. 2019-03-26 21:53:00 -04:00
Pietro Gagliardi 0d9cfa0f68 Resolved some TODOs/removed some stale TODOs. The one about libui_is_debug was confirmed by freenode elibrokeit as the pacman package manager uses it. 2019-03-25 23:12:28 -04:00
Pietro Gagliardi 0b87ee9f93 More TODOs. 2019-03-25 20:52:49 -04:00
Pietro Gagliardi 9527bb73ca Remove /nologo options from meson.build files; according to jpakkane, this is already provided by meson. 2019-03-25 20:17:42 -04:00
Pietro Gagliardi 1b9250e41e Removed include_directories hackery, as suggested by various people in freenode #mesonbuild. 2019-03-25 20:07:22 -04:00
Pietro Gagliardi 87f2be6849 Rewrote one expression to reduce the number of variables. 2019-03-25 10:46:41 -04:00
Pietro Gagliardi c449ab7da9 Fixed the name of the Windows DLL in meson.build. 2019-03-25 10:29:18 -04:00
Pietro Gagliardi 3457082b1b Set up examples meson.build. 2019-03-24 17:26:15 -04:00
Pietro Gagliardi 467a9102ec Fixed static builds on all platforms. So close to getting all this set up! 2019-03-24 14:11:02 -04:00
Pietro Gagliardi c1dfc0ab5d And got the Windows build working. Woo! 2019-03-24 12:57:25 -04:00
Pietro Gagliardi 2be9a4f3a3 Added the initial Windows meson.build. Windows Meson is having problems running, so we'll have to test this later. 2019-03-23 22:28:17 -04:00
Pietro Gagliardi 5e557d61b3 Set the minimum required meson version and moved the libui-specific OS X variables into darwin.build like we did with unix.build. 2019-03-23 21:50:54 -04:00
Pietro Gagliardi dff8ec0f22 Set up the Unix meson.build. That seems to work too. 2019-03-23 21:06:19 -04:00
Pietro Gagliardi cdd997b6f6 Added tester build file and made sure everything works. It works! 2019-03-23 18:12:33 -04:00
Pietro Gagliardi 1deacb55aa And massaged things into a buildable state. Woo. NOW things are starting to get annoying, but at least it's not so much *voodoo* anymore? 2019-03-23 16:18:13 -04:00
Pietro Gagliardi 253ce9a3cc Decided to just use add_project_(link_)arguments() for now, and set up the macOS build for testing. 2019-03-23 15:42:42 -04:00
Pietro Gagliardi 035139a1e9 Set up the macOS dependencies; I found it by accident :V Also removed the independent temporary dependency variables. 2019-03-22 22:46:53 -04:00
Pietro Gagliardi a440b174f7 Use host_machine instead of target_machine. Confusingly, host_machine is not the build host, but rather the target machine that the binaries will run on. build_machine is the build host. It probably made sense to the person in the 1980s who came up with this, but meh. 2019-03-22 22:04:07 -04:00
Pietro Gagliardi 7063ed6e32 Take some suggestions from the meson IRC channel: don't set unnecessary variables before project(); don't disallow plain builds since the options that meson doesn't apply aren't any of the ones I care about. 2019-03-22 22:00:19 -04:00
Pietro Gagliardi 1a9b0881bc Clean up meson.build slightly and add a section to the top to describe what I want to do so I can ask people. 2019-03-21 23:21:30 -04:00
Pietro Gagliardi 355b5d05d3 Filled meson.build a bit more, so I can ask questions about it. 2019-03-21 11:23:30 -04:00
Pietro Gagliardi f8543fc641 Started a top-level meson.build file. This might actually work... maybe. 2019-03-17 21:26:52 -04:00
Pietro Gagliardi 751ce562bb Renamed the doc folder to _doc so as to make room for newer, more final documentation. 2019-03-17 19:29:58 -04:00
Pietro Gagliardi 65a0c5958e Delete OLD_uitable.h; forgot to do it sooner. 2019-03-17 19:27:59 -04:00
Pietro Gagliardi 39d4542de3
Merge pull request #455 from torkleyy/patch-1
Update Rust bindings
2019-02-10 08:54:34 -05:00
Thomas Schaller 853d97aecb Update Rust bindings
All the other bindings are either abandoned
or forks of rust-native/libui-rs
2019-02-10 11:59:43 +01:00
Pietro Gagliardi e753ae9b57 More notes. 2019-02-09 21:38:10 -05:00
Pietro Gagliardi 7ce5070eeb
Merge pull request #454 from NoraCodes/readme-rust-link-fix
Point to the correct canonical location for Rust
2019-02-08 09:03:08 -05:00
Leonora Tindall e8db7f9bf9
Point to the correct canonical location for Rust 2019-01-31 20:57:57 -06:00
Pietro Gagliardi d305440fa0 Merge branch 'windows-namespace-and-hresult-cleanup'
Branch is abandoned, but notes files were changed, so keep those.
2019-01-05 18:57:37 -05:00
Pietro Gagliardi f1d9e36a0e Abandon the current work on windows-namespace-and-hresult-cleanup. I'll take a different approach. 2019-01-05 18:56:04 -05:00
Pietro Gagliardi a03754512f Merge branch 'master' into windows-namespace-and-hresult-cleanup 2019-01-05 18:46:25 -05:00
Pietro Gagliardi 04891a99ab Remove the autolayout --no-ff merge dummy file. 2019-01-05 17:40:59 -05:00
Pietro Gagliardi dabf2e6b93 Merge branch 'autolayout'
PROPERLY this time.
2019-01-05 17:40:33 -05:00
Pietro Gagliardi b95dd8fab5 Add a dummy file to ensure that branch autolayout can be --no-ff merged with master. 2019-01-05 17:35:41 -05:00
Pietro Gagliardi c65865d5c2 Merge branch 'master' into autolayout
For some reason the merge of this ages ago was forgotten. We're gonna make a dummy commit and properly --no-ff this.
2019-01-05 17:34:08 -05:00
Pietro Gagliardi acc0e3e5ea Merge branch 'master' of github.com:andlabs/libui 2018-12-30 20:18:26 -05:00
Pietro Gagliardi 000f699ba6
Merge pull request #426 from tacdevel/libuisharp-bindings-update
LibUISharp binding project rename
2018-12-30 20:17:16 -05:00
Pietro Gagliardi 0d9e3c4b67 More notes. 2018-12-26 12:40:37 -05:00
Pietro Gagliardi 38e5d23891 More notes. 2018-11-24 19:57:05 -05:00
Thomas Corwin 97609af771 Update the C# binding LibUISharp's name and link. 2018-11-20 15:16:38 -05:00
Pietro Gagliardi 6490cdadb7 More TODOs. 2018-11-11 21:25:45 -05:00
Pietro Gagliardi ae8a3939ae More TODOs. 2018-11-08 11:32:41 -05:00
Pietro Gagliardi df5d144dbd More TODOs. 2018-11-07 10:11:51 -05:00
Pietro Gagliardi c25831ec66 Properly sized the explorer bar now. 2018-11-05 21:09:50 -05:00
Pietro Gagliardi a5fb198558 Started work to properly size the explorer bars. 2018-11-04 22:19:44 -05:00
Pietro Gagliardi 7138276ccf And completed the genericization for Vista. It works!!! 2018-11-02 23:23:35 -04:00
Pietro Gagliardi 3d4b959632 More work on generalizing the winbuttonexplorertheme program. 2018-11-01 10:50:10 -04:00
Pietro Gagliardi d9a851169e More work. More platform-specific parameters, yay! 2018-10-30 23:34:06 -04:00
Pietro Gagliardi 447dc24651 Start of refactoring of stuff into classes! It's spaghetti already~ 2018-10-29 21:11:16 -04:00
Pietro Gagliardi c49151a4dc Background now draws correctly on Vista. Something weird is going on with the theme there; the parts (except for part 1) seem to be shifted down one... and the UIFILE there uses named constants directly... 2018-10-28 22:03:56 -04:00
Pietro Gagliardi b82d1b0a3b More work; we now have the background. Oh boy, this is gonna be fun, because Vista doesn't have things set up quite right compared to 7... 2018-10-28 18:17:37 -04:00
Pietro Gagliardi 9e6baf0a61 And cleaned up the button sizing, metrics, and drawing code. It seems to position the content correctly still! :D 2018-10-26 23:23:08 -04:00
Pietro Gagliardi d15dfa06a8 More text drawing work. I might need to make a generic button metrics function for this instead. 2018-10-21 22:23:11 -04:00
Pietro Gagliardi 836e0dc2c7 Resolved sizing woes for now. 2018-10-20 19:22:02 -04:00
Pietro Gagliardi 71ddf6ce91 Figured out more stuff about our button size woes. 2018-10-19 22:22:45 -04:00
Pietro Gagliardi 24e8649c87 More experiments. This is getting absurd. 2018-10-18 22:32:53 -04:00
Pietro Gagliardi 7e34fac79d More experimentation. DirectUI is doing something with the sizing that I'm not... 2018-10-16 23:19:23 -04:00
Pietro Gagliardi 83ba0b1a41 More experiments in properly sizing our themed buttons since I'll just be custom-drawing them in their entirety based on the UIFILE's specification of content alignment. 2018-10-16 11:25:22 -04:00
Pietro Gagliardi fcec8693ca Started drawing the button properly. Focus rects are now in the way... 2018-10-15 09:30:22 -04:00
Pietro Gagliardi 38723aeff9 More TODOs. 2018-10-15 01:54:15 -04:00
Pietro Gagliardi ba9c42e5bb More theming work. We may actually have it this time! 2018-10-15 01:53:22 -04:00
Pietro Gagliardi 760a7c09f5 Started a new test program that works like the rebar one except with real button controls instead. 2018-10-14 23:56:00 -04:00
Pietro Gagliardi 359c08aa11 Tried to custom-draw the split button properly. Not sure it's possible... 2018-10-14 19:08:02 -04:00
Pietro Gagliardi c216d8953d Undid all custom sizing stuff for now. Let's just make this work first. 2018-10-14 18:42:51 -04:00
Pietro Gagliardi ddd6afbf36 Refined icon loading and tried to expand the winrebarexplorertheme test a bit more elaborate. This is going badly again... 2018-10-14 15:12:00 -04:00
Pietro Gagliardi 79d1d58af2 Oops 2018-10-13 18:12:04 -04:00
Pietro Gagliardi 1d94e95e83 More work. That chevron is going to be annoying... 2018-10-13 17:56:44 -04:00
Pietro Gagliardi 9d31dddd13 Figured out what I was doing wrong to get rightbar not working; it was some code I forgot about =P 2018-10-13 14:17:17 -04:00
Pietro Gagliardi fc2ef2c904 More work. This is starting to get twisted. 2018-10-12 22:45:37 -04:00
Pietro Gagliardi a5aa4624df More work. We're definitely building up to something... 2018-10-12 20:56:53 -04:00
Pietro Gagliardi 87d3fc5064 And started the custom draw code. 2018-10-11 22:49:37 -04:00
Pietro Gagliardi 6a22c61cd4 More work on winrebarexplorertheme.cpp, including the boilerplate for custom draw. More TODOs in general. 2018-10-11 22:19:10 -04:00
Pietro Gagliardi d082b4efa4 More work on winrebarexplorertheme.cpp. It registers themes. 2018-10-11 21:03:34 -04:00
Pietro Gagliardi 91fe6e7c47 More rebar refinements. 2018-10-11 05:35:06 -04:00
Pietro Gagliardi 97b11e027d Refined the rebar test some more. 2018-10-11 04:10:36 -04:00
Pietro Gagliardi fa4f5d78cb More notes. 2018-10-10 22:13:05 -04:00
Pietro Gagliardi 30ee36f8d2 More test programs. This isn't done yet, and it's not working right... 2018-10-09 23:40:13 -04:00
Pietro Gagliardi 30d4129a38
Merge pull request #421 from Garland-g/master
Perl6 NativeCall bindings
2018-09-20 06:58:00 -04:00
Travis Gibson 186a92f6e9
Perl6 NativeCall bindings 2018-09-19 20:48:52 -07:00
Pietro Gagliardi ea1fde52ad More TODOs and removed the old C++. 2018-08-08 21:31:58 -04:00
Pietro Gagliardi b3de605d50 Started template support, writing the initial C++ template. 2018-08-08 21:31:12 -04:00
Pietro Gagliardi ecf9efd6d7 More functions in funclist.proto. 2018-08-08 20:53:32 -04:00
Pietro Gagliardi 1f4d7dc374 Adjusted mk.sh slightly. 2018-08-08 19:51:20 -04:00
Pietro Gagliardi c33ea32e0f Started a new hresultwrap in Go. I'll run it locally. 2018-08-08 19:48:52 -04:00
Pietro Gagliardi 2df2d565f9 Merge branch 'master' into windows-namespace-and-hresult-cleanup 2018-08-08 18:29:24 -04:00
Pietro Gagliardi c4ce1072c7 Merge branch 'master' into windows-namespace-and-hresult-cleanup 2018-05-31 08:21:40 -04:00
Pietro Gagliardi 246abee8a4 Merge branch 'master' into windows-namespace-and-hresult-cleanup 2018-05-30 08:50:58 -04:00
Pietro Gagliardi bba2d30362 Merge branch 'master' into windows-namespace-and-hresult-cleanup 2018-05-30 08:07:40 -04:00
Pietro Gagliardi 039a9db2e5 Wrapped the processing in a class and collapsed consecutive blank lines. 2018-05-28 22:57:52 -04:00
Pietro Gagliardi d4517fab84 And changed hresultwrap to only write to the output file in main(). 2018-05-28 22:50:00 -04:00
Pietro Gagliardi b590482ccb Expanded the tool input slightly and (finally) changed hresultwrap.cpp to use WriteCloser. 2018-05-28 22:46:30 -04:00
Pietro Gagliardi 7e2c505b1d Merge branch 'master' into windows-namespace-and-hresult-cleanup 2018-05-28 13:39:36 -04:00
Pietro Gagliardi ea5bd79b89 Made WINAPI (stdcall) the default calling convention. Hopefully this will opt us into some compiler optimizations... hopefully. 2018-05-27 20:44:34 -04:00
Pietro Gagliardi eef179c1e5 And added function bodies to hresultwrap. 2018-05-27 20:38:10 -04:00
Pietro Gagliardi a1a20837cd And cleaned up the item class, turning it into a Function class. 2018-05-27 20:17:35 -04:00
Pietro Gagliardi 620b03f442 And fixed the remaining errors, including runtime erorrs. It works! 2018-05-27 19:48:39 -04:00
Pietro Gagliardi cf945367a3 Rewrote hresultwrap.cpp with the new changes, fixing some build errors too. Now to fix the remaining build errors. 2018-05-27 16:32:33 -04:00
Pietro Gagliardi 4a7e7ed983 Rewrote the library to use ByteSlice. 2018-05-27 15:50:00 -04:00
Pietro Gagliardi 8231bd337f Built a new ByteSlice interface in lib.cpp that will keep shuffling the bytes around much nicer. I'll change everything to use it next. 2018-05-27 15:36:16 -04:00
Pietro Gagliardi 481e1e30bb And updated hresultwrap to produce signatures. Man this is so un-C++-y it actually feels like I'm doing it wrong... 2018-05-26 20:09:16 -04:00
Pietro Gagliardi ef9e08d4ad Started assembling the input file to this hresult utility. 2018-05-26 19:40:55 -04:00
Pietro Gagliardi 8f5eba45bd Added more support for writing hresultwrap itself. There is probably a more C++-y way to write all this :| If only I could use Go... 2018-05-26 17:42:26 -04:00
Pietro Gagliardi a07727515f Updated hresultwrap to use lib.cpp, fixing errors along the way. 2018-05-26 16:56:53 -04:00
Pietro Gagliardi a6634f775b Minor style fretting 2018-05-25 21:17:29 -04:00
Pietro Gagliardi 472476392c Started expanding what were scanner.cpp and scanner.hpp into a more flexible library for tool writing. Also decided to go with separate POSIX and Windows implementations. 2018-05-25 21:07:45 -04:00
Pietro Gagliardi ca11bf1e42 More notes. 2018-05-25 20:25:36 -04:00
Pietro Gagliardi 43c2f26de3 Split Scanner into its own files. 2018-05-25 00:33:56 -04:00
Pietro Gagliardi 8b35ab973d Simplification through adversity, or, POSIX is not as portable as it would like :D It still works, though! 2018-05-24 16:11:58 -04:00
Pietro Gagliardi a5e07be2f5 Fixed EOF behavior. 2018-05-22 21:23:38 -04:00
Pietro Gagliardi c38564a8f7 And integrated Scanner into the mix. C's EOF behavior is gonna make things harder... 2018-05-22 21:19:54 -04:00
Pietro Gagliardi b769b37189 Attempted to simplify hresultwrap.cpp through a Scanner class, similar to Go's bufio.Scanner. There are a few snags right now... 2018-05-22 21:03:54 -04:00
Pietro Gagliardi d09be0d5fc Fixed bugs in hresultwrap.cpp. 2018-05-21 23:05:39 -04:00
Pietro Gagliardi fb745e80e3 Started the tool to convert Windows API functions into HRESULT wrappers. 2018-05-21 22:42:19 -04:00
Pietro Gagliardi 20483669b2 Merge branch 'master' into windows-namespace-and-hresult-cleanup 2018-05-21 20:12:42 -04:00
91 changed files with 3620 additions and 865 deletions

View File

@ -2,66 +2,80 @@ version: 'build #{build}'
environment: environment:
matrix: matrix:
- linking: shared - arch: 386
libtype: shared
libfiles: libui.dll libui.lib
compiler: msvc2013 compiler: msvc2013
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
- linking: static - arch: 386
libtype: static
libfiles: libui.lib
compiler: msvc2013 compiler: msvc2013
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
- linking: shared - arch: amd64
compiler: msvc2015 libtype: shared
libfiles: libui.dll libui.lib
compiler: msvc2013
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
- arch: amd64
libtype: static
libfiles: libui.lib
compiler: msvc2013
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
- arch: 386
libtype: static
libfiles: libui.lib
compiler: mingw
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- linking: static - arch: amd64
compiler: msvc2015 libtype: static
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 libfiles: libui.lib
- linking: shared
compiler: msvc2017
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- linking: static
compiler: msvc2017
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- linking: static
compiler: mingw compiler: mingw
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
platform: platform:
- Win32
- x64 - x64
before_build: # Note: AppVeyor tries to be "helpful" and splits cmd.exe scripts into their constitutent lines to check their error codes. There is no way to switch this off; for true multi-line scripts we have to use PowerShell. But we need to use vcvarsall.bat, so that's out of the question.
- if %compiler%==msvc2013 ( set "CMAKE_GENERATOR=Visual Studio 12 2013" ) install:
else if %compiler%==msvc2015 ( set "CMAKE_GENERATOR=Visual Studio 14 2015" ) # Set Python Version
else if %compiler%==msvc2017 ( set "CMAKE_GENERATOR=Visual Studio 15 2017" ) - set "PYTHON_ROOT=C:\python37-x64"
else if %compiler%==mingw ( set "CMAKE_GENERATOR=MinGW Makefiles" ) - if %arch%==386 ( set "PYTHON_ROOT=C:\python37" )
- if %compiler%-%platform%==mingw-Win32 ( set "PATH=C:\msys64\mingw32\bin;%PATH%" ) - set "PATH=%PYTHON_ROOT%;%PYTHON_ROOT%\Scripts;%PATH%"
else if %compiler%-%platform%==mingw-x64 ( set "PATH=C:\msys64\mingw64\bin;%PATH%" ) # Install Latest Meson
else if %platform%==x64 ( set "CMAKE_GENERATOR=%CMAKE_GENERATOR% Win64" ) - pip install meson
- if %linking%==static ( set CMAKE_FLAGS=-DBUILD_SHARED_LIBS=OFF ) # Install Ninja
- if %compiler%==mingw ( set "outdir=build\out" ) else ( set "outdir=build\out\Release" ) - powershell -Command "Invoke-WebRequest https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-win.zip -OutFile C:\ninja-win.zip"
- ren "C:\Program Files\Git\usr\bin\sh.exe" _sh.exe - mkdir C:\ninja
- set "simultaneous=3" - powershell -Command "Expand-Archive -LiteralPath C:\ninja-win.zip -DestinationPath C:\ninja"
- set "PATH=C:\ninja;%PATH%"
# Parameters for the build_script phase, to reduce their noise.
- set "mingwPath=C:\msys64\mingw64\bin"
- set vcvarsallArch=x86
- if %arch%==386 ( set "mingwPath=C:\msys64\mingw32\bin" )
- if %arch%==386 ( set vcvarsallArch=amd64 )
build_script: build_script:
- md build && cd build - if %compiler%==mingw ( set "PATH=%mingwPath%;%PATH%" )
- if not %compiler%==mingw ( set "CFLAGS=/MP%simultaneous% %CFLAGS%" ) - if not %compiler%==mingw ( call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" %vcvarsallArch% )
- if not %compiler%==mingw ( set "CPPFLAGS=/MP%simultaneous% %CPPFLAGS%" ) - meson setup build --buildtype=release --default-library=%libtype%
- if not %compiler%==mingw ( set "CXXFLAGS=/MP%simultaneous% %CXXFLAGS%" ) - ninja -C build
- cmake -G "%CMAKE_GENERATOR%" %CMAKE_FLAGS% ..
- if %compiler%==mingw ( mingw32-make -j%simultaneous% tester examples )
else ( msbuild libui.sln /t:Build /p:Configuration=Release /p:Platform=%platform% )
- cd %APPVEYOR_BUILD_FOLDER%
after_build: after_build:
- if %platform%==x64 ( set "arch=amd64" ) else ( set "arch=386" ) - set "version=%APPVEYOR_REPO_BRANCH%"
- if %APPVEYOR_REPO_TAG%==true ( set "version=%APPVEYOR_REPO_TAG_NAME%" ) - if %APPVEYOR_REPO_TAG%==true ( set "version=%APPVEYOR_REPO_TAG_NAME%" )
else ( set "version=%APPVEYOR_REPO_BRANCH%" ) - set "artifact=%version%-windows-%arch%-%compiler%-%libtype%"
- if %linking%==shared ( set "artifact=shared" ) else ( set "artifact=%compiler%-static" ) - cd build\meson-out
- set "artifact=%version%-windows-%arch%-%artifact%" # TODO msvc only?
- del .\%outdir%\libui.exp # remove unnecessary files - if %libtype%==static ( ren libui.a libui.lib )
- 7z a libui-%artifact%.zip .\%outdir%\libui.* ui.h ui_windows.h - copy ..\..\ui.h .
- 7z l libui-%artifact%.zip - copy ..\..\ui_windows.h .
- 7z a examples-%artifact%.zip .\%outdir%\*.exe # remove unnecessary files
- 7z l examples-%artifact%.zip # TODO should we do this on Azure too?
- del libui.exp
- 7z a "%APPVEYOR_BUILD_FOLDER%\libui-%artifact%.zip" %libfiles% ui.h ui_windows.h
- 7z a "%APPVEYOR_BUILD_FOLDER%\examples-%artifact%.zip" controlgallery.exe cpp-multithread.exe datetime.exe drawtext.exe histogram.exe tester.exe timer.exe
- del ui.h ui_windows.h
artifacts: artifacts:
- path: libui-*.zip - path: libui-*.zip

View File

@ -1,97 +0,0 @@
language: c
include: &toolchain_linux_amd64
os: linux
dist: trusty
addons:
apt:
update: true
packages:
- libgtk-3-dev
include: &toolchain_linux_386
os: linux
dist: trusty
addons:
apt:
packages:
- gcc-multilib
- g++-multilib
- libgtk-3-dev:i386
# the rest fixes broken dependencies of libgtk:i386
- libgirepository-1.0-1:i386
- libglib2.0-dev:i386
- gir1.2-glib-2.0:i386
- gir1.2-atk-1.0:i386
- libatk1.0-dev:i386
- libfreetype6-dev:i386
- libfontconfig1-dev:i386
- libcairo2-dev:i386
- libgdk-pixbuf2.0-dev:i386
- libpango1.0-dev:i386
- libxft-dev:i386
- libpng12-dev:i386
include: &toolchain_osx_amd64
os: osx
osx_image: xcode8
# Travis CI build matrix.
# Each entry below will trigger an extra, parallel build on Travis.
matrix:
include:
- env: linking=shared arch=amd64
<<: *toolchain_linux_amd64
- env: linking=static arch=amd64
<<: *toolchain_linux_amd64
- env: linking=shared arch=386
<<: *toolchain_linux_386
- env: linking=static arch=386
<<: *toolchain_linux_386
- env: linking=shared arch=amd64
<<: *toolchain_osx_amd64
- env: linking=static arch=amd64
<<: *toolchain_osx_amd64
install:
- if [[ "${arch}" == "386" ]]; then
export CFLAGS=-m32;
export CXXFLAGS=-m32;
export PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig;
fi
- if [[ "${linking}" == "static" ]]; then
export CMAKE_FLAGS=-DBUILD_SHARED_LIBS=OFF;
fi
script:
- cmake --version
- mkdir build
- pushd build
- cmake -G "Unix Makefiles" ${CMAKE_FLAGS} ..
- make tester examples
- popd
after_success:
- ls -lR build/out
- file build/out/test
- export platform="$TRAVIS_OS_NAME"
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cp ui.h ui_darwin.h build/out/; export platform=darwin; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp ui.h ui_unix.h build/out/; fi
- if [[ "x${TRAVIS_TAG}" != "x" ]]; then export version=${TRAVIS_TAG}; else export version=${TRAVIS_BRANCH}; fi
- export artifact=${version}-${platform}-${arch}-${linking}
- echo ${artifact}
- pushd build/out
- # TODO do not include symlinks in the archive
- tar -czvf libui-${artifact}.tgz libui.* *.h
- tar -czvf examples-${artifact}.tgz `find . -type f ! -name "*.*"`
- popd
deploy:
provider: releases
api_key:
secure: "fmgC97mlXQY/ASWAL/GyTJfiJIo/hsVFf6bP3Zz8odv259PJUFGgnZ9kNIgJcFQ5961lXDFi7pBMMSetm1GZ2EBZxIXnUfe1kfIhw62ybJHIwB2+g2tc8A4zzfkWJVY4xVYpitOU3iMuu5Z8U2n+68RYWKpcxhbkVw5v8Zu2Rms="
file: build/out/*.tgz
file_glob: true
skip_cleanup: true
on:
tags: true

View File

@ -1,238 +0,0 @@
# 3 june 2016
# see https://cmake.org/gitweb?p=cmake.git;a=commit;h=95cdf132489c79e88a10fdf7a7566fa002c7680b (thanks ngladitz in irc.freenode.net/#cmake)
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
# TODOs
# - silence entering/leaving messages?
# - uname -s for more refined OS control
# - Haiku for haiku
# - debian DESTDIR? https://github.com/andlabs/libui/pull/10
# - libui-combined* needs to be deleted so that custom command can run every time
# - add notelemetry.obj to *ALL TARGETS* on VS2015 and up - https://www.infoq.com/news/2016/06/visual-cpp-telemetry
# - switch to 3.1.0 features
# the docs say we need to set this up prior to project()
# the docs don't say this, but the CACHE part is important; see https://stackoverflow.com/questions/34208360/cmake-seems-to-ignore-cmake-osx-deployment-target
# TODO figure out what other variables must be set with CACHE
# TODO figure out if FORCE is needed here
# TODO figure out whether STRING "" is best or if something else is better; also what FORCE does because I forget and later I say it's needed
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.8" CACHE STRING "" FORCE)
# we want to disable incremental linking
# see also:
# - https://github.com/bulletphysics/bullet3/blob/master/CMakeLists.txt#L43
# - https://cmake.org/pipermail/cmake/2010-February/035174.html
# this must also go before project()
set(MSVC_INCREMENTAL_DEFAULT ON)
# default to debug builds
# do this before project() just to be safe
# either DEBUG or Debug will work; we use DEBUG as that's what cmake does internally (https://cmake.org/pipermail/cmake/2013-June/055177.html)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE DEBUG CACHE STRING "" FORCE)
endif()
project(libui)
option(BUILD_SHARED_LIBS "Whether to build libui as a shared library or a static library" ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out")
set(CMAKE_PDB_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out")
if(APPLE)
set(_OSNAME darwin)
set(_HASVERSION TRUE)
set(_VERSION "A")
# always use our rpath
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
# the / is required by some older versions of OS X
set(CMAKE_INSTALL_RPATH "@executable_path/")
set(CMAKE_MACOSX_RPATH TRUE)
elseif(WIN32)
set(_OSNAME windows)
# and don't include the default libraries with ANY of the builds
# note the CACHE FORCE stuff is required here
set(CMAKE_C_STANDARD_LIBRARIES CACHE STRING "" FORCE)
set(CMAKE_CXX_STANDARD_LIBRARIES CACHE STRING "" FORCE)
else()
set(_OSNAME unix)
set(_HASVERSION TRUE)
set(_VERSION "0")
# always use our rpath
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH "\$ORIGIN")
endif()
# common flags
if(MSVC)
# TODO subsystem version
# TODO /Wall does too much
# TODO -Wno-switch equivalent
# TODO /sdl turns C4996 into an ERROR
# don't use /analyze; that requires us to write annotations everywhere
# TODO undecided flags from qo?
# the RTC flags are only supplied in debug builds because they are only supposed to be used by debug builds (see "This is because run-time error checks are not valid in a release (optimized) build." in https://docs.microsoft.com/cpp/build/reference/rtc-run-time-error-checks)
# /RTCc is not supplied because it's discouraged as of VS2015; see https://www.reddit.com/r/cpp/comments/46mhne/rtcc_rejects_conformant_code_with_visual_c_2015/d06auq5
# /EHsc is to shut the compiler up in some cases
# TODO make /EHsc C++-only
set(_COMMON_CFLAGS
/W4 /wd4100
/bigobj /nologo
$<$<CONFIG:Debug>:/RTC1 /RTCs /RTCu>
/EHsc
)
# note the /MANIFEST:NO (which must be / and uppercase); thanks FraGag (https://github.com/andlabs/libui/issues/93#issuecomment-223183436)
# TODO warnings on undefined symbols
set(_COMMON_LDFLAGS
/LARGEADDRESSAWARE
/NOLOGO
/INCREMENTAL:NO
/MANIFEST:NO
)
# TODO autogenerate a .def file?
# more incremental linking fixes
# TODO actually get rid of incremental linking here
else()
set(_COMMON_CFLAGS
-Wall -Wextra -pedantic
-Wno-unused-parameter
-Wno-switch
-fvisibility=hidden
)
# don't use C_VERSION or CXX_VERSION because they use GNU standards
# TODO we can actually do this; set both C_EXTENSIONS and CXX_EXTENSIONS to OFF
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --std=c99")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11")
set(_COMMON_LDFLAGS
-fvisibility=hidden
)
# don't require shipping the MinGW-w64 DLLs
if(WIN32)
list(APPEND _COMMON_LDFLAGS
-static
-static-libgcc
-static-libstdc++
)
endif()
# TODO document this
if(ADDRESS_SANITIZER)
set(_COMMON_CFLAGS ${_COMMON_CFLAGS}
-fsanitize=address
-fno-omit-frame-pointer
)
set(_COMMON_LDFLAGS ${_COMMON_LDFLAGS}
-fsanitize=address
-fno-omit-frame-pointer
)
endif()
endif()
# problem:
# - target_link_libraries() only supports - for flags
# - but cmake only doesn't generate the manifest if the flag has a /
macro(_target_link_options_private _target)
foreach(_opt IN LISTS ${ARGN})
set_property(TARGET ${_target} APPEND_STRING PROPERTY
LINK_FLAGS " ${_opt}")
endforeach()
endmacro()
add_subdirectory("common")
add_subdirectory("${_OSNAME}")
add_library(libui ${_LIBUI_SOURCES})
target_include_directories(libui
PUBLIC .
PRIVATE ${_LIBUI_INCLUEDIRS})
target_compile_definitions(libui
PRIVATE ${_LIBUI_DEFS})
# cmake produces this for us by default but only for shared libraries
target_compile_definitions(libui
PRIVATE libui_EXPORTS)
target_compile_options(libui
PUBLIC ${_COMMON_CFLAGS}
PRIVATE ${_LIBUI_CFLAGS})
# TODO link directories?
if(BUILD_SHARED_LIBS)
target_link_libraries(libui
PRIVATE ${_LIBUI_LIBS})
endif()
# TODO INTERFACE libs don't inherit to grandhcildren?
# on Windows the linker for static libraries is different; don't give it the flags
if(BUILD_SHARED_LIBS)
_target_link_options_private(libui
_COMMON_LDFLAGS
_LIBUI_LDFLAGS)
endif()
if(NOT BUILD_SHARED_LIBS)
# TODO figure out a way to tell libui that it's static
target_compile_definitions(libui
PUBLIC _UI_STATIC)
endif()
if(NOT MSVC)
# on non-MSVC compilers cmake adds an extra lib-
# note that we apply this to libui, not to any intermediates
set_target_properties(libui PROPERTIES
OUTPUT_NAME ui)
# flags for warning on undefined symbols
# TODO figure out why FreeBSD follows linked libraries here
# TODO figure out MSVC equivalents
if(BUILD_SHARED_LIBS)
if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD))
# on OS X we don't need to do this; Apple's linker warns about undefined symbols in -shared builds!
if(NOT APPLE)
target_link_libraries(libui
PRIVATE -Wl,--no-undefined -Wl,--no-allow-shlib-undefined
)
endif()
endif()
endif()
endif()
if(BUILD_SHARED_LIBS)
if(_HASVERSION)
set_target_properties(libui PROPERTIES
SOVERSION "${_VERSION}")
endif()
endif()
# TODO why is this not a default?!
set_property(TARGET libui PROPERTY
POSITION_INDEPENDENT_CODE True)
macro(_add_exec _name)
# TODOTODO re-add WIN32 when merging back
add_executable(${_name}
EXCLUDE_FROM_ALL
${ARGN})
target_link_libraries(${_name} libui)
_target_link_options_private(${_name}
_COMMON_LDFLAGS)
# TODO does this propagate?
set_property(TARGET ${_name} PROPERTY
POSITION_INDEPENDENT_CODE True)
# TODO see above about INTERFACE
if(NOT BUILD_SHARED_LIBS)
target_link_libraries(${_name}
${_LIBUI_LIBS})
endif()
# TODOfor some reason these don't propagate
if(NOT WIN32)
target_include_directories(${_name}
PUBLIC .)
target_compile_options(${_name}
PUBLIC ${_COMMON_CFLAGS})
endif()
endmacro()
add_subdirectory("test")
add_subdirectory("examples")

7
Makefile Normal file
View File

@ -0,0 +1,7 @@
all:
redomod:
rm -f go.*
GO111MODULE= go mod init
GO111MODULE= go mod tidy

View File

@ -1,65 +0,0 @@
// 20 june 2016
// kept in a separate file for now
typedef struct uiImage uiImage;
// TODO use const void * for const correctness
_UI_EXTERN uiImage *uiNewImage(double width, double height);
_UI_EXTERN void uiFreeImage(uiImage *i);
_UI_EXTERN void uiImageAppend(uiImage *i, void *pixels, int pixelWidth, int pixelHeight, int pixelStride);
typedef struct uiTableModel uiTableModel;
typedef struct uiTableModelHandler uiTableModelHandler;
// TODO actually validate these
_UI_ENUM(uiTableModelColumnType) {
uiTableModelColumnString,
uiTableModelColumnImage,
uiTableModelColumnInt,
uiTableModelColumnColor,
};
// TODO validate ranges; validate types on each getter/setter call (? table columns only?)
struct uiTableModelHandler {
int (*NumColumns)(uiTableModelHandler *, uiTableModel *);
uiTableModelColumnType (*ColumnType)(uiTableModelHandler *, uiTableModel *, int);
int (*NumRows)(uiTableModelHandler *, uiTableModel *);
void *(*CellValue)(uiTableModelHandler *, uiTableModel *, int, int);
void (*SetCellValue)(uiTableModelHandler *, uiTableModel *, int, int, const void *);
};
_UI_EXTERN void *uiTableModelStrdup(const char *str);
// TODO rename the strdup one to this too
_UI_EXTERN void *uiTableModelGiveColor(double r, double g, double b, double a);
_UI_EXTERN void *uiTableModelGiveInt(int i);
// TODO TakeString
// TODO add const
_UI_EXTERN int uiTableModelTakeInt(void *v);
_UI_EXTERN uiTableModel *uiNewTableModel(uiTableModelHandler *mh);
_UI_EXTERN void uiFreeTableModel(uiTableModel *m);
_UI_EXTERN void uiTableModelRowInserted(uiTableModel *m, int newIndex);
_UI_EXTERN void uiTableModelRowChanged(uiTableModel *m, int index);
_UI_EXTERN void uiTableModelRowDeleted(uiTableModel *m, int oldIndex);
// TODO reordering/moving
typedef struct uiTableColumn uiTableColumn;
_UI_EXTERN void uiTableColumnAppendTextPart(uiTableColumn *c, int modelColumn, int expand);
// TODO images shouldn't expand...
_UI_EXTERN void uiTableColumnAppendImagePart(uiTableColumn *c, int modelColumn, int expand);
_UI_EXTERN void uiTableColumnAppendButtonPart(uiTableColumn *c, int modelColumn, int expand);
// TODO should these have labels?
_UI_EXTERN void uiTableColumnAppendCheckboxPart(uiTableColumn *c, int modelColumn, int expand);
_UI_EXTERN void uiTableColumnAppendProgressBarPart(uiTableColumn *c, int modelColumn, int expand);
// TODO Editable?
_UI_EXTERN void uiTableColumnPartSetEditable(uiTableColumn *c, int part, int editable);
_UI_EXTERN void uiTableColumnPartSetTextColor(uiTableColumn *c, int part, int modelColumn);
typedef struct uiTable uiTable;
#define uiTable(this) ((uiTable *) (this))
_UI_EXTERN uiTableColumn *uiTableAppendColumn(uiTable *t, const char *name);
_UI_EXTERN uiTableColumn *uiTableAppendTextColumn(uiTable *t, const char *name, int modelColumn);
// TODO getter?
_UI_EXTERN void uiTableSetRowBackgroundColorModelColumn(uiTable *t, int modelColumn);
_UI_EXTERN uiTable *uiNewTable(uiTableModel *model);

View File

@ -1,8 +1,8 @@
# libui: a portable GUI library for C # libui: a portable GUI library for C
This README is being written.<br> This README is being written.<br>
[![Build Status, Linux and macOS](https://travis-ci.org/andlabs/libui.svg?branch=master)](https://travis-ci.org/andlabs/libui)<br> [![Build Status, Azure Pipelines](https://dev.azure.com/andlabs/libui/_apis/build/status/andlabs.libui?branchName=master)](https://dev.azure.com/andlabs/libui/_build/latest?definitionId=1&branchName=master)<br>
[![Build Status, Windows](https://ci.appveyor.com/api/projects/status/ouyk78c52mmisa31?svg=true)](https://ci.appveyor.com/project/andlabs/libui) [![Build Status, AppVeyor](https://ci.appveyor.com/api/projects/status/ouyk78c52mmisa31/branch/master?svg=true)](https://ci.appveyor.com/project/andlabs/libui/branch/master)
## Status ## Status
@ -30,6 +30,10 @@ But libui is not dead; I am working on it whenever I can, and I hope to get it t
*Note that today's entry (Eastern Time) may be updated later today.* *Note that today's entry (Eastern Time) may be updated later today.*
* **7 April 2019**
* **The build system has been switched to Meson.** See below for instructions. This change was made because the previous build system, CMake, caused countless headaches over trivial issues. Meson was chosen due to how unproblematic setting up libui's build just right was, as well as having design goals that are by coincidence closely aligned with what libui wants.
* Travis CI has been replaced with Azure Pipelines and much of the AppVeyor CI configuration was integrated into the Azure Pipelines configuration. This shouldn't affect most developers.
* **1 September 2018** * **1 September 2018**
* **Alpha 4.1 is here.** This is an emergency fix to Alpha 4 to fix `uiImageAppend()` not working as documented. It now works properly, with one important difference you'll need to care about: **it now requires image data to be alpha-premultiplied**. In addition, `uiImage` also is implemented slightly more nicely now, and `ui.h` has minor documentation typo fixes. * **Alpha 4.1 is here.** This is an emergency fix to Alpha 4 to fix `uiImageAppend()` not working as documented. It now works properly, with one important difference you'll need to care about: **it now requires image data to be alpha-premultiplied**. In addition, `uiImage` also is implemented slightly more nicely now, and `ui.h` has minor documentation typo fixes.
* Alpha 4.1 also tries to make everything properly PIC-enabled. * Alpha 4.1 also tries to make everything properly PIC-enabled.
@ -82,7 +86,8 @@ But libui is not dead; I am working on it whenever I can, and I hope to get it t
## Build Requirements ## Build Requirements
* All platforms: * All platforms:
* CMake 3.1.0 or newer * [Meson](https://mesonbuild.com/) 0.48.0 or newer
* Any of Meson's backends; this section assumes you are using [Ninja](https://ninja-build.org/), but there is no reason the other backends shouldn't work.
* Windows: either * Windows: either
* Microsoft Visual Studio 2013 or newer (2013 is needed for `va_copy()`) — you can build either a static or a shared library * Microsoft Visual Studio 2013 or newer (2013 is needed for `va_copy()`) — you can build either a static or a shared library
* MinGW-w64 (other flavors of MinGW may not work) — **you can only build a static library**; shared library support will be re-added once the following features come in: * MinGW-w64 (other flavors of MinGW may not work) — **you can only build a static library**; shared library support will be re-added once the following features come in:
@ -92,33 +97,41 @@ But libui is not dead; I am working on it whenever I can, and I hope to get it t
## Building ## Building
Out-of-tree builds typical of cmake are preferred: libui uses only [the standard Meson build options](https://mesonbuild.com/Builtin-options.html), so a libui build can be set up just like any other:
``` ```
$ # you must be in the top-level libui directory, otherwise this won't work $ # you must be in the top-level libui directory, otherwise this won't work
$ mkdir build $ meson setup build [options]
$ cd build $ ninja -C build
$ cmake ..
``` ```
Pass `-DBUILD_SHARED_LIBS=OFF` to `cmake` to build a static library. The standard cmake build configurations are provided; if none is specified, `Debug` is used. Once this completes, everything will be under `build/meson-out/`. (Note that unlike the previous build processes, everything is built by default, including tests and examples.)
If you use a makefile generator with cmake, then The most important options are:
``` * `--buildtype=(debug|release|...)` controls the type of build made; the default is `debug`. For a full list of valid values, consult [the Meson documentation](https://mesonbuild.com/Running-Meson.html).
$ make * `--default-library=(shared|static)` controls whether libui is built as a shared library or a static library; the default is `shared`. You currently cannot specify `both`, as the build process changes depending on the target type (though I am willing to look into changing things if at all possible).
$ make tester # for the test program * `-Db_sanitize=which` allows enabling the chosen [sanitizer](https://github.com/google/sanitizers) on a system that supports sanitizers. The list of supported values is in [the Meson documentation](https://mesonbuild.com/Builtin-options.html#base-options).
$ make examples # for examples * `--backend=backend` allows using the specified `backend` for builds instead of `ninja` (the default). A list of supported values is in [the Meson documentation](https://mesonbuild.com/Builtin-options.html#universal-options).
```
and pass `VERBOSE=1` to see build commands. Build targets will be in the `build/out` folder. Most other built-in options will work, though keep in mind there are a handful of options that cannot be overridden because libui depends on them holding a specific value; if you do override these, though, libui will warn you when you run `meson`.
Project file generators should work, but are untested by me. The Meson website and documentation has more in-depth usage instructions.
On Windows, I use the `Unix Makefiles` generator and GNU make (built using the `build_w32.bat` script included in the source and run in the Visual Studio command line). In this state, if MinGW-w64 (either 32-bit or 64-bit) is not in your `%PATH%`, cmake will use MSVC by default; otherwise, cmake will use with whatever MinGW-w64 is in your path. `set PATH=%PATH%;c:\msys2\mingw(32/64)\bin` should be enough to temporarily change to a MinGW-w64 build for the current command line session only if you installed MinGW-w64 through [MSYS2](https://msys2.github.io/); no need to change global environment variables constantly. For the sake of completeness, I should note that the default value of `--layout` is `flat`, not the usual `mirror`. This is done both to make creating the release archives easier as well as to reduce the chance that shared library builds will fail to start on Windows because the DLL is in another directory. You can always specify this manually if you want.
Backends other than `ninja` should work, but are untested by me.
## Installation ## Installation
Meson also supports installing from source; if you use Ninja, just do
```
$ ninja -C build install
```
When running `meson`, the `--prefix` option will set the installation prefix. [The Meson documentation](https://mesonbuild.com/Builtin-options.html#universal-options) has more information, and even lists more fine-grained options that you can use to control the installation.
#### Arch Linux #### Arch Linux
Can be built from AUR: https://aur.archlinux.org/packages/libui-git/ Can be built from AUR: https://aur.archlinux.org/packages/libui-git/
@ -137,23 +150,24 @@ Language | Bindings
--- | --- --- | ---
C++ | [libui-cpp](https://github.com/billyquith/libui-cpp), [cpp-libui-qtlike](https://github.com/aoloe/cpp-libui-qtlike) C++ | [libui-cpp](https://github.com/billyquith/libui-cpp), [cpp-libui-qtlike](https://github.com/aoloe/cpp-libui-qtlike)
C# / .NET Framework | [LibUI.Binding](https://github.com/NattyNarwhal/LibUI.Binding) C# / .NET Framework | [LibUI.Binding](https://github.com/NattyNarwhal/LibUI.Binding)
C# / .NET Core | [DevZH.UI](https://github.com/noliar/DevZH.UI), [SharpUI](https://github.com/benpye/sharpui/), [LibUISharp](https://github.com/tom-corwin/LibUISharp) C# / .NET Core | [DevZH.UI](https://github.com/noliar/DevZH.UI), [SharpUI](https://github.com/benpye/sharpui/), [TCD.UI](https://github.com/tacdevel/tcdfx)
CHICKEN Scheme | [wasamasa/libui](https://github.com/wasamasa/libui) CHICKEN Scheme | [wasamasa/libui](https://github.com/wasamasa/libui)
Common Lisp | [jinwoo/cl-ui](https://github.com/jinwoo/cl-ui) Common Lisp | [jinwoo/cl-ui](https://github.com/jinwoo/cl-ui)
Crystal | [libui.cr](https://github.com/Fusion/libui.cr), [hedron](https://github.com/Qwerp-Derp/hedron) Crystal | [libui.cr](https://github.com/Fusion/libui.cr), [hedron](https://github.com/Qwerp-Derp/hedron)
D | [DerelictLibui (flat API)](https://github.com/Extrawurst/DerelictLibui), [libuid (object-oriented)](https://github.com/mogud/libuid) D | [DerelictLibui (flat API)](https://github.com/Extrawurst/DerelictLibui), [libuid (object-oriented)](https://github.com/mogud/libuid)
Euphoria | [libui-euphoria](https://github.com/ghaberek/libui-euphoria) Euphoria | [libui-euphoria](https://github.com/ghaberek/libui-euphoria)
Harbour | [HBUI](https://github.com/RJopek/HBUI) Harbour | [hbui](https://github.com/rjopek/hbui)
Haskell | [haskell-libui](https://github.com/beijaflor-io/haskell-libui) Haskell | [haskell-libui](https://github.com/beijaflor-io/haskell-libui)
JavaScript/Node.js | [libui-node](https://github.com/parro-it/libui-node), [libui.js (merged into libui-node?)](https://github.com/mavenave/libui.js), [proton-native](https://github.com/kusti8/proton-native), [vuido](https://github.com/mimecorg/vuido) JavaScript/Node.js | [libui-node](https://github.com/parro-it/libui-node), [libui.js (merged into libui-node?)](https://github.com/mavenave/libui.js), [proton-native](https://github.com/kusti8/proton-native), [vuido](https://github.com/mimecorg/vuido)
Julia | [Libui.jl](https://github.com/joa-quim/Libui.jl) Julia | [Libui.jl](https://github.com/joa-quim/Libui.jl)
Kotlin | [kotlin-libui](https://github.com/msink/kotlin-libui) Kotlin | [kotlin-libui](https://github.com/msink/kotlin-libui)
Lua | [libuilua](https://github.com/zevv/libuilua), [libui-lua](https://github.com/mdombroski/libui-lua), [lui](http://tset.de/lui/index.html), [lui](https://github.com/zhaozg/lui) Lua | [libuilua](https://github.com/zevv/libuilua), [libui-lua](https://github.com/mdombroski/libui-lua), [lui](http://tset.de/lui/index.html), [lui](https://github.com/zhaozg/lui)
Nim | [ui](https://github.com/nim-lang/ui) Nim | [ui](https://github.com/nim-lang/ui)
Perl6 | [perl6-libui](https://github.com/Garland-g/perl6-libui)
PHP | [ui](https://github.com/krakjoe/ui) PHP | [ui](https://github.com/krakjoe/ui)
Python | [pylibui](https://github.com/joaoventura/pylibui), [pylibui-cffi](https://github.com/Yardanico/pylibui-cffi) Python | [pylibui](https://github.com/joaoventura/pylibui)
Ruby | [libui-ruby](https://github.com/jamescook/libui-ruby) Ruby | [libui-ruby](https://github.com/jamescook/libui-ruby), [libui](https://github.com/kojix2/libui)
Rust | [libui-rs](https://github.com/pcwalton/libui-rs), [arcturu/libui-rs](https://github.com/arcturu/libui-rs), [LeoTindall/libui-rs](https://github.com/LeoTindall/libui-rs) Rust | [libui-rs](https://github.com/rust-native-ui/libui-rs)
Scala | [scalaui](https://github.com/lolgab/scalaui) Scala | [scalaui](https://github.com/lolgab/scalaui)
Swift | [libui-swift](https://github.com/sclukey/libui-swift) Swift | [libui-swift](https://github.com/sclukey/libui-swift)

View File

View File

View File

@ -0,0 +1,907 @@
// 9 october 2018
#define UNICODE
#define _UNICODE
#define STRICT
#define STRICT_TYPED_ITEMIDS
#define WINVER 0x0600 /* from Microsoft's winnls.h */
#define _WIN32_WINNT 0x0600
#define _WIN32_WINDOWS 0x0600 /* from Microsoft's pdh.h */
#define _WIN32_IE 0x0700
#define NTDDI_VERSION 0x06000000
#include <windows.h>
#include <commctrl.h>
#include <uxtheme.h>
#include <vsstyle.h>
#include <vssym32.h>
#include <windowsx.h>
#include <stdio.h>
#include <stdlib.h>
// cl winbuttonexplorertheme.cpp -MT -link user32.lib kernel32.lib gdi32.lib comctl32.lib uxtheme.lib msimg32.lib windows.res
void diele(const char *func)
{
DWORD le;
le = GetLastError();
fprintf(stderr, "%s: %I32u\n", func, le);
exit(EXIT_FAILURE);
}
void diehr(const char *func, HRESULT hr)
{
fprintf(stderr, "%s: 0x%08I32X\n", func, hr);
exit(EXIT_FAILURE);
}
// TODO if we merge this into libui proper, this will need to be deduplicated
static inline HRESULT lastErrorToHRESULT(DWORD lastError)
{
if (lastError == 0)
return E_FAIL;
return HRESULT_FROM_WIN32(lastError);
}
HINSTANCE hInstance;
HWND leftButtons[5];
HWND rightButtons[3];
class commandModuleStyleParams {
public:
virtual int partID_CMOD_MODULEBACKGROUND(void) const = 0;
virtual int partID_CMOD_TASKBUTTON(void) const = 0;
virtual int partID_CMOD_SPLITBUTTONLEFT(void) const = 0;
virtual int partID_CMOD_SPLITBUTTONRIGHT(void) const = 0;
virtual int partID_CMOD_MENUGLYPH(void) const = 0;
virtual int partID_CMOD_OVERFLOWGLYPH(void) const = 0;
virtual int stateID_CMODS_NORMAL(void) const = 0;
virtual int stateID_CMODS_HOT(void) const = 0;
virtual int stateID_CMODS_PRESSED(void) const = 0;
virtual int stateID_CMODS_KEYFOCUSED(void) const = 0;
virtual int stateID_CMODS_NEARHOT(void) const = 0;
virtual HRESULT backgroundGradientColors(HTHEME theme, COLORREF *colors) const = 0;
virtual HRESULT buttonTextColor(HTHEME theme, UINT uItemState, COLORREF *color) const = 0;
virtual BOOL buttonTextShadowed(UINT uItemState) const = 0;
virtual int folderBarMarginsLeftDIP(void) const = 0;
virtual int folderBarMarginsTopDIP(void) const = 0;
virtual int folderBarMarginsRightDIP(void) const = 0;
virtual int folderBarMarginsBottomDIP(void) const = 0;
virtual int buttonMarginsXDIP(void) const = 0;
virtual int buttonMarginsYDIP(void) const = 0;
virtual int buttonTextArrowSeparationXDIP(void) const = 0;
};
class commandModuleStyleParamsVista : public commandModuleStyleParams {
public:
virtual int partID_CMOD_MODULEBACKGROUND(void) const { return 1; }
virtual int partID_CMOD_TASKBUTTON(void) const { return 2; }
virtual int partID_CMOD_SPLITBUTTONLEFT(void) const { return 3; }
virtual int partID_CMOD_SPLITBUTTONRIGHT(void) const { return 4; }
virtual int partID_CMOD_MENUGLYPH(void) const { return 5; }
virtual int partID_CMOD_OVERFLOWGLYPH(void) const { return 6; }
virtual int stateID_CMODS_NORMAL(void) const { return 1; }
virtual int stateID_CMODS_HOT(void) const { return 2; }
virtual int stateID_CMODS_PRESSED(void) const { return 3; }
virtual int stateID_CMODS_KEYFOCUSED(void) const { return 4; }
virtual int stateID_CMODS_NEARHOT(void) const { return 5; }
virtual HRESULT backgroundGradientColors(HTHEME theme, COLORREF *colors) const
{
if (colors == NULL)
return E_POINTER;
#define argb(a, r, g, b) ((((COLORREF) ((BYTE) (a))) << 24) | RGB(r, g, b))
colors[0] = argb(255, 4, 80, 130);
colors[1] = argb(255, 17, 101, 132);
colors[2] = argb(255, 29, 121, 134);
return S_OK;
}
virtual HRESULT buttonTextColor(HTHEME theme, UINT uItemState, COLORREF *color) const
{
if (color == NULL)
return E_POINTER;
*color = GetSysColor(COLOR_WINDOW);
if ((uItemState & CDIS_DISABLED) != 0)
*color = argb(255, 161, 204, 210);
#undef argb
return S_OK;
}
virtual BOOL buttonTextShadowed(UINT uItemState) const
{
return (uItemState & CDIS_DISABLED) == 0;
}
virtual int folderBarMarginsLeftDIP(void) const { return 3; }
virtual int folderBarMarginsTopDIP(void) const { return 2; }
virtual int folderBarMarginsRightDIP(void) const { return 3; }
virtual int folderBarMarginsBottomDIP(void) const { return 3; }
virtual int buttonMarginsXDIP(void) const { return 6; }
virtual int buttonMarginsYDIP(void) const { return 5; }
virtual int buttonTextArrowSeparationXDIP(void) const { return 3; }
};
class commandModuleStyleParams7 : public commandModuleStyleParams {
virtual int partID_CMOD_MODULEBACKGROUND(void) const { return 1; }
virtual int partID_CMOD_TASKBUTTON(void) const { return 3; }
virtual int partID_CMOD_SPLITBUTTONLEFT(void) const { return 4; }
virtual int partID_CMOD_SPLITBUTTONRIGHT(void) const { return 5; }
virtual int partID_CMOD_MENUGLYPH(void) const { return 6; }
virtual int partID_CMOD_OVERFLOWGLYPH(void) const { return 7; }
virtual int stateID_CMODS_NORMAL(void) const { return 1; }
virtual int stateID_CMODS_HOT(void) const { return 2; }
virtual int stateID_CMODS_PRESSED(void) const { return 3; }
virtual int stateID_CMODS_KEYFOCUSED(void) const { return 4; }
/*TODO verify this*/virtual int stateID_CMODS_NEARHOT(void) const { return 5; }
virtual HRESULT backgroundGradientColors(HTHEME theme, COLORREF *colors) const
{
HRESULT hr;
if (colors == NULL)
return E_POINTER;
hr = GetThemeColor(theme,
2, 0,
TMT_GRADIENTCOLOR1, colors + 0);
if (hr != S_OK)
return hr;
hr = GetThemeColor(theme,
2, 0,
TMT_GRADIENTCOLOR2, colors + 1);
if (hr != S_OK)
return hr;
return GetThemeColor(theme,
2, 0,
TMT_GRADIENTCOLOR3, colors + 2);
}
virtual HRESULT buttonTextColor(HTHEME theme, UINT uItemState, COLORREF *color) const
{
int state;
if (color == NULL)
return E_POINTER;
state = 1;
if ((uItemState & CDIS_DISABLED) != 0)
state = 6;
// TODO check if 3 is the correct part ID for all button types
return GetThemeColor(theme,
3, state,
TMT_TEXTCOLOR, color);
}
virtual BOOL buttonTextShadowed(UINT uItemState) const
{
return FALSE;
}
virtual int folderBarMarginsLeftDIP(void) const { return 3; }
virtual int folderBarMarginsTopDIP(void) const { return 2; }
virtual int folderBarMarginsRightDIP(void) const { return 9; }
virtual int folderBarMarginsBottomDIP(void) const { return 3; }
virtual int buttonMarginsXDIP(void) const { return 13; }
virtual int buttonMarginsYDIP(void) const { return 5; }
virtual int buttonTextArrowSeparationXDIP(void) const { return 1; }
};
// all coordinates are in client space
struct buttonMetrics {
SIZE fittingSize;
int baseX;
int baseY;
int dpiX;
int dpiY;
BOOL hasText;
SIZE textSize;
BOOL hasArrow;
SIZE arrowSize;
};
struct buttonRects {
RECT clientRect;
RECT textRect;
RECT arrowRect;
};
class commandModuleStyle {
public:
virtual HRESULT drawFolderBar(commandModuleStyleParams *p, HDC dc, RECT *rcWindow, RECT *rcPaint) const = 0;
virtual HRESULT buttonMetrics(commandModuleStyleParams *p, HWND button, HDC dc, struct buttonMetrics *m) const = 0;
virtual HRESULT buttonRects(commandModuleStyleParams *p, HWND button, struct buttonMetrics *m, struct buttonRects *r) const = 0;
virtual HRESULT drawButton(commandModuleStyleParams *p, HWND button, HDC dc, UINT uItemState, RECT *rcPaint) const = 0;
};
class commandModuleStyleThemed : public commandModuleStyle {
HTHEME theme;
HTHEME textstyleTheme;
public:
commandModuleStyleThemed(HTHEME theme, HTHEME textstyleTheme)
{
this->theme = theme;
this->textstyleTheme = textstyleTheme;
}
virtual HRESULT drawFolderBar(commandModuleStyleParams *p, HDC dc, RECT *rcWindow, RECT *rcPaint) const
{
COLORREF colors[3];
TRIVERTEX vertices[4];
static GRADIENT_RECT gr[2] = {
{ 0, 1 },
{ 2, 3 },
};
HRESULT hr;
hr = p->backgroundGradientColors(this->theme, colors);
if (hr != S_OK)
return hr;
vertices[0].x = rcWindow->left;
vertices[0].y = rcWindow->top;
vertices[0].Red = ((COLOR16) GetRValue(colors[0])) << 8;
vertices[0].Green = ((COLOR16) GetGValue(colors[0])) << 8;
vertices[0].Blue = ((COLOR16) GetBValue(colors[0])) << 8;
vertices[0].Alpha = ((COLOR16) LOBYTE(colors[0] >> 24)) << 8;
vertices[1].x = (rcWindow->right - rcWindow->left) / 2;
vertices[1].y = rcWindow->bottom;
vertices[1].Red = ((COLOR16) GetRValue(colors[1])) << 8;
vertices[1].Green = ((COLOR16) GetGValue(colors[1])) << 8;
vertices[1].Blue = ((COLOR16) GetBValue(colors[1])) << 8;
vertices[1].Alpha = ((COLOR16) LOBYTE(colors[1] >> 24)) << 8;
vertices[2] = vertices[1];
vertices[2].y = rcWindow->top;
vertices[3].x = rcWindow->right;
vertices[3].y = rcWindow->bottom;
vertices[3].Red = ((COLOR16) GetRValue(colors[2])) << 8;
vertices[3].Green = ((COLOR16) GetGValue(colors[2])) << 8;
vertices[3].Blue = ((COLOR16) GetBValue(colors[2])) << 8;
vertices[3].Alpha = ((COLOR16) LOBYTE(colors[2] >> 24)) << 8;
if (GradientFill(dc, vertices, 4, (PVOID) gr, 2, GRADIENT_FILL_RECT_H) == FALSE)
return lastErrorToHRESULT(GetLastError());
return DrawThemeBackground(this->theme, dc,
p->partID_CMOD_MODULEBACKGROUND(), 0,
rcWindow, rcPaint);
}
#define hasNonsplitArrow(button) ((button) == leftButtons[0] || (button) == leftButtons[1] || (button) == leftButtons[2])
#define dlgUnitsToX(dlg, baseX) MulDiv((dlg), (baseX), 4)
#define dlgUnitsToY(dlg, baseY) MulDiv((dlg), (baseY), 8)
// TODO verify the parameter order
#define dipsToX(dip, dpiX) MulDiv((dip), (dpiX), 96)
#define dipsToY(dip, dpiY) MulDiv((dip), (dpiY), 96)
// TODO for win7: the sizes are correct (according to UI Automation) but they don't visually match?
virtual HRESULT buttonMetrics(commandModuleStyleParams *p, HWND button, HDC dc, struct buttonMetrics *m) const
{
BOOL releaseDC;
TEXTMETRICW tm;
RECT r;
int minStdButtonHeight;
HRESULT hr;
if (m == NULL)
return E_POINTER;
releaseDC = FALSE;
if (dc == NULL) {
dc = GetDC(button);
if (dc == NULL)
return lastErrorToHRESULT(GetLastError());
releaseDC = TRUE;
}
ZeroMemory(&tm, sizeof (TEXTMETRICW));
hr = GetThemeTextMetrics(this->textstyleTheme, dc,
TEXT_BODYTEXT, 0,
&tm);
if (hr != S_OK)
goto fail;
hr = GetThemeTextExtent(this->textstyleTheme, dc,
TEXT_BODYTEXT, 0,
L"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 52, 0,
NULL, &r);
if (hr != S_OK)
goto fail;
m->baseX = (int) (((r.right - r.left) / 26 + 1) / 2);
m->baseY = (int) tm.tmHeight;
m->dpiX = GetDeviceCaps(dc, LOGPIXELSX);
m->dpiY = GetDeviceCaps(dc, LOGPIXELSY);
m->fittingSize.cx = 0;
m->fittingSize.cy = 0;
m->hasText = TRUE;
if (m->hasText) {
LRESULT n;
WCHAR *buf;
LOGFONTW lf;
n = SendMessageW(button, WM_GETTEXTLENGTH, 0, 0);
buf = new WCHAR[n + 1];
GetWindowTextW(button, buf, n + 1);
hr = GetThemeTextExtent(this->textstyleTheme, dc,
TEXT_BODYTEXT, 0,
buf, n, DT_CENTER,
NULL, &r);
delete[] buf;
if (hr != S_OK)
goto fail;
m->textSize.cx = r.right - r.left;
m->textSize.cy = r.bottom - r.top;
m->fittingSize.cx += m->textSize.cx;
m->fittingSize.cy += m->textSize.cy;
// dui70.dll adds this to the width when "overhang" is enabled, and it seems to be enabled for our cases, but I can't tell what conditions it's enabled for...
// and yes, it seems to be using the raw lfHeight value here :/
// TODO find the right TMT constant
hr = GetThemeFont(this->textstyleTheme, dc,
4, 0,
TMT_FONT, &lf);
if (hr != S_OK)
goto fail;
m->fittingSize.cx += 2 * (abs(lf.lfHeight) / 6);
}
m->hasArrow = hasNonsplitArrow(button);
if (m->hasArrow) {
// TS_MIN returns 1x1 and TS_DRAW returns 0x0, so...
hr = GetThemePartSize(theme, dc,
p->partID_CMOD_MENUGLYPH(), 0,
NULL, TS_TRUE, &(m->arrowSize));
if (hr != S_OK)
goto fail;
m->fittingSize.cx += m->arrowSize.cx;
// TODO I don't think dui70.dll takes this into consideration...
if (m->fittingSize.cy < m->arrowSize.cy)
m->fittingSize.cy = m->arrowSize.cy;
m->fittingSize.cx += dipsToX(p->buttonTextArrowSeparationXDIP(), m->dpiX);
}
m->fittingSize.cx += dipsToX(p->buttonMarginsXDIP(), m->dpiX) * 2;
m->fittingSize.cy += dipsToY(p->buttonMarginsYDIP(), m->dpiY) * 2;
// and dui70.dll seems to do a variant of this but for text buttons only...
minStdButtonHeight = dlgUnitsToY(14, m->baseY);
if (m->fittingSize.cy < minStdButtonHeight)
m->fittingSize.cy = minStdButtonHeight;
hr = S_OK;
fail:
if (releaseDC)
// TODO when migrating this to libui, this will need to be renamed to indicate we are intentionally ignoring errors
ReleaseDC(button, dc);
return hr;
};
// TODO check errors
virtual HRESULT buttonRects(commandModuleStyleParams *p, HWND button, struct buttonMetrics *m, struct buttonRects *r) const
{
if (r == NULL)
return E_POINTER;
GetClientRect(button, &(r->clientRect));
if (m->hasText)
r->textRect = r->clientRect;
if (m->hasArrow) {
r->arrowRect = r->clientRect;
r->arrowRect.left = r->arrowRect.right;
r->arrowRect.left -= dipsToX(p->buttonMarginsXDIP(), m->dpiX);
r->arrowRect.right = r->arrowRect.left;
r->arrowRect.left -= m->arrowSize.cx;
r->arrowRect.top += ((r->arrowRect.bottom - r->arrowRect.top) - m->arrowSize.cy) / 2;
r->arrowRect.bottom = r->arrowRect.top + m->arrowSize.cy;
if (m->hasText) {
r->textRect.right = r->arrowRect.left - dipsToX(p->buttonTextArrowSeparationXDIP(), m->dpiX);
r->textRect.right += dipsToX(p->buttonMarginsXDIP(), m->dpiX);
}
}
return S_OK;
}
// TODO check errors fully
virtual HRESULT drawButton(commandModuleStyleParams *p, HWND button, HDC dc, UINT uItemState, RECT *rcPaint) const
{
struct buttonMetrics m;
struct buttonRects r;
int part, state;
HRESULT hr;
hr = this->buttonMetrics(p, button, dc, &m);
if (hr != S_OK)
return hr;
hr = this->buttonRects(p, button, &m, &r);
if (hr != S_OK)
return hr;
part = p->partID_CMOD_TASKBUTTON();
state = p->stateID_CMODS_NORMAL();
if ((uItemState & CDIS_FOCUS) != 0)
state = p->stateID_CMODS_KEYFOCUSED();
if ((uItemState & CDIS_HOT) != 0)
state = p->stateID_CMODS_HOT();
if ((uItemState & CDIS_SELECTED) != 0)
state = p->stateID_CMODS_PRESSED();
hr = DrawThemeParentBackground(button, dc, rcPaint);
if (hr != S_OK)
return hr;
hr = DrawThemeBackground(this->theme, dc,
part, state,
&(r.clientRect), rcPaint);
if (hr != S_OK)
return hr;
if (m.hasText) {
int textState;
COLORREF textColor;
LRESULT n;
WCHAR *buf;
DTTOPTS dttopts;
hr = p->buttonTextColor(this->theme, uItemState, &textColor);
if (hr != S_OK)
return hr;
n = SendMessageW(button, WM_GETTEXTLENGTH, 0, 0);
buf = new WCHAR[n + 1];
GetWindowTextW(button, buf, n + 1);
ZeroMemory(&dttopts, sizeof (DTTOPTS));
dttopts.dwSize = sizeof (DTTOPTS);
dttopts.dwFlags = DTT_TEXTCOLOR;
dttopts.crText = textColor;
hr = DrawThemeTextEx(this->textstyleTheme, dc,
TEXT_BODYTEXT, 0,
buf, n, DT_CENTER | DT_VCENTER | DT_SINGLELINE,
&(r.textRect), &dttopts);
delete[] buf;
if (hr != S_OK)
return hr;
}
if (m.hasArrow) {
// TODO verify the state ID on all platforms
hr = DrawThemeBackground(this->theme, dc,
p->partID_CMOD_MENUGLYPH(), 0,
&(r.arrowRect), rcPaint);
if (hr != S_OK)
return hr;
}
return S_OK;
}
};
#if 0
// TODO check errors
void drawExplorerChevron(HTHEME theme, HDC dc, HWND rebar, WPARAM band, RECT *rcPaint)
{
REBARBANDINFOW rbi;
RECT r;
int state;
ZeroMemory(&rbi, sizeof (REBARBANDINFOW));
rbi.cbSize = sizeof (REBARBANDINFOW);
rbi.fMask = RBBIM_CHILD | RBBIM_CHEVRONLOCATION | RBBIM_CHEVRONSTATE;
SendMessageW(rebar, RB_GETBANDINFOW, band, (LPARAM) (&rbi));
if ((rbi.uChevronState & STATE_SYSTEM_INVISIBLE) != 0)
return;
state = 1;
// TODO check if this is correct
if ((rbi.uChevronState & STATE_SYSTEM_FOCUSED) != 0)
state = 4;
if ((rbi.uChevronState & STATE_SYSTEM_HOTTRACKED) != 0)
state = 2;
if ((rbi.uChevronState & STATE_SYSTEM_PRESSED) != 0)
state = 3;
r = rbi.rcChevronLocation;
// TODO commctrl.h says this should be correct for the chevron rect, but it's not?
// MapWindowRect(rbi.hwndChild, rebar, &r);
DrawThemeBackground(theme, dc,
3, state,
&r, rcPaint);
DrawThemeBackground(theme, dc,
7, 1,
&r, rcPaint);
}
#endif
HICON shieldIcon;
HICON applicationIcon;
HICON helpIcon;
HIMAGELIST rightList;
HTHEME theme = NULL;
HTHEME textstyleTheme = NULL;
const char *which = "7";
commandModuleStyle *cms = NULL;
commandModuleStyleParams *cmsp = NULL;
HIMAGELIST dropdownArrowList = NULL;
static struct {
const WCHAR *text;
BOOL dropdown;
} leftbarButtons[] = {
{ L"Organize", TRUE },
{ L"Include in library", TRUE },
{ L"Share with", TRUE },
{ L"Burn", FALSE },
{ L"New folder", FALSE },
};
// TODO check errors
LRESULT drawExplorerButton(NMCUSTOMDRAW *nm)
{
HRESULT hr;
if (nm->dwDrawStage != CDDS_PREPAINT)
return CDRF_DODEFAULT;
hr = cms->drawButton(cmsp, nm->hdr.hwndFrom,
nm->hdc, nm->uItemState, &(nm->rc));
if (hr != S_OK)
return CDRF_DODEFAULT;
return CDRF_SKIPDEFAULT;
}
void onWM_CREATE(HWND hwnd)
{
int buttonx, buttony;
int i;
buttonx = 5;
buttony = 5;
for (i = 0; i < 5; i++) {
// TODO split buttons don't support arrow navigation?
leftButtons[i] = CreateWindowExW(0,
L"BUTTON", leftbarButtons[i].text,
WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON,
buttonx, buttony,
150, 30,
hwnd, (HMENU) (100 + i), hInstance, NULL);
if (leftButtons[i] == NULL)
diele("CreateWindowExW(L\"BUTTON\")");
buttonx += 150;
}
}
// TODO check errors
void updateTheme(HWND hwnd)
{
if (cmsp != NULL) {
delete cmsp;
cmsp = NULL;
}
if (cms != NULL) {
delete cms;
cms = NULL;
}
if (textstyleTheme != NULL) {
CloseThemeData(textstyleTheme);
textstyleTheme = NULL;
}
if (theme != NULL) {
CloseThemeData(theme);
theme = NULL;
}
theme = OpenThemeData(hwnd, L"CommandModule");
textstyleTheme = OpenThemeData(hwnd, L"TEXTSTYLE");
cms = new commandModuleStyleThemed(theme, textstyleTheme);
if (strcmp(which, "vista") == 0)
cmsp = new commandModuleStyleParamsVista;
else
cmsp = new commandModuleStyleParams7;
}
void repositionButtons(HWND hwnd)
{
HDWP dwp;
int buttonx, buttony;
HDC dc;
int dpiX;
int dpiY;
struct buttonMetrics m;
int i;
dc = GetDC(hwnd);
if (dc == NULL)
diele("GetDC()");
dpiX = GetDeviceCaps(dc, LOGPIXELSX);
dpiY = GetDeviceCaps(dc, LOGPIXELSY);
// TODO check error
ReleaseDC(hwnd, dc);
dwp = BeginDeferWindowPos(5);
if (dwp == NULL)
diele("BeginDeferWindowPos()");
buttonx = dipsToX(cmsp->folderBarMarginsLeftDIP(), dpiX);
buttony = dipsToY(cmsp->folderBarMarginsTopDIP(), dpiY);
for (i = 0; i < 5; i++) {
cms->buttonMetrics(cmsp, leftButtons[i], NULL, &m);
dwp = DeferWindowPos(dwp, leftButtons[i], NULL,
buttonx, buttony, m.fittingSize.cx, m.fittingSize.cy,
SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER);
if (dwp == NULL)
diele("DeferWindowPos()");
buttonx += m.fittingSize.cx;
}
if (EndDeferWindowPos(dwp) == 0)
diele("EndDeferWindowPos()");
}
// TODO check errors
void folderBarRect(HWND hwnd, HDC dc, RECT *r)
{
int dpiX;
int dpiY;
RECT child;
int i;
dpiX = GetDeviceCaps(dc, LOGPIXELSX);
dpiY = GetDeviceCaps(dc, LOGPIXELSY);
GetClientRect(hwnd, r);
r->right -= r->left;
r->left = 0;
r->top = 0;
r->bottom = 0;
for (i = 0; i < 5; i++) {
GetWindowRect(leftButtons[i], &child);
if (r->bottom < (child.bottom - child.top))
r->bottom = (child.bottom - child.top);
}
r->bottom += dipsToY(cmsp->folderBarMarginsTopDIP(), dpiY);
r->bottom += dipsToY(cmsp->folderBarMarginsBottomDIP(), dpiY);
}
#if 0
// TODO check errors
void handleEvents(HWND hwnd, WPARAM wParam)
{
LRESULT n;
const WCHAR *selRebar = NULL, *selToolbar = NULL;
WCHAR *bufRebar = NULL, *bufToolbar = NULL;
BOOL changeRebar = FALSE, changeToolbar = FALSE;
BOOL invalidate = FALSE;
WPARAM check;
switch (wParam) {
case MAKEWPARAM(300, CBN_SELCHANGE):
n = SendMessageW(rebarCombo, CB_GETCURSEL, 0, 0);
selRebar = rebarThemes[n];
changeRebar = TRUE;
break;
case MAKEWPARAM(301, CBN_SELCHANGE):
n = SendMessageW(toolbarCombo, CB_GETCURSEL, 0, 0);
selToolbar = toolbarThemes[n];
changeToolbar = TRUE;
break;
case MAKEWPARAM(200, BN_CLICKED):
drawmode = 0;
n = SendMessageW(rebarCombo, WM_GETTEXTLENGTH, 0, 0);
bufRebar = new WCHAR[n + 1];
GetWindowTextW(rebarCombo, bufRebar, n + 1);
n = SendMessageW(toolbarCombo, WM_GETTEXTLENGTH, 0, 0);
bufToolbar = new WCHAR[n + 1];
GetWindowTextW(toolbarCombo, bufToolbar, n + 1);
selRebar = bufRebar;
selToolbar = bufToolbar;
changeRebar = TRUE;
changeToolbar = TRUE;
break;
case MAKEWPARAM(201, BN_CLICKED):
drawmode = 1;
invalidate = TRUE;
break;
case MAKEWPARAM(302, BN_CLICKED):
ShowWindow(leftbar, SW_HIDE);
check = BST_CHECKED;
if (SendMessage(toolbarTransparentCheckbox, BM_GETCHECK, 0, 0) == BST_CHECKED)
check = BST_UNCHECKED;
SendMessage(toolbarTransparentCheckbox, BM_SETCHECK, check, 0);
if (check == BST_CHECKED)
SendMessageW(leftbar, TB_SETSTYLE, 0, toolbarStyles | TBSTYLE_LIST | TBSTYLE_TRANSPARENT);
else
SendMessageW(leftbar, TB_SETSTYLE, 0, toolbarStyles | TBSTYLE_LIST);
ShowWindow(leftbar, SW_SHOW);
break;
case MAKEWPARAM(202, BN_CLICKED):
SetFocus(leftbar);
break;
}
if (changeRebar) {
if (selRebar != NULL && wcscmp(selRebar, L"NULL") == 0)
selRebar = NULL;
if (selRebar != NULL && *selRebar != L'\0')
SendMessageW(rebar, RB_SETWINDOWTHEME, 0, (LPARAM) selRebar);
else
SetWindowTheme(rebar, selRebar, selRebar);
invalidate = TRUE;
}
if (changeToolbar) {
if (selToolbar != NULL && wcscmp(selToolbar, L"NULL") == 0)
selToolbar = NULL;
if (selToolbar != NULL && *selToolbar != L'\0') {
SendMessageW(leftbar, TB_SETWINDOWTHEME, 0, (LPARAM) selToolbar);
SendMessageW(rightbar, TB_SETWINDOWTHEME, 0, (LPARAM) selToolbar);
} else {
SetWindowTheme(leftbar, selToolbar, selToolbar);
SetWindowTheme(rightbar, selToolbar, selToolbar);
}
invalidate = TRUE;
}
if (invalidate)
InvalidateRect(hwnd, NULL, TRUE);
if (bufRebar != NULL)
delete[] bufRebar;
if (bufToolbar != NULL)
delete[] bufToolbar;
}
#endif
LRESULT CALLBACK wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HDC dc;
PAINTSTRUCT ps;
NMHDR *nm = (NMHDR *) lParam;
int i;
switch (uMsg) {
case WM_CREATE:
onWM_CREATE(hwnd);
updateTheme(hwnd);
repositionButtons(hwnd);
break;
case WM_CLOSE:
PostQuitMessage(0);
break;
case WM_SIZE:
repositionButtons(hwnd);
// TODO check errors
InvalidateRect(hwnd, NULL, TRUE);
break;
case WM_THEMECHANGED:
updateTheme(hwnd);
repositionButtons(hwnd);
break;
case WM_PAINT:
// TODO check errors
dc = BeginPaint(hwnd, &ps);
{RECT w;
folderBarRect(hwnd, dc, &w);
cms->drawFolderBar(cmsp, dc, &w, &(ps.rcPaint));}
EndPaint(hwnd, &ps);
return 0;
case WM_PRINTCLIENT:
{RECT w, paint;
folderBarRect(hwnd, (HDC) wParam, &w);
GetClientRect(hwnd,&paint);
cms->drawFolderBar(cmsp, (HDC) wParam, &w, &w);}
return 0;
#if 0
case WM_COMMAND:
handleEvents(hwnd, wParam);
break;
#endif
case WM_NOTIFY:
switch (nm->code) {
case NM_CUSTOMDRAW:
for (i = 0; i < 5; i++)
if (nm->hwndFrom == leftButtons[i])
return drawExplorerButton((NMCUSTOMDRAW *) nm);
break;
}
break;
}
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
}
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
int main(int argc, char *argv[])
{
STARTUPINFOW si;
int nCmdShow;
INITCOMMONCONTROLSEX icc;
HICON hDefaultIcon;
HCURSOR hDefaultCursor;
WNDCLASSW wc;
HWND mainwin;
MSG msg;
HRESULT hr;
if (argc > 1)
which = argv[1];
hInstance = (HINSTANCE) (&__ImageBase);
nCmdShow = SW_SHOWDEFAULT;
GetStartupInfoW(&si);
if ((si.dwFlags & STARTF_USESHOWWINDOW) != 0)
nCmdShow = si.wShowWindow;
ZeroMemory(&icc, sizeof (INITCOMMONCONTROLSEX));
icc.dwSize = sizeof (INITCOMMONCONTROLSEX);
icc.dwICC = ICC_STANDARD_CLASSES | ICC_BAR_CLASSES | ICC_COOL_CLASSES;
if (InitCommonControlsEx(&icc) == 0)
diele("InitCommonControlsEx()");
hDefaultIcon = LoadIconW(NULL, IDI_APPLICATION);
if (hDefaultIcon == NULL)
diele("LoadIconW(IDI_APPLICATION)");
hDefaultCursor = LoadCursorW(NULL, IDC_ARROW);
if (hDefaultCursor == NULL)
diele("LoadCursorW(IDC_ARROW)");
hr = LoadIconMetric(NULL, IDI_SHIELD, LIM_SMALL, &shieldIcon);
if (hr != S_OK)
diehr("LoadIconMetric(IDI_SHIELD)", hr);
hr = LoadIconMetric(NULL, IDI_APPLICATION, LIM_SMALL, &applicationIcon);
if (hr != S_OK)
diehr("LoadIconMetric(IDI_APPLICATION)", hr);
hr = LoadIconMetric(NULL, IDI_QUESTION, LIM_SMALL, &helpIcon);
if (hr != S_OK)
diehr("LoadIconMetric(IDI_QUESTION)", hr);
rightList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
ILC_COLOR32, 0, 3);
if (rightList == NULL)
diele("ImageList_Create()");
if (ImageList_ReplaceIcon(rightList, -1, shieldIcon) == -1)
diele("ImageList_ReplaceIcon(IDI_SHIELD)");
if (ImageList_ReplaceIcon(rightList, -1, applicationIcon) == -1)
diele("ImageList_ReplaceIcon(IDI_APPLICATION)");
if (ImageList_ReplaceIcon(rightList, -1, helpIcon) == -1)
diele("ImageList_ReplaceIcon(IDI_QUESTION)");
ZeroMemory(&wc, sizeof (WNDCLASSW));
wc.lpszClassName = L"mainwin";
wc.lpfnWndProc = wndproc;
wc.hInstance = hInstance;
wc.hIcon = hDefaultIcon;
wc.hCursor = hDefaultCursor;
wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
if (RegisterClassW(&wc) == 0)
diele("RegisterClassW()");
mainwin = CreateWindowExW(0,
L"mainwin", L"Main Window",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL);
if (mainwin == NULL)
diele("CreateWindowExW(L\"mainwin\")");
ShowWindow(mainwin, nCmdShow);
if (UpdateWindow(mainwin) == 0)
diele("UpdateWindow()");
for (;;) {
int res;
res = GetMessageW(&msg, NULL, 0, 0);
if (res < 0)
diele("GetMessageW()");
if (res == 0)
break;
if (IsDialogMessageW(mainwin, &msg) == 0) {
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
}
return 0;
}

View File

@ -0,0 +1,676 @@
// 9 october 2018
#define UNICODE
#define _UNICODE
#define STRICT
#define STRICT_TYPED_ITEMIDS
#define WINVER 0x0600 /* from Microsoft's winnls.h */
#define _WIN32_WINNT 0x0600
#define _WIN32_WINDOWS 0x0600 /* from Microsoft's pdh.h */
#define _WIN32_IE 0x0700
#define NTDDI_VERSION 0x06000000
#include <windows.h>
#include <commctrl.h>
#include <uxtheme.h>
#include <vsstyle.h>
#include <vssym32.h>
#include <windowsx.h>
#include <stdio.h>
#include <stdlib.h>
// cl winrebarexplorertheme.cpp -MT -link user32.lib kernel32.lib gdi32.lib comctl32.lib uxtheme.lib msimg32.lib windows.res
void diele(const char *func)
{
DWORD le;
le = GetLastError();
fprintf(stderr, "%s: %I32u\n", func, le);
exit(EXIT_FAILURE);
}
void diehr(const char *func, HRESULT hr)
{
fprintf(stderr, "%s: 0x%08I32X\n", func, hr);
exit(EXIT_FAILURE);
}
HINSTANCE hInstance;
HWND rebar;
HWND leftbar;
HWND rightbar;
HWND rebarCombo;
HWND toolbarCombo;
HWND toolbarTransparentCheckbox;
HICON shieldIcon;
HICON applicationIcon;
HICON helpIcon;
HIMAGELIST rightList;
#define toolbarStyles (WS_CHILD | CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_NORESIZE | TBSTYLE_FLAT)
static struct {
const WCHAR *text;
BOOL dropdown;
} leftbarButtons[] = {
{ L"Organize", TRUE },
{ L"Include in library", TRUE },
{ L"Share with", TRUE },
{ L"Burn", FALSE },
{ L"New folder", FALSE },
};
// TODO check errors
// TODO extract colors from the theme
void drawExplorerBackground(HTHEME theme, HDC dc, RECT *rcWindow, RECT *rcPaint)
{
static TRIVERTEX vertices[] = {
{ 0, 0, 4 << 8, 80 << 8, 130 << 8, 255 << 8 },
{ 0, 0, 17 << 8, 101 << 8, 132 << 8, 255 << 8 },
{ 0, 0, 17 << 8, 101 << 8, 132 << 8, 255 << 8 },
{ 0, 0, 29 << 8, 121 << 8, 134 << 8, 255 << 8 },
};
static GRADIENT_RECT gr[2] = {
{ 0, 1 },
{ 2, 3 },
};
vertices[0].x = rcPaint->left;
vertices[0].y = 0;
vertices[1].x = rcPaint->right;
vertices[1].y = (rcWindow->bottom - rcWindow->top) / 2;
vertices[2].x = rcPaint->left;
vertices[2].y = (rcWindow->bottom - rcWindow->top) / 2;
vertices[3].x = rcPaint->right;
vertices[3].y = rcWindow->bottom - rcWindow->top;
GradientFill(dc, vertices, 4, (PVOID) gr, 2, GRADIENT_FILL_RECT_V);
DrawThemeBackground(theme, dc,
1, 0,
rcWindow, rcPaint);
}
// TODO check errors
void drawExplorerChevron(HTHEME theme, HDC dc, HWND rebar, WPARAM band, RECT *rcPaint)
{
REBARBANDINFOW rbi;
RECT r;
int state;
ZeroMemory(&rbi, sizeof (REBARBANDINFOW));
rbi.cbSize = sizeof (REBARBANDINFOW);
rbi.fMask = RBBIM_CHILD | RBBIM_CHEVRONLOCATION | RBBIM_CHEVRONSTATE;
SendMessageW(rebar, RB_GETBANDINFOW, band, (LPARAM) (&rbi));
if ((rbi.uChevronState & STATE_SYSTEM_INVISIBLE) != 0)
return;
state = 1;
// TODO check if this is correct
if ((rbi.uChevronState & STATE_SYSTEM_FOCUSED) != 0)
state = 4;
if ((rbi.uChevronState & STATE_SYSTEM_HOTTRACKED) != 0)
state = 2;
if ((rbi.uChevronState & STATE_SYSTEM_PRESSED) != 0)
state = 3;
r = rbi.rcChevronLocation;
// TODO commctrl.h says this should be correct for the chevron rect, but it's not?
// MapWindowRect(rbi.hwndChild, rebar, &r);
DrawThemeBackground(theme, dc,
3, state,
&r, rcPaint);
DrawThemeBackground(theme, dc,
7, 1,
&r, rcPaint);
}
// TODO check errors
LRESULT customDrawExplorerRebar(NMCUSTOMDRAW *nm)
{
HTHEME theme;
RECT r;
if (nm->dwDrawStage != CDDS_PREPAINT)
return CDRF_DODEFAULT;
theme = OpenThemeData(nm->hdr.hwndFrom, L"CommandModule");
GetClientRect(nm->hdr.hwndFrom, &r);
drawExplorerBackground(theme, nm->hdc, &r, &(nm->rc));
// TODO dwItemSpec is often invalid?!
drawExplorerChevron(theme, nm->hdc, nm->hdr.hwndFrom, 0, &(nm->rc));
CloseThemeData(theme);
return CDRF_SKIPDEFAULT;
}
// TODO check errors
LRESULT customDrawExplorerToolbar(NMTBCUSTOMDRAW *nm)
{
HWND toolbar, rebar;
WPARAM itemIndex;
TBBUTTON tbb;
HTHEME theme;
RECT r;
int part, state;
toolbar = nm->nmcd.hdr.hwndFrom;
switch (nm->nmcd.dwDrawStage) {
case CDDS_PREPAINT:
theme = OpenThemeData(toolbar, L"CommandModule");
rebar = GetParent(toolbar);
GetWindowRect(rebar, &r);
MapWindowRect(NULL, toolbar, &r);
drawExplorerBackground(theme, nm->nmcd.hdc, &r, &(nm->nmcd.rc));
CloseThemeData(theme);
return CDRF_NOTIFYITEMDRAW;
case CDDS_ITEMPREPAINT:
itemIndex = (WPARAM) SendMessageW(toolbar, TB_COMMANDTOINDEX, nm->nmcd.dwItemSpec, 0);
ZeroMemory(&tbb, sizeof (TBBUTTON));
SendMessageW(toolbar, TB_GETBUTTON, itemIndex, (LPARAM) (&tbb));
theme = OpenThemeData(toolbar, L"CommandModule");
part = 3;
if ((tbb.fsStyle & BTNS_DROPDOWN) != 0)
part = 4;
state = 1;
// TODO this doesn't work; both keyboard and mouse are listed as HOT
if ((nm->nmcd.uItemState & CDIS_FOCUS) != 0)
state = 4;
if ((nm->nmcd.uItemState & CDIS_HOT) != 0)
state = 2;
if ((nm->nmcd.uItemState & CDIS_SELECTED) != 0)
state = 3;
SendMessageW(toolbar, TB_GETITEMRECT, itemIndex, (LPARAM) (&r));
DrawThemeBackground(theme, nm->nmcd.hdc,
3, state,
&r, &(nm->nmcd.rc));
CloseThemeData(theme);
return TBCDRF_NOBACKGROUND;
}
return CDRF_DODEFAULT;
}
static struct {
const WCHAR *text;
LRESULT (*handleRebar)(NMCUSTOMDRAW *nm);
LRESULT (*handleToolbar)(NMTBCUSTOMDRAW *nm);
} drawmodes[] = {
{ L"SetWindowTheme()", NULL, NULL },
{ L"Custom Draw Explorer", customDrawExplorerRebar, customDrawExplorerToolbar },
{ NULL, NULL },
};
int drawmode = 0;
static const WCHAR *rebarThemes[] = {
L"NULL",
L"",
L"AlternateRebar",
L"BrowserTabBar",
L"Communications",
L"Default",
L"ExplorerBar",
L"Help",
L"InactiveNavbar",
L"InactiveNavbarComposited",
L"ITBarBase",
L"MaxInactiveNavbar",
L"MaxInactiveNavbarComposited",
L"MaxNavbar",
L"MaxNavbarComposited",
L"Media",
L"Navbar",
L"NavbarBase",
L"NavbarComposited",
L"NavbarNonTopmost",
L"Rebar",
L"RebarStyle",
L"TaskBar",
L"TaskBarComposited",
NULL,
};
static WCHAR *toolbarThemes[] = {
L"NULL",
L"",
L"Alternate",
L"BB",
L"BBComposited",
L"Communications",
L"ExplorerMenu",
L"Go",
L"GoComposited",
L"InactiveBB",
L"InactiveBBComposited",
L"InactiveGo",
L"InactiveGoComposited",
L"InfoPaneToolbar",
L"LVPopup",
L"LVPopupBottom",
L"MaxBB",
L"MaxBBComposited",
L"MaxGo",
L"MaxGoComposited",
L"MaxInactiveBB",
L"MaxInactiveBBComposited",
L"MaxInactiveGo",
L"MaxInactiveGoComposited",
L"Media",
L"Placesbar",
L"SearchButton",
L"SearchButtonComposited",
L"StartMenu",
L"TaskBar",
L"TaskBarComposited",
L"TaskBarVert",
L"TaskBarVertComposited",
L"Toolbar",
L"ToolbarStyle",
L"TrayNotify",
L"TrayNotifyComposited",
NULL,
};
// TODO toolbarThemes
void onWM_CREATE(HWND hwnd)
{
TBBUTTON tbb[5];
RECT btnrect;
DWORD tbbtnsize;
LONG tbsizex, tbsizey;
REBARBANDINFOW rbi;
HWND button;
LONG buttonx, buttony;
LONG combox, comboy;
int i;
rebar = CreateWindowExW(0,
REBARCLASSNAMEW, NULL,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CCS_NODIVIDER | CCS_TOP | RBS_FIXEDORDER,
0, 0, 0, 0,
hwnd, (HMENU) 100, hInstance, NULL);
if (rebar == NULL)
diele("CreateWindowExW(REBARCLASSNAMEW)");
leftbar = CreateWindowExW(0,
TOOLBARCLASSNAMEW, NULL,
toolbarStyles | TBSTYLE_LIST | TBSTYLE_TRANSPARENT,
0, 0, 0, 0,
hwnd, (HMENU) 101, hInstance, NULL);
if (leftbar == NULL)
diele("CreateWindowExW(TOOLBARCLASSNAMEW) leftbar");
SendMessageW(leftbar, TB_BUTTONSTRUCTSIZE, sizeof (TBBUTTON), 0);
// I_IMAGENONE causes the button text to be left-aligned; don't use it
// if (SendMessageW(leftbar, TB_SETBITMAPSIZE, 0, 0) == FALSE)
// diele("TB_SETBITMAPSIZE");
SendMessageW(leftbar, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS | TBSTYLE_EX_HIDECLIPPEDBUTTONS | TBSTYLE_EX_MIXEDBUTTONS);
// TODO this *should* be DIPs...
// TODO figure out where the *2 is documented
// SendMessageW(leftbar, TB_SETPADDING, 0, MAKELPARAM(6 * 2, 5 * 2));
ZeroMemory(tbb, 5 * sizeof (TBBUTTON));
for (i = 0; i < 5; i++) {
tbb[i].iBitmap = 0;
tbb[i].idCommand = i;
tbb[i].fsState = TBSTATE_ENABLED;
tbb[i].fsStyle = BTNS_AUTOSIZE | BTNS_BUTTON | BTNS_NOPREFIX | BTNS_SHOWTEXT;
if (leftbarButtons[i].dropdown)
tbb[i].fsStyle |= BTNS_DROPDOWN | BTNS_WHOLEDROPDOWN;
tbb[i].iString = (INT_PTR) (leftbarButtons[i].text);
}
if (SendMessageW(leftbar, TB_ADDBUTTONSW, 5, (LPARAM) tbb) == FALSE)
diele("TB_ADDBUTTONSW");
tbsizex = 0;
for (i = 0; i < 5; i++) {
if (SendMessageW(leftbar, TB_GETITEMRECT, (WPARAM) i, (LPARAM) (&btnrect)) == FALSE)
diele("TB_GETITEMRECT");
tbsizex += btnrect.right - btnrect.left;
}
tbbtnsize = (DWORD) SendMessageW(leftbar, TB_GETBUTTONSIZE, 0, 0);
tbsizey = HIWORD(tbbtnsize);
ZeroMemory(&rbi, sizeof (REBARBANDINFOW));
rbi.cbSize = sizeof (REBARBANDINFOW);
rbi.fMask = RBBIM_CHILD | RBBIM_STYLE | RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE | RBBIM_ID;
rbi.fStyle = RBBS_NOGRIPPER | RBBS_CHILDEDGE | RBBS_USECHEVRON | RBBS_HIDETITLE;
rbi.hwndChild = leftbar;
rbi.cx = tbsizex;
rbi.cyChild = tbsizey;
rbi.cxMinChild = 0;
rbi.cyMinChild = tbsizey;
rbi.cxIdeal = tbsizex;
rbi.wID = 0;
if (SendMessageW(rebar, RB_INSERTBANDW, (WPARAM) (-1), (LPARAM) (&rbi)) == 0)
diele("RB_INSERTBANDW leftbar");
rightbar = CreateWindowExW(0,
TOOLBARCLASSNAMEW, NULL,
toolbarStyles | TBSTYLE_TRANSPARENT,
0, 0, 0, 0,
hwnd, (HMENU) 102, hInstance, NULL);
if (rightbar == NULL)
diele("CreateWindowExW(TOOLBARCLASSNAMEW) rightbar");
SendMessageW(rightbar, TB_BUTTONSTRUCTSIZE, sizeof (TBBUTTON), 0);
SendMessageW(rightbar, TB_SETIMAGELIST, 0, (LPARAM) rightList);
SendMessageW(rightbar, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS);
// TODO this *should* be DIPs...
// TODO figure out where the *2 is documented
// SendMessageW(rightbar, TB_SETPADDING, 0, MAKELPARAM(6 * 2, 5 * 2));
ZeroMemory(tbb, 5 * sizeof (TBBUTTON));
tbb[0].iBitmap = 0;
tbb[0].idCommand = 0;
tbb[0].fsState = TBSTATE_ENABLED;
tbb[0].fsStyle = BTNS_AUTOSIZE | BTNS_BUTTON | BTNS_DROPDOWN;
tbb[1].iBitmap = 1;
tbb[1].idCommand = 1;
tbb[1].fsState = TBSTATE_ENABLED;
tbb[1].fsStyle = BTNS_AUTOSIZE | BTNS_BUTTON;
tbb[2].iBitmap = 2;
tbb[2].idCommand = 2;
tbb[2].fsState = TBSTATE_ENABLED;
tbb[2].fsStyle = BTNS_AUTOSIZE | BTNS_BUTTON;
if (SendMessageW(rightbar, TB_ADDBUTTONSW, 3, (LPARAM) tbb) == FALSE)
diele("TB_ADDBUTTONSW");
// TODO check error
// TODO figure out why this works here but not elsewhere
// SendMessageW(rightbar, TB_SETBUTTONSIZE, 0, 0);
tbsizex = 0;
for (i = 0; i < 3; i++) {
if (SendMessageW(rightbar, TB_GETITEMRECT, (WPARAM) i, (LPARAM) (&btnrect)) == FALSE)
diele("TB_GETITEMRECT");
tbsizex += btnrect.right - btnrect.left;
}
tbbtnsize = (DWORD) SendMessageW(rightbar, TB_GETBUTTONSIZE, 0, 0);
tbsizey = HIWORD(tbbtnsize);
ZeroMemory(&rbi, sizeof (REBARBANDINFOW));
rbi.cbSize = sizeof (REBARBANDINFOW);
rbi.fMask = RBBIM_CHILD | RBBIM_STYLE | RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_ID;
rbi.fStyle = RBBS_NOGRIPPER | RBBS_HIDETITLE;
rbi.hwndChild = rightbar;
rbi.cx = tbsizex;
rbi.cyChild = tbsizey;
rbi.cxMinChild = tbsizex;
rbi.cyMinChild = tbsizey;
rbi.wID = 1;
if (SendMessageW(rebar, RB_INSERTBANDW, (WPARAM) (-1), (LPARAM) (&rbi)) == 0)
diele("RB_INSERTBANDW rightbar");
buttonx = 10;
buttony = 40;
#define buttonwid 200
#define buttonht 25
for (i = 0; drawmodes[i].text != NULL; i++) {
button = CreateWindowExW(0,
L"BUTTON", drawmodes[i].text,
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
buttonx, buttony,
buttonwid, buttonht,
hwnd, (HMENU) (200 + i), hInstance, NULL);
if (button == NULL)
diele("CreateWIndowExW(L\"BUTTON\")");
if (i == 0) {
combox = buttonx + buttonwid + 5;
comboy = buttony;
}
buttony += buttonht + 5;
}
button = CreateWindowExW(0,
L"BUTTON", L"Give Toolbar Focus",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
buttonx, buttony,
buttonwid, buttonht,
hwnd, (HMENU) (200 + i), hInstance, NULL);
if (button == NULL)
diele("CreateWIndowExW(L\"BUTTON\")");
rebarCombo = CreateWindowExW(WS_EX_CLIENTEDGE,
L"COMBOBOX", L"",
WS_CHILD | WS_VISIBLE | CBS_DROPDOWN,
combox, comboy,
buttonwid, buttonht,
hwnd, (HMENU) 300, hInstance, NULL);
if (rebarCombo == NULL)
diele("CreateWindowExW(L\"COMBOBOX\")");
for (i = 0; rebarThemes[i] != NULL; i++)
// TODO check error
SendMessageW(rebarCombo, CB_ADDSTRING, 0, (LPARAM) (rebarThemes[i]));
comboy += buttonht + 5;
toolbarCombo = CreateWindowExW(WS_EX_CLIENTEDGE,
L"COMBOBOX", L"",
WS_CHILD | WS_VISIBLE | CBS_DROPDOWN,
combox, comboy,
buttonwid, buttonht,
hwnd, (HMENU) 301, hInstance, NULL);
if (toolbarCombo == NULL)
diele("CreateWindowExW(L\"COMBOBOX\")");
for (i = 0; toolbarThemes[i] != NULL; i++)
// TODO check error
SendMessageW(toolbarCombo, CB_ADDSTRING, 0, (LPARAM) (toolbarThemes[i]));
comboy += buttonht + 5;
toolbarTransparentCheckbox = CreateWindowExW(0,
L"BUTTON", L"Transparent toolbar",
WS_CHILD | WS_VISIBLE | BS_CHECKBOX,
combox, comboy,
buttonwid, buttonht,
hwnd, (HMENU) 302, hInstance, NULL);
if (toolbarTransparentCheckbox == NULL)
diele("CreateWindowExW(L\"BUTTON\")");
SendMessage(toolbarTransparentCheckbox, BM_SETCHECK, BST_CHECKED, 0);
}
// TODO it seems like I shouldn't have to do this?
void repositionRebar(HWND hwnd)
{
RECT win, rb;
if (GetClientRect(hwnd, &win) == 0)
diele("GetClientRect()");
if (GetWindowRect(rebar, &rb) == 0)
diele("GetWindowRect()");
if (SetWindowPos(rebar, NULL,
0, 0, win.right - win.left, rb.bottom - rb.top,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER) == 0)
diele("SetWindowPos()");
}
// TODO check errors
void handleEvents(HWND hwnd, WPARAM wParam)
{
LRESULT n;
const WCHAR *selRebar = NULL, *selToolbar = NULL;
WCHAR *bufRebar = NULL, *bufToolbar = NULL;
BOOL changeRebar = FALSE, changeToolbar = FALSE;
BOOL invalidate = FALSE;
WPARAM check;
switch (wParam) {
case MAKEWPARAM(300, CBN_SELCHANGE):
n = SendMessageW(rebarCombo, CB_GETCURSEL, 0, 0);
selRebar = rebarThemes[n];
changeRebar = TRUE;
break;
case MAKEWPARAM(301, CBN_SELCHANGE):
n = SendMessageW(toolbarCombo, CB_GETCURSEL, 0, 0);
selToolbar = toolbarThemes[n];
changeToolbar = TRUE;
break;
case MAKEWPARAM(200, BN_CLICKED):
drawmode = 0;
n = SendMessageW(rebarCombo, WM_GETTEXTLENGTH, 0, 0);
bufRebar = new WCHAR[n + 1];
GetWindowTextW(rebarCombo, bufRebar, n + 1);
n = SendMessageW(toolbarCombo, WM_GETTEXTLENGTH, 0, 0);
bufToolbar = new WCHAR[n + 1];
GetWindowTextW(toolbarCombo, bufToolbar, n + 1);
selRebar = bufRebar;
selToolbar = bufToolbar;
changeRebar = TRUE;
changeToolbar = TRUE;
break;
case MAKEWPARAM(201, BN_CLICKED):
drawmode = 1;
invalidate = TRUE;
break;
case MAKEWPARAM(302, BN_CLICKED):
ShowWindow(leftbar, SW_HIDE);
check = BST_CHECKED;
if (SendMessage(toolbarTransparentCheckbox, BM_GETCHECK, 0, 0) == BST_CHECKED)
check = BST_UNCHECKED;
SendMessage(toolbarTransparentCheckbox, BM_SETCHECK, check, 0);
if (check == BST_CHECKED)
SendMessageW(leftbar, TB_SETSTYLE, 0, toolbarStyles | TBSTYLE_LIST | TBSTYLE_TRANSPARENT);
else
SendMessageW(leftbar, TB_SETSTYLE, 0, toolbarStyles | TBSTYLE_LIST);
ShowWindow(leftbar, SW_SHOW);
break;
case MAKEWPARAM(202, BN_CLICKED):
SetFocus(leftbar);
break;
}
if (changeRebar) {
if (selRebar != NULL && wcscmp(selRebar, L"NULL") == 0)
selRebar = NULL;
if (selRebar != NULL && *selRebar != L'\0')
SendMessageW(rebar, RB_SETWINDOWTHEME, 0, (LPARAM) selRebar);
else
SetWindowTheme(rebar, selRebar, selRebar);
invalidate = TRUE;
}
if (changeToolbar) {
if (selToolbar != NULL && wcscmp(selToolbar, L"NULL") == 0)
selToolbar = NULL;
if (selToolbar != NULL && *selToolbar != L'\0') {
SendMessageW(leftbar, TB_SETWINDOWTHEME, 0, (LPARAM) selToolbar);
SendMessageW(rightbar, TB_SETWINDOWTHEME, 0, (LPARAM) selToolbar);
} else {
SetWindowTheme(leftbar, selToolbar, selToolbar);
SetWindowTheme(rightbar, selToolbar, selToolbar);
}
invalidate = TRUE;
}
if (invalidate)
InvalidateRect(hwnd, NULL, TRUE);
if (bufRebar != NULL)
delete[] bufRebar;
if (bufToolbar != NULL)
delete[] bufToolbar;
}
LRESULT CALLBACK wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
NMHDR *nm = (NMHDR *) lParam;
switch (uMsg) {
case WM_CREATE:
onWM_CREATE(hwnd);
break;
case WM_CLOSE:
PostQuitMessage(0);
break;
case WM_SIZE:
repositionRebar(hwnd);
break;
case WM_COMMAND:
handleEvents(hwnd, wParam);
break;
case WM_NOTIFY:
switch (nm->code) {
case NM_CUSTOMDRAW:
if (drawmode == 0)
break;
if (nm->hwndFrom == rebar)
return (*(drawmodes[drawmode].handleRebar))((NMCUSTOMDRAW *) nm);
else if (nm->hwndFrom == leftbar || nm->hwndFrom == rightbar)
return (*(drawmodes[drawmode].handleToolbar))((NMTBCUSTOMDRAW *) nm);
break;
}
break;
}
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
}
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
int main(void)
{
STARTUPINFOW si;
int nCmdShow;
INITCOMMONCONTROLSEX icc;
HICON hDefaultIcon;
HCURSOR hDefaultCursor;
WNDCLASSW wc;
HWND mainwin;
MSG msg;
HRESULT hr;
hInstance = (HINSTANCE) (&__ImageBase);
nCmdShow = SW_SHOWDEFAULT;
GetStartupInfoW(&si);
if ((si.dwFlags & STARTF_USESHOWWINDOW) != 0)
nCmdShow = si.wShowWindow;
ZeroMemory(&icc, sizeof (INITCOMMONCONTROLSEX));
icc.dwSize = sizeof (INITCOMMONCONTROLSEX);
icc.dwICC = ICC_STANDARD_CLASSES | ICC_BAR_CLASSES | ICC_COOL_CLASSES;
if (InitCommonControlsEx(&icc) == 0)
diele("InitCommonControlsEx()");
hDefaultIcon = LoadIconW(NULL, IDI_APPLICATION);
if (hDefaultIcon == NULL)
diele("LoadIconW(IDI_APPLICATION)");
hDefaultCursor = LoadCursorW(NULL, IDC_ARROW);
if (hDefaultCursor == NULL)
diele("LoadCursorW(IDC_ARROW)");
hr = LoadIconMetric(NULL, IDI_SHIELD, LIM_SMALL, &shieldIcon);
if (hr != S_OK)
diehr("LoadIconMetric(IDI_SHIELD)", hr);
hr = LoadIconMetric(NULL, IDI_APPLICATION, LIM_SMALL, &applicationIcon);
if (hr != S_OK)
diehr("LoadIconMetric(IDI_APPLICATION)", hr);
hr = LoadIconMetric(NULL, IDI_QUESTION, LIM_SMALL, &helpIcon);
if (hr != S_OK)
diehr("LoadIconMetric(IDI_QUESTION)", hr);
rightList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
ILC_COLOR32, 0, 3);
if (rightList == NULL)
diele("ImageList_Create()");
if (ImageList_ReplaceIcon(rightList, -1, shieldIcon) == -1)
diele("ImageList_ReplaceIcon(IDI_SHIELD)");
if (ImageList_ReplaceIcon(rightList, -1, applicationIcon) == -1)
diele("ImageList_ReplaceIcon(IDI_APPLICATION)");
if (ImageList_ReplaceIcon(rightList, -1, helpIcon) == -1)
diele("ImageList_ReplaceIcon(IDI_QUESTION)");
ZeroMemory(&wc, sizeof (WNDCLASSW));
wc.lpszClassName = L"mainwin";
wc.lpfnWndProc = wndproc;
wc.hInstance = hInstance;
wc.hIcon = hDefaultIcon;
wc.hCursor = hDefaultCursor;
wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
if (RegisterClassW(&wc) == 0)
diele("RegisterClassW()");
mainwin = CreateWindowExW(0,
L"mainwin", L"Main Window",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL);
if (mainwin == NULL)
diele("CreateWindowExW(L\"mainwin\")");
ShowWindow(mainwin, nCmdShow);
if (UpdateWindow(mainwin) == 0)
diele("UpdateWindow()");
for (;;) {
int res;
res = GetMessageW(&msg, NULL, 0, 0);
if (res < 0)
diele("GetMessageW()");
if (res == 0)
break;
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
return 0;
}

View File

@ -1,5 +1,9 @@
// 27 february 2018 // 27 february 2018
// TODO
// - https://blogs.msdn.microsoft.com/oldnewthing/20181107-00/?p=100155 https://blogs.msdn.microsoft.com/oldnewthing/20181108-00/?p=100165 https://blogs.msdn.microsoft.com/oldnewthing/20181109-00/?p=100175
// - also in the above: note the unspecified order of data in the sub-segments...
#ifndef testingprivIncludeGuard_testing_h #ifndef testingprivIncludeGuard_testing_h
#define testingprivIncludeGuard_testing_h #define testingprivIncludeGuard_testing_h

76
_notes/azure-pipelines Normal file
View File

@ -0,0 +1,76 @@
multi-platform {
https://docs.microsoft.com/en-us/azure/devops/pipelines/get-started-multiplatform?view=azure-devops
}
microsoft-hosted agents {
https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml#use-a-microsoft-hosted-agent
https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=azure-devops
https://github.com/Microsoft/azure-pipelines-image-generation/blob/master/images/win/Vs2017-Server2016-Readme.md
https://github.com/Microsoft/azure-pipelines-image-generation/blob/master/images/win/Vs2015-Server2012R2-Readme.md
}
maximum number of processors (for ninja -j) {
msbuild supports this with the -m option natively; meanwhile:
https://www.gnu.org/software/coreutils/manual/html_node/nproc-invocation.html
}
potentially useful tasks {
https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/publish-pipeline-artifact?view=azure-devops
https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/visual-studio-build?view=azure-devops
https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/xcode?view=azure-devops
https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/github-release?view=azure-devops
https://docs.microsoft.com/en-us/azure/devops/extend/develop/add-build-task?view=azure-devops
}
meson CI reference {
https://github.com/mesonbuild/meson/blob/master/docs/markdown/Continuous-Integration.md
}
job templates, which will clean up our pipelines {
https://docs.microsoft.com/en-us/azure/devops/pipelines/process/templates?view=azure-devops
}
migrating from travis {
https://docs.microsoft.com/en-us/azure/devops/pipelines/migrate/from-travis?view=azure-devops
}
32-bit {
https://github.com/numpy/numpy/issues/12856
https://github.com/numpy/numpy/pull/12863/files
https://github.com/numpy/numpy/blob/master/azure-pipelines.yml (also explains what the @s mean; thanks guys)
}
using visual studio tools {
https://docs.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs
https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=vs-2019#developer_command_file_locations
}
OLD using visual studio tools; also some docker {
https://github.com/mesonbuild/meson/blob/master/ci/azure-steps.yml
https://github.com/reactiveui/Akavache/blob/master/azure-pipelines.yml
https://github.com/vector-of-bool/CMakeCM/blob/master/azure-pipelines.yml
https://docs.microsoft.com/en-us/visualstudio/install/advanced-build-tools-container?view=vs-2019
https://docs.microsoft.com/en-us/visualstudio/install/build-tools-container?view=vs-2019
https://devblogs.microsoft.com/cppblog/using-msvc-in-a-docker-container-for-your-c-projects/
https://devblogs.microsoft.com/cppblog/finding-the-visual-c-compiler-tools-in-visual-studio-2017/
}
reference {
https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#task
https://docs.microsoft.com/en-us/azure/devops/pipelines/apps/windows/cpp?view=azure-devops
https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/python?view=azure-devops
https://docs.microsoft.com/en-us/azure/devops/pipelines/process/conditions?view=azure-devops&tabs=yaml
}
C++ binary compatibility and shared libraries (TODO split into its own notes file) {
https://docs.microsoft.com/en-us/cpp/porting/binary-compat-2015-2017?view=vs-2017
}
others I forgot why I had them open {
https://github.com/Microsoft/cpprestsdk/blob/master/azure-pipelines.yml (32-bit?)
https://docs.microsoft.com/en-us/azure/devops/release-notes/2018/sprint-142-update (I forget, maybe also 32-bit?)
}
others that might not be relevant {
https://github.com/Microsoft/azure-pipelines-agent/blob/master/docs/start/envubuntu.md has instructions on how to build the agent tool itself
}

1
_notes/cplusplus Normal file
View File

@ -0,0 +1 @@
https://blogs.msdn.microsoft.com/oldnewthing/20181226-00/?p=100565

View File

@ -13,3 +13,4 @@ https://www.microsoft.com/en-us/language/Terminology
https://www.microsoft.com/en-us/language/LicenseAgreement https://www.microsoft.com/en-us/language/LicenseAgreement
https://www.microsoft.com/en-us/language/Translations https://www.microsoft.com/en-us/language/Translations
http://www.ttt.org/oscarstandards/tbx/ http://www.ttt.org/oscarstandards/tbx/
https://blogs.msdn.microsoft.com/oldnewthing/20181122-00/?p=100295

View File

@ -0,0 +1,23 @@
https://developer.apple.com/documentation/corefoundation/1542764-cfurlcopyresourcepropertyforkey?language=objc
https://developer.apple.com/documentation/foundation/nsargumentdomain?language=objc
https://developer.apple.com/documentation/appkit/1428499-nsapplicationmain
https://webkit.googlesource.com/WebKit/+/9ae3deefb7df48bd85f01edcf8382ee300eafbd4%5E!/
https://stackoverflow.com/questions/11181324/how-to-change-retina-display-system-preferences-in-osx
https://web.archive.org/web/20150828053709/http://garethjenkins.com/2012/07/01/investigating-a-high-resolution-retina-utility-for-macbook-pro-1x-and-2x-modes/
https://github.com/avibrazil/RDM
https://www.google.com/search?client=firefox-b-1-d&q=IOFramebuffer+subclass
https://developer.apple.com/documentation/kernel/ioframebuffer?language=objc
https://stackoverflow.com/questions/51846999/how-to-write-macos-display-driver
https://twitter.com/kenkeiter/status/3631378994298882
http://en.ennowelbers.info/node/33
https://www.insanelymac.com/forum/topic/114528-how-to-compile-a-driver-from-source/
https://github.com/mkernel/EWProxyFramebuffer
https://stackoverflow.com/questions/46904493/ioframebuffer-cant-access-vram-framebuffer-in-macos-10-13
https://www.google.com/search?client=firefox-b-1-d&q=IOFramebuffer+10.13
https://github.com/codykrieger/gfxCardStatus/issues/296
https://plugable.com/2018/03/30/macos-10-13-4-disables-displaylink-duet-display-devices/
https://www.tekrevue.com/tip/hidpi-mode-os-x/
https://medium.com/@ivan.ha/how-to-mimic-a-2k-monitor-as-retina-display-in-macos-sierra-using-hidpi-f53d87630c48
https://www.google.com/search?client=firefox-b-1-d&q=IOFramebuffer+10.13
https://www.quora.com/What-is-the-underlying-reason-if-DisplayLink-is-no-longer-working-properly-on-Mac-OS
https://github.com/Siguza/iokit-utils

View File

@ -204,3 +204,10 @@ font1.gif (GIF Image, 424 × 475 pixels) http://www.functionx.com/win32/controls
Inskcapes Hidden Little Feature: Mesh Gradients | OCS-Mag http://www.ocsmag.com/2016/02/27/inskcapes-hidden-little-feature-mesh-gradients/ (near "When youre done colouring in all the nodes, you may want to drag") Inskcapes Hidden Little Feature: Mesh Gradients | OCS-Mag http://www.ocsmag.com/2016/02/27/inskcapes-hidden-little-feature-mesh-gradients/ (near "When youre done colouring in all the nodes, you may want to drag")
https://msdn.microsoft.com/en-us/library/windows/desktop/ms632615(v=vs.85).aspx we need to handle this alongisde WM_CAPTURECHANGED https://msdn.microsoft.com/en-us/library/windows/desktop/ms632615(v=vs.85).aspx we need to handle this alongisde WM_CAPTURECHANGED
https://msdn.microsoft.com/en-us/library/windows/desktop/dn424996%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
whatever this is seems to have no documentation... it appears to be related to UWP, if not only Store apps...
unreachable code optimizations
https://docs.microsoft.com/en-us/cpp/intrinsics/assume?view=vs-2017
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html

9
_notes/rebarstuff Normal file
View File

@ -0,0 +1,9 @@
https://docs.microsoft.com/en-us/windows/desktop/uxguide/cmd-toolbars
https://docs.microsoft.com/en-us/windows/desktop/controls/cc-faq-iemenubar
https://docs.microsoft.com/en-us/windows/desktop/controls/cc-faq-ietoolbar
https://docs.microsoft.com/en-us/windows/desktop/controls/create-rebar-controls
https://docs.microsoft.com/en-us/windows/desktop/controls/create-toolbars
https://docs.microsoft.com/en-us/windows/desktop/controls/handle-drop-down-buttons
https://docs.microsoft.com/en-us/windows/desktop/controls/tb-buttonstructsize
https://www.google.com/search?q=winapi+toolbar+dropdown+position&ie=utf-8&oe=utf-8&client=firefox-b-1
https://www.google.com/search?q=winapi+toolbar+dropdown+arrow+position&ie=utf-8&oe=utf-8&client=firefox-b-1

View File

@ -16,3 +16,6 @@ https://msdn.microsoft.com/en-us/library/windows/desktop/dn469266(v=vs.85).aspx#
https://msdn.microsoft.com/library/windows/desktop/mt843498(v=vs.85).aspx(d=robot)#appendix_c_common_high_dpi_issues https://msdn.microsoft.com/library/windows/desktop/mt843498(v=vs.85).aspx(d=robot)#appendix_c_common_high_dpi_issues
https://msdn.microsoft.com/en-us/library/windows/desktop/dn469266(v=vs.85).aspx#addressing_high_dpi_issues https://msdn.microsoft.com/en-us/library/windows/desktop/dn469266(v=vs.85).aspx#addressing_high_dpi_issues
https://msdn.microsoft.com/library/windows/desktop/mt843498(v=vs.85).aspx(d=robot)#addressing_high_dpi_issues https://msdn.microsoft.com/library/windows/desktop/mt843498(v=vs.85).aspx(d=robot)#addressing_high_dpi_issues
https://msdn.microsoft.com/en-us/library/windows/desktop/dn302215(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/hh802769(v=vs.85).aspx

6
_notes/winflags Normal file
View File

@ -0,0 +1,6 @@
# TODO is there a -Wno-switch equivalent?
# TODO /sdl turns C4996 into an ERROR
# don't use /analyze; that requires us to write annotations everywhere
# TODO undecided flags from qo?
# the RTC flags are only supplied in debug builds because they are only supposed to be used by debug builds (see "This is because run-time error checks are not valid in a release (optimized) build." in https://docs.microsoft.com/cpp/build/reference/rtc-run-time-error-checks)
# /RTCc is not supplied because it's discouraged as of VS2015; see https://www.reddit.com/r/cpp/comments/46mhne/rtcc_rejects_conformant_code_with_visual_c_2015/d06auq5

View File

@ -1,36 +1,5 @@
# 3 june 2016 # 3 june 2016
if(WIN32)
set(_EXAMPLE_RESOURCES_RC resources.rc)
endif()
macro(_add_example _name)
_add_exec(${_name} ${ARGN})
# because Microsoft's toolchain is dumb
if(MSVC)
set_property(TARGET ${_name} APPEND_STRING PROPERTY
LINK_FLAGS " /ENTRY:mainCRTStartup")
endif()
endmacro()
_add_example(controlgallery
controlgallery/main.c
${_EXAMPLE_RESOURCES_RC}
)
_add_example(histogram
histogram/main.c
${_EXAMPLE_RESOURCES_RC}
)
_add_example(cpp-multithread
cpp-multithread/main.cpp
${_EXAMPLE_RESOURCES_RC}
)
if(NOT WIN32)
target_link_libraries(cpp-multithread pthread)
endif()
_add_example(drawtext _add_example(drawtext
drawtext/attributes.c drawtext/attributes.c
drawtext/basic.c drawtext/basic.c
@ -48,11 +17,3 @@ _add_example(opentype
) )
target_include_directories(opentype target_include_directories(opentype
PRIVATE opentype) PRIVATE opentype)
add_custom_target(examples
DEPENDS
controlgallery
histogram
cpp-multithread
drawtext
opentype)

378
azure-pipelines.yml Normal file
View File

@ -0,0 +1,378 @@
# 31 march 2019
trigger:
branches:
include:
- '*'
tags:
include:
- '*'
variables:
releaseExamples: 'controlgallery cpp-multithread datetime drawtext histogram tester timer'
jobs:
# linux {
- job: linux_386_shared
displayName: 'Linux 386 Shared'
pool:
vmImage: 'ubuntu-16.04'
workspace:
clean: all
steps:
- template: azure-pipelines/setup-python3.yml
- template: azure-pipelines/install-latest-meson-ninja.yml
- template: azure-pipelines/linux-386-install-gtk-dev.yml
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
defaultLibrary: shared
- template: azure-pipelines/build.yml
- template: azure-pipelines/artifacts.yml
parameters:
os: linux
arch: 386
libtype: shared
libfiles: libui.so.0
osHeader: ui_unix.h
- job: linux_386_static
displayName: 'Linux 386 Static'
pool:
vmImage: 'ubuntu-16.04'
workspace:
clean: all
steps:
- template: azure-pipelines/setup-python3.yml
- template: azure-pipelines/install-latest-meson-ninja.yml
- template: azure-pipelines/linux-386-install-gtk-dev.yml
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
defaultLibrary: static
- template: azure-pipelines/build.yml
- template: azure-pipelines/artifacts.yml
parameters:
os: linux
arch: 386
libtype: static
libfiles: libui.a
osHeader: ui_unix.h
- job: linux_amd64_shared
displayName: 'Linux amd64 Shared'
pool:
vmImage: 'ubuntu-16.04'
workspace:
clean: all
steps:
- template: azure-pipelines/setup-python3.yml
- template: azure-pipelines/install-latest-meson-ninja.yml
- template: azure-pipelines/linux-install-gtk-dev.yml
- template: azure-pipelines/configure.yml
parameters:
defaultLibrary: shared
- template: azure-pipelines/build.yml
- template: azure-pipelines/artifacts.yml
parameters:
os: linux
arch: amd64
libtype: shared
libfiles: libui.so.0
osHeader: ui_unix.h
- job: linux_amd64_static
displayName: 'Linux amd64 Static'
pool:
vmImage: 'ubuntu-16.04'
workspace:
clean: all
steps:
- template: azure-pipelines/setup-python3.yml
- template: azure-pipelines/install-latest-meson-ninja.yml
- template: azure-pipelines/linux-install-gtk-dev.yml
- template: azure-pipelines/configure.yml
parameters:
defaultLibrary: static
- template: azure-pipelines/build.yml
- template: azure-pipelines/artifacts.yml
parameters:
os: linux
arch: amd64
libtype: static
libfiles: libui.a
osHeader: ui_unix.h
# }
# windows vs2015 {
- job: windows_386_msvc2015_shared
displayName: 'Windows 386 MSVC2015 Shared'
pool:
vmImage: 'vs2015-win2012r2'
workspace:
clean: all
steps:
- template: azure-pipelines/vs2015-install-python3.yml
- template: azure-pipelines/install-latest-meson-ninja.yml
- template: azure-pipelines/windows-install-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
defaultLibrary: shared
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: 386
toolchain: msvc2015
libtype: shared
libfiles: libui.dll libui.exp libui.lib
osHeader: ui_windows.h
- job: windows_386_msvc2015_static
displayName: 'Windows 386 MSVC2015 Static'
pool:
vmImage: 'vs2015-win2012r2'
workspace:
clean: all
steps:
- template: azure-pipelines/vs2015-install-python3.yml
- template: azure-pipelines/install-latest-meson-ninja.yml
- template: azure-pipelines/windows-install-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
defaultLibrary: static
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
afterBuild: ren build\meson-out\libui.a libui.lib
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: 386
toolchain: msvc2015
libtype: static
libfiles: libui.lib
osHeader: ui_windows.h
- job: windows_amd64_msvc2015_shared
displayName: 'Windows amd64 MSVC2015 Shared'
pool:
vmImage: 'vs2015-win2012r2'
workspace:
clean: all
steps:
- template: azure-pipelines/vs2015-install-python3.yml
- template: azure-pipelines/install-latest-meson-ninja.yml
- template: azure-pipelines/windows-install-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
defaultLibrary: shared
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: amd64
toolchain: msvc2015
libtype: shared
libfiles: libui.dll libui.exp libui.lib
osHeader: ui_windows.h
- job: windows_amd64_msvc2015_static
displayName: 'Windows amd64 MSVC2015 Static'
pool:
vmImage: 'vs2015-win2012r2'
workspace:
clean: all
steps:
- template: azure-pipelines/vs2015-install-python3.yml
- template: azure-pipelines/install-latest-meson-ninja.yml
- template: azure-pipelines/windows-install-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
defaultLibrary: static
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
afterBuild: ren build\meson-out\libui.a libui.lib
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: amd64
toolchain: msvc2015
libtype: static
libfiles: libui.lib
osHeader: ui_windows.h
# }
# windows vs2017 {
- job: windows_386_msvc2017_shared
displayName: 'Windows 386 MSVC2017 Shared'
pool:
vmImage: 'vs2017-win2016'
workspace:
clean: all
steps:
- template: azure-pipelines/setup-python3.yml
- template: azure-pipelines/install-latest-meson-ninja.yml
- template: azure-pipelines/windows-install-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
defaultLibrary: shared
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: 386
toolchain: msvc2017
libtype: shared
libfiles: libui.dll libui.exp libui.lib
osHeader: ui_windows.h
- job: windows_386_msvc2017_static
displayName: 'Windows 386 MSVC2017 Static'
pool:
vmImage: 'vs2017-win2016'
workspace:
clean: all
steps:
- template: azure-pipelines/setup-python3.yml
- template: azure-pipelines/install-latest-meson-ninja.yml
- template: azure-pipelines/windows-install-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
defaultLibrary: static
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
afterBuild: ren build\meson-out\libui.a libui.lib
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: 386
toolchain: msvc2017
libtype: static
libfiles: libui.lib
osHeader: ui_windows.h
- job: windows_amd64_msvc2017_shared
displayName: 'Windows amd64 MSVC2017 Shared'
pool:
vmImage: 'vs2017-win2016'
workspace:
clean: all
steps:
- template: azure-pipelines/setup-python3.yml
- template: azure-pipelines/install-latest-meson-ninja.yml
- template: azure-pipelines/windows-install-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
defaultLibrary: shared
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: amd64
toolchain: msvc2017
libtype: shared
libfiles: libui.dll libui.exp libui.lib
osHeader: ui_windows.h
- job: windows_amd64_msvc2017_static
displayName: 'Windows amd64 MSVC2017 Static'
pool:
vmImage: 'vs2017-win2016'
workspace:
clean: all
steps:
- template: azure-pipelines/setup-python3.yml
- template: azure-pipelines/install-latest-meson-ninja.yml
- template: azure-pipelines/windows-install-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
defaultLibrary: static
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
afterBuild: ren build\meson-out\libui.a libui.lib
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: amd64
toolchain: msvc2017
libtype: static
libfiles: libui.lib
osHeader: ui_windows.h
# }
# mac {
# TODO beforeConfigure/beforeBuild: export SDKROOT=$(xcodebuild -version -sdk macosx10.13 Path)?
- job: darwin_amd64_shared
displayName: 'Darwin amd64 Shared'
pool:
vmImage: 'macos-10.13'
workspace:
clean: all
steps:
- template: azure-pipelines/setup-python3.yml
- template: azure-pipelines/install-latest-meson-ninja.yml
- template: azure-pipelines/darwin-install-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
defaultLibrary: shared
- template: azure-pipelines/build.yml
- template: azure-pipelines/artifacts.yml
parameters:
os: darwin
arch: amd64
libtype: shared
libfiles: libui.A.dylib
osHeader: ui_darwin.h
- job: darwin_amd64_static
displayName: 'Darwin amd64 Static'
pool:
vmImage: 'macos-10.13'
workspace:
clean: all
steps:
- template: azure-pipelines/setup-python3.yml
- template: azure-pipelines/install-latest-meson-ninja.yml
- template: azure-pipelines/darwin-install-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
defaultLibrary: static
- template: azure-pipelines/build.yml
- template: azure-pipelines/artifacts.yml
parameters:
os: darwin
arch: amd64
libtype: static
libfiles: libui.a
osHeader: ui_darwin.h
# }

399
azure-pipelines/TODOMatrix Normal file
View File

@ -0,0 +1,399 @@
# 31 march 2019
variables:
releaseExamples: 'controlgallery cpp-multithread datetime drawtext histogram tester timer'
strategy:
matrix:
# targetname:
# os: 'fill this in'
# arch: 'fill this in'
# toolchain: 'fill this in'
# libtype: 'fill this in'
# vmImage: 'fill this in'
# python3Template: 'fill filename'
# depsAndNinjaTemplate: 'fill filename'
# beforeConfigure: 'fill this in'
# beforeBuild: 'fill this in'
# afterBuild: 'fill this in'
# artifactTemplate: 'fill filename'
# libfiles: 'fill this in'
# osHeader: 'fill this in'
linux_386_shared:
os: 'linux'
arch: '386'
libtype: 'shared'
vmImage: 'ubuntu-16.04'
python3Template: 'azure-pipelines/setup-python3.yml'
depsAndNinjaTemplate: 'azure-pipelines/linux-386-install-gtk-dev.yml'
beforeConfigure: 'export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig'
artifactTemplate: 'azure-pipelines/artifacts.yml'
libfiles: 'libui.so.0'
osHeader: 'ui_unix.h'
pool:
vmImage: $(vmImage)
workspace:
clean: all
steps:
- template: $(variables.python3Template)
- template: azure-pipelines/install-latest-meson-ninja.yml
- template: $(variables.depsAndNinjaTemplate)
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: $(beforeConfigure)
defaultLibrary: $(libtype)
- template: azure-pipelines/build.yml
parameters:
beforeBuild: $(beforeBuild)
afterBuild: $(afterBuild)
- template: $(variables.artifactTemplate)
parameters:
os: $(os)
arch: $(arch)
toolchain: $(toolchain)
libtype: $(libtype)
libfiles: $(libfiles)
osHeader: $(osHeader)
## linux {
#- job: linux_386_static
# displayName: 'Linux 386 Static'
# pool:
# vmImage: 'ubuntu-16.04'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/setup-python3.yml
# - template: azure-pipelines/install-latest-meson-ninja.yml
# - template: azure-pipelines/linux-386-install-gtk-dev.yml
# - template: azure-pipelines/configure.yml
# parameters:
# beforeConfigure: export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
# defaultLibrary: static
# - template: azure-pipelines/build.yml
# - template: azure-pipelines/artifacts.yml
# parameters:
# os: linux
# arch: 386
# libtype: static
# libfiles: libui.a
# osHeader: ui_unix.h
#
#- job: linux_amd64_shared
# displayName: 'Linux amd64 Shared'
# pool:
# vmImage: 'ubuntu-16.04'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/setup-python3.yml
# - template: azure-pipelines/install-latest-meson-ninja.yml
# - template: azure-pipelines/linux-install-gtk-dev.yml
# - template: azure-pipelines/configure.yml
# parameters:
# defaultLibrary: shared
# - template: azure-pipelines/build.yml
# - template: azure-pipelines/artifacts.yml
# parameters:
# os: linux
# arch: amd64
# libtype: shared
# libfiles: libui.so.0
# osHeader: ui_unix.h
#
#- job: linux_amd64_static
# displayName: 'Linux amd64 Static'
# pool:
# vmImage: 'ubuntu-16.04'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/setup-python3.yml
# - template: azure-pipelines/install-latest-meson-ninja.yml
# - template: azure-pipelines/linux-install-gtk-dev.yml
# - template: azure-pipelines/configure.yml
# parameters:
# defaultLibrary: static
# - template: azure-pipelines/build.yml
# - template: azure-pipelines/artifacts.yml
# parameters:
# os: linux
# arch: amd64
# libtype: static
# libfiles: libui.a
# osHeader: ui_unix.h
#
## }
#
## windows vs2015 {
#
#- job: windows_386_msvc2015_shared
# displayName: 'Windows 386 MSVC2015 Shared'
# pool:
# vmImage: 'vs2015-win2012r2'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/vs2015-install-python3.yml
# - template: azure-pipelines/install-latest-meson-ninja.yml
# - template: azure-pipelines/windows-install-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
# defaultLibrary: shared
# - template: azure-pipelines/build.yml
# parameters:
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
# - template: azure-pipelines/windows-artifacts.yml
# parameters:
# os: windows
# arch: 386
# toolchain: msvc2015
# libtype: shared
# libfiles: libui.dll libui.exp libui.lib
# osHeader: ui_windows.h
#
#- job: windows_386_msvc2015_static
# displayName: 'Windows 386 MSVC2015 Static'
# pool:
# vmImage: 'vs2015-win2012r2'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/vs2015-install-python3.yml
# - template: azure-pipelines/install-latest-meson-ninja.yml
# - template: azure-pipelines/windows-install-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
# defaultLibrary: static
# - template: azure-pipelines/build.yml
# parameters:
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
# afterBuild: ren build\meson-out\libui.a libui.lib
# - template: azure-pipelines/windows-artifacts.yml
# parameters:
# os: windows
# arch: 386
# toolchain: msvc2015
# libtype: static
# libfiles: libui.lib
# osHeader: ui_windows.h
#
#- job: windows_amd64_msvc2015_shared
# displayName: 'Windows amd64 MSVC2015 Shared'
# pool:
# vmImage: 'vs2015-win2012r2'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/vs2015-install-python3.yml
# - template: azure-pipelines/install-latest-meson-ninja.yml
# - template: azure-pipelines/windows-install-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
# defaultLibrary: shared
# - template: azure-pipelines/build.yml
# parameters:
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
# - template: azure-pipelines/windows-artifacts.yml
# parameters:
# os: windows
# arch: amd64
# toolchain: msvc2015
# libtype: shared
# libfiles: libui.dll libui.exp libui.lib
# osHeader: ui_windows.h
#
#- job: windows_amd64_msvc2015_static
# displayName: 'Windows amd64 MSVC2015 Static'
# pool:
# vmImage: 'vs2015-win2012r2'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/vs2015-install-python3.yml
# - template: azure-pipelines/install-latest-meson-ninja.yml
# - template: azure-pipelines/windows-install-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
# defaultLibrary: static
# - template: azure-pipelines/build.yml
# parameters:
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
# afterBuild: ren build\meson-out\libui.a libui.lib
# - template: azure-pipelines/windows-artifacts.yml
# parameters:
# os: windows
# arch: amd64
# toolchain: msvc2015
# libtype: static
# libfiles: libui.lib
# osHeader: ui_windows.h
#
## }
#
## windows vs2017 {
#
#- job: windows_386_msvc2017_shared
# displayName: 'Windows 386 MSVC2017 Shared'
# pool:
# vmImage: 'vs2017-win2016'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/setup-python3.yml
# - template: azure-pipelines/install-latest-meson-ninja.yml
# - template: azure-pipelines/windows-install-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
# defaultLibrary: shared
# - template: azure-pipelines/build.yml
# parameters:
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
# - template: azure-pipelines/windows-artifacts.yml
# parameters:
# os: windows
# arch: 386
# toolchain: msvc2017
# libtype: shared
# libfiles: libui.dll libui.exp libui.lib
# osHeader: ui_windows.h
#
#- job: windows_386_msvc2017_static
# displayName: 'Windows 386 MSVC2017 Static'
# pool:
# vmImage: 'vs2017-win2016'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/setup-python3.yml
# - template: azure-pipelines/install-latest-meson-ninja.yml
# - template: azure-pipelines/windows-install-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
# defaultLibrary: static
# - template: azure-pipelines/build.yml
# parameters:
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
# afterBuild: ren build\meson-out\libui.a libui.lib
# - template: azure-pipelines/windows-artifacts.yml
# parameters:
# os: windows
# arch: 386
# toolchain: msvc2017
# libtype: static
# libfiles: libui.lib
# osHeader: ui_windows.h
#
#- job: windows_amd64_msvc2017_shared
# displayName: 'Windows amd64 MSVC2017 Shared'
# pool:
# vmImage: 'vs2017-win2016'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/setup-python3.yml
# - template: azure-pipelines/install-latest-meson-ninja.yml
# - template: azure-pipelines/windows-install-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
# defaultLibrary: shared
# - template: azure-pipelines/build.yml
# parameters:
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
# - template: azure-pipelines/windows-artifacts.yml
# parameters:
# os: windows
# arch: amd64
# toolchain: msvc2017
# libtype: shared
# libfiles: libui.dll libui.exp libui.lib
# osHeader: ui_windows.h
#
#- job: windows_amd64_msvc2017_static
# displayName: 'Windows amd64 MSVC2017 Static'
# pool:
# vmImage: 'vs2017-win2016'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/setup-python3.yml
# - template: azure-pipelines/install-latest-meson-ninja.yml
# - template: azure-pipelines/windows-install-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
# defaultLibrary: static
# - template: azure-pipelines/build.yml
# parameters:
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
# afterBuild: ren build\meson-out\libui.a libui.lib
# - template: azure-pipelines/windows-artifacts.yml
# parameters:
# os: windows
# arch: amd64
# toolchain: msvc2017
# libtype: static
# libfiles: libui.lib
# osHeader: ui_windows.h
#
## }
#
## mac {
#
## TODO beforeConfigure/beforeBuild: export SDKROOT=$(xcodebuild -version -sdk macosx10.13 Path)?
#
#- job: darwin_amd64_shared
# displayName: 'Darwin amd64 Shared'
# pool:
# vmImage: 'macos-10.13'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/setup-python3.yml
# - template: azure-pipelines/install-latest-meson-ninja.yml
# - template: azure-pipelines/darwin-install-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# defaultLibrary: shared
# - template: azure-pipelines/build.yml
# - template: azure-pipelines/artifacts.yml
# parameters:
# os: darwin
# arch: amd64
# libtype: shared
# libfiles: libui.A.dylib
# osHeader: ui_darwin.h
#
#- job: darwin_amd64_static
# displayName: 'Darwin amd64 Static'
# pool:
# vmImage: 'macos-10.13'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/setup-python3.yml
# - template: azure-pipelines/install-latest-meson-ninja.yml
# - template: azure-pipelines/darwin-install-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# defaultLibrary: static
# - template: azure-pipelines/build.yml
# - template: azure-pipelines/artifacts.yml
# parameters:
# os: darwin
# arch: amd64
# libtype: static
# libfiles: libui.a
# osHeader: ui_darwin.h
#
## }

View File

@ -0,0 +1,28 @@
# 6 april 2019
parameters:
os: ''
arch: ''
libtype: ''
libfiles: ''
osHeader: ''
steps:
- script: |
set -x
pushd build/meson-out
cp ../../ui.h ../../${{ parameters.osHeader }} .
tar czf $(Build.ArtifactStagingDirectory)/libui-$(Build.SourceBranchName)-${{ parameters.os }}-${{ parameters.arch }}-${{ parameters.libtype }}.tgz ${{ parameters.libfiles }} ui.h ${{ parameters.osHeader}}
tar czf $(Build.ArtifactStagingDirectory)/examples-$(Build.SourceBranchName)-${{ parameters.os }}-${{ parameters.arch }}-${{ parameters.libtype }}.tgz $(releaseExamples)
rm ui.h ${{ parameters.osHeader }}
popd
displayName: 'Create Artifacts'
- task: GitHubRelease@0
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
inputs:
gitHubConnection: andlabs
repositoryName: andlabs/libui
action: 'edit'
addChangelog: false
assets: '$(Build.ArtifactStagingDirectory)/*'
assetUploadMode: 'replace'

12
azure-pipelines/build.yml Normal file
View File

@ -0,0 +1,12 @@
# 5 april 2019
parameters:
beforeBuild: ''
afterBuild: ''
steps:
- script: |
${{ parameters.beforeBuild }}
ninja -C build -v
${{ parameters.afterBuild }}
displayName: 'Build'

View File

@ -0,0 +1,43 @@
# 7 april 2019
BEGIN {
RS = ""
FS = "\n +- "
}
/^- job:/ {
for (i = 1; i <= NF; i++) {
if (!(i in nextindex)) {
# fast path for first occurrence
lines[i, 0] = $i
nextindex[i] = 1
if (maxIndex < i)
maxIndex = i
continue
}
found = 0
for (j = 0; j < nextindex[i]; j++)
if (lines[i, j] == $i) {
found = 1
break
}
if (!found) {
lines[i, nextindex[i]] = $i
nextindex[i]++
}
}
}
END {
for (i = 1; i <= maxIndex; i++) {
if (nextindex[i] == 1) {
# only one entry here, just print it
print "- " lines[i, 0]
continue
}
print "{"
for (j = 0; j < nextindex[i]; j++)
print "- " lines[i, j]
print "}"
}
}

298
azure-pipelines/collapsed Normal file
View File

@ -0,0 +1,298 @@
{
- - job: linux_386_shared
displayName: 'Linux 386 Shared'
pool:
vmImage: 'ubuntu-16.04'
workspace:
clean: all
steps:
- - job: linux_386_static
displayName: 'Linux 386 Static'
pool:
vmImage: 'ubuntu-16.04'
workspace:
clean: all
steps:
- - job: linux_amd64_shared
displayName: 'Linux amd64 Shared'
pool:
vmImage: 'ubuntu-16.04'
workspace:
clean: all
steps:
- - job: linux_amd64_static
displayName: 'Linux amd64 Static'
pool:
vmImage: 'ubuntu-16.04'
workspace:
clean: all
steps:
- - job: windows_386_msvc2015_shared
displayName: 'Windows 386 MSVC2015 Shared'
pool:
vmImage: 'vs2015-win2012r2'
workspace:
clean: all
steps:
- - job: windows_386_msvc2015_static
displayName: 'Windows 386 MSVC2015 Static'
pool:
vmImage: 'vs2015-win2012r2'
workspace:
clean: all
steps:
- - job: windows_amd64_msvc2015_shared
displayName: 'Windows amd64 MSVC2015 Shared'
pool:
vmImage: 'vs2015-win2012r2'
workspace:
clean: all
steps:
- - job: windows_amd64_msvc2015_static
displayName: 'Windows amd64 MSVC2015 Static'
pool:
vmImage: 'vs2015-win2012r2'
workspace:
clean: all
steps:
- - job: windows_386_msvc2017_shared
displayName: 'Windows 386 MSVC2017 Shared'
pool:
vmImage: 'vs2017-win2016'
workspace:
clean: all
steps:
- - job: windows_386_msvc2017_static
displayName: 'Windows 386 MSVC2017 Static'
pool:
vmImage: 'vs2017-win2016'
workspace:
clean: all
steps:
- - job: windows_amd64_msvc2017_shared
displayName: 'Windows amd64 MSVC2017 Shared'
pool:
vmImage: 'vs2017-win2016'
workspace:
clean: all
steps:
- - job: windows_amd64_msvc2017_static
displayName: 'Windows amd64 MSVC2017 Static'
pool:
vmImage: 'vs2017-win2016'
workspace:
clean: all
steps:
- - job: darwin_amd64_shared
displayName: 'Darwin amd64 Shared'
pool:
vmImage: 'macos-10.13'
workspace:
clean: all
steps:
- - job: darwin_amd64_static
displayName: 'Darwin amd64 Static'
pool:
vmImage: 'macos-10.13'
workspace:
clean: all
steps:
}
{
- template: azure-pipelines/setup-python3.yml
- template: azure-pipelines/vs2015-install-python3.yml
}
- template: azure-pipelines/install-latest-meson-ninja.yml
{
- template: azure-pipelines/linux-386-install-gtk-dev.yml
- template: azure-pipelines/linux-install-gtk-dev.yml
- template: azure-pipelines/windows-install-ninja.yml
- template: azure-pipelines/darwin-install-ninja.yml
}
{
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
defaultLibrary: shared
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
defaultLibrary: static
- template: azure-pipelines/configure.yml
parameters:
defaultLibrary: shared
- template: azure-pipelines/configure.yml
parameters:
defaultLibrary: static
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
defaultLibrary: shared
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
defaultLibrary: static
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
defaultLibrary: shared
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
defaultLibrary: static
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
defaultLibrary: shared
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
defaultLibrary: static
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
defaultLibrary: shared
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
defaultLibrary: static
}
{
- template: azure-pipelines/build.yml
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
afterBuild: ren build\meson-out\libui.a libui.lib
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
afterBuild: ren build\meson-out\libui.a libui.lib
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
afterBuild: ren build\meson-out\libui.a libui.lib
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
afterBuild: ren build\meson-out\libui.a libui.lib
}
{
- template: azure-pipelines/artifacts.yml
parameters:
os: linux
arch: 386
libtype: shared
libfiles: libui.so.0
osHeader: ui_unix.h
- template: azure-pipelines/artifacts.yml
parameters:
os: linux
arch: 386
libtype: static
libfiles: libui.a
osHeader: ui_unix.h
- template: azure-pipelines/artifacts.yml
parameters:
os: linux
arch: amd64
libtype: shared
libfiles: libui.so.0
osHeader: ui_unix.h
- template: azure-pipelines/artifacts.yml
parameters:
os: linux
arch: amd64
libtype: static
libfiles: libui.a
osHeader: ui_unix.h
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: 386
toolchain: msvc2015
libtype: shared
libfiles: libui.dll libui.exp libui.lib
osHeader: ui_windows.h
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: 386
toolchain: msvc2015
libtype: static
libfiles: libui.lib
osHeader: ui_windows.h
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: amd64
toolchain: msvc2015
libtype: shared
libfiles: libui.dll libui.exp libui.lib
osHeader: ui_windows.h
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: amd64
toolchain: msvc2015
libtype: static
libfiles: libui.lib
osHeader: ui_windows.h
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: 386
toolchain: msvc2017
libtype: shared
libfiles: libui.dll libui.exp libui.lib
osHeader: ui_windows.h
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: 386
toolchain: msvc2017
libtype: static
libfiles: libui.lib
osHeader: ui_windows.h
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: amd64
toolchain: msvc2017
libtype: shared
libfiles: libui.dll libui.exp libui.lib
osHeader: ui_windows.h
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: amd64
toolchain: msvc2017
libtype: static
libfiles: libui.lib
osHeader: ui_windows.h
- template: azure-pipelines/artifacts.yml
parameters:
os: darwin
arch: amd64
libtype: shared
libfiles: libui.A.dylib
osHeader: ui_darwin.h
- template: azure-pipelines/artifacts.yml
parameters:
os: darwin
arch: amd64
libtype: static
libfiles: libui.a
osHeader: ui_darwin.h
}

View File

@ -0,0 +1,11 @@
# 5 april 2019
parameters:
beforeConfigure: ''
defaultLibrary: 'must-be-set'
steps:
- script: |
${{ parameters.beforeConfigure }}
meson setup build --buildtype=release --default-library=${{ parameters.defaultLibrary }}
displayName: 'Configure'

View File

@ -0,0 +1,13 @@
# 5 april 2019
# because brew install is also slow (it runs an update task first)
steps:
- script: |
sudo mkdir -p /opt/ninja
pushd /opt/ninja
sudo wget https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-mac.zip
sudo unzip ninja-mac.zip
sudo chmod a+rx ninja
popd
echo '##vso[task.prependpath]/opt/ninja'
displayName: 'Install Ninja'

View File

@ -0,0 +1,9 @@
# 4 april 2019
# TODO remove ninja installation from non-Linux OSs and make the same ninja via pip change in the AppVeyor script
steps:
- script: |
python -m pip install --upgrade pip setuptools wheel
pip install meson ninja
displayName: 'Install Latest Meson and Ninja'

View File

@ -0,0 +1,17 @@
# 7 april 2019
# TODO figure out how to get meson to recognize the compiler is producing 32-bit output
steps:
- script: |
# Azure Pipelines ships with a patched version of this and that patch is only available on 64-bit systems, so trying to install the 32-bit versions will remove the 64-bit versions outright
# This is a dependency of Mesa, so we'll have to downgrade to the stock distro ones :/
llvmPackages=
for i in libllvm6.0 clang-6.0 libclang-common-6.0-dev liblldb-6.0 liblldb-6.0-dev lld-6.0 lldb-6.0 llvm-6.0-dev python-lldb-6.0 libclang1-6.0 llvm-6.0 llvm-6.0-runtime; do llvmPackages="$llvmPackages $i=1:6.0-1ubuntu2~16.04.1"; done
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install --allow-downgrades \
gcc-multilib g++-multilib \
$llvmPackages \
libgtk-3-dev:i386
displayName: 'Install GTK+ Dev Files'

View File

@ -0,0 +1,6 @@
# 7 april 2019
steps:
- script: |
sudo apt-get install libgtk-3-dev
displayName: 'Install GTK+ Dev Files'

View File

@ -0,0 +1,7 @@
# 4 april 2019
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.6'
architecture: 'x64'

View File

@ -0,0 +1,10 @@
# 4 april 2019
# see https://github.com/Microsoft/azure-pipelines-image-generation/issues/374 for context and source
steps:
- script: |
powershell -Command "Invoke-WebRequest https://www.python.org/ftp/python/3.7.1/python-3.7.1-amd64-webinstall.exe -OutFile C:\py3-setup.exe"
C:\py3-setup.exe /quiet PrependPath=0 InstallAllUsers=0 Include_launcher=0 InstallLauncherAllUsers=0 Include_test=0 Include_doc=0 Include_dev=0 Include_debug=0 Include_tcltk=0 TargetDir=C:\Python37
@echo ##vso[task.prependpath]C:\Python37
@echo ##vso[task.prependpath]C:\Python37\Scripts
displayName: 'Install Python 3'

View File

@ -0,0 +1,28 @@
# 6 april 2019
parameters:
os: ''
arch: ''
toolchain: ''
libtype: ''
libfiles: ''
osHeader: ''
steps:
- powershell: |
pushd build\meson-out
Copy-Item @("..\..\ui.h","..\..\${{ parameters.osHeader }}") -Destination .
Compress-Archive -Destination $(Build.ArtifactStagingDirectory)\libui-$(Build.SourceBranchName)-${{ parameters.os }}-${{ parameters.arch }}-${{ parameters.toolchain }}-${{ parameters.libtype }}.zip -Path @("${{ parameters.libfiles }}".Split(" ") + @("ui.h","${{ parameters.osHeader}}"))
Compress-Archive -Destination $(Build.ArtifactStagingDirectory)\examples-$(Build.SourceBranchName)-${{ parameters.os }}-${{ parameters.arch }}-${{ parameters.libtype }}.zip -Path @("$(releaseExamples)".Split(" ") | % {$_ + ".exe"})
Remove-Item @("ui.h","${{ parameters.osHeader }}")
popd
displayName: 'Create Artifacts'
- task: GitHubRelease@0
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
inputs:
gitHubConnection: andlabs
repositoryName: andlabs/libui
action: 'edit'
addChangelog: false
assets: '$(Build.ArtifactStagingDirectory)/*'
assetUploadMode: 'replace'

View File

@ -0,0 +1,10 @@
# 4 april 2019
# why this? because choco isn't available on the VS2015 image and is extremely slow on the VS2017 one (it should not take 2.5 minutes to install just ninja!)
steps:
- script: |
powershell -Command "Invoke-WebRequest https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-win.zip -OutFile C:\ninja-win.zip"
mkdir C:\ninja
powershell -Command "Expand-Archive -LiteralPath C:\ninja-win.zip -DestinationPath C:\ninja"
@echo ##vso[task.prependpath]C:\ninja
displayName: 'Install Ninja'

View File

@ -1,23 +0,0 @@
# 3 june 2016
list(APPEND _LIBUI_SOURCES
common/attribute.c
common/attrlist.c
common/attrstr.c
common/areaevents.c
common/control.c
common/debug.c
common/matrix.c
common/opentype.c
common/shouldquit.c
common/tablemodel.c
common/tablevalue.c
common/userbugs.c
common/utf.c
)
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
list(APPEND _LIBUI_INCLUDEDIRS
common
)
set(_LIBUI_INCLUDEDIRS ${_LIBUI_INCLUDEDIRS} PARENT_SCOPE)

17
common/meson.build Normal file
View File

@ -0,0 +1,17 @@
# 23 march 2019
libui_sources += [
'common/attribute.c',
'common/attrlist.c',
'common/attrstr.c',
'common/areaevents.c',
'common/control.c',
'common/debug.c',
'common/matrix.c',
'common/opentype.c',
'common/shouldquit.c',
'common/tablemodel.c',
'common/tablevalue.c',
'common/userbugs.c',
'common/utf.c',
]

View File

@ -1,64 +0,0 @@
# 3 june 2016
list(APPEND _LIBUI_SOURCES
darwin/aat.m
darwin/alloc.m
darwin/area.m
darwin/areaevents.m
darwin/attrstr.m
darwin/autolayout.m
darwin/box.m
darwin/button.m
darwin/checkbox.m
darwin/colorbutton.m
darwin/combobox.m
darwin/control.m
darwin/datetimepicker.m
darwin/debug.m
darwin/draw.m
darwin/drawtext.m
darwin/editablecombo.m
darwin/entry.m
darwin/fontbutton.m
darwin/fontmatch.m
darwin/fonttraits.m
darwin/fontvariation.m
darwin/form.m
darwin/future.m
darwin/graphemes.m
darwin/grid.m
darwin/group.m
darwin/image.m
darwin/label.m
darwin/main.m
darwin/map.m
darwin/menu.m
darwin/multilineentry.m
darwin/opentype.m
darwin/progressbar.m
darwin/radiobuttons.m
darwin/scrollview.m
darwin/separator.m
darwin/slider.m
darwin/spinbox.m
darwin/stddialogs.m
darwin/tab.m
darwin/table.m
darwin/tablecolumn.m
darwin/text.m
darwin/undocumented.m
darwin/util.m
darwin/window.m
darwin/winmoveresize.m
)
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
# TODO is this correct?
list(APPEND _LIBUI_INCLUDEDIRS
darwin
)
set(_LIBUI_INCLUDEDIRS _LIBUI_INCLUDEDIRS PARENT_SCOPE)
set(_LIBUI_LIBS
objc "-framework Foundation" "-framework AppKit"
PARENT_SCOPE)

64
darwin/meson.build Normal file
View File

@ -0,0 +1,64 @@
# 23 march 2019
libui_sources += [
'darwin/aat.m',
'darwin/alloc.m',
'darwin/area.m',
'darwin/areaevents.m',
'darwin/attrstr.m',
'darwin/autolayout.m',
'darwin/box.m',
'darwin/button.m',
'darwin/checkbox.m',
'darwin/colorbutton.m',
'darwin/combobox.m',
'darwin/control.m',
'darwin/datetimepicker.m',
'darwin/debug.m',
'darwin/draw.m',
'darwin/drawtext.m',
'darwin/editablecombo.m',
'darwin/entry.m',
'darwin/fontbutton.m',
'darwin/fontmatch.m',
'darwin/fonttraits.m',
'darwin/fontvariation.m',
'darwin/form.m',
'darwin/future.m',
'darwin/graphemes.m',
'darwin/grid.m',
'darwin/group.m',
'darwin/image.m',
'darwin/label.m',
'darwin/main.m',
'darwin/map.m',
'darwin/menu.m',
'darwin/multilineentry.m',
'darwin/opentype.m',
'darwin/progressbar.m',
'darwin/radiobuttons.m',
'darwin/scrollview.m',
'darwin/separator.m',
'darwin/slider.m',
'darwin/spinbox.m',
'darwin/stddialogs.m',
'darwin/tab.m',
'darwin/table.m',
'darwin/tablecolumn.m',
'darwin/text.m',
'darwin/undocumented.m',
'darwin/util.m',
'darwin/window.m',
'darwin/winmoveresize.m',
]
libui_deps += [
meson.get_compiler('objc').find_library('objc',
required: true),
dependency('appleframeworks',
modules: ['Foundation', 'AppKit'],
required: true),
]
libui_soversion = 'A'
# the / is required by some older versions of OS X
libui_rpath = '@executable_path/'

View File

@ -1,62 +0,0 @@
# 3 june 2016
if(WIN32)
set(_EXAMPLE_RESOURCES_RC resources.rc)
endif()
macro(_add_example _name)
_add_exec(${_name} ${ARGN})
# because Microsoft's toolchain is dumb
if(MSVC)
set_property(TARGET ${_name} APPEND_STRING PROPERTY
LINK_FLAGS " /ENTRY:mainCRTStartup")
endif()
endmacro()
_add_example(controlgallery
controlgallery/main.c
${_EXAMPLE_RESOURCES_RC}
)
_add_example(histogram
histogram/main.c
${_EXAMPLE_RESOURCES_RC}
)
_add_example(cpp-multithread
cpp-multithread/main.cpp
${_EXAMPLE_RESOURCES_RC}
)
if(NOT WIN32)
target_link_libraries(cpp-multithread pthread)
endif()
if(APPLE)
# since we use a deployment target of 10.8, the non-C++11-compliant libstdc++ is chosen by default; we need C++11
# see issue #302 for more details
target_compile_options(cpp-multithread PRIVATE --stdlib=libc++)
target_link_libraries(cpp-multithread --stdlib=libc++)
endif()
_add_example(drawtext
drawtext/main.c
${_EXAMPLE_RESOURCES_RC}
)
_add_example(timer
timer/main.c
${_EXAMPLE_RESOURCES_RC}
)
_add_example(datetime
datetime/main.c
${_EXAMPLE_RESOURCES_RC}
)
add_custom_target(examples
DEPENDS
controlgallery
histogram
cpp-multithread
drawtext
timer
datetime)

61
examples/meson.build Normal file
View File

@ -0,0 +1,61 @@
# 24 march 2019
libui_example_sources = []
libui_example_link_args = []
libui_example_cpp_extra_args = []
if libui_OS == 'windows'
libui_example_manifest = 'example.manifest'
if libui_mode == 'static'
libui_example_manifest = 'example.static.manifest'
endif
libui_example_sources += [
windows.compile_resources('resources.rc',
args: libui_manifest_args,
depend_files: [libui_example_manifest]),
]
# because Microsoft's toolchain is dumb
if libui_MSVC
libui_example_link_args += ['/ENTRY:mainCRTStartup']
endif
elif libui_OS == 'darwin'
# since we use a deployment target of 10.8, the non-C++11-compliant libstdc++ is chosen by default; we need C++11
# see issue #302 for more details
libui_example_cpp_extra_args += ['--stdlib=libc++']
endif
libui_examples = {
'controlgallery': {
'sources': ['controlgallery/main.c'],
},
'histogram': {
'sources': ['histogram/main.c'],
},
'cpp-multithread': {
'sources': ['cpp-multithread/main.cpp'],
'deps': [
dependency('threads',
required: true),
],
'cpp_args': libui_example_cpp_extra_args,
'link_args': libui_example_cpp_extra_args,
},
'drawtext': {
'sources': ['drawtext/main.c'],
},
'timer': {
'sources': ['timer/main.c'],
},
'datetime': {
'sources': ['datetime/main.c'],
},
}
foreach name, args : libui_examples
# TODO once we upgrade to 0.49.0, add pie: true
executable(name, args['sources'] + libui_example_sources,
dependencies: args.get('deps', []) + libui_binary_deps,
link_with: libui_libui,
cpp_args: args.get('cpp_args', []),
link_args: args.get('link_args', []) + libui_example_link_args,
gui_app: false,
install: false)
endforeach

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module go.wit.com/dev/andlabs/libui
go 1.21.4

176
meson.build Normal file
View File

@ -0,0 +1,176 @@
# 17 march 2019
# TODO I'm not sure how to allow building 32-bit instead of 64-bit with meson
# TODO remove cpp from this list once https://github.com/mesonbuild/meson/issues/5181 is settled; move it to the OS checks and under cpp-multithread
project('libui', ['c', 'cpp'],
meson_version: '>=0.48.0',
default_options: [
'buildtype=debug', # build debug by default
'default_library=shared', # build shared libraries by default
'layout=flat', # keep all outputs together by default
# these are forced options, but meson doesn't let me set these up separately before I call project() (TODO https://github.com/mesonbuild/meson/issues/5179)
'warning_level=3', # always max warnings
'b_pch=false', # we don't want precompiled headers
'b_staticpic=true', # use PIC even for static libraries
'c_std=c99', # strict C99
'c_winlibs=', # we define our own Windows libraries
'cpp_std=c++11', # strict C++11
'cpp_eh=sc', # shut the compiler up in some cases
'cpp_winlibs=', # likewise as with c_winlibs
],
license: 'MIT')
# TODO after https://github.com/mesonbuild/meson/issues/5179 is settled, remove these
libui_OS = host_machine.system()
libui_MSVC = meson.get_compiler('c').get_id() == 'msvc'
# TODO switch to tabs; the spaces are just so I can share this file while I'm writing it
libui_forced_options = {
'warning_level': '3', # always max warnings
'b_pch': 'false', # we don't want precompiled headers
'b_staticpic': 'true', # use PIC even for static libraries
'c_std': 'c99', # strict C99
'c_winlibs': '[]', # we define our own Windows libraries
'cpp_std': 'c++11', # strict C++11
'cpp_eh': 'sc', # shut the compiler up in some cases
'cpp_winlibs': '[]', # likewise as with c_winlibs
}
foreach name, value : libui_forced_options
# TODO rewrite this when https://github.com/mesonbuild/meson/issues/5181 is settled
if not ((name == 'c_winlibs' or name == 'cpp_eh' or name == 'cpp_winlibs') and not libui_MSVC) and not (name == 'c_std' and libui_MSVC)
actual = '@0@'.format(get_option(name))
if actual != value
error('sorry, but libui requires that option ' + name + ' has the default value ' + value)
endif
endif
endforeach
libui_OS = host_machine.system()
libui_MSVC = meson.get_compiler('c').get_id() == 'msvc'
if libui_OS == 'darwin'
add_languages('objc',
required: true)
endif
libui_mode = get_option('default_library')
if libui_mode == 'both'
error('sorry, but libui does not support building both shared and static libraries at the same time, because Windows resource file rules differ between the two')
endif
libui_is_debug = get_option('buildtype').startswith('debug')
libui_project_compile_args = []
libui_project_link_args = []
if libui_OS == 'darwin'
libui_macosx_version_min = '-mmacosx-version-min=10.8'
libui_project_compile_args += [libui_macosx_version_min]
libui_project_link_args += [libui_macosx_version_min]
endif
if libui_MSVC
# TODO subsystem version
libui_project_compile_args += [
'/wd4100',
'/bigobj',
]
if libui_is_debug
libui_project_compile_args += ['/RTC1', '/RTCs', '/RTCu']
endif
libui_project_link_args += [
'/LARGEADDRESSAWARE',
'/INCREMENTAL:NO',
'/MANIFEST:NO',
]
# TODO autogenerate a .def file?
else
libui_project_compile_args += [
'-Wno-unused-parameter',
'-Wno-switch',
]
if libui_OS == 'windows'
# don't require shipping the MinGW-w64 DLLs
libui_project_link_args += [
'-static',
'-static-libgcc',
'-static-libstdc++',
]
endif
endif
# TODO come up with a better way to do this, both for libui (the compiler define, used by winapi.hpp, and the manifest args) and for the binaries (the manifest args)
# TODO (after the above TODO is resolved) move that below the part below that actually adds these arguments
libui_manifest_args = []
if libui_mode == 'static'
libui_project_compile_args += ['-D_UI_STATIC']
libui_manifest_args = ['-D_UI_STATIC']
endif
add_project_arguments(libui_project_compile_args,
language: ['c', 'cpp', 'objc'])
add_project_link_arguments(libui_project_link_args,
language: ['c', 'cpp', 'objc'])
# TODO:
# meson determins whether -Wl,--no-undefined is provided via
# built-in option b_lundef, and it's true by default, which is what
# we want (so I don't make mistakes like asking for unknown
# functions in my dependencies). However, meson also is smart
# about specifying this properly on systems that don't support it, like
# FreeBSD (where I had the comment "figure out why FreeBSD
# follows linked libraries here" when I was on cmake) and OpenBSD
# (according to someone on freenode #mesonbuild), but it isn't clear
# whether it's just ignored or if the value is forced to false.
# Therefore, once this is determined, we can uncomment the
# following.
libui_libui_link_args = []
#if not libui_MSVC and get_option("b_lundef")
# TODO what should this be on MSVC?
# libui_libui_link_args += ['-Wl,--no-allow-shlib-undefined']
#endif
libui_sources = []
libui_deps = []
libui_soversion = ''
libui_rpath = ''
subdir('common')
if libui_OS == 'windows'
subdir('windows')
install_headers('ui_windows.h')
elif libui_OS == 'darwin'
subdir('darwin')
install_headers('ui_darwin.h')
else
subdir('unix')
install_headers('ui_unix.h')
endif
libui_libui = library('ui', libui_sources,
dependencies: libui_deps,
build_rpath: libui_rpath,
install_rpath: libui_rpath,
name_prefix: 'lib', # always call it libui, even in Windows DLLs
install: true,
gnu_symbol_visibility: 'hidden',
c_args: ['-Dlibui_EXPORTS'],
cpp_args: ['-Dlibui_EXPORTS'],
objc_args: ['-Dlibui_EXPORTS'],
link_args: libui_libui_link_args,
soversion: libui_soversion,
darwin_versions: []) # TODO
install_headers('ui.h')
# TODO when the API is stable enough to be versioned, create a pkg-config file (https://mesonbuild.com/Pkgconfig-module.html) and a declare_dependency() section too
libui_binary_deps = []
if libui_mode == 'static'
libui_binary_deps = libui_deps
endif
subdir('test')
subdir('examples')

View File

@ -1,40 +0,0 @@
# 3 june 2016
if(WIN32)
set(_TEST_RESOURCES_RC resources.rc)
endif()
_add_exec(tester
drawtests.c
images.c
main.c
menus.c
page1.c
page2.c
page3.c
page4.c
page5.c
page6.c
page7.c
page7a.c
page7b.c
page7c.c
# page8.c
# page9.c
# page10.c
page11.c
page12.c
page13.c
page14.c
page15.c
page16.c
spaced.c
${_TEST_RESOURCES_RC}
)
target_include_directories(tester
PRIVATE test
)
set_target_properties(tester PROPERTIES
OUTPUT_NAME test
WIN32_EXECUTABLE FALSE
)

48
test/meson.build Normal file
View File

@ -0,0 +1,48 @@
# 23 march 2019
libui_test_sources = [
'drawtests.c',
'images.c',
'main.c',
'menus.c',
'page1.c',
'page2.c',
'page3.c',
'page4.c',
'page5.c',
'page6.c',
'page7.c',
'page7a.c',
'page7b.c',
'page7c.c',
# 'page8.c',
# 'page9.c',
# 'page10.c',
'page11.c',
'page12.c',
'page13.c',
'page14.c',
'page15.c',
'page16.c',
'spaced.c',
]
if libui_OS == 'windows'
libui_test_manifest = 'test.manifest'
if libui_mode == 'static'
libui_test_manifest = 'test.static.manifest'
endif
libui_test_sources += [
windows.compile_resources('resources.rc',
args: libui_manifest_args,
depend_files: [libui_test_manifest]),
]
endif
# TODO meson doesn't let us name this target test, but also doesn't seem to provide a way to override the executable name???? we'll probably need to file a feature request for this
# TODO once we upgrade to 0.49.0, add pie: true
executable('tester', libui_test_sources,
dependencies: libui_binary_deps,
link_with: libui_libui,
gui_app: false,
install: false)

View File

@ -1,66 +0,0 @@
# 3 june 2016
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED gtk+-3.0)
list(APPEND _LIBUI_SOURCES
unix/alloc.c
unix/area.c
unix/attrstr.c
unix/box.c
unix/button.c
unix/cellrendererbutton.c
unix/checkbox.c
unix/child.c
unix/colorbutton.c
unix/combobox.c
unix/control.c
unix/datetimepicker.c
unix/debug.c
unix/draw.c
unix/drawmatrix.c
unix/drawpath.c
unix/drawtext.c
unix/editablecombo.c
unix/entry.c
unix/fontbutton.c
unix/fontmatch.c
unix/form.c
unix/future.c
unix/graphemes.c
unix/grid.c
unix/group.c
unix/image.c
unix/label.c
unix/main.c
unix/menu.c
unix/multilineentry.c
unix/opentype.c
unix/progressbar.c
unix/radiobuttons.c
unix/separator.c
unix/slider.c
unix/spinbox.c
unix/stddialogs.c
unix/tab.c
unix/table.c
unix/tablemodel.c
unix/text.c
unix/util.c
unix/window.c
)
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
list(APPEND _LIBUI_INCLUDEDIRS
unix
)
set(_LIBUI_INCLUDEDIRS _LIBUI_INCLUDEDIRS PARENT_SCOPE)
# TODO the other variables don't work?
set(_LIBUI_CFLAGS
${GTK_CFLAGS}
PARENT_SCOPE)
set(_LIBUI_LIBS
${GTK_LDFLAGS} m ${CMAKE_DL_LIBS}
PARENT_SCOPE)

View File

@ -248,6 +248,9 @@ static gboolean areaWidget_button_press_event(GtkWidget *w, GdkEventButton *e)
// clicking doesn't automatically transfer keyboard focus; we must do so manually (thanks tristan in irc.gimp.net/#gtk+) // clicking doesn't automatically transfer keyboard focus; we must do so manually (thanks tristan in irc.gimp.net/#gtk+)
gtk_widget_grab_focus(w); gtk_widget_grab_focus(w);
me.Down = e->button;
me.Up = 0;
// we handle multiple clicks ourselves here, in the same way as we do on Windows // we handle multiple clicks ourselves here, in the same way as we do on Windows
if (e->type != GDK_BUTTON_PRESS) if (e->type != GDK_BUTTON_PRESS)
// ignore GDK's generated double-clicks and beyond // ignore GDK's generated double-clicks and beyond
@ -266,9 +269,6 @@ static gboolean areaWidget_button_press_event(GtkWidget *w, GdkEventButton *e)
e->time, maxTime, e->time, maxTime,
maxDistance, maxDistance); maxDistance, maxDistance);
me.Down = e->button;
me.Up = 0;
// and set things up for window drags // and set things up for window drags
a->dragevent = e; a->dragevent = e;
finishMouseEvent(a, &me, e->button, e->x, e->y, e->state, e->window); finishMouseEvent(a, &me, e->button, e->x, e->y, e->state, e->window);

62
unix/meson.build Normal file
View File

@ -0,0 +1,62 @@
# 23 march 2019
libui_sources += [
'unix/alloc.c',
'unix/area.c',
'unix/attrstr.c',
'unix/box.c',
'unix/button.c',
'unix/cellrendererbutton.c',
'unix/checkbox.c',
'unix/child.c',
'unix/colorbutton.c',
'unix/combobox.c',
'unix/control.c',
'unix/datetimepicker.c',
'unix/debug.c',
'unix/draw.c',
'unix/drawmatrix.c',
'unix/drawpath.c',
'unix/drawtext.c',
'unix/editablecombo.c',
'unix/entry.c',
'unix/fontbutton.c',
'unix/fontmatch.c',
'unix/form.c',
'unix/future.c',
'unix/graphemes.c',
'unix/grid.c',
'unix/group.c',
'unix/image.c',
'unix/label.c',
'unix/main.c',
'unix/menu.c',
'unix/multilineentry.c',
'unix/opentype.c',
'unix/progressbar.c',
'unix/radiobuttons.c',
'unix/separator.c',
'unix/slider.c',
'unix/spinbox.c',
'unix/stddialogs.c',
'unix/tab.c',
'unix/table.c',
'unix/tablemodel.c',
'unix/text.c',
'unix/util.c',
'unix/window.c',
]
libui_deps += [
dependency('gtk+-3.0',
version: '>=3.10.0',
method: 'pkg-config',
required: true),
# We specify these as not required because some Unix systems include them with libc instead of providing them as separate files (thanks textshell and jpakkane in freenode #mesonbuild)
meson.get_compiler('c').find_library('m',
required: false),
meson.get_compiler('c').find_library('dl',
required: false),
]
libui_soversion = '0'
libui_rpath = '$ORIGIN'

View File

@ -62,6 +62,7 @@ static void setEditable(uiTableModel *m, GtkTreeIter *iter, int modelColumn, Gtk
// TODO avoid the need for this // TODO avoid the need for this
path = gtk_tree_model_get_path(GTK_TREE_MODEL(m), iter); path = gtk_tree_model_get_path(GTK_TREE_MODEL(m), iter);
row = gtk_tree_path_get_indices(path)[0]; row = gtk_tree_path_get_indices(path)[0];
gtk_tree_path_free(path);
editable = uiprivTableModelCellEditable(m, row, modelColumn) != 0; editable = uiprivTableModelCellEditable(m, row, modelColumn) != 0;
g_object_set(r, prop, editable, NULL); g_object_set(r, prop, editable, NULL);
} }
@ -256,6 +257,7 @@ static void progressBarColumnDataFunc(GtkTreeViewColumn *c, GtkCellRenderer *r,
// TODO avoid the need for this // TODO avoid the need for this
path = gtk_tree_model_get_path(GTK_TREE_MODEL(m), iter); path = gtk_tree_model_get_path(GTK_TREE_MODEL(m), iter);
rc->row = gtk_tree_path_get_indices(path)[0]; rc->row = gtk_tree_path_get_indices(path)[0];
gtk_tree_path_free(path);
rc->col = p->modelColumn; rc->col = p->modelColumn;
val = (gint *) g_hash_table_lookup(p->t->indeterminatePositions, rc); val = (gint *) g_hash_table_lookup(p->t->indeterminatePositions, rc);
if (pval == -1) { if (pval == -1) {

View File

@ -1,94 +0,0 @@
# 3 june 2016
list(APPEND _LIBUI_SOURCES
windows/alloc.cpp
windows/area.cpp
windows/areadraw.cpp
windows/areaevents.cpp
windows/areascroll.cpp
windows/areautil.cpp
windows/attrstr.cpp
windows/box.cpp
windows/button.cpp
windows/checkbox.cpp
windows/colorbutton.cpp
windows/colordialog.cpp
windows/combobox.cpp
windows/container.cpp
windows/control.cpp
windows/d2dscratch.cpp
windows/datetimepicker.cpp
windows/debug.cpp
windows/draw.cpp
windows/drawmatrix.cpp
windows/drawpath.cpp
windows/drawtext.cpp
windows/dwrite.cpp
windows/editablecombo.cpp
windows/entry.cpp
windows/events.cpp
windows/fontbutton.cpp
windows/fontdialog.cpp
windows/fontmatch.cpp
windows/form.cpp
windows/graphemes.cpp
windows/grid.cpp
windows/group.cpp
windows/image.cpp
windows/init.cpp
windows/label.cpp
windows/main.cpp
windows/menu.cpp
windows/multilineentry.cpp
windows/opentype.cpp
windows/parent.cpp
windows/progressbar.cpp
windows/radiobuttons.cpp
windows/separator.cpp
windows/sizing.cpp
windows/slider.cpp
windows/spinbox.cpp
windows/stddialogs.cpp
windows/tab.cpp
windows/table.cpp
windows/tabledispinfo.cpp
windows/tabledraw.cpp
windows/tableediting.cpp
windows/tablemetrics.cpp
windows/tabpage.cpp
windows/text.cpp
windows/utf16.cpp
windows/utilwin.cpp
windows/window.cpp
windows/winpublic.cpp
windows/winutil.cpp
)
# resources.rc only contains the libui manifest.
# For a DLL, we have to include this directly, so we do so.
# Windows won't link resources in static libraries, so including this would have no effect.
# In those cases, we just need them to include the manifest with the executable (or link it directly into the output executable themselves); they can also customize the manifest as they see fit (assuming nothing breaks in the process).
# TODO make sure this gets added to both binary-only archives and install rules in this case
if(BUILD_SHARED_LIBS)
list(APPEND _LIBUI_SOURCES
windows/resources.rc
)
endif()
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
list(APPEND _LIBUI_INCLUDEDIRS
windows
)
set(_LIBUI_INCLUDEDIRS _LIBUI_INCLUDEDIRS PARENT_SCOPE)
# TODO prune this list
set(_LIBUI_LIBS
user32 kernel32 gdi32 comctl32 uxtheme msimg32 comdlg32 d2d1 dwrite ole32 oleaut32 oleacc uuid windowscodecs
PARENT_SCOPE)
if(NOT MSVC)
if(BUILD_SHARED_LIBS)
message(FATAL_ERROR
"Sorry, but libui for Windows can currently only be built as a static library with MinGW. You will need to either build as a static library or switch to MSVC."
)
endif()
endif()

View File

@ -16,7 +16,7 @@
// get Windows version right; right now Windows Vista // get Windows version right; right now Windows Vista
// unless otherwise stated, all values from Microsoft's sdkddkver.h // unless otherwise stated, all values from Microsoft's sdkddkver.h
// TODO is all of this necessary? how is NTDDI_VERSION used? // TODO is all of this necessary? how is NTDDI_VERSION used?
// TODO plaform update sp2 // TODO platform update sp2
#define WINVER 0x0600 /* from Microsoft's winnls.h */ #define WINVER 0x0600 /* from Microsoft's winnls.h */
#define _WIN32_WINNT 0x0600 #define _WIN32_WINNT 0x0600
#define _WIN32_WINDOWS 0x0600 /* from Microsoft's pdh.h */ #define _WIN32_WINDOWS 0x0600 /* from Microsoft's pdh.h */

View File

@ -314,7 +314,7 @@ static void drawGrid(ID2D1RenderTarget *rt, D2D1_RECT_F *fillRect)
pformat = rt->GetPixelFormat(); pformat = rt->GetPixelFormat();
#else #else
{ {
typedef D2D1_PIXEL_FORMAT *(__stdcall ID2D1RenderTarget::* GetPixelFormatF)(D2D1_PIXEL_FORMAT *); typedef D2D1_PIXEL_FORMAT *(__stdcall ID2D1RenderTarget::* GetPixelFormatF)(D2D1_PIXEL_FORMAT *) const;
GetPixelFormatF gpf; GetPixelFormatF gpf;
gpf = (GetPixelFormatF) (&(rt->GetPixelFormat)); gpf = (GetPixelFormatF) (&(rt->GetPixelFormat));

View File

@ -19,7 +19,7 @@ HRESULT _logLastError(debugargs, const WCHAR *s)
useFormatted = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, le, 0, (LPWSTR) (&formatted), 0, NULL) != 0; useFormatted = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, le, 0, (LPWSTR) (&formatted), 0, NULL) != 0;
if (!useFormatted) if (!useFormatted)
formatted = L"\n"; formatted = (WCHAR *) L"\n"; // TODO
msg = strf(L"[libui] %s:%s:%s() %s: GetLastError() == %I32u %s", msg = strf(L"[libui] %s:%s:%s() %s: GetLastError() == %I32u %s",
file, line, func, file, line, func,
s, le, formatted); s, le, formatted);
@ -46,7 +46,7 @@ HRESULT _logHRESULT(debugargs, const WCHAR *s, HRESULT hr)
useFormatted = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, hr, 0, (LPWSTR) (&formatted), 0, NULL) != 0; useFormatted = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, hr, 0, (LPWSTR) (&formatted), 0, NULL) != 0;
if (!useFormatted) if (!useFormatted)
formatted = L"\n"; formatted = (WCHAR *) L"\n"; // TODO
msg = strf(L"[libui] %s:%s:%s() %s: HRESULT == 0x%08I32X %s", msg = strf(L"[libui] %s:%s:%s() %s: HRESULT == 0x%08I32X %s",
file, line, func, file, line, func,
s, hr, formatted); s, hr, formatted);

View File

@ -1,6 +1,8 @@
// 20 may 2015 // 20 may 2015
#include "uipriv_windows.hpp" #include "uipriv_windows.hpp"
// TODO no scrollbars? also not sure if true for combobox as well
// we as Common Controls 6 users don't need to worry about the height of comboboxes; see http://blogs.msdn.com/b/oldnewthing/archive/2006/03/10/548537.aspx // we as Common Controls 6 users don't need to worry about the height of comboboxes; see http://blogs.msdn.com/b/oldnewthing/archive/2006/03/10/548537.aspx
struct uiEditableCombobox { struct uiEditableCombobox {

View File

@ -368,7 +368,7 @@ static void fontDialogDrawSampleText(struct fontDialog *f, ID2D1RenderTarget *rt
sample = uiprivFontCollectionCorrectString(f->fc, sampleStrings); sample = uiprivFontCollectionCorrectString(f->fc, sampleStrings);
sampleStrings->Release(); sampleStrings->Release();
} else } else
sample = L"The quick brown fox jumps over the lazy dog."; sample = (WCHAR *) L"The quick brown fox jumps over the lazy dog."; // TODO
// DirectWrite doesn't allow creating a text format from a font; we need to get this ourselves // DirectWrite doesn't allow creating a text format from a font; we need to get this ourselves
family = cbGetItemText(f->familyCombobox, f->curFamily); family = cbGetItemText(f->familyCombobox, f->curFamily);

View File

@ -22,7 +22,7 @@ static const char *initerr(const char *message, const WCHAR *label, DWORD value)
hassysmsg = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, value, 0, (LPWSTR) (&sysmsg), 0, NULL) != 0; hassysmsg = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, value, 0, (LPWSTR) (&sysmsg), 0, NULL) != 0;
if (!hassysmsg) if (!hassysmsg)
sysmsg = L""; sysmsg = (WCHAR *) L""; // TODO
wmessage = toUTF16(message + 1); wmessage = toUTF16(message + 1);
wout = strf(L"-error initializing libui: %s; code %I32d (0x%08I32X) %s", wout = strf(L"-error initializing libui: %s; code %I32d (0x%08I32X) %s",
wmessage, wmessage,

91
windows/meson.build Normal file
View File

@ -0,0 +1,91 @@
# 23 march 2019
windows = import('windows')
libui_sources += [
'windows/alloc.cpp',
'windows/area.cpp',
'windows/areadraw.cpp',
'windows/areaevents.cpp',
'windows/areascroll.cpp',
'windows/areautil.cpp',
'windows/attrstr.cpp',
'windows/box.cpp',
'windows/button.cpp',
'windows/checkbox.cpp',
'windows/colorbutton.cpp',
'windows/colordialog.cpp',
'windows/combobox.cpp',
'windows/container.cpp',
'windows/control.cpp',
'windows/d2dscratch.cpp',
'windows/datetimepicker.cpp',
'windows/debug.cpp',
'windows/draw.cpp',
'windows/drawmatrix.cpp',
'windows/drawpath.cpp',
'windows/drawtext.cpp',
'windows/dwrite.cpp',
'windows/editablecombo.cpp',
'windows/entry.cpp',
'windows/events.cpp',
'windows/fontbutton.cpp',
'windows/fontdialog.cpp',
'windows/fontmatch.cpp',
'windows/form.cpp',
'windows/graphemes.cpp',
'windows/grid.cpp',
'windows/group.cpp',
'windows/image.cpp',
'windows/init.cpp',
'windows/label.cpp',
'windows/main.cpp',
'windows/menu.cpp',
'windows/multilineentry.cpp',
'windows/opentype.cpp',
'windows/parent.cpp',
'windows/progressbar.cpp',
'windows/radiobuttons.cpp',
'windows/separator.cpp',
'windows/sizing.cpp',
'windows/slider.cpp',
'windows/spinbox.cpp',
'windows/stddialogs.cpp',
'windows/tab.cpp',
'windows/table.cpp',
'windows/tabledispinfo.cpp',
'windows/tabledraw.cpp',
'windows/tableediting.cpp',
'windows/tablemetrics.cpp',
'windows/tabpage.cpp',
'windows/text.cpp',
'windows/utf16.cpp',
'windows/utilwin.cpp',
'windows/window.cpp',
'windows/winpublic.cpp',
'windows/winutil.cpp',
]
# resources.rc only contains the libui manifest.
# For a DLL, we have to include this directly, so we do so.
# Windows won't link resources in static libraries, so including this would have no effect.
# In those cases, we just need them to include the manifest with the executable (or link it directly into the output executable themselves); they can also customize the manifest as they see fit (assuming nothing breaks in the process).
if libui_mode == 'shared'
libui_sources += [
windows.compile_resources('resources.rc',
args: libui_manifest_args,
depend_files: ['libui.manifest']),
]
endif
# TODO prune this list
foreach lib : ['user32', 'kernel32', 'gdi32', 'comctl32', 'uxtheme', 'msimg32', 'comdlg32', 'd2d1', 'dwrite', 'ole32', 'oleaut32', 'oleacc', 'uuid', 'windowscodecs']
libui_deps += [
meson.get_compiler('cpp').find_library(lib,
required: true),
]
endforeach
if libui_OS == 'windows' and libui_mode == 'shared' and not libui_MSVC
error('Sorry, but libui for Windows can currently only be built as a static library with MinGW. You will need to either build as a static library or switch to MSVC.')
endif

View File

@ -16,7 +16,7 @@
// get Windows version right; right now Windows Vista // get Windows version right; right now Windows Vista
// unless otherwise stated, all values from Microsoft's sdkddkver.h // unless otherwise stated, all values from Microsoft's sdkddkver.h
// TODO is all of this necessary? how is NTDDI_VERSION used? // TODO is all of this necessary? how is NTDDI_VERSION used?
// TODO plaform update sp2 // TODO platform update sp2
#define WINVER 0x0600 /* from Microsoft's winnls.h */ #define WINVER 0x0600 /* from Microsoft's winnls.h */
#define _WIN32_WINNT 0x0600 #define _WIN32_WINNT 0x0600
#define _WIN32_WINDOWS 0x0600 /* from Microsoft's pdh.h */ #define _WIN32_WINDOWS 0x0600 /* from Microsoft's pdh.h */

View File

@ -144,7 +144,7 @@ D2D1_SIZE_F realGetSize(ID2D1RenderTarget *rt)
return rt->GetSize(); return rt->GetSize();
#else #else
D2D1_SIZE_F size; D2D1_SIZE_F size;
typedef D2D1_SIZE_F *(__stdcall ID2D1RenderTarget::* GetSizeF)(D2D1_SIZE_F *); typedef D2D1_SIZE_F *(__stdcall ID2D1RenderTarget::* GetSizeF)(D2D1_SIZE_F *) const;
GetSizeF gs; GetSizeF gs;
gs = (GetSizeF) (&(rt->GetSize)); gs = (GetSizeF) (&(rt->GetSize));