Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App blank until user mouseover #199

Open
danielrh opened this issue Jul 27, 2019 · 1 comment
Open

App blank until user mouseover #199

danielrh opened this issue Jul 27, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@danielrh
Copy link

Description

The example svg app is blank until it receives mouse input.
I've reduced the example to a smaller repro case (built in release)

extern crate azul;
use std::time::Duration;
use azul::{
    prelude::*,
    widgets::{button::Button, svg::*},
};


const SVG: &str = include_str!("../../img/tiger.svg");

#[derive(Debug)]
struct MyAppData {
    cache: SvgCache,
    layers: Vec<(SvgLayerId, SvgStyle)>,
}

impl Layout for MyAppData {
    fn layout(&self, _info: LayoutInfo<Self>) -> Dom<MyAppData> {
        let ptr = StackCheckedPointer::new(self, self).unwrap();
      Dom::div().with_child(
        Dom::gl_texture(draw_svg, ptr).with_id("svg-container"),
      )
    }
}

fn draw_svg(info: GlCallbackInfoUnchecked<MyAppData>) -> GlCallbackReturn {
  let cb = |info: GlCallbackInfo<MyAppData, MyAppData>| {
            use azul::widgets::svg::SvgLayerResource::*;

    let map = info.state;
    let logical_size = info.bounds.get_logical_size();
    Some(Svg::with_layers(map.layers.iter().map(|e| Reference(*e)).collect())
         .render_svg(&map.cache, &info.layout_info.window, logical_size))
  };
    unsafe {
        info.invoke_callback(cb)
    }
}


fn main() {

    let mut svg_cache = SvgCache::empty();
    let mut svg_layers = svg_cache.add_svg(&SVG).unwrap();
    let app_data = MyAppData {
        cache: svg_cache,
        layers: svg_layers,
    };

  let mut app = App::new(app_data, AppConfig::default()).unwrap();
    let window = app.create_window(WindowCreateOptions::default(), css::native()).unwrap();
    app.run(window).unwrap();
}

Version / OS

Ubuntu 18.04

  • azul version:
    46e5f18

  • Operating system:

Ubutunu 18.04

  • Windowing system (X11 or Wayland, Linux only):
    X11

Steps to Reproduce

Run the app, do not interact...window will be blank until mouse arrives at the window

Additional Information

@danielrh danielrh added the bug Something isn't working label Jul 27, 2019
@fschutt
Copy link
Owner

fschutt commented Jul 28, 2019

Yes, Linux / X11 sends a special "repaint" command that is ignored by Azul. This will probably fixed when I've completed the glutin / winit upgrade (on the /unvendor_dependencies branch)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants