Piston: events for mouse move from outside of the window

I just stated to play with Pison, and it looks and works way better than I expected. With lazy mode my application start to be idle if nothing happens (that's exactly I expected and it's not what happens with many other applications, hello, atom).

But I done strace on my application and I noticed that it recieving X events even when they happens outside of the application window. I rechecked with other well-written X applications (e.g. xterm) and found they reacts only on their own events.

The snippet of my code (it displays pre-rendered image):

fn show_and_wait(cnv_in:Canvas){
    let opengl = OpenGL::V3_2;
    let (width, height) = (cnv_in.pixel_x as u32, cnv_in.pixel_y as u32);
    let mut window: PistonWindow =
        WindowSettings::new("equart", (width, height))
        .exit_on_esc(true)
        .graphics_api(opengl)
        .build()
        .unwrap();

    let mut canvas = im::ImageBuffer::from_fn(width, height, |x, y| {
            let v = cnv_in.img[(x + y * cnv_in.pixel_x as u32) as usize];
            im::Rgba([v,v,v, 255])
    });
    let mut texture_context = TextureContext {
        factory: window.factory.clone(),
        encoder: window.factory.create_command_buffer().into()
    };
    let mut texture: G2dTexture = Texture::from_image(
            &mut texture_context,
            &canvas,
            &TextureSettings::new()
        ).unwrap();


    texture.update(&mut texture_context, &canvas).unwrap();
    let mut events = Events::new(EventSettings::new().lazy(true));
    while let Some(e) = events.next(&mut window) {
        if let Some(_) = e.render_args() {
            window.draw_2d(&e, |c, g, device| {
                image(&texture, c.transform, g);
            });
        }
    }
}

When I do strace, it shows activity for application even if mouse (and focus) is completely off the application. I looked through docs and sources (as much as I can understand them) and found thing related to the scope limitation for events.

Is this a bug? A feature? Or I've missed something important?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.