Commit graph

41 commits

Author SHA1 Message Date
cinap_lenrek b5d47d6deb libdraw: fix typo: 0xfffff -> 0xffff 2014-02-03 03:56:01 +01:00
cinap_lenrek 5fd52f6241 libdraw: work arround devdraw truncating screenid as 16bit 2014-02-03 03:53:18 +01:00
cinap_lenrek d77455ab2d libdraw: use pid as initial screenid so one can have more than 25 windows. 2014-02-01 09:53:08 +01:00
cinap_lenrek aa8f8d866b libdraw: cleanup string() and stringwidth()
getting rid of the goto at the end of the while
loop by moving the if(subfontnae) case before
the cachechars() call.
2014-01-10 01:19:14 +01:00
cinap_lenrek e3b4950966 libdraw: fix stringwidth problems
cachechars() used to skip over characters on its own when
loadchar() could not find the character or a PJW replacement.
this resulted in wrong width calculation. now we just return
and handle the case inside _string and _stringwidth.

fix subfont leak in stringwidth()

remove annoying prints in stringwidth()
2014-01-06 03:49:14 +01:00
cinap_lenrek 0be917ff4d libdraw: make newwindow() unmount the old window
newwindow() used to mount the new window directly on /dev, resulting
in the old window and the new one being mounted over each other.

we now try to unmount the old window from /dev first, mount new
window to /mnt/wsys (replacing the old) and then bind /mnt/wsys
before /dev.

if theres no /mnt/wsys, just mount window directly before /dev.
2013-10-04 15:57:05 +02:00
cinap_lenrek 8556b8dae1 libevent: drop queued mouse events
the changeset r541ead66e8af:

"libdraw: make ebread() return buffer immidiately if available"

makes mouse sluggish when the program cant keep up as mouse
events queue up. this more or less restores the original
behaviour but only for mouse events.
2013-09-18 01:54:22 +02:00
cinap_lenrek 508b53a29a libdraw: fix leftover processes or programs failing to restore window labels when receiving interrupt note
fix the default note handler for event programs. only handle non system
notes or notes in the slave processes. for interrupt in the main process,
just call exits() which will do the cleanup and restore window label
properly.

this makes completely overriding the note handler in gping and
stats uneccesary.
2013-08-13 21:46:13 +02:00
cinap_lenrek 09d465a976 libdraw: make ebread() return buffer immidiately if available, cleanup
this reduces number of syscalls and improves performance for vt
2013-08-11 08:31:53 +02:00
cinap_lenrek 62bd2ae8b9 libdraw: fix ekbd() memory leak 2013-08-11 08:22:21 +02:00
cinap_lenrek 82b243b5ad libdraw: fix allocscreen() memory leak with too many retries (from 9atom) 2013-06-19 20:13:55 +02:00
cinap_lenrek b5659c0977 libdraw: avoid moving cursor if we dont have to for menuhit
depending on the font, poping the menu would move your cursor
one pixel down each time (due to division). this is annoying
when using a trackpoint and trying to repeat some operation
over 9000 times.

the cursor should only be moved when the menu is repositioned
to contain it on the screen.
2013-06-18 23:23:41 +02:00
cinap_lenrek 202be57bb9 draw: add badrect() function to reject zero, negative size or orverly huge rectangles
not checking the rectangle dimensions causes integer overflows
and memory corruption. adding a new badrect() function that checks
for these cases.
2013-06-16 19:01:46 +02:00
cinap_lenrek cf657b418b libdraw: fix agefont crash when display == nil (from sources / agefont-nodisplay patch)
If you run this:
	{for (i in `{seq 1 70000}) echo '½•α·'} | mc | wc
mc will eventually suicide. The error comes from
/sys/src/libdraw/font.c:/^agefont which assumes it has a
display. Normally, this is set up by geninitdraw (usually
via initdraw), but mc.c avoids that to avoid the screen
redraws (flicker, at a minimum, but worse in long-running
cases).

graphics(2) does not prohibit this use, so I made the least
intrusive change to make it work.
2013-05-25 04:36:16 +02:00
cinap_lenrek 30d7276d69 libdraw: fix font f->cacheimage nil dereference
the initial fontresize() might fail but its error code is ignored
potentially leaving f->cacheimage == nil. make sure we call
fontresize() in loadchar() when theres no cacheimage and check the
return value to avoid nil pointer dereference.
2013-05-04 20:36:28 +02:00
cinap_lenrek 90036b9991 libdraw: avoid printing error on closemouse() 2013-04-27 04:21:08 +02:00
cinap_lenrek a72a7c1cc2 libdraw: exit mouseproc() on read error instead of spinning 2013-04-27 04:10:39 +02:00
cinap_lenrek 0c4d5b8b07 libdraw: fix memory corruption bug in initdisplay() 2013-01-25 14:17:41 +01:00
cinap_lenrek a426c08ce2 libdraw: gengetwindow() fix mistake
dont zero *winp so the "screen" pointer is preserved.
2013-01-11 23:18:22 +01:00
cinap_lenrek 23b189c2bc libdraw: gengetwindow() resize race
instead of trying to make rio not change the window image too fast
and give the client some time to attach it (which turns out to be
impossible), we acknowledge that there is a race and just retry
the window reattach as long as the winname keeps changing in
gengetwindow().
2013-01-10 22:16:23 +01:00
cinap_lenrek 7295fa71a4 libdraw: fix wrong menusel() calculation for menuhit() (noticable with small fonts)
the text for a menu entry is drawn from:

y = textr.min.y + i*(font->height+Vspacing);

but we calculated the item from:

r = insetrect(textr);
i = (p.y - r.min.y) / (font->height+Vspacing);

the insetrect is wrong.
2013-01-08 03:45:49 +01:00
cinap_lenrek 6cadd03bbe fix utf and rune handling in preparation for 32bit runes 2012-12-31 21:09:46 +01:00
cinap_lenrek 03f2668d68 libdraw: enter()/eenter() ^W support - we are getting there 2012-09-26 17:35:21 +02:00
cinap_lenrek d3f93ee1f3 need more coffee 2012-09-26 15:54:25 +02:00
cinap_lenrek aa3dd7fd8f libdraw: fix ^W corner case tick == 0 for enter()/eenter() 2012-09-26 15:48:57 +02:00
cinap_lenrek a77f6553d8 libdraw: implement ^W word delete for enter() and eenter() 2012-09-26 15:31:09 +02:00
cinap_lenrek 5cbae621a5 libdraw: improve handling of screen clipr 2012-08-09 04:02:10 +02:00
cinap_lenrek f3b08dd655 libdraw: enter/eenter, set and restore clip rect 2012-07-22 16:32:59 +02:00
glenda 55ede5177c libdraw: change built in lucm.9 default font to vga font 2011-12-09 19:11:16 +01:00
cinap_lenrek db605e7bc8 libdraw: dont abort() on failed allocimage in fontresize() 2011-11-10 16:54:02 +01:00
cinap_lenrek 278d4f8477 libdraw: added enter() and eenter() functions 2011-10-31 19:41:48 +01:00
glenda da4d5c9c21 libdraw: shutdown keyboard and mouseprocs with threadint, libthread: avoid delayed note leak (this fixes the "too many delayed notes" error with auth/fgui) 2011-10-02 23:14:14 +02:00
cinap_lenrek 45f2fd3c01 libdraw: fix old subfont leak 2011-09-05 18:34:46 +02:00
cinap_lenrek f6e73a6a22 libdraw: reduce memory for writeimage/writememimage 2011-09-04 04:38:08 +02:00
cinap_lenrek 4749fc5ca1 libdraw: fix libdraws copy of writeimage() too 2011-09-04 03:40:33 +02:00
cinap_lenrek b5bbc62dda libdraw: fix unloadimage() for wide images, libmemdraw: work arround width limit by outputting uncompressed image in writememimage() if compressed blocksize exceeds chunk limit 2011-09-04 23:51:14 +02:00
glenda 41a34b227b libdraw: make loadimage and readimage handle wide images 2011-09-03 09:17:46 -04:00
cinap_lenrek e1318e0bef libdraw: fix more leaks 2011-08-14 15:16:56 +02:00
aiju 3a55f9ac92 libdraw: fixed memory leak 2011-08-14 15:12:57 +02:00
Taru Karttunen a9060cc06b Import sources from 2011-03-30 iso image - lib 2011-03-30 19:35:09 +03:00
Taru Karttunen e5888a1ffd Import sources from 2011-03-30 iso image 2011-03-30 15:46:40 +03:00