Comments (3)
Can you give me a hint where precisely the problem is and what would have to be done about it?
from haskell-wayland.
Wayland message arguments can have one of a number of types, as detailed in the wayland documentation. These bindings use that information to properly marshal data to Haskell types - e.g. an fd
type argument is converted into a System.Posix.IO.Fd
.
The array
type argument is an opaque array-like structure. However, the type of its elements is not specified by the protocol, giving us little chance to properly marshal the data to Haskell types. So I just ignored all messages containing such arguments.
But the wl_keyboard
interface makes use of an array
argument in its enter
event, so we can't set a callback for enter
: indeed, KeyboardListener doesn't even offer a place to set it.
But now the C structure that we pass to the wayland library (notice that the KeyboardListener is Storable, a fact that we don't want the user to exploit but can't really hide either AFAIA) has the wrong length (since it's missing the enter
field), causing a segfault.
The solution is to either add that field to the C struct we store and set it to null (ie. properly disable interfacing with messages which have an array
type argument), or invent a smart way to marshal array
type arguments into Haskell, which would be the preferred thing to do, but takes some, well, let's say "creative" solutions.
The former would simply be done by remembering that there is some disabled message in an interface, and then pass a nullFunPtr in Graphics/Wayland/Scanner.chs.
The latter would consist of, if possible, use heuristics to figure out how to present the data neatly (e.g. the wl_keyboard.enter.keys
argument is a list of ints specifying the currently pressed keys), or otherwise just return the underlying length and a data pointer, since officially it is indeed just a blob of binary data.
from haskell-wayland.
Thanks!
from haskell-wayland.
Related Issues (9)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from haskell-wayland.