Skip to content

Instantly share code, notes, and snippets.

UX Notes:

General Visuals

  • The current state/value of a widget should be obvious/visible.
  • If the value doesn't fit the last digit should be faded to indicate that the value shown is only partial. A good heuristic would be to choose a size that is large enough to fit 3 digit numbers (e.g. selecting a value between 0-100)
  • Expand the label when the user is interacting with the widget.
  • The the widget's state/value should always be visible, move the location of the label if necessary (e.g. when pointer is interacting with the widget)
  • A widget should optionally provide an indication of the min/max boundaries, where relevant.
  • The slider should optionally provide an indication of intermediate values (e.g. axis ticks) between the min/max boundaries, where relevant.
  • UI elements that are used for fine control (e.g. knobs) should be big enough to make them easy to grab.
  • For widgets with a single functionality the entire widget's area should optionally be wired to trigger the widget's action.

General

  • Event and Lifecycle are propagated down the entire tree but if every single events was processed by every widget that would cause performance issues.
  • The mechanism which decides which events and lifecycles will be propagated to which parts of the tree is the Pod
  • Some events are global (e.g. WindowSize) and are handled directly by the Pod and some are local and targeted to specific subset of widgets in the tree (e.g.MouseMove).
  • Targeted events are controlled by the IS_DISABLED, IS_HANDLED, HAS_ACTIVE, IS_HOT, and HAS_FOCUS flags.

Event Handling Infrastructure

  • The IS_HANDLED flag is set to false at the root of the tree by the Pod
  • The widget that processes the event must set the IS_HANDLED flag through its context.
  • The IS_HANDLED flag applies to keyboard and mouse events.
@giannissc
giannissc / xilem-architecture-overview.md
Last active April 23, 2024 06:15
Xilem Architecture Overview

There are four user levels to using a GUI framework:

  1. View composition
  2. Custom interactions
  3. Custom widgets
  4. Framework Development

xilem-architecture-overview

View composition

xilem-architecture-view-composition

@kylechui
kylechui / dot-repeating.md
Last active April 8, 2024 08:20
A basic overview of how to manage dot-repeating in your Neovim plugin, as well as manipulate it to "force" what action is repeated.

Adding dot-repeat to your Neovim plugin

In Neovim, the . character repeats "the most recent action"; however, this is not always respected by plugin actions. Here we will explore how to build dot-repeat support directly into your plugin, bypassing the requirement of dependencies like repeat.vim.

The Basics

When some buffer-modifying action is performed, Neovim implicitly remembers the operator (e.g. d), motion (e.g. iw), and some other miscellaneous information. When the dot-repeat command is called, Neovim repeats that operator-motion combination. For example, if we type ci"text<Esc>, then we replace the inner contents of some double quotes with text, i.e. "hello world""text". Dot-repeating from here will do the same, i.e. "more samples""text".

Using operatorfunc

@lbiaggi
lbiaggi / ltex.lua
Last active October 20, 2023 19:27
ltex-ls support WIP
--- BEFORE USING, change language entries to fit your needs.
local lspconfig = require'lspconfig'
local configs = require'lspconfig/configs'
local util = require 'lspconfig/util'
local Dictionary_file = {
["pt-BR"] = {vim.fn.getenv("NVIM_HOME") .. "spell/dictionary.txt"} -- there is another way to find ~/.config/nvim ?
}
local DisabledRules_file = {
@derhuerst
derhuerst / _.md
Last active April 9, 2024 11:06
List of HAFAS API Endpoints
@klange
klange / _.md
Last active December 2, 2023 20:36
It's a résumé, as a readable and compilable C source file. Since Hacker News got here, this has been updated to be most of my actual résumé. This isn't a serious document, just a concept to annoy people who talk about recruiting and the formats they accept résumés in. It's also relatively representative of my coding style.

Since this is on Hacker News and reddit...

  • No, I don't distribute my résumé like this. A friend of mine made a joke about me being the kind of person who would do this, so I did (the link on that page was added later). My actual résumé is a good bit crazier.
  • I apologize for the use of _t in my types. I spend a lot of time at a level where I can do that; "reserved for system libraries? I am the system libraries".
  • Since people kept complaining, I've fixed the assignments of string literals to non-const char *s.
  • My use of type * name, however, is entirely intentional.
  • If you're using an older compiler, you might have trouble with the anonymous unions and the designated initializers - I think gcc 4.4 requires some extra braces to get them working together. Anything reasonably recent should work fine. Clang and gcc (newer than 4.4, at le