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

GuiAction with a well-defined initial state #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/gui/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ struct Clip {
float end;
};

struct Empty {
};

enum GuiActionTag {
gui_action_none,
gui_action_toggle_pause,
Expand All @@ -30,6 +33,7 @@ enum GuiActionTag {
struct GuiAction {
enum GuiActionTag tag;
union {
struct Empty none;
float seek_position;
struct Clip clip;
uint64_t id;
Expand Down
6 changes: 1 addition & 5 deletions src/gui/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ mod gui_actions {
use crate::c_bindings::*;

fn make_action(tag: GuiActionTag) -> GuiAction {
unsafe {
let mut ret = std::mem::MaybeUninit::<GuiAction>::zeroed();
(*ret.as_mut_ptr()).tag = tag;
ret.assume_init()
}
GuiAction { tag };
}

pub fn none() -> GuiAction {
Expand Down