-
-
Notifications
You must be signed in to change notification settings - Fork 21.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
Streamline InputEvent class hierarchy to define position property only once #59144
Conversation
619a8bc
to
2ef2a18
Compare
That makes sense to me. I thought about the same but didn't push on that idea since the screen event didn't inherit |
@@ -7,7 +7,7 @@ | |||
<tutorials> | |||
</tutorials> | |||
<members> | |||
<member name="window_id" type="int" setter="set_window_id" getter="get_window_id" default="0"> | |||
<member name="window_id" type="int" setter="set_window_id" getter="get_window_id"> |
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.
I wonder why this is changing in this PR.
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.
I asked myself the same question, but could not find any reason for this.
Two additional thoughts came to my mind:
|
On my side I am not sure about the usefulness of this. Also, I think making a common To sum up, I believe the gain from this PR is limited while it make the class hierarchy more complex (which is visible to the end user, not only internal). |
@groud regarding real-life use cases, I just made an argument here: godotengine/godot-proposals#4158 (reply in thread) |
Well, from what I read is that his PR would only help to solve an internal implementation small issue. So this is a contributor's problem, not a user's one. So IMO, this is not sufficient to justify a change there. Also, regarding your issue, you should check for the first class, and not rely on "set_position". It really unlikely we are going to add a lot more of new events with position anyway, so there's no need to change the class hierarchy just to future-proof that. |
This was discussed in the PR-review-meeting. |
This PR changes the
InputEvent
class hierarchy, so that the position property is defined only in a single new class namedInputEventWithPosition
. Current status is, that position gets defined in four different classes with their own getters and setters, which would be simplified by this patch. Another benefit is, that this change makes it easy to distinguish between events with and without position.In order to make this possible, this patch changes
InputEventScreenDrag
andInputEventScreenTouch
, so that they now also inherit fromInputEventWithModifiers
.The changed class hierarchy would look like this:
Implements godotengine/godot-proposals#4158
Bugsquad edit: Related to #55300 and #58334