-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
egui_winit
: Make the clipboard_text
and allow_ime
state public
#3724
Conversation
0aee060
to
cb0bfbf
Compare
48e306a
to
7011bf3
Compare
Co-authored-by: Marijn Suijten <[email protected]>
7011bf3
to
f0fc434
Compare
but the return type is |
|
It was a comment on the fact that the fields where private instead of public. I don't know what the convention is in this repo but I would personally make the fields public instead of writing methods that return a &mut |
@tedsteen that comment was written with immutability in mind, but even after correcting that we need mutable access to this field, this matches the |
The difference is that |
Wasn't suggesting that a |
Ouch, looks like this missed out on the |
Co-authored-by: Marijn Suijten <[email protected]>
d595298
to
e083d88
Compare
Co-authored-by: Marijn Suijten <[email protected]>
I opted to take the same approach regarding the clipboard in the last commit, by making a
Sorry, this had slipped my mind after the Christmas holiday D: |
@@ -172,6 +172,26 @@ impl State { | |||
self.egui_input.max_texture_side = Some(max_texture_side); | |||
} | |||
|
|||
/// Fetches text from the clipboard and returns it. | |||
pub fn clipboard_text(&mut self) -> Option<String> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we document why this is mutable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH it's something deep down inside arboard
(not sure about smithay
), and it isn't obviously documented there other than it being "and get operation" and doing any operation probably requiring mut access.
egui_winit
: Allow getting the clipboard
and allow_ime
stateegui_winit
: Make the clipboard
and allow_ime
state public
egui_winit
: Make the clipboard
and allow_ime
state publicegui_winit
: Make the clipboard_text
and allow_ime
state public
The
egui_winit::State
contains both theclipboard
andallow_ime
, but these are both private fields. In our implementation we useegui_winit
to do most of the lifting, but it would come really in handy if we could access these values.Instead of making the fields
pub
we opted for separate get/set functions, that way calling side can't freely replace any of the values fully and it's more in line with the style of the rest of the codebase.