Code Monkey home page Code Monkey logo

Comments (5)

jrmoulton avatar jrmoulton commented on May 27, 2024 1

https://github.com/lapce/floem/blob/936e5ce26efaef9a9ab2c8f6fce3bfe09f9a2c21/src/window_handle.rs#L1392C20-L1398C22

Looks like this part of the code should use an atomicu32 for key function instead of doing s.clone().

The clone is problematic because the separator items will hash the same so as soon as there is more than one the dyn stack will have the count wrong. Unique values are needed

from floem.

aalhitennf avatar aalhitennf commented on May 27, 2024 1

f for enter misclick 😮‍💨

I fixed it by changing menu display to enum

20240307_21h01m26s_grim

    #[derive(Clone, PartialEq, Eq, Hash)]
    pub enum MenuDisplay {
        Separator(usize),
        Item {
            id: Option<u64>,
            enabled: bool,
            title: String,
            children: Option<Vec<MenuDisplay>>,
        },
    }

separator is is given at format_menu

    fn format_menu(menu: &Menu) -> Vec<MenuDisplay> {
        menu.children
            .iter()
            .enumerate()
            .map(|(sep, e)| match e {
                crate::menu::MenuEntry::Separator => MenuDisplay::Separator(sep),

from floem.

aalhitennf avatar aalhitennf commented on May 27, 2024

Could also make MenuEntry::Separator to have id from static AtomicU64 when its added to Menu but dunno if that's necessary, index from iterator should be unique enough?

I can make PR, whatever you think is better?

from floem.

jrmoulton avatar jrmoulton commented on May 27, 2024

The enum looks like a good solution to me. @dzhou121 ?

from floem.

aalhitennf avatar aalhitennf commented on May 27, 2024

Made a pr

from floem.

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.