Git Product home page Git Product logo

Comments (5)

elinorbgr avatar elinorbgr commented on August 25, 2024

Hmm, this is difficult to say with such a small amount of code, as it would depend a lot on what's done around. Do you have a minimal example that can be run and reproduces this issue, including the event-loop setup?

For the matter, calling callback.done directly forwards the API call to the wayland C lib, which is supposed to handle it properly. Does the event appear in the trace if you run your server with the WAYLAND_DEBUG=1 environment variable?

from wayland-rs.

harryfei avatar harryfei commented on August 25, 2024

https://github.com/fangyuanziti/wayland-http

All my code placed in this repository. It's a simple compositor with a http API.

Start server

WAYLAND_DEBUG=1 cargo run

Test with a client

WAYLAND_DEBUG=1 weston-simple-damage

The frame function is placed in src/surface.rs.

from wayland-rs.

elinorbgr avatar elinorbgr commented on August 25, 2024

Okay, I understand your issue.

Using EventLoop::run(), your compositor blocks waiting for events coming from the client before processing things further, including flushing your events to the client. And the two processes deadlock each other. You can observe this is you start two instances of weston-simple-damage for example, the two clients will generate enough events to make your events loop always make progress.

In your case, as you're not guaranteed to have a regular stream of events causing your event loop to progress forward, you should probably use a more explicit handling, like this:

loop  {
    // wait for client events for at most 50 miliseconds
    event_loop.dispatch(Some(50)).unwrap();
    display.flush_clients();
}

from wayland-rs.

elinorbgr avatar elinorbgr commented on August 25, 2024

EventLoop::run() should be better document to reflect this.

from wayland-rs.

harryfei avatar harryfei commented on August 25, 2024

You are right. I will change my main loop code. Thanks for your work 😄

from wayland-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.