diff --git a/src/backend/gtk3/message_dialog.rs b/src/backend/gtk3/message_dialog.rs index 978f369..8541f3e 100644 --- a/src/backend/gtk3/message_dialog.rs +++ b/src/backend/gtk3/message_dialog.rs @@ -59,6 +59,7 @@ impl GtkMessageDialog { title.as_ptr(), ) as *mut gtk_sys::GtkDialog; + set_child_labels_selectable(dialog); // Also set the window title, otherwise it would be empty gtk_sys::gtk_window_set_title(dialog as _, title.as_ptr()); @@ -89,6 +90,23 @@ impl GtkMessageDialog { } } +unsafe fn is_label(type_instance: *const gobject_sys::GTypeInstance) -> bool { + (*(*type_instance).g_class).g_type == gtk_sys::gtk_label_get_type() +} + +/// Sets the child labels of a widget selectable +unsafe fn set_child_labels_selectable(dialog: *mut gtk_sys::GtkDialog) { + let area = gtk_sys::gtk_message_dialog_get_message_area(dialog as _); + let mut children = gtk_sys::gtk_container_get_children(area as _); + while !children.is_null() { + let child = (*children).data; + if is_label(child as _) { + gtk_sys::gtk_label_set_selectable(child as _, 1); + } + children = (*children).next; + } +} + impl Drop for GtkMessageDialog { fn drop(&mut self) { unsafe {