a private fork of github.com/9fans/plan9port
Go to file
David Arroyo 66598ad2c5 Fix race condition on attach and mouse track on warp
I tried running the wayland devdraw implementation on Sway 1.10,
wlroots 0.18 and encountered the error:

	xdg_surface#13: error 3: xdg_surface has never been configured

According to https://wayland.app/protocols/xdg-shell#xdg_surface ,
a client must commit a surface without a buffer, *wait* for the first
configure request from the compositor, ack it, and *only then* can
it proceed to attach a buffer to the surface and tell wayland to display it.

This was caused by the following sequence of events:

1. devdraw starts, enters gfx_main
2. `gfx_main` calls `gfx_started`, which spawns the `serveproc` thread
3. `gfx_main` enters `wl_display_dispatch`, flushing any buffered requests to
   the compositor, and enters `wl_display_poll()` to wait for incoming messages
4. `serveproc` calls `rpc_attach`, sets up the surface, and buffers a commit.

The race is between #3 and #4. If #3 happens first, the buffered commit
just sits there until `rpc_flush` is called, which calls `wl_display_flush()`,
but at that point a buffer is attached too quickly for the configure to happen.

This commit fixes the race by adding a `configured` field to the WaylandClient
and using it to guard `rpc_flush`.

In addition, I found that mouse warping, at least in sway, would move
the cursor but future mouse presses would register at the old location
until I moved the mouse. So I added a call to gfx_mousetrack to the end
of `rpc_setmouse`.
2025-11-25 17:01:34 -05:00
.github ci: bump actions/checkout from 4 to 5 2025-08-12 07:06:27 -04:00
acid merge 2012-03-05 16:36:31 -05:00
bin man: remove -s from usage message 2025-09-23 17:52:58 -04:00
dict all: remove .cvsignore files 2017-09-14 17:25:17 +02:00
dist config: add $egrep 2025-07-23 19:44:54 +00:00
face faces for lp. 2005-09-13 01:24:50 +00:00
font Fix fonts (#463) 2022-07-27 10:25:51 -04:00
include DragonFly: fix build 2025-07-25 19:02:59 +00:00
lib add macedit to moveplan9.files 2022-08-18 10:48:50 -04:00
lp all: remove .cvsignore files 2017-09-14 17:25:17 +02:00
mac mac: arrange for arm64 run on arm64 2024-10-22 08:11:37 -04:00
mail all: remove .cvsignore files 2017-09-14 17:25:17 +02:00
man tmac/tmac.an: define .MR in a groff compatible way 2025-07-27 09:58:50 -04:00
ndb ndb/local: remove rsc-specific entries (oops) 2008-06-04 13:28:05 -04:00
news odds and ends 2004-04-21 23:43:46 +00:00
plumb plumb/basic: avoid wrap around in file:1:2 (#158) 2018-11-13 23:59:04 -05:00
postscript Fix fonts (#463) 2022-07-27 10:25:51 -04:00
proto forgotten files 2005-01-13 04:56:07 +00:00
sky all: remove .cvsignore files 2017-09-14 17:25:17 +02:00
src Fix race condition on attach and mouse track on warp 2025-11-25 17:01:34 -05:00
tmac tmac/tmac.an*: work around formatter bug 2025-10-26 19:03:55 -04:00
troff troff: import HB, HI and HX fonts from Plan 9 2017-06-15 19:09:58 +00:00
unix all: update for new MIT license 2021-03-23 20:59:23 -04:00
.gitignore .gitignore: ignore macOS .DS_Store files 2025-07-27 09:52:08 -04:00
CHANGES CHANGES: add pointer to web version 2008-05-10 13:38:21 -04:00
CONTRIBUTING.md codereview: delete, now using GitHub pull requests 2017-09-01 13:25:20 -04:00
CONTRIBUTORS venti: fix venti graph on 64-bit 2017-07-23 11:11:56 +00:00
INSTALL INSTALL: set defaults for awk and egrep 2025-07-24 16:25:44 +00:00
LICENSE all: update for new MIT license 2021-03-23 20:59:23 -04:00
Makefile For annoying people like Uriel. 2005-11-25 13:18:11 +00:00
README.md README.md: Add GH actions badge 2024-01-09 19:00:21 -05:00
configure For annoying people like Uriel. 2005-11-25 13:18:11 +00:00
install.txt install(1): mention libfontconfig1-dev for Debian 2021-04-09 15:23:55 -04:00
rcmain rcmain: use new $termprog variable 2013-08-13 12:46:38 -04:00

README.md

This is a port of many Plan 9 libraries and programs to Unix.

Installation

To install, run ./INSTALL. It builds mk and then uses mk to run the rest of the installation.

For more details, see install(1), at install.txt in this directory and at https://9fans.github.io/plan9port/man/man1/install.html.

Documentation

See https://9fans.github.io/plan9port/man/ for more documentation. (Documentation is also in this tree, but you need to run a successful install first. After that, "9 man 1 intro".)

Intro(1) contains a list of man pages that describe new features or differences from Plan 9.

Helping out

If you'd like to help out, great!

If you port this code to other architectures, please share your changes so others can benefit.

Git

You can use Git to keep your local copy up-to-date as we make changes and fix bugs. See the git(1) man page here ("9 man git") for details on using Git.

Status

Github Actions Build Status Coverity Scan Build Status

Contact