Better text selection
This commit is contained in:
@@ -69,6 +69,10 @@ pub enum PlatformEvent {
|
||||
window_id: WindowId,
|
||||
event: KeyboardEvent,
|
||||
},
|
||||
ClipboardText {
|
||||
window_id: WindowId,
|
||||
text: String,
|
||||
},
|
||||
PrimarySelectionText {
|
||||
window_id: WindowId,
|
||||
text: String,
|
||||
@@ -107,6 +111,13 @@ pub enum PlatformRequest {
|
||||
window_id: WindowId,
|
||||
scene: SceneSnapshot,
|
||||
},
|
||||
SetClipboardText {
|
||||
window_id: WindowId,
|
||||
text: String,
|
||||
},
|
||||
RequestClipboardText {
|
||||
window_id: WindowId,
|
||||
},
|
||||
SetPrimarySelectionText {
|
||||
window_id: WindowId,
|
||||
text: String,
|
||||
@@ -254,6 +265,21 @@ impl PlatformProxy {
|
||||
self.send(PlatformRequest::RequestPrimarySelectionText { window_id })
|
||||
}
|
||||
|
||||
pub fn set_clipboard_text(
|
||||
&self,
|
||||
window_id: WindowId,
|
||||
text: impl Into<String>,
|
||||
) -> Result<(), PlatformClosed> {
|
||||
self.send(PlatformRequest::SetClipboardText {
|
||||
window_id,
|
||||
text: text.into(),
|
||||
})
|
||||
}
|
||||
|
||||
pub fn request_clipboard_text(&self, window_id: WindowId) -> Result<(), PlatformClosed> {
|
||||
self.send(PlatformRequest::RequestClipboardText { window_id })
|
||||
}
|
||||
|
||||
pub fn set_cursor_icon(
|
||||
&self,
|
||||
window_id: WindowId,
|
||||
@@ -328,6 +354,8 @@ pub fn start_headless() -> PlatformRuntime {
|
||||
PlatformRequest::ReplaceScene { window_id, scene } => {
|
||||
handle_replace_scene(&state, window_id, scene);
|
||||
}
|
||||
PlatformRequest::SetClipboardText { .. } => {}
|
||||
PlatformRequest::RequestClipboardText { .. } => {}
|
||||
PlatformRequest::SetPrimarySelectionText { .. } => {}
|
||||
PlatformRequest::RequestPrimarySelectionText { .. } => {}
|
||||
PlatformRequest::SetCursorIcon { .. } => {}
|
||||
|
||||
Reference in New Issue
Block a user