From d3fea52613b8d714354d35ba96d9b7ef6c10ef01 Mon Sep 17 00:00:00 2001 From: Joonas Javanainen Date: Wed, 8 Jul 2020 00:04:47 +0300 Subject: [PATCH] Fix issues caused by 1.77 upgrade --- src/io.rs | 2 ++ src/lib.rs | 4 ++-- src/style.rs | 10 ++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/io.rs b/src/io.rs index 0d7a242..4630d03 100644 --- a/src/io.rs +++ b/src/io.rs @@ -306,6 +306,7 @@ pub struct Io { keys_down_duration_prev: [f32; 512], nav_inputs_down_duration: [f32; NavInput::COUNT + NavInput::INTERNAL_COUNT], nav_inputs_down_duration_prev: [f32; NavInput::COUNT + NavInput::INTERNAL_COUNT], + pen_pressure: f32, input_queue_surrogate: sys::ImWchar16, input_queue_characters: ImVector, } @@ -471,6 +472,7 @@ fn test_io_memory_layout() { assert_field_offset!(keys_down_duration_prev, KeysDownDurationPrev); assert_field_offset!(nav_inputs_down_duration, NavInputsDownDuration); assert_field_offset!(nav_inputs_down_duration_prev, NavInputsDownDurationPrev); + assert_field_offset!(pen_pressure, PenPressure); assert_field_offset!(input_queue_surrogate, InputQueueSurrogate); assert_field_offset!(input_queue_characters, InputQueueCharacters); } diff --git a/src/lib.rs b/src/lib.rs index 85dc0b5..20a309d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -84,7 +84,7 @@ pub fn dear_imgui_version() -> &'static str { #[test] fn test_version() { - assert_eq!(dear_imgui_version(), "1.76"); + assert_eq!(dear_imgui_version(), "1.77"); } impl Context { @@ -403,7 +403,7 @@ impl<'ui> Ui<'ui> { // Widgets: Popups impl<'ui> Ui<'ui> { pub fn open_popup<'p>(&self, str_id: &'p ImStr) { - unsafe { sys::igOpenPopup(str_id.as_ptr()) }; + unsafe { sys::igOpenPopup(str_id.as_ptr(), 0) }; } pub fn popup<'p, F>(&self, str_id: &'p ImStr, f: F) where diff --git a/src/style.rs b/src/style.rs index b81fd0f..6e2cb6d 100644 --- a/src/style.rs +++ b/src/style.rs @@ -15,6 +15,7 @@ pub struct Style { /// Rounding radius of window corners. /// /// Set to 0.0 to have rectangular windows. + /// Large values tend to lead to a variety of artifacts and are not recommended. pub window_rounding: f32, /// Thickness of border around windows. /// @@ -89,6 +90,11 @@ pub struct Style { pub tab_rounding: f32, /// Thickness of border around tabs pub tab_border_size: f32, + /// Minimum width for close button to appear on an unselected tab when hovered. + /// + /// `= 0.0`: always show when hovering + /// `= f32::MAX`: never show close button unless selected + pub tab_min_width_for_unselected_close_button: f32, /// Side of the color buttonton pubin color editor widgets (left/right). pub color_button_position: Direction, /// Alignment of button text when button is larger than text. @@ -442,6 +448,10 @@ fn test_style_memory_layout() { assert_field_offset!(grab_rounding, GrabRounding); assert_field_offset!(tab_rounding, TabRounding); assert_field_offset!(tab_border_size, TabBorderSize); + assert_field_offset!( + tab_min_width_for_unselected_close_button, + TabMinWidthForUnselectedCloseButton + ); assert_field_offset!(color_button_position, ColorButtonPosition); assert_field_offset!(button_text_align, ButtonTextAlign); assert_field_offset!(selectable_text_align, SelectableTextAlign);