Commit graph

127 commits

Author SHA1 Message Date
cinap_lenrek d7303af06d rio: allow reading the image of a hidden window thru the window file 2015-11-25 04:31:30 +01:00
cinap_lenrek 9ef4ba83f6 rio: fix handling "resize" wctl for hidden windows
when the "resize" wctl was used on a hidden window, the window
was put back on the screen, however, it was not removed from
the hidden[] array so trying to hide the window again failed
because whide() assumed it was already hidden.

the fix is to not unhide the window, but preserve the hidden
state, so windows can programmatically be reshaped and moved,
but will remain hidden unless explicitely unhidden.
2015-11-25 04:30:44 +01:00
cinap_lenrek 518fd3ec83 rio: stop serving kbdin file (thanks eekee)
kbdfs already provides a /dev/kbdin file for the system, rio does
not need to provide one for the onscreen keyboard anymore.
2015-11-23 00:50:44 +01:00
BurnZeZ 8f27b8d04d rio: fix scrolling when cursor is above window 2015-10-24 22:57:07 -04:00
cinap_lenrek 797cc13c70 fix dangerous werrstr() usages
werrstr() takes a format string as its first argument.
a common error is to pass user controlled string buffers
into werrstr() that might contain format string escapes
causing werrstr() to take bogus arguments from the stack
and crash.

so instead of doing:
	werrstr(buf);

we want todo:
	werrstr("%s", buf);

or if we have a local ERRMAX sized buffer that we can override:
	errstr(buf, sizeof buf);
2014-11-07 12:51:59 +01:00
cinap_lenrek c38cd50805 rio: dont serve a kbd file per window when we didnt got one from the environment
9vx doesnt provide a /dev/kbd file and rio faking one
up causes problems with vncv. (issue #223)
2014-10-25 02:05:44 +02:00
BurnZeZ 748a95266f rio: fix "-cd dir" in mountspec being ignored 2014-10-11 11:47:38 -04:00
ftrvxmtrx d2c3185bfa fix threadsetname usage in few places 2014-05-03 13:07:52 +02:00
cinap_lenrek 6a83facfb3 rio: properly handle initial wrap arround in wlook() 2014-01-11 10:46:07 +01:00
cinap_lenrek 7c503e6f49 rio: implement "look" (thanks lf94) 2014-01-11 10:14:35 +01:00
cinap_lenrek f912e01854 rio: make scrollwheel handling consistent with sam
scrollwheel now works proportional to y mouse position.
special case is when shift is hold down. then scrollwheel
will work like before and scroll one line up or down.
2014-01-05 02:37:42 +01:00
cinap_lenrek 56300f72e8 rio: dont consider shell characters as part of the filename for auto completion
rio looks backwards in the line for the beginning of a filename
that needs to be completed with ^F. this change makes the
characters: =, ^, ( and { stoppers, so filename completion
will work in all these cases:

foobar=/foo/ba^F; for(i in (fo^F ba^F)){/bin/baz^F

this means completion will not work for prefixes having these
special characters in them.

thanks to burnzez for bringing it up.
2013-12-19 18:12:16 +01:00
stanley lieber 66fea232bc rio -b: make lighttitlecol darker 2013-11-20 18:40:51 -05:00
cinap_lenrek 118cf5e36a rio: eleminate temporary allocations before frinsert() and in namecomplete()
frinsert() shouldnt modify the runes passed and the
buffer isnt going to be modified my us during the call
so removing the temporary copies.

namecomplete() makes utf-8 copies of the rune strings so
theres no need to copy the runes.
2013-11-05 08:00:26 +01:00
cinap_lenrek c5a70cc23d rio: do backspace \b processing inplace avoiding buffer allocation 2013-11-03 04:03:38 +01:00
cinap_lenrek 9619a621ac rio: cleanup and error handling 2013-11-03 00:34:35 +01:00
cinap_lenrek bcad0cd4e6 rio: huge simplification of flush handling
xfidflush() now uses a simpler way to flush another xfid.

when we can send to Xfid.c channel, we know that the
xfid is completed. so all xfidflush() needs todo is to
do an alt sending to both Xfid.c and Xfid.flushc.

once the send to Xfid.c succeeds, we know the xfid is gone
and we can respond to the flush request.

theres no need to keep track of flush state anymore. so
Xfid.active and Xfid.flushing can be removed.

note, that it is ok to respond normally to a currently
flushed request.
2013-11-02 17:54:42 +01:00
cinap_lenrek 837918ee5e rio: add sanity check in xfidallocthread() 2013-11-01 21:28:03 +01:00
cinap_lenrek f37ee95fbc rio: enforce flush reply ordering for all xfids
flushing isnt optional for concurrently handled requests.
we need to ensure that Rflush is replied *after* the
origianl request.

so we assign the flushtag for *every* xfid in xfidctl(),
and filsysrespond() checks if the xfid was flushed
*after* replying and wakes up the flushing xfid.
2013-11-01 21:21:24 +01:00
cinap_lenrek 413977c19b rio: properly handle follow up flushes (fixes unexpected reply tag)
when multiple flushes are send, they need to be replied
in order. we ensure this by having the flush xfid taking
over the flushtag (synchronized with a new fs->csyncflush
channel) so the next flush will flush the previous flush.
2013-11-01 18:57:11 +01:00
cinap_lenrek 3da35f028f rio: gone windows gone wrong (fix missing recv(x->flushc, nil) when gone but request flushing) 2013-10-05 22:55:10 +02:00
cinap_lenrek fe03ec0e21 rio: gone windows, window resize, rectonscreen, goodrect
dont rely on postnote to shutdown client. instead, make reads on
cons, kbd and mouse error. when we mount a window system over
exportfs, the pid useless and even dangerous! pid should be
only used by clients forked by rio itself.

fix bug in resized(), goodrect() takes rect in screen coordinates!

make rectonscreen() fix window size if the window doesnt fit
on the screen.

improve goodrect() to check for windows outside of the screen or
bigger than screen without borders visible.
2013-10-04 02:17:53 +02:00
cinap_lenrek ad993a2618 rio: translate window when scaling results in bad window rect on screen resize
when the screen is resized, we scale the windows to
match the new screen size. when the screen is too
small tho, the scaled down window rect might result
in a bad window rect. before, we kept the window
in its original position and size making it possible
to move a window out of the screen by resizing its
outer rio.

now, if we get a bad rectangle after scaling, we
just tralslate position to the new scaled r.min
point but preserve its orginal size. this keeps
the window always accessible.
2013-09-17 01:30:35 +02:00
cinap_lenrek 29f4de5f53 rio: fix Xfidwrite memory leak on flush 2013-09-16 17:28:49 +02:00
cinap_lenrek d8cd5d197d rio: position keyboard window (-k) at the bottom of the screen 2013-08-20 23:48:18 +02:00
cinap_lenrek dfe6118e30 rio: fix unused variable warning in wscroll() 2013-08-10 03:58:52 +02:00
cinap_lenrek 66531b005f rio: shorten overlong window labels 2013-08-10 03:54:55 +02:00
cinap_lenrek 684cf70857 rio: make sure flush replies are send only *after* the request got flushed or was replied
due to the xfid handlers clearing flushtag too early, xfidflush might respond too early
causing spurious replies send later by the handler. now, we clear the flushtag in
filsysrespond *after* the reply was send. xfidflush will wait for us on the active
qlock.
2013-08-05 04:21:34 +02:00
cinap_lenrek 1df707a0b2 unsticky scrollbars
scrollbars used to put the mouse on the scrollbar while scrolling. if latency
is high, this often results to the cursor jumping back. instead, make button 2
srolling work without needing the mouse to be inside the scrollbar and leave
the mouse position alone.
2013-08-05 00:25:40 +02:00
cinap_lenrek 24349c52b4 rio: add ^B control sequence to move cursor to output point 2013-08-04 06:45:58 +02:00
cinap_lenrek b34a1394c2 rio: run filename completion in background process
this avoids locking up rio when doing filename completion
on a unresponsive directory.
2013-06-29 11:26:08 +02:00
cinap_lenrek e36d9f5c4e make filesystem handling of read9pmsg() consistent 2013-06-16 06:26:31 +02:00
cinap_lenrek f990a6d30a rio: place text at beginning of line before cursor and host point 2013-05-13 04:40:02 +02:00
cinap_lenrek 303394314a rio: fix completion and readback and make it possible to complete history 2013-05-13 04:19:10 +02:00
stanley lieber b94a33e01c rio: fix highlight text for -b 2013-04-30 21:03:12 -04:00
cinap_lenrek b4759c2186 still races, reverting... need a better approach. 2013-01-10 23:10:16 +01:00
cinap_lenrek 681bcfa968 rio: fix window resize and attach race
if a window gets hidden/unhidden/resized too fast, the client might have no
chance attaching to that image using winname. so we move the window
offscreen instead and delay the freeimage() by doing it in the deletethread().
2013-01-09 16:32:53 +01:00
cinap_lenrek 0ad8548b70 rio: fix auto compmplete candidates getting read back without prompt 2012-11-10 02:30:17 +01:00
cinap_lenrek 30d54cc055 rio: fix topping a hidden window does not activate the foreground font color 2012-10-30 23:18:53 +01:00
cinap_lenrek 99216e0129 rio: fix deadlock
we can't really change the Window *input from
outside the winctl() thread. the problem is
that the window might end up reading the
mouse (scroll, select) which makes the w->cctl
channel block once you try to talk to the
window again (from the mousethread). this also
means we have to coordinate window switchin
from the winctl proc waiting for the current
window to release the input and then take over.
thers a new Winctl message Topped that basically
does that now using Wakeup and a chan to
synchronize.
2012-10-22 07:03:47 +02:00
cinap_lenrek 54d2424a7c rio: fix cursor for sizing nocurrent window
wrepaint() used to also set the cursor for the window
if it was current. this reset the corner cursors on
bandresize when one tried to attempt to size a window
that was not current. make repaint just repaint the
window and border. set cursor explicitely for hold
toggle.
2012-10-21 18:27:43 +02:00
cinap_lenrek bf13408df2 rio: various fixes
use notefd in killprocs() insead of postnote() as the process
might'v exited. the notefd stays valid even if the particular
process it was originaly opend on exited. remove the Window.pid
field as its not needed.

dup() the notefd for interruptproc as the window might'v gone
away and closed the notefd file descriptor, resulting in us
writing to the wrong thing.

use snprint() instead of sprint() for safety.

fix bogus debug fprint().

add missing "visible" flushimage() after Reshaped winctl message
got handled. i assumed wsetname()/nameimage() would be enough,
it but does a invisible flush so softscreen doesnt get updated
immidiately.

do not make allocimage() failure in scrtemps() fatal. it wont
draw the window properly, but it gives the user a chance to
delete some windows to recover.
2012-10-21 17:00:12 +02:00
cinap_lenrek 8057e48ae1 rio: colors, flicker reduction, refresh after mouse close
allocate all the colors in iconinit(), remove unused ones
like grey. rename darkgrey to paletextcol because thats
what it is used for. new approach to window image allocation.
we allocate the window with DNofill and let the window fill
itself. this reduces flickering especially with (-b) option
and makes rio resize feel a lot faster.

wrefresh() didnt work. now fixed.
2012-10-20 15:51:32 +02:00
cinap_lenrek c33732a530 rio: wtop() after resize fix
wtop() checked w->topped == topped as a fast exit. if you
had the top most window not being current (== input) which
can happen when you delete the current window, then wtop would
after resize would not make the window current because it
is already top topmost one. wtopme() and wcurrent() both are
non-ops when window is already the topmost or window is already
current, so remove the check as its not needed. also topping
the window feels less sluggish.
2012-10-20 10:38:11 +02:00
cinap_lenrek 624c9f5112 rio: preserve window z-order on resize, fix race conditions
sort the window array by w->topped before reshaping all
windows. this preserves the window z-order.

remove implicit focus change on reshape/move. it called
wcurrent() in wtcl thread which might send a wctl message
to itself, bad... also we might not want to change focus
on reshape, like for the rio resize. so we set the input
window explicitely in all call sites.

window deletion was racy. wclosewin() destroys w->i, but
it is called outside the wctl thread so it might just
free the image under libframe doing some text selection.
this is fixed the following: add wclunk() function,
which basically just marks the window as deleted and
removes the reference from the window[] and hidden[]
arrays. (called on wclose() when refcount drops to
zero). wclosewin() now just frees the image and is only
called from the wctl thread on exit or when handing
the Deleted message.

get a reference to the window when doing sweeping or
moving as the filesystem might just clunk it under
us and we might end up sending wctl messages to
a Exited window.

wctl resize message has to fail if the window is not
current as it might be hidden... would also be annoying.
2012-10-20 22:42:01 +02:00
cinap_lenrek 0a3eb7d6b1 rio: copy window labels for menu3
as the menu is displayed, the window might go away or change its
label causing menuhit() to dereference bad memory. just strdup()
the labels before passing to menu3str to prevent accidents.
2012-10-18 18:51:32 +02:00
cinap_lenrek 92d3ff8426 rio: single line scroll up/down with holding shift key 2012-09-16 02:49:41 +02:00
cinap_lenrek 87fca361f7 rio: rect outside screen counts as covered wcovered() 2012-08-22 00:11:42 +02:00
cinap_lenrek 2dd17995f1 rio: fix mistake 2012-08-16 06:57:58 +02:00
cinap_lenrek 711557c85e rio: add some tolerance when declaring windows covered 2012-08-16 06:32:34 +02:00
cinap_lenrek 2eb369bb1d rio: add covered (burried) windows to the menu3 hidden window list 2012-08-16 04:00:32 +02:00
cinap_lenrek 15c0d4b7c4 rio: add scroll lock key to toggle scroll mode 2012-07-28 14:47:35 +02:00
cinap_lenrek 98b9c4eb1e rio: dont shift window out to the left when its too wide for the screen 2012-07-26 17:28:14 +02:00
stanley lieber c065e02a99 rio/rio.c: update usage 2012-06-03 15:19:23 -05:00
cinap_lenrek 8791baf8b3 rio: dont list files we dont serve when reading directory 2012-05-08 23:53:46 +02:00
cinap_lenrek 20c27e0197 rio: keep window rects managable on rio resize 2012-03-13 08:14:55 +01:00
cinap_lenrek 21cedbedb2 rio: fix memory leak for w->dir 2012-01-28 20:29:55 +01:00
cinap_lenrek 205f12720e rio: don't hardcode font 2011-12-09 21:44:02 +01:00
cinap_lenrek 25f4840c7e rio: dont serve /dev/screen from display->image, as its not updated on resize. instead, use screen and omit the file if provided by the enviroment. allow unaligned reads. 2011-11-29 13:41:02 -05:00
cinap_lenrek c389d96769 rio: return correct color chan after screen depth change 2011-11-25 01:10:46 +01:00
cinap_lenrek e1bb660ef2 rio: return correct color chan after screen depth change 2011-11-25 00:49:41 +01:00
stanley lieber 315b61ade3 rio: use -b instead of the $reverse env variable 2011-11-19 12:43:15 -06:00
cinap_lenrek 205a39474c rio: use -scroll parameter from attach message 2011-10-13 06:18:57 +02:00
cinap_lenrek 4e9e860776 rio: fix kbdin 2011-05-28 08:23:32 +00:00
cinap_lenrek fbbb449cc0 big /dev/kbd change, new format, support Alt+Stuff (key composing) 2011-05-28 08:16:01 +00:00
cinap_lenrek ec4bcbd01f rio: disable cons if /dev/kbd is open, add games/doom 2011-05-26 23:30:17 +00:00
cinap_lenrek befae4b650 rio: run kbdproc in with clean fdtable 2011-05-26 14:54:28 +00:00
cinap_lenrek f258c3725d rio: dont leak the /dev/consctl and /dev/kbd filedescriptors into windows 2011-05-23 21:43:51 +00:00
cinap_lenrek 545fc5e329 rio: remove useless if() 2011-05-13 09:08:27 +00:00
cinap_lenrek 07cfc31444 fix broken kbdproc buffering 2011-05-13 03:27:25 +00:00
cinap_lenrek ac2e6cf020 rio: continue on zero length /dev/cons read, put reverse pale colors back in 2011-05-11 13:38:28 +00:00
cinap_lenrek d831a028dc ignore \0 bytes, disable navigation keys when /dev/kbd is open 2011-05-11 09:23:01 +00:00
cinap_lenrek bc91b2709f merge 2011-05-11 05:56:28 +00:00
cinap_lenrek 4fcc906e7f add /dev/kbd support to rio 2011-05-11 05:55:48 +00:00
stanley lieber ec236059b6 there are no pastel paints in the dungeons and dragons world - rob pike 2011-05-09 16:51:12 +00: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