mirror of
https://github.com/minetest/minetest.git
synced 2025-01-10 15:27:29 +01:00
Don't memset SEvent directly (#15359)
Fixes a compiler warning by manually zeroing the tag and the largest union member instead
This commit is contained in:
parent
8b85a62310
commit
5c5538685e
@ -18,7 +18,7 @@ enum EEVENT_TYPE
|
|||||||
to mouse or keyboard events. When a GUI element receives an event it will either
|
to mouse or keyboard events. When a GUI element receives an event it will either
|
||||||
process it and return true, or pass the event to its parent. If an event is not absorbed
|
process it and return true, or pass the event to its parent. If an event is not absorbed
|
||||||
before it reaches the root element then it will then be passed to the user receiver. */
|
before it reaches the root element then it will then be passed to the user receiver. */
|
||||||
EET_GUI_EVENT = 0,
|
EET_GUI_EVENT = 1,
|
||||||
|
|
||||||
//! A mouse input event.
|
//! A mouse input event.
|
||||||
/** Mouse events are created by the device and passed to IrrlichtDevice::postEventFromUser
|
/** Mouse events are created by the device and passed to IrrlichtDevice::postEventFromUser
|
||||||
@ -332,6 +332,9 @@ struct SEvent
|
|||||||
//! True if ctrl was also pressed
|
//! True if ctrl was also pressed
|
||||||
bool Control : 1;
|
bool Control : 1;
|
||||||
|
|
||||||
|
//! Is this a simulated mouse event generated by the engine itself?
|
||||||
|
bool Simulated : 1;
|
||||||
|
|
||||||
//! A bitmap of button states. You can use isButtonPressed() to determine
|
//! A bitmap of button states. You can use isButtonPressed() to determine
|
||||||
//! if a button is pressed or not.
|
//! if a button is pressed or not.
|
||||||
u32 ButtonStates;
|
u32 ButtonStates;
|
||||||
@ -347,9 +350,6 @@ struct SEvent
|
|||||||
|
|
||||||
//! Type of mouse event
|
//! Type of mouse event
|
||||||
EMOUSE_INPUT_EVENT Event;
|
EMOUSE_INPUT_EVENT Event;
|
||||||
|
|
||||||
//! Is this a simulated mouse event generated by Minetest itself?
|
|
||||||
bool Simulated;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Any kind of keyboard event.
|
//! Any kind of keyboard event.
|
||||||
@ -543,8 +543,9 @@ struct SEvent
|
|||||||
};
|
};
|
||||||
|
|
||||||
SEvent() {
|
SEvent() {
|
||||||
// would be left uninitialized in many places otherwise
|
EventType = static_cast<EEVENT_TYPE>(0);
|
||||||
MouseInput.Simulated = false;
|
// zero the biggest union member we have, which clears all others too
|
||||||
|
memset(&JoystickEvent, 0, sizeof(JoystickEvent));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1581,7 +1581,6 @@ bool CIrrDeviceLinux::activateJoysticks(core::array<SJoystickInfo> &joystickInfo
|
|||||||
fcntl(info.fd, F_SETFL, O_NONBLOCK);
|
fcntl(info.fd, F_SETFL, O_NONBLOCK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
(void)memset(&info.persistentData, 0, sizeof(info.persistentData));
|
|
||||||
info.persistentData.EventType = irr::EET_JOYSTICK_INPUT_EVENT;
|
info.persistentData.EventType = irr::EET_JOYSTICK_INPUT_EVENT;
|
||||||
info.persistentData.JoystickEvent.Joystick = ActiveJoysticks.size();
|
info.persistentData.JoystickEvent.Joystick = ActiveJoysticks.size();
|
||||||
|
|
||||||
|
@ -1107,7 +1107,6 @@ void GUITable::sendTableEvent(s32 column, bool doubleclick)
|
|||||||
m_sel_doubleclick = doubleclick;
|
m_sel_doubleclick = doubleclick;
|
||||||
if (Parent) {
|
if (Parent) {
|
||||||
SEvent e;
|
SEvent e;
|
||||||
memset(&e, 0, sizeof e);
|
|
||||||
e.EventType = EET_GUI_EVENT;
|
e.EventType = EET_GUI_EVENT;
|
||||||
e.GUIEvent.Caller = this;
|
e.GUIEvent.Caller = this;
|
||||||
e.GUIEvent.Element = 0;
|
e.GUIEvent.Element = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user