aboutsummaryrefslogtreecommitdiff
path: root/src/libdraw
Commit message (Collapse)AuthorAgeFilesLines
* libdraw: fix subfont scalingmatheuristic2023-08-211-1/+1
| | | | | A subfont with n chars has n+1 Fontchars, so scalesubfont() needs to scale all n+1 info entries.
* Bail out if convW2M(...) indicates failure.Igor Böhm2022-07-261-1/+2
|
* libdraw: fix out-of-bounds access to local buffer in event.c:startrpc()Igor Böhm2022-07-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function `startrpc()` stack allocates a local buffer of size 100: ```c static Muxrpc* startrpc(int type) { uchar buf[100]; ^^^^^^^^ Wsysmsg w; w.type = type; convW2M(&w, buf, sizeof buf); return muxrpcstart(display->mux, buf); } ``` The function `convW2M()` is called passing `buf`. That function accesses `buf` out-of-bounds: ```c uint convW2M(Wsysmsg *m, uchar *p, uint n) { ... case Tcursor2: PUT(p+6, m->cursor.offset.x); PUT(p+10, m->cursor.offset.y); memmove(p+14, m->cursor.clr, sizeof m->cursor.clr); memmove(p+46, m->cursor.set, sizeof m->cursor.set); PUT(p+78, m->cursor2.offset.x); PUT(p+82, m->cursor2.offset.y); memmove(p+86, m->cursor2.clr, sizeof m->cursor2.clr); memmove(p+214, m->cursor2.set, sizeof m->cursor2.set); p[342] = m->arrowcursor; ^^^^^^ ``` To fix the issue the size of local variable `buf` is increased from 100 to 512 to avoid out-of-bounds array access.
* libdraw: Fix GUI programs on AIX (#398)Ben Huntsman2021-08-301-0/+4
|
* devdraw, libdraw: fix memory leaks by freeing getns() malloced string (#431)Igor Böhm2020-07-221-2/+5
|
* libdraw: handle larger number of subfontsRuss Cox2020-05-291-1/+1
|
* devdraw, libdraw: handle keyboard runes > U+FFFFRuss Cox2020-05-183-2/+17
| | | | | | | | | | | Runes in Plan 9 were limited to the 16-bit BMP when I drew up the RPC protocol between graphical programs and devdraw a long time ago. Now that they can be 32-bit, use a 32-bit wire encoding too. A new message number to avoid problems with other clients (like 9fans.net/go). Add keyboard shortcut alt : , for U+1F602, face with tears of joy, to test that it all works.
* libdraw: send hangup to process when window is lostRuss Cox2020-01-141-1/+5
| | | | | | This matches the Plan 9 behavior a bit better. Fixes #30.
* libdraw: use proper pipe for default font dataRuss Cox2020-01-141-6/+16
| | | | | | May fix a deadlock / missing font on OpenBSD. Fixes #308.
* libdraw: connect to devdraw via $wsysid when setRuss Cox2020-01-132-1/+79
|
* libdraw: fix "mk"Russ Cox2020-01-121-2/+1
| | | | Should default to building the library, not getsubfont.o.
* Trivial changes: whitespace and modes.Dan Cross2020-01-1027-85/+76
| | | | | | | | | Remote whitespace at the ends of lines. Remove blank lines from the ends of files. Change modes on source files so that they are not executable. Signed-off-by: Dan Cross <cross@gajendra.net>
* libdraw,devdraw: fix compatibility with old 16x16 cursor protocol (#217)Fazlul Shahriar2019-04-052-1/+24
| | | | Some libraries that depend on devdraw don't know about 32x32 cursor -- mainly 9fans.net/go/draw.
* libdraw: redo default font construction to be hidpi-safeRuss Cox2018-11-1612-497/+372
| | | | | | | | | | | | | | | | If $font is not set, the default font is constructed from font data linked into every libdraw binary. That process was different from the usual openfont code, and so it was not hidpi-aware, resulting in very tiny fonts out of the box on hidpi systems, until users set $font. Fix this by using openfont to construct the default font, by recognizing the name *default* when looking for font and subfont file contents. Then all the hidpi scaling applies automatically. As a side effect, the concept of a 'default subfont' is gone, as are display->defaultsubfont, getdefont, and memgetdefont.
* libdraw: add Cursor2, a 32x32 high-res cursorRuss Cox2018-11-156-6/+64
| | | | | | Also add setcursor2, esetcursor2, and draw protocol encoding. Calls to the old setcursor, esetcursor create a 32x32 by pixel doubling when needed.
* libdraw: fix error in the previous commitXiao-Yong Jin2018-03-271-1/+1
|
* libdraw: fix some memory leaks in font handlingXiao-Yong Jin2018-03-275-6/+18
|
* libdraw: replace hand-rolled realloc, preventing buffer overflow.Ray Lai2017-04-081-3/+1
| | | | | | | | | | | | | | The original buffer is f->nsubf*sizeof *subf bytes (oldsize) large. Once it's full, a new buffer of (f->nsubf+DSUBF)*sizeof *subf (newsize) is mallocated. Unfortunately memmove() reads (newsize) bytes from the original (oldsize) buffer, causing a buffer overflow. By switching to realloc(), we don't need to do buffer size calculation, memmoving, and freeing of the original buffer. Change-Id: Ibf85bc06abe1c8275b11acb1d7d346a14291d2cd Reviewed-on: https://plan9port-review.googlesource.com/1520 Reviewed-by: Gleydson Soares <gsoares@gmail.com>
* 9term, win: work around bsd linker nonsenseRuss Cox2017-01-061-0/+5
| | | | | | Change-Id: Ifcef0636ee1e1fd0f9b06a8d1a99d58fae831318 Reviewed-on: https://plan9port-review.googlesource.com/2780 Reviewed-by: Russ Cox <rsc@swtch.com>
* fontsrv: use 64 chars per subfont instead of 256Russ Cox2015-08-271-1/+1
| | | | | | | | Makes loading faster, and makes larger sizes not too wide. Change-Id: I076c83fdb9577c1e596de45558f38ea93e3a2a31 Reviewed-on: https://plan9port-review.googlesource.com/1360 Reviewed-by: Russ Cox <rsc@swtch.com>
* libdraw, acme: fix acme segfault triggered passing an invalid fontGleydson Soares2015-05-151-0/+2
| | | | | | | | acme -f nosuchfont Change-Id: Iaa727db02b43e63082130796ec97c0efb7fe2b19 Reviewed-on: https://plan9port-review.googlesource.com/1220 Reviewed-by: Russ Cox <rsc@swtch.com>
* libdraw: refine hidpi font selectionRuss Cox2015-02-173-1/+43
| | | | | | Change-Id: Id1e6a2630713024a1925ad1341bb9c846f82e93e Reviewed-on: https://plan9port-review.googlesource.com/1171 Reviewed-by: Russ Cox <rsc@swtch.com>
* libdraw: autoscale fonts when moving between low and high dpi screensRuss Cox2015-02-177-27/+212
| | | | | | Change-Id: I6093955b222db89dfe437fb723593b173d888d01 Reviewed-on: https://plan9port-review.googlesource.com/1170 Reviewed-by: Russ Cox <rsc@swtch.com>
* libdraw: add 2*font syntax for scaled fontsRuss Cox2015-02-176-4/+75
| | | | | | | | An experiment. Change-Id: I40660a211b8372701597d80f7e86917e94cccbaa Reviewed-on: https://plan9port-review.googlesource.com/1161 Reviewed-by: Russ Cox <rsc@swtch.com>
* libdraw, libframe, acme: fix, guard against inverted range in textsetselectRuss Cox2014-12-021-0/+3
| | | | | | | | | | Credit to Roi Martin <jroi.martin@gmail.com> for noticing that libdraw was being passed a negative string length and for finding the sequence of keystrokes that make acme do it reproducibly. Change-Id: If3f3d04a25c506175f740d3e887d5d83b5cd1bfe Reviewed-on: https://plan9port-review.googlesource.com/1092 Reviewed-by: Russ Cox <rsc@swtch.com>
* libdraw: add scalesizeRuss Cox2012-11-251-0/+7
| | | | | R=rsc http://codereview.appspot.com/6855092
* devdraw, libdraw: add display->dpiRuss Cox2012-11-251-0/+9
| | | | | | | | Fixed at 100 right now, but the plan is to make it accurate and then use it. R=rsc http://codereview.appspot.com/6856091
* libdraw: add visibleclicks modeRuss Cox2012-09-173-2/+54
| | | | | R=rsc http://codereview.appspot.com/6501137
* libdraw: allow 32-bit RunesRuss Cox2010-01-281-1/+1
| | | | | | R=, rsc CC= http://codereview.appspot.com/196054
* mergeRuss Cox2009-07-141-2/+6
|
* mergeRuss Cox2009-07-083-6/+63
|
* mergeRuss Cox2009-04-301-0/+9
|
* libdraw: add borderopJeff Sickel2008-12-031-9/+15
|
* libdraw: do not let devdraw fork, for OS XRuss Cox2008-07-011-1/+5
|
* libdraw: die if display doesRuss Cox2008-06-302-3/+3
|
* libdraw: fix spinning event loop (David Bulkow)Russ Cox2008-01-101-6/+6
|
* block instead of chewing cpu in eread (Lu Xuxiao)rsc2006-11-051-1/+1
|
* In non-blocking recv functions in libmux and libdraw,rsc2006-11-042-15/+31
| | | | | | | | | | | | distinguish between "cannot receive without blocking" and "EOF on connection". In libmux, do not elect async guys muxers, so that synchronous RPC calls run in the main event loop (e.g., in eresized) do not get stuck. Fixes problem reported by Lu Xuxiao, namely that jpg etc. would spin at 100% cpu usage.
* move USED past decls (Arvindh Tamilmani)rsc2006-07-041-2/+2
|
* use pinrsc2006-06-261-1/+27
|
* add iprintrsc2006-06-252-0/+15
|
* gonersc2006-06-252-180/+0
|
* eventrsc2006-06-256-1904/+272
|
* byersc2006-06-251-43/+0
|
* newrsc2006-06-254-0/+742
|
* byersc2006-06-2575-11641/+226
|
* fix _screen leakrsc2006-05-232-15/+8
|
* changes from plan 9rsc2006-05-212-15/+11
|
* do RFNOTEG in initdraw (Anselm Garbe)rsc2006-05-201-0/+1
|
* shut up gccrsc2006-04-211-0/+3
|