diff --git a/gdk4/src/surface.rs b/gdk4/src/surface.rs index 0c9f9edb13b7..3d094faccf27 100644 --- a/gdk4/src/surface.rs +++ b/gdk4/src/surface.rs @@ -28,6 +28,7 @@ pub trait SurfaceExtManual: sealed::Sealed + IsA + 'static { } } + // Returns true if the coordinates were successfully translated #[doc(alias = "gdk_surface_translate_coordinates")] fn translate_coordinates(&self, to: &Surface, mut x: f64, mut y: f64) -> bool { unsafe { diff --git a/gsk4/src/path.rs b/gsk4/src/path.rs index a653b10bab1d..af98b444f75d 100644 --- a/gsk4/src/path.rs +++ b/gsk4/src/path.rs @@ -5,14 +5,14 @@ use glib::translate::*; impl Path { #[doc(alias = "gsk_path_foreach")] - pub fn foreach bool>( + pub fn foreach glib::ControlFlow>( &self, flags: PathForeachFlags, func: P, - ) -> bool { + ) -> glib::ControlFlow { let func_data: P = func; unsafe extern "C" fn func_func< - P: FnMut(&PathOperation, &graphene::Point, usize, f32) -> bool, + P: FnMut(&PathOperation, &graphene::Point, usize, f32) -> glib::ControlFlow, >( op: ffi::GskPathOperation, pts: *const graphene::ffi::graphene_point_t, diff --git a/gtk4/src/drop_target.rs b/gtk4/src/drop_target.rs index 575ca0890418..67fa63e2a59c 100644 --- a/gtk4/src/drop_target.rs +++ b/gtk4/src/drop_target.rs @@ -45,6 +45,7 @@ impl DropTarget { } } + // Returns true if the drop was accepted pub fn connect_drop bool + 'static>( &self, f: F, diff --git a/gtk4/src/shortcuts_section.rs b/gtk4/src/shortcuts_section.rs index e1747ad39b09..894199e27a5d 100644 --- a/gtk4/src/shortcuts_section.rs +++ b/gtk4/src/shortcuts_section.rs @@ -8,11 +8,22 @@ use glib::{ use std::mem::transmute; impl ShortcutsSection { + // todo: figure out what the bool return value here corresponds to pub fn connect_change_current_page bool + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe { + unsafe extern "C" fn change_current_page_trampoline< + F: Fn(&ShortcutsSection, i32) -> bool + 'static, + >( + this: *mut ffi::GtkShortcutsSection, + object: libc::c_int, + f: glib::ffi::gpointer, + ) -> glib::ffi::gboolean { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this), object).into_glib() + } let f = Box::new(f); connect_raw( self.as_ptr() as *mut _, @@ -27,14 +38,3 @@ impl ShortcutsSection { self.emit_by_name("change-current-page", &[&object]) } } - -unsafe extern "C" fn change_current_page_trampoline< - F: Fn(&ShortcutsSection, i32) -> bool + 'static, ->( - this: *mut ffi::GtkShortcutsSection, - object: libc::c_int, - f: glib::ffi::gpointer, -) -> glib::ffi::gboolean { - let f: &F = &*(f as *const F); - f(&from_glib_borrow(this), object).into_glib() -} diff --git a/gtk4/src/subclass/accessible_range.rs b/gtk4/src/subclass/accessible_range.rs index c67b91f9bf94..cdfb3ec9f257 100644 --- a/gtk4/src/subclass/accessible_range.rs +++ b/gtk4/src/subclass/accessible_range.rs @@ -18,6 +18,7 @@ mod sealed { } pub trait AccessibleRangeImplExt: sealed::Sealed + ObjectSubclass { + // Returns true if the operation was performed, false otherwise fn parent_set_current_value(&self, accessible_range: &Self::Type, value: f64) -> bool { unsafe { let type_data = Self::type_data(); diff --git a/gtk4/src/subclass/cell_area.rs b/gtk4/src/subclass/cell_area.rs index ddb9a5949d8b..7e5723871afa 100644 --- a/gtk4/src/subclass/cell_area.rs +++ b/gtk4/src/subclass/cell_area.rs @@ -17,7 +17,7 @@ pub struct CellCallback { } impl CellCallback { - pub fn call>(&self, cell_renderer: &R) -> bool { + pub fn call>(&self, cell_renderer: &R) -> glib::ControlFlow { unsafe { if let Some(callback) = self.callback { from_glib(callback( @@ -25,8 +25,7 @@ impl CellCallback { self.user_data, )) } else { - // true to stop iterating over cells - true + glib::ControlFlow::Break } } } @@ -44,7 +43,7 @@ impl CellCallbackAllocate { cell_renderer: &R, cell_area: &gdk::Rectangle, cell_background: &gdk::Rectangle, - ) -> bool { + ) -> glib::ControlFlow { unsafe { if let Some(callback) = self.callback { from_glib(callback( @@ -54,8 +53,7 @@ impl CellCallbackAllocate { self.user_data, )) } else { - // true to stop iterating over cells - true + glib::ControlFlow::Break } } } @@ -227,6 +225,7 @@ mod sealed { #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] pub trait CellAreaImplExt: sealed::Sealed + ObjectSubclass { + // Returns true if the area was successfully activated fn parent_activate, W: IsA>( &self, context: &P, @@ -317,6 +316,7 @@ pub trait CellAreaImplExt: sealed::Sealed + ObjectSubclass { } } + // returns true only if the event is handled fn parent_event, P: IsA>( &self, context: &P, @@ -338,7 +338,6 @@ pub trait CellAreaImplExt: sealed::Sealed + ObjectSubclass { flags.into_glib(), )) } else { - // returns true only if the event is handled false } } @@ -396,6 +395,7 @@ pub trait CellAreaImplExt: sealed::Sealed + ObjectSubclass { } } + // Whether the cell is activatable fn parent_is_activatable(&self) -> bool { unsafe { let data = Self::type_data(); @@ -408,6 +408,7 @@ pub trait CellAreaImplExt: sealed::Sealed + ObjectSubclass { } } + // TRUE if focus remains inside area as a result of this call. fn parent_focus(&self, direction_type: DirectionType) -> bool { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/cell_renderer.rs b/gtk4/src/subclass/cell_renderer.rs index 760844da1fbe..a732d06498c9 100644 --- a/gtk4/src/subclass/cell_renderer.rs +++ b/gtk4/src/subclass/cell_renderer.rs @@ -257,6 +257,7 @@ pub trait CellRendererImplExt: sealed::Sealed + ObjectSubclass { } } + // Returns true if the event was consumed/handled fn parent_activate>( &self, event: Option<&gdk::Event>, diff --git a/gtk4/src/subclass/font_chooser.rs b/gtk4/src/subclass/font_chooser.rs index 2360d076ce51..6e965c393258 100644 --- a/gtk4/src/subclass/font_chooser.rs +++ b/gtk4/src/subclass/font_chooser.rs @@ -17,6 +17,7 @@ pub struct FilterCallback { } impl FilterCallback { + // true if the font should be displayed pub fn call(&self, font_family: &FontFamily, font_face: &FontFace) -> bool { unsafe { if let Some(filter_func) = self.filter_func { diff --git a/gtk4/src/subclass/gl_area.rs b/gtk4/src/subclass/gl_area.rs index 9c389a0daa37..343959324615 100644 --- a/gtk4/src/subclass/gl_area.rs +++ b/gtk4/src/subclass/gl_area.rs @@ -13,7 +13,7 @@ pub trait GLAreaImpl: GLAreaImplExt + WidgetImpl { self.parent_create_context() } - fn render(&self, context: &GLContext) -> bool { + fn render(&self, context: &GLContext) -> glib::Propagation { self.parent_render(context) } @@ -44,7 +44,7 @@ pub trait GLAreaImplExt: sealed::Sealed + ObjectSubclass { } } - fn parent_render(&self, context: &GLContext) -> bool { + fn parent_render(&self, context: &GLContext) -> glib::Propagation { unsafe { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::GtkGLAreaClass; diff --git a/gtk4/src/subclass/im_context.rs b/gtk4/src/subclass/im_context.rs index a83b79d155f6..075b4ed30918 100644 --- a/gtk4/src/subclass/im_context.rs +++ b/gtk4/src/subclass/im_context.rs @@ -88,6 +88,7 @@ pub trait IMContextImplExt: sealed::Sealed + ObjectSubclass { } } + // Returns true if the signal was handled fn parent_delete_surrounding(&self, offset: i32, n_chars: i32) -> bool { unsafe { let data = Self::type_data(); @@ -99,12 +100,12 @@ pub trait IMContextImplExt: sealed::Sealed + ObjectSubclass { n_chars, )) } else { - // Returns true if the signal was handled false } } } + // Returns true if the event was consumed fn parent_filter_keypress(&self, event: &gdk::Event) -> bool { unsafe { let data = Self::type_data(); @@ -115,7 +116,6 @@ pub trait IMContextImplExt: sealed::Sealed + ObjectSubclass { event.to_glib_none().0, )) } else { - // Returns true if the event was consumed false } } @@ -225,6 +225,7 @@ pub trait IMContextImplExt: sealed::Sealed + ObjectSubclass { } } + // Returns true if the signal was handled fn parent_retrieve_surrounding(&self) -> bool { unsafe { let data = Self::type_data(); @@ -236,7 +237,6 @@ pub trait IMContextImplExt: sealed::Sealed + ObjectSubclass { .to_glib_none() .0)) } else { - // Returns true if the signal was handled false } } diff --git a/gtk4/src/subclass/media_stream.rs b/gtk4/src/subclass/media_stream.rs index 82387e7ae7dc..bdc96195e209 100644 --- a/gtk4/src/subclass/media_stream.rs +++ b/gtk4/src/subclass/media_stream.rs @@ -49,6 +49,7 @@ pub trait MediaStreamImplExt: sealed::Sealed + ObjectSubclass { } } + // Returns true if successfully started playing fn parent_play(&self) -> bool { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/print_operation.rs b/gtk4/src/subclass/print_operation.rs index 9faf33f4eaee..c56a92d92a2b 100644 --- a/gtk4/src/subclass/print_operation.rs +++ b/gtk4/src/subclass/print_operation.rs @@ -164,6 +164,7 @@ pub trait PrintOperationImplExt: sealed::Sealed + ObjectSubclass { } } + // Returns true if pagination is complete fn parent_paginate(&self, context: &PrintContext) -> bool { unsafe { let data = Self::type_data(); @@ -183,6 +184,7 @@ pub trait PrintOperationImplExt: sealed::Sealed + ObjectSubclass { } } + // true if the listener wants to take over control of the preview. fn parent_preview( &self, preview: &PrintOperationPreview, diff --git a/gtk4/src/subclass/range.rs b/gtk4/src/subclass/range.rs index b5d15c907275..15edb0d83d4c 100644 --- a/gtk4/src/subclass/range.rs +++ b/gtk4/src/subclass/range.rs @@ -11,7 +11,7 @@ pub trait RangeImpl: RangeImplExt + WidgetImpl { self.parent_adjust_bounds(new_value) } - fn change_value(&self, scroll_type: ScrollType, new_value: f64) -> bool { + fn change_value(&self, scroll_type: ScrollType, new_value: f64) -> glib::Propagation { self.parent_change_value(scroll_type, new_value) } @@ -48,7 +48,7 @@ pub trait RangeImplExt: sealed::Sealed + ObjectSubclass { } } - fn parent_change_value(&self, scroll_type: ScrollType, new_value: f64) -> bool { + fn parent_change_value(&self, scroll_type: ScrollType, new_value: f64) -> glib::Propagation { unsafe { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::GtkRangeClass; diff --git a/gtk4/src/subclass/tree_drag_source.rs b/gtk4/src/subclass/tree_drag_source.rs index 484360de3469..055cd44c5cfa 100644 --- a/gtk4/src/subclass/tree_drag_source.rs +++ b/gtk4/src/subclass/tree_drag_source.rs @@ -24,6 +24,7 @@ mod sealed { #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] pub trait TreeDragSourceImplExt: sealed::Sealed + ObjectSubclass { + // Returns true if the row can be dragged fn parent_row_draggable(&self, path: &TreePath) -> bool { unsafe { let type_data = Self::type_data(); @@ -65,6 +66,7 @@ pub trait TreeDragSourceImplExt: sealed::Sealed + ObjectSubclass { } } + // True if the row was successfully deleted fn parent_drag_data_delete(&self, path: &TreePath) -> bool { unsafe { let type_data = Self::type_data(); diff --git a/gtk4/src/subclass/tree_model_filter.rs b/gtk4/src/subclass/tree_model_filter.rs index f6362f6ffb4f..117415cb2253 100644 --- a/gtk4/src/subclass/tree_model_filter.rs +++ b/gtk4/src/subclass/tree_model_filter.rs @@ -32,6 +32,7 @@ mod sealed { #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] pub trait TreeModelFilterImplExt: sealed::Sealed + ObjectSubclass { + // Whether the row indicated by iter is visible fn parent_visible>(&self, child_model: &M, iter: &TreeIter) -> bool { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/widget.rs b/gtk4/src/subclass/widget.rs index 588802208d1d..1a3dc5f00c3f 100644 --- a/gtk4/src/subclass/widget.rs +++ b/gtk4/src/subclass/widget.rs @@ -230,6 +230,7 @@ pub trait WidgetImplExt: sealed::Sealed + ObjectSubclass { } } + // true if the widget contains (x, y) fn parent_contains(&self, x: f64, y: f64) -> bool { unsafe { let data = Self::type_data(); @@ -259,6 +260,7 @@ pub trait WidgetImplExt: sealed::Sealed + ObjectSubclass { } } + // Returns true if focus ended up inside widget fn parent_focus(&self, direction_type: DirectionType) -> bool { unsafe { let data = Self::type_data(); @@ -285,6 +287,7 @@ pub trait WidgetImplExt: sealed::Sealed + ObjectSubclass { } } + // Returns true if focus ended up inside widget fn parent_grab_focus(&self) -> bool { unsafe { let data = Self::type_data(); @@ -309,6 +312,8 @@ pub trait WidgetImplExt: sealed::Sealed + ObjectSubclass { } } + // TRUE if stopping keyboard navigation is fine, + // FALSE if the emitting widget should try to handle the keyboard navigation attempt in its parent container(s). fn parent_keynav_failed(&self, direction_type: DirectionType) -> bool { unsafe { let data = Self::type_data(); @@ -360,6 +365,7 @@ pub trait WidgetImplExt: sealed::Sealed + ObjectSubclass { } } + // True if the signal has been handled fn parent_mnemonic_activate(&self, group_cycling: bool) -> bool { unsafe { let data = Self::type_data(); diff --git a/gtk4/src/subclass/window.rs b/gtk4/src/subclass/window.rs index 7cb511c8f367..ec126cd2f55d 100644 --- a/gtk4/src/subclass/window.rs +++ b/gtk4/src/subclass/window.rs @@ -67,6 +67,7 @@ pub trait WindowImplExt: sealed::Sealed + ObjectSubclass { } } + // Returns true if debugging (inspector) should be enabled, false otherwise fn parent_enable_debugging(&self, toggle: bool) -> bool { unsafe { let data = Self::type_data();