about summary refs log tree commit diff stats
Commit message (Collapse)AuthorAgeFilesLines
...
| * javascript: type erase dfinbptato2025-01-133-70/+68
| | | | | | | | | | | | | | | | | | It works in refc. It won't work in ARC/ORC, but that's a problem for another time. (FWIW, I think ARC/ORC could be made work by simply adding pointers to the destructors. But it's fully incompatible with refc, and I won't maintain this so long as not even ARC works with Chawan.)
| * javascript: replace old jsgetprop with new onebptato2025-01-132-39/+2
| |
| * javascript: take cstring in getClass, hasClassbptato2025-01-131-3/+3
| |
| * Conform to strict defsbptato2025-01-139-88/+130
| | | | | | | | Breaks compatibility with 1.6.14.
| * optshim: remove valType, optbptato2025-01-132-4/+1
| |
| * javascript: remove $ -> toString conversionbptato2025-01-101-5/+1
| | | | | | | | Undocumented and fairly surprising behavior. Just do it manually.
| * javascript: drop union types and non-JSValue varargsbptato2025-01-102-249/+60
| | | | | | | | Untested and unused since forever.
| * javascript: remove undocumented & broken defineConstsbptato2025-01-011-19/+0
| | | | | | | | | | | | | | I have a mostly working version in Chawan (in src/html/script.nim), but it still has to work around the fact that we define prototypes differently than mainstream browsers. So I won't try to fix it here if I'll have to change what it does *yet again* in the future.
| * Make it work with abiCheckbptato2024-12-291-4/+4
| | | | | | | | | | Nim doesn't distinguish betw
/*
 * (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
 * See LICENSE file for license details.
 */
#include "dwm.h"
#include <stdio.h>
#include <string.h>
#include <X11/Xlocas='column2'>| | 
| | 
| | 
| | 
| | 
| | 
| | 
| | 
| | 
| | 
.jsgetprop is now deprecated. Its replacement, .jsgetownprop, provides the same functionality and more, so that it's now equivalent in power to the QJS API: * instead of JS_NULL, it's JS_UNINITIALIZED that signals "not found" * it allows you to set the property descriptor (for returning get/set functions) Also, .jsgetrealprop was added to wrap get_property. This will be renamed to .jsgetprop in the future.
| * Version 0.6.0bptato2024-11-163-3/+7
| |
| * javascript, jsopaque: get rid of some useless tablesbptato2024-11-164-21/+35
| | | | | | | | these work better as seqs; I was just being lazy...
| * Update to quickjs-ng 0.7.0bptato2024-11-1610-2257/+4224
| | | | | | | | | | Includes a patch to adjust the JS_SetOpaque API to continue supporting opaques on the global object.
| * fromjs: remove leftover debugging codebptato2024-11-161-2/+0
| |
| * Version 0.5.5bptato2024-11-093-2/+6
| |
| * fromjs, quickjs: fix and use JS_FreePropertyEnum APIbptato2024-11-092-4/+2
| |
| * fromjs: fix crash on fromJS with seqbptato2024-11-093-2/+13
| |
| * Version 0.5.4bptato2024-11-084-3/+7
| |
| * Fix some C warnings; do not link pthread with threads:offbptato2024-11-083-6/+9
| |
| * Version 0.5.3bptato2024-10-283-2/+5
| |
| * update eprintbptato2024-10-281-3/+6
| |
| * jspropenumlist: avoid zero-length mallocbptato2024-10-281-3/+7
| | | | | | | | qjs-ng asserts on it
| * Version 0.5.2bptato2024-10-123-2/+5
| |
| * libregexp: fix incorrect patchbptato2024-10-122-2/+6
| | | | | | | | | | | | The loop runs until we hit a prefix byte, and unconditionally decrements the pointer. However, we started i from 0 (instead of the correct 1), meaning we always lost at least one char.
| * Version 0.5.1bptato2024-10-023-2/+5
| |
| * quickjs: fix build without threadsbptato2024-10-026-7/+16
| |
| * Version 0.5.0bptato2024-09-293-3/+13
| |
| * Switch to QuickJS-NG 0.6.1bptato2024-09-2925-11623/+10883
| | | | | | | | | | qjs-ng is more actively maintained than qjs, and has some very useful features like column tracking.
| * Version 0.4.3bptato2024-09-175-12/+24
| |
| * Version 0.4.2bptato2024-09-175-7/+40
| |
| * javascript: fix crash on missing opaquebptato2024-09-174-3/+13
| | | | | | | | | | | | | | | | | | Prototype objects don't have an opaque, so handle those. This does mean that leaving out setGlobal after having set a global type will no longer run; this behavior was undocumented and likely undesirable in all cases, so I'll call it a bug. While we're at it, fix inherited jsgetprop as well.
| * javascript: don't use SetProperty in newJSClassbptato2024-09-172-2/+2
| | | | | | | | | | SetProperty has undesirable effects like calling GetOwnProperty. Define it instead.
| * Version 0.4.1bptato2024-08-224-5/+9
| |
| * Version 0.4.0bptato2024-08-153-3/+10
| |
| * Misc. fixes & refactoringbptato2024-08-1515-106/+165
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fix JS_NewObjectClass binding * fix JS exception handling in jsgetprop * fix incorrect varargs slice end * strict exception tracking everywhere except fromjs & tojs -> fromjs & tojs call user-defined procs, which possibly do not care about exception tracking. in theory, we should error out on this, because unwinding QJS stack breaks everything. in practice, I can't even make it work in Chawan so meh * remove dependency on std/unicode -> this removes the toJS(Rune) overload. users who need it can easily add it themselves. * remove setInterruptHandler wrapper (just use the QJS API) * fromJS(int) now converts to int64 or int32 based on the architecture * move isSequence into fromJS * add some doc strings to the API
| * Version 0.3.1bptato2024-08-094-4/+5
| |
| * fromjs, tojs: fix compilation, NUL char handlingbptato2024-08-094-18/+37
| | | | | | | | | | | | | | | | * use string in ident maps instead of cstring, as the latter doesn't work on some arch's * fix toJS with strings including a NUL char * skip an unnecessary copy in enum conversion * update todo
| * Version 0.3.0bptato2024-08-094-4/+15
| |
| * javascript: allow omitting file namebptato2024-08-093-30/+32
| |
| * Use malloc_usable_size() on any OS based on GNU libcPino Toscano2024-08-091-2/+2
| | | | | | | | | | malloc_usable_size() is a GNU extension in GNU libc; hence, use it every time GNU libc is used, rather than only on Linux.
| * Fix `JS_HasException()` when `null` is thrown (#313)Kasper Isager Dalsgarð2024-08-091-5/+5
| | | | | | | | Use `JS_UNINITIALIZED` instead of `JS_NULL` when no exception is pending, so `null` can be thrown and distinguished from no exception pending.
| * Fix GC leak in `js_proxy_get()` (#302)Dmitry Volyntsev2024-08-091-1/+3
| | | | | | | | Fixes #277
/span> dc.status, False); if((dc.w = dc.x - x) > bh) { dc.x = x; if(sel) drawtext(sel->name, dc.sel, False); else drawtext(NULL, dc.norm, False); } XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0); XSync(dpy, False); } void drawtitle(Client *c) { if(c == sel && issel) { drawstatus(); XUnmapWindow(dpy, c->twin); XSetWindowBorder(dpy, c->win, dc.sel[ColBG]); return; } XSetWindowBorder(dpy, c->win, dc.norm[ColBG]); XMapWindow(dpy, c->twin); dc.x = dc.y = 0; dc.w = c->tw; drawtext(c->name, dc.norm, False); XCopyArea(dpy, dc.drawable, c->twin, dc.gc, 0, 0, c->tw, c->th, 0, 0); XSync(dpy, False); } unsigned long getcolor(const char *colstr) { Colormap cmap = DefaultColormap(dpy, screen); XColor color; XAllocNamedColor(dpy, cmap, colstr, &color, &color); return color.pixel; } void setfont(const char *fontstr) { char **missing, *def; int i, n; missing = NULL; setlocale(LC_ALL, ""); if(dc.font.set) XFreeFontSet(dpy, dc.font.set); dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def); if(missing) { while(n--) fprintf(stderr, "missing fontset: %s\n", missing[n]); XFreeStringList(missing); if(dc.font.set) { XFreeFontSet(dpy, dc.font.set); dc.font.set = NULL; } } if(dc.font.set) { XFontSetExtents *font_extents; XFontStruct **xfonts; char **font_names; dc.font.ascent = dc.font.descent = 0; font_extents = XExtentsOfFontSet(dc.font.set); n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names); for(i = 0, dc.font.ascent = 0, dc.font.descent = 0; i < n; i++) { if(dc.font.ascent < (*xfonts)->ascent) dc.font.ascent = (*xfonts)->ascent; if(dc.font.descent < (*xfonts)->descent) dc.font.descent = (*xfonts)->descent; xfonts++; } } else { if(dc.font.xfont) XFreeFont(dpy, dc.font.xfont); dc.font.xfont = NULL; dc.font.xfont = XLoadQueryFont(dpy, fontstr); if (!dc.font.xfont) dc.font.xfont = XLoadQueryFont(dpy, "fixed"); if (!dc.font.xfont) eprint("error, cannot init 'fixed' font\n"); dc.font.ascent = dc.font.xfont->ascent; dc.font.descent = dc.font.xfont->descent; } dc.font.height = dc.font.ascent + dc.font.descent; } unsigned int textw(const char *text) { return textnw(text, strlen(text)) + dc.font.height; }