Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 11 11:18
    13k commented #984
  • Jan 10 16:06
    chrisduerr commented #984
  • Jan 10 15:27
    13k commented #984
  • Jan 01 01:10
    michaelkirk opened #1346
  • Dec 28 2020 17:01

    murarth on master

    Fix broken link in documentatio… (compare)

  • Dec 28 2020 17:01
    murarth closed #1345
  • Dec 28 2020 04:14
    atsheehan opened #1345
  • Dec 10 2020 23:45

    kchibisov on v0.26.0

    (compare)

  • Dec 10 2020 23:44

    kchibisov on master

    Release version 0.26.0 (compare)

  • Dec 10 2020 23:44
    kchibisov closed #1344
  • Dec 10 2020 19:23
    chrisduerr review_requested #1344
  • Dec 10 2020 19:23
    chrisduerr opened #1344
  • Dec 10 2020 17:58
    chrisduerr commented #1343
  • Dec 10 2020 17:38

    kchibisov on master

    Usa stable version of rustfmt f… (compare)

  • Dec 10 2020 17:38
    kchibisov closed #1343
  • Dec 10 2020 17:37
    kchibisov commented #1343
  • Dec 10 2020 17:19
    kchibisov review_requested #1343
  • Dec 10 2020 17:18
    kchibisov synchronize #1343
  • Dec 10 2020 17:17
    kchibisov opened #1343
  • Dec 10 2020 17:04

    chrisduerr on master

    Bump winit to 0.24.0 (compare)

matrixbot
@matrixbot
Ralith they (ostensibly) represent that the event queue has been drained, which according to Ygor's report is not actually happening
matrixbot
@matrixbot
UndeadLeech on Freenode Last time I checked the X11 backend just calls through to XCheckIfEvent.
UndeadLeech on Freenode So it's completely up to that at which point the cleared event is to be emitted.
matrixbot
@matrixbot
Ralith which is why it's a surprising and interesting report, yeah
Ralith xlib has its issues but it should damn well be able to tell that the queue is not empty :P
matrixbot
@matrixbot
Ygor I forgot to mention before, but only window events get blocked by the sleep. Device events are all logged in the same frame
matrixbot
@matrixbot
Ralith even weirder; last time I touched that code it all goes through the same queue
matrixbot
@matrixbot
maroider the plot thickens
matrixbot
@matrixbot
orchaldir Hi, I have a question about the event loop. I use glutin::event_loop::ControlFlow::WaitUntil with 60 hz and update/render on ResumeTimeReached & RedrawRequested. It works fine until I move the mouse. Then I only get MainEventsCleared, RedrawEventsCleared, Motion & MouseMotion. To which event should I react to keep the 60 hz?
matrixbot
@matrixbot
orchaldir WaitCancelled is also published, but the render frequency is too with it.
matrixbot
@matrixbot
UndeadLeech on Freenode You should probably always check in your event loop if the time for the next redraw has come and always sleep until the next redraw is required.
UndeadLeech on Freenode It shouldn't matter when you get woken up or for what reason you got woken up.
matrixbot
@matrixbot
Ralith if you want to render continuously without missing frames, you should let vsync do the blocking rather than winit
matrixbot
@matrixbot
UndeadLeech on Freenode Yeah, vsync or frame scheduling are much, much better than sleeping. WaitUntil will never synchronize properly.
matrixbot
@matrixbot
arturkovacs To add to this, I would call request_redraw() on the window when getting MainEventsCleared
matrixbot
@matrixbot
Ralith that's pretty pointless
Ralith if you want to redraw continuously, just do it in the events cleared event directly
matrixbot
@matrixbot
arturkovacs Oh that does seem true. Now I feel silly 🤦‍♂️
matrixbot
@matrixbot
Ralith no worries, there were some bad examples floating around for a while that caused a lot of confusion around that
matrixbot
@matrixbot
orchaldir thanks for the tips.
matrixbot
@matrixbot
@deadshot465:matrix.org was kicked by @appservice-irc:matrix.org ("Idle for 30+ days").
matrixbot
@matrixbot
Phoenix K hi everyone :^)
UndeadLeech on Freenode What's up?
Phoenix K I created a crate which abstracts away winit's inversion of control. I'm wondering if anyone 1. recognizes it as similar to existing work 2. thinks it's a good or bad idea.
Phoenix K It works by spawning your "virtual main thread" in a second thread, and hijacking the real main thread with the event-loop, and using communication between the threads to let your program be structured as if winit didn't hijack the main thread.
Phoenix K Here's the example from winit's readme, adapted to utilize this library:
use winit_main::{
    self,
    reexports::{
        event::{Event, WindowEvent},
        window::WindowAttributes,
    },
    EventLoopHandle,
    EventReceiver,
};


#[winit_main::main]
fn main(event_loop: EventLoopHandle, events: EventReceiver) {
    println!("creating window");
    let window = event_loop
        .create_window(WindowAttributes::default())
        .unwrap();

    for event in events.iter() {
        println!("received event: {:?}", event);
        if matches!(
            event,
            Event::WindowEvent {
                event: WindowEvent::CloseRequested,
                window_id,
            } if window_id == window.id()
        ) {
            break;
        }
    }

    println!("exiting");
}
UndeadLeech on Freenode What's the point exactly?
Phoenix K Abstractly, I would rather be able to write code like any other code, and treat the event loop as an iterator of events which I can call functions on to create and destroy windows, etc.
UndeadLeech on Freenode I don't see how that's not already the case.
matrixbot
@matrixbot
Phoenix K Well, the event loop hijacks the mean thread, right? It's a "don't call me, we'll call you" sort of situation
Phoenix K More concretely, for example, this could turn into something that combines with tokio, and allows the event loop to be used neatly from the context of a tokio runtime.
UndeadLeech on Freenode Yeah, it's a function. That's not that special?
Phoenix K Hm, but it's an inversion of control. That has a couple of undesirable properties, including:
  • It's difficult to add inversion of control to a program after the fact, it tends to fundamentally affect the program's architecture.
  • For the above reason, it's difficult to write programs which are generic between inversions-of-control, or to modify a program from using one inversion-of-control framework to using a different framework.
  • It's tricky to use several inversions of control simultaneously. For example, it would be difficult to combine tokio with winit without creating additional abstractions.
matrixbot
@matrixbot
Ralith Phoenix K: https://github.com/ryanisaacg/blinds may be of interest
Phoenix K Ah, thank you. Interesting, that one looks like it's async.
Phoenix K (This one is blocking)
Phoenix K Also seems to be a more complete abstraction. It looks like it defines its own set of event types entirely, whereas I just re-export winit's. Interesting.
matrixbot
@matrixbot
maroider arturkovacs: I can't really dedicate enough time to test your latest changes on the keyboard events PR right now, so you may have to wait a week or so.
matrixbot
@matrixbot
arturkovacs I'll wait then :) Of course if you would like to end your participation for any reason that's okay too but I'd rather have you along until this gets done at least
matrixbot
@matrixbot

maroider > <@arturkovacs:matrix.org> I'll wait then :) Of course if you would like to end your participation for any reason that's okay too but I'd rather have you along until this gets done at least

Don't worry. I intend to stick around.

maroider For better or for worse.
matrixbot
@matrixbot
maroider > <@arturkovacs:matrix.org> I'll wait then :) Of course if you would like to end your participation for any reason that's okay too but I'd rather have you along until this gets done at least
  • Don't worry, I intend to stick around.
matrixbot
@matrixbot
Phoenix K I have a sort of a question. If I were making a game with winit, how would I enable v-sync? Is this something I would even do in the windows API, or would that logic be somewhere else entirely?
Phoenix K * I have a sort of a question. If I were making a game with winit, how would I enable v-sync? Is this something I would even do with the windowing API, or would that logic be somewhere else entirely?
matrixbot
@matrixbot
@theduke:matrix.org was kicked by @appservice-irc:matrix.org ("Idle for 30+ days").
matrixbot
@matrixbot

maroider > <@phoenixk:matrix.org> I have a sort of a question. If I were making a game with winit, how would I enable v-sync? Is this something I would even do with the windowing API, or would that logic be somewhere else entirely?

V-sync is managed through rendering APIs, rather than through windowing APIs.

maroider > <@phoenixk:matrix.org> I have a sort of a question. If I were making a game with winit, how would I enable v-sync? Is this something I would even do with the windowing API, or would that logic be somewhere else entirely?
  • V-sync is (to my knowledge) managed through rendering APIs, rather than through windowing APIs.
matrixbot
@matrixbot
UndeadLeech on Freenode That's correct. Like this with glutin for example: https://docs.rs/glutin/0.26.0/glutin/struct.ContextBuilder.html#method.with_vsync
matrixbot
@matrixbot
maroider And with wgpu-rs, you'd use PresentMode::Fifo.
matrixbot
@matrixbot
Phoenix K Ah, thank you.