Commit graph

153 commits

Author SHA1 Message Date
Ben Huntsman
e9d8c45168 libdraw: Fix GUI programs on AIX (#398) 2021-08-30 19:40:49 -04:00
Igor Böhm
afa34a73a9
devdraw, libdraw: fix memory leaks by freeing getns() malloced string (#431) 2020-07-22 14:59:58 -04:00
Russ Cox
a6ad39aaaa libdraw: handle larger number of subfonts 2020-05-29 20:58:37 -04:00
Russ Cox
d25d0ca1a3 devdraw, libdraw: handle keyboard runes > U+FFFF
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.
2020-05-18 23:45:03 -04:00
Russ Cox
40d787ab12 libdraw: send hangup to process when window is lost
This matches the Plan 9 behavior a bit better.

Fixes #30.
2020-01-14 18:05:51 -05:00
Russ Cox
4ae529dbfe libdraw: use proper pipe for default font data
May fix a deadlock / missing font on OpenBSD.

Fixes #308.
2020-01-14 13:32:17 -05:00
Russ Cox
dbf57689c4 libdraw: connect to devdraw via $wsysid when set 2020-01-13 16:46:14 -05:00
Russ Cox
0b6b451b71 libdraw: fix "mk"
Should default to building the library, not getsubfont.o.
2020-01-12 15:08:28 -05:00
Dan Cross
fa325e9b42 Trivial changes: whitespace and modes.
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>
2020-01-10 14:54:30 +00:00
Fazlul Shahriar
7bb69ba88b libdraw,devdraw: fix compatibility with old 16x16 cursor protocol (#217)
Some libraries that depend on devdraw don't know about
32x32 cursor -- mainly 9fans.net/go/draw.
2019-04-05 15:09:35 -04:00
Russ Cox
16d0081989 libdraw: redo default font construction to be hidpi-safe
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.
2018-11-16 00:03:24 -05:00
Russ Cox
8581c2b567 libdraw: add Cursor2, a 32x32 high-res cursor
Also add setcursor2, esetcursor2, and draw protocol encoding.
Calls to the old setcursor, esetcursor create a 32x32 by
pixel doubling when needed.
2018-11-15 20:39:35 -05:00
Xiao-Yong Jin
03a8ec739a libdraw: fix error in the previous commit 2018-03-27 18:11:37 +02:00
Xiao-Yong Jin
dc2a17b95c libdraw: fix some memory leaks in font handling 2018-03-27 15:03:12 +02:00
Ray Lai
94b38bdb72 libdraw: replace hand-rolled realloc, preventing buffer overflow.
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>
2017-04-08 00:06:42 +00:00
Russ Cox
9e0d3750c5 9term, win: work around bsd linker nonsense
Change-Id: Ifcef0636ee1e1fd0f9b06a8d1a99d58fae831318
Reviewed-on: https://plan9port-review.googlesource.com/2780
Reviewed-by: Russ Cox <rsc@swtch.com>
2017-01-06 20:20:33 +00:00
Russ Cox
775cb933ec fontsrv: use 64 chars per subfont instead of 256
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>
2015-08-27 00:36:32 +00:00
Gleydson Soares
25822e8da3 libdraw, acme: fix acme segfault triggered passing an invalid font
acme -f nosuchfont

Change-Id: Iaa727db02b43e63082130796ec97c0efb7fe2b19
Reviewed-on: https://plan9port-review.googlesource.com/1220
Reviewed-by: Russ Cox <rsc@swtch.com>
2015-05-15 02:30:27 +00:00
Russ Cox
79555a9987 libdraw: refine hidpi font selection
Change-Id: Id1e6a2630713024a1925ad1341bb9c846f82e93e
Reviewed-on: https://plan9port-review.googlesource.com/1171
Reviewed-by: Russ Cox <rsc@swtch.com>
2015-02-17 20:52:06 +00:00
Russ Cox
213fc4f6fb libdraw: autoscale fonts when moving between low and high dpi screens
Change-Id: I6093955b222db89dfe437fb723593b173d888d01
Reviewed-on: https://plan9port-review.googlesource.com/1170
Reviewed-by: Russ Cox <rsc@swtch.com>
2015-02-17 20:51:23 +00:00
Russ Cox
77f23268f7 libdraw: add 2*font syntax for scaled fonts
An experiment.

Change-Id: I40660a211b8372701597d80f7e86917e94cccbaa
Reviewed-on: https://plan9port-review.googlesource.com/1161
Reviewed-by: Russ Cox <rsc@swtch.com>
2015-02-17 05:58:37 +00:00
Russ Cox
fff818fe87 libdraw, libframe, acme: fix, guard against inverted range in textsetselect
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>
2014-12-02 01:18:40 +00:00
Russ Cox
9f3851871e libdraw: add scalesize
R=rsc
http://codereview.appspot.com/6855092
2012-11-25 22:15:57 -05:00
Russ Cox
d0e0701913 devdraw, libdraw: add display->dpi
Fixed at 100 right now, but the plan is to make it accurate
and then use it.

R=rsc
http://codereview.appspot.com/6856091
2012-11-25 21:41:52 -05:00
Russ Cox
54bebe6a69 libdraw: add visibleclicks mode
R=rsc
http://codereview.appspot.com/6501137
2012-09-17 12:39:49 -04:00
Russ Cox
2d6da3763e libdraw: allow 32-bit Runes
R=, rsc
CC=
http://codereview.appspot.com/196054
2010-01-28 16:58:34 -08:00
Russ Cox
e6c837d612 merge 2009-07-14 22:55:52 -07:00
Russ Cox
9b4a2324d3 merge 2009-07-08 21:43:14 -07:00
Russ Cox
4aad1a3258 merge 2009-04-30 07:29:24 -07:00
Jeff Sickel
41305b2355 libdraw: add borderop 2008-12-03 02:13:38 -06:00
Russ Cox
b61a5ce81e libdraw: do not let devdraw fork, for OS X 2008-07-01 07:39:10 -04:00
Russ Cox
b65a69c192 libdraw: die if display does 2008-06-30 19:44:15 -04:00
Russ Cox
0a98a883d5 libdraw: fix spinning event loop (David Bulkow) 2008-01-10 21:38:42 -05:00
rsc
33da33e72b block instead of chewing cpu in eread (Lu Xuxiao) 2006-11-05 14:43:52 +00:00
rsc
3a19470202 In non-blocking recv functions in libmux and libdraw,
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.
2006-11-04 18:46:00 +00:00
rsc
40227f1f68 move USED past decls (Arvindh Tamilmani) 2006-07-04 14:35:50 +00:00
rsc
19f4cef528 use pin 2006-06-26 05:48:10 +00:00
rsc
8159666d6a add iprint 2006-06-25 23:52:51 +00:00
rsc
b733ffba4f gone 2006-06-25 21:04:36 +00:00
rsc
150f88023b event 2006-06-25 21:04:07 +00:00
rsc
f97f537440 bye 2006-06-25 19:00:38 +00:00
rsc
257fb6261e new 2006-06-25 19:00:14 +00:00
rsc
74dc60da74 bye 2006-06-25 18:59:29 +00:00
rsc
24c4c46b98 fix _screen leak 2006-05-23 03:55:45 +00:00
rsc
3bff492520 changes from plan 9 2006-05-21 16:20:29 +00:00
rsc
dff99a80b6 do RFNOTEG in initdraw (Anselm Garbe) 2006-05-20 05:01:26 +00:00
rsc
6b11fe88cb shut up gcc 2006-04-21 03:01:48 +00:00
rsc
2ff29ba87a no checksnarf 2006-04-04 19:45:03 +00:00
rsc
cbeb0b26e4 Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. 2006-04-01 19:24:03 +00:00
rsc
0b10ae3815 fix alpha oops 2006-03-31 17:28:29 +00:00