Skip to content

Instantly share code, notes, and snippets.

The goal is to be able to sketch directly on top of another foreground app with Milton.

To enter screen sketch mode, you launch Milton with a special command line switch. This would also be provided with a shortcut in the Windows Start Menu: In addition to the current "Milton" icon, there'd also be a "Milton Screen Sketch" icon.

When screen sketch mode is entered:

  1. Maximize window, set WS_EX_TOPMOST, and hide system title bar, frame and Milton's own menu.
  2. Implement this SO answer for DWM-accelerated OpenGL window transparency: https://stackoverflow.com/a/4055059
  3. Install a global keyboard hook to toggle whether Milton should be the foreground window. When it's in the foreground it can receive keyboard and tablet events as it usually would. SetForegroundWindow is restricted for security reasons, so this is only possible if a keyboard hook callback counts as the process "receiving the last input event". If this doesn't work, we can just use built-in Windows task switching via the task bar or alt-tabbi
#ifndef __MG_ED25519_H_INCLUDE_GUARD__
#define __MG_ED25519_H_INCLUDE_GUARD__
//#define MG_ED25519_IMPLEMENTATION exactly once, blah blah
/*
I completely ripped this off of Orson Peters' ed25519 implementation to make it a single file. I added mg_ed25519 prefixes
to everything so it wouldn't pollute the global namespace, but otherwise the code is the same.
The original implementation is here: https://github.com/orlp/ed25519
- Shawn McGrath <@sssmcgrath on twitter>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>
#include <string.h>
#define streq(a, b) (!strcmp((a), (b)))
#ifndef __USE_GNU
#define __USE_GNU
@nil-ableton
nil-ableton / ctime.c
Last active July 19, 2019 22:45 — forked from mmozeiko/ctime.c
ctime.c
/* ========================================================================
$File: tools/ctime/ctime.c $
$Date: 2016/05/08 04:16:55PM $
$Revision: 7 $
$Creator: Casey Muratori $
$Notice:
The author of this software MAKES NO WARRANTY as to the RELIABILITY,
SUITABILITY, or USABILITY of this software. USE IT AT YOUR OWN RISK.
@Reedbeta
Reedbeta / cool-game-programming-blogs.opml
Last active May 5, 2024 18:07
List of cool blogs on game programming, graphics, theoretical physics, and other random stuff
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Graphics, Games, Programming, and Physics Blogs</title>
</head>
<body>
<outline text="Tech News" title="Tech News">
<outline type="rss" text="Ars Technica" title="Ars Technica" xmlUrl="http://feeds.arstechnica.com/arstechnica/index/" htmlUrl="https://arstechnica.com"/>
<outline type="rss" text="Polygon - Full" title="Polygon - Full" xmlUrl="http://www.polygon.com/rss/index.xml" htmlUrl="https://www.polygon.com/"/>
<outline type="rss" text="Road to VR" title="Road to VR" xmlUrl="http://www.roadtovr.com/feed" htmlUrl="https://www.roadtovr.com"/>
@pervognsen
pervognsen / btree.inl
Last active June 15, 2019 17:23
Experiments in lightweight C templates
// Here is btree.inl, which is the thing you would write yourself.
// Unlike C++ templates, the granularity of these lightweight templates is at the
// module level rather than the function or class level. You can think of it like
// ML functors (parameterized modules) except that there isn't any static checking
// of signatures (in that respect, it's like C++ templates). In my view, this style
// of parameterized generative modules is generally the better conceptual framework.
// This is a completely valid C file even prior to preprocessing, so during library
// development you can just include this file directly. That is a big win for testing
@bishboria
bishboria / springer-free-maths-books.md
Last active June 8, 2024 06:39
Springer made a bunch of books available for free, these were the direct links

Are there other single-file public-domain libraries out there?

Yes. Here are some:

  • jo_gif.cpp: tiny GIF writer (public domain)
  • gif.h: animated GIF writer (public domain)
  • tiny_jpeg.h: JPEG encoder (public domain)
  • lodepng: PNG encoder/decoder (zlib license)
  • nanoSVG: 1-file SVG parser; 1-file SVG rasterizer (zlib license)
  • tinyobjloader: wavefront OBJ file loader (BSD license)
@ashelly
ashelly / getopt.c
Last active November 9, 2023 23:22
"Port of GNU getopt() to Win32 for anyone who's tired of dealing with getopt() calls in Unix-to-Windows ports." Ported by Pete Wilson. Recovered from the Internet Archive's snapshot of www.pwilson.net/sample.html.
/* Getopt for GNU.
NOTE: getopt is now part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to drepper@gnu.org
before changing it!
Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001
Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public