conrod icon indicating copy to clipboard operation
conrod copied to clipboard

Provide `Ui` methods that indicate whether or not user input is currently being captured.

Open mitchmindtree opened this issue 10 years ago • 3 comments

The method would return None if the input is not captured, otherwise returning Some(widget::Index) with the index of the widget currently capturing the input. I.e.

if ui.is_mouse_captured().is_none() {
    // Do stuff with mouse
}

if ui.is_keyboard_captured().is_none() {
    // Do stuff with keyboard
}

mitchmindtree avatar Nov 02 '15 03:11 mitchmindtree

I'm currently hitting this issue as a blocker for my editor.

LaylBongers avatar Jul 19 '17 14:07 LaylBongers

Nevermind it seems that the following is what I needed:

let widget = self.ui.global_input().current.widget_under_mouse;

LaylBongers avatar Jul 19 '17 15:07 LaylBongers

    /// Which widget, if any, is currently capturing the keyboard
    pub widget_capturing_keyboard: Option<widget::Id>,
    /// Which widget, if any, is currently capturing the mouse
    pub widget_capturing_mouse: Option<widget::Id>,
    /// The widget that is currently under the mouse cursor.
    ///
    /// If the mouse is currently over multiple widgets, this index will represent the top-most,
    /// non-graphic-child widget.
    pub widget_under_mouse: Option<widget::Id>,

We have all of these fields on the struct ui.global_input() returns. Can this issue be closed?

cedric-h avatar Jul 14 '19 22:07 cedric-h