Get rid of easily removable uses of const_cast
This commit is contained in:
@@ -283,7 +283,7 @@ void DisplayServerMacOS::set_window_per_pixel_transparency_enabled(bool p_enable
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayServerMacOS::_update_displays_arrangement() {
|
||||
void DisplayServerMacOS::_update_displays_arrangement() const {
|
||||
origin = Point2i();
|
||||
|
||||
for (int i = 0; i < get_screen_count(); i++) {
|
||||
@@ -309,7 +309,7 @@ Point2i DisplayServerMacOS::_get_screens_origin() const {
|
||||
// to convert between macOS native screen coordinates and the ones expected by Godot.
|
||||
|
||||
if (displays_arrangement_dirty) {
|
||||
const_cast<DisplayServerMacOS *>(this)->_update_displays_arrangement();
|
||||
_update_displays_arrangement();
|
||||
}
|
||||
|
||||
return origin;
|
||||
@@ -470,7 +470,7 @@ void DisplayServerMacOS::_process_key_events() {
|
||||
key_event_pos = 0;
|
||||
}
|
||||
|
||||
void DisplayServerMacOS::_update_keyboard_layouts() {
|
||||
void DisplayServerMacOS::_update_keyboard_layouts() const {
|
||||
kbd_layouts.clear();
|
||||
current_layout = 0;
|
||||
|
||||
@@ -2935,14 +2935,14 @@ bool DisplayServerMacOS::get_swap_cancel_ok() {
|
||||
|
||||
int DisplayServerMacOS::keyboard_get_layout_count() const {
|
||||
if (keyboard_layout_dirty) {
|
||||
const_cast<DisplayServerMacOS *>(this)->_update_keyboard_layouts();
|
||||
_update_keyboard_layouts();
|
||||
}
|
||||
return kbd_layouts.size();
|
||||
}
|
||||
|
||||
void DisplayServerMacOS::keyboard_set_current_layout(int p_index) {
|
||||
if (keyboard_layout_dirty) {
|
||||
const_cast<DisplayServerMacOS *>(this)->_update_keyboard_layouts();
|
||||
_update_keyboard_layouts();
|
||||
}
|
||||
|
||||
ERR_FAIL_INDEX(p_index, kbd_layouts.size());
|
||||
@@ -2972,7 +2972,7 @@ void DisplayServerMacOS::keyboard_set_current_layout(int p_index) {
|
||||
|
||||
int DisplayServerMacOS::keyboard_get_current_layout() const {
|
||||
if (keyboard_layout_dirty) {
|
||||
const_cast<DisplayServerMacOS *>(this)->_update_keyboard_layouts();
|
||||
_update_keyboard_layouts();
|
||||
}
|
||||
|
||||
return current_layout;
|
||||
@@ -2980,7 +2980,7 @@ int DisplayServerMacOS::keyboard_get_current_layout() const {
|
||||
|
||||
String DisplayServerMacOS::keyboard_get_layout_language(int p_index) const {
|
||||
if (keyboard_layout_dirty) {
|
||||
const_cast<DisplayServerMacOS *>(this)->_update_keyboard_layouts();
|
||||
_update_keyboard_layouts();
|
||||
}
|
||||
|
||||
ERR_FAIL_INDEX_V(p_index, kbd_layouts.size(), "");
|
||||
@@ -2989,7 +2989,7 @@ String DisplayServerMacOS::keyboard_get_layout_language(int p_index) const {
|
||||
|
||||
String DisplayServerMacOS::keyboard_get_layout_name(int p_index) const {
|
||||
if (keyboard_layout_dirty) {
|
||||
const_cast<DisplayServerMacOS *>(this)->_update_keyboard_layouts();
|
||||
_update_keyboard_layouts();
|
||||
}
|
||||
|
||||
ERR_FAIL_INDEX_V(p_index, kbd_layouts.size(), "");
|
||||
|
||||
Reference in New Issue
Block a user