summaryrefslogtreecommitdiff
path: root/sys/src/cmd/rio/xfid.c
AgeCommit message (Collapse)Author
2023-02-06rio: refactor the keyboardtap code a bitcinap_lenrek
run the keyboardtap as a thread instead of a proc so that we can read input window variable. This gets rid of the wintap channel. do focus handling by tracking the last window and only send context switch when we start typing into a different window. have fromtap, totap channels created by open and use the variable also as the in-use flag. handle use nbsendp() when sending to the tap program, as it might be blocked or misbehaving. if the totap channel is full, we bypass the tap and send to input again. handle keyup on focus loss in the window thread instead (just like the artificial mouseup) it is unrelated to keyboardtap.
2022-09-28rio: ensure single reader and single writer for kbdtapJacob Moody
Multiple readers eat each other's lunch, and it makes more sense to limit use to one 'pipeline' then just one reader. This also brings back the 'focus' message from kbdtap used by ktrans to reset its line buffers when the user switches windows. An event file was considered, but deemed harmful to the artwork. To paraphrase an old excuse found in the code: "rio just isn't structured for that. Apologies."
2022-09-11rio: correct error messageJacob Moody
2022-09-11rio: return 'global' size for none /dev/wctl read (thanks umbraticus)Jacob Moody
Before we were just erroring, this provides something useful giving the total size of the rio to the riostart script.
2022-09-11rio: more pointy edges with none attachJacob Moody
Would crash when reading from wctl in riostart.
2022-09-11rio: add 'none' attach option to wsysJacob Moody
This allows users to mount wsys without having a valid window or creating a new one. In this mode wsys only servs 'global' files, those that apply to all windows. Providing this mount to riostart's namespace gives us two things: * Allows kbdtap programs(ktrans) to run in riostart * Obsoletes $wctl and the associated named pipe by providing /dev/wctl in riostart As such, the wctl pipe and environment variable are removed as well.
2022-08-21rio: kbdtap deadlocks are verbodenJacob Moody
This should make kbdtap related deadlocks impossible. The tap thread has been rewritten to use one alt which always allows for the window handling code to nofiy us regardless if we're send'ing or recv'ing. We also move the start/stop messages to their own channel and can the reset code for now.
2022-08-20rio: make it harder to deadlock from kbdtapJacob Moody
It was quite easy for a single threaded tap program to cause a deadlock. The following describes the scenario: prog: read a key from /dev/kbdtap prog: processing key rio: read a key from the 'upstream' /dev/kbd rio: submit key to tap thread prog: writes translated key back to /dev/kbdtap Because the tap thread is blocked on waiting for the program to read the new character, the program's write never completes and we hit deadlock. This was "conviently" avoided in testing with ktrans because the reader and writer are in two different processes. So in this case ktrans could make forward progress. To solve this we first turn the tap channels to have a small buffer, this grases the wheel and allows the above case to become tolerant for some amount of new upstream characters. Second we move the tap processing thread in to its own process. This isolates this processing from the rest of the main rio thread. This ensures that a misbehaving kbdtap user will never lock you out of being able to 'Delete' it and restore normal functionality.
2022-08-20rio: /dev/label should just ignore offsetJacob Moody
We were erroring if offset != 0. Just ignore the offset.
2022-08-19rio: correct tap codeJacob Moody
Remove tapmesg, allow the reads to accept flushes, accept writes of multiple messages, move open/close to Xfid code.
2022-08-15rio: add /dev/kbdtapJacob Moody
2020-11-29rio: avoid redrawing window text on resize for programs using libdrawcinap_lenrek
As long as the client as the mouse file open and maintains reading the winname file of the window after a resize we will avoid drawing the text frame on a resize as it will be overdrawn by the client. This reduces flicker on resize somewhat for slow systems.
2019-11-19rio: fix cons read breakage from previous commitcinap_lenrek
2019-11-19rio: fix bug causing short reads of wctl filesAlex Musolino
Previously, reads of wctl files would return one byte less than requested as the returned string must be null terminated. Now we pass the actual size of the allocated buffer to the handler, which is large enough to accommodate a trailing partial rune and terminating null byte.
2017-05-07rio: implement writable and truncatable /dev/textcinap_lenrek
2016-06-26rio: move the test if w is allowed to change cursor into wsetcursor()cinap_lenrek
the onscreen cursor shows the cursor of the current focused window or the window it points at. if there is no window, then we set the default cursor (nil).
2016-05-14rio: only the current window may change the cursor, fix typo screen->r vs ↵cinap_lenrek
w->screenr in drag()
2016-05-14rio: second attempt...cinap_lenrek
2016-05-14revert previous commit, not ready yetcinap_lenrek
2016-05-13rio: get rid of all mouse moves, fix cursor handlingcinap_lenrek
2016-04-04rio: /dev/kbd cleanupcinap_lenrek
- use free running unsigned indeces for window kbdq - emalloc() vs malloc() in xfid
2016-04-03change /dev/kbd to return multiple messages per readcinap_lenrek
2015-11-25rio: allow reading the image of a hidden window thru the window filecinap_lenrek
2015-11-23rio: stop serving kbdin file (thanks eekee)cinap_lenrek
kbdfs already provides a /dev/kbdin file for the system, rio does not need to provide one for the onscreen keyboard anymore.
2014-10-11rio: fix "-cd dir" in mountspec being ignoredBurnZeZ
2014-05-03fix threadsetname usage in few placesftrvxmtrx
2013-11-03rio: cleanup and error handlingcinap_lenrek
2013-11-02rio: huge simplification of flush handlingcinap_lenrek
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-01rio: add sanity check in xfidallocthread()cinap_lenrek
2013-11-01rio: enforce flush reply ordering for all xfidscinap_lenrek
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-01rio: properly handle follow up flushes (fixes unexpected reply tag)cinap_lenrek
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-10-05rio: gone windows gone wrong (fix missing recv(x->flushc, nil) when gone but ↵cinap_lenrek
request flushing)
2013-10-04rio: gone windows, window resize, rectonscreen, goodrectcinap_lenrek
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-09-16rio: fix Xfidwrite memory leak on flushcinap_lenrek
2013-08-05rio: make sure flush replies are send only *after* the request got flushed ↵cinap_lenrek
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.
2012-10-22rio: fix deadlockcinap_lenrek
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-21rio: fix cursor for sizing nocurrent windowcinap_lenrek
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-21rio: various fixescinap_lenrek
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-20rio: colors, flicker reduction, refresh after mouse closecinap_lenrek
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.
2011-11-29rio: dont serve /dev/screen from display->image, as its not updated on ↵cinap_lenrek
resize. instead, use screen and omit the file if provided by the enviroment. allow unaligned reads.
2011-11-25rio: return correct color chan after screen depth changecinap_lenrek
2011-11-25rio: return correct color chan after screen depth changecinap_lenrek
2011-10-13rio: use -scroll parameter from attach messagecinap_lenrek
2011-05-11add /dev/kbd support to riocinap_lenrek
2011-03-30Import sources from 2011-03-30 iso image - libTaru Karttunen
2011-03-30Import sources from 2011-03-30 iso imageTaru Karttunen