Skip to content

Commit

Permalink
Make window input obey input handling system
Browse files Browse the repository at this point in the history
  • Loading branch information
rsubtil committed Nov 2, 2023
1 parent a277a4a commit 24b02a6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scene/gui/popup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
#include "core/os/keyboard.h"
#include "scene/gui/panel.h"

void Popup::unhandled_input(const Ref<InputEvent> &p_event) {
_input_from_window(p_event);
}

void Popup::_input_from_window(const Ref<InputEvent> &p_event) {
if (get_flag(FLAG_POPUP) && p_event->is_action_pressed(SNAME("ui_cancel"), false, true)) {
_close_pressed();
Expand Down Expand Up @@ -208,7 +212,9 @@ Popup::Popup() {
set_flag(FLAG_RESIZE_DISABLED, true);
set_flag(FLAG_POPUP, true);

connect("window_input", callable_mp(this, &Popup::_input_from_window));
set_process_unhandled_input(true);

//connect("window_input", callable_mp(this, &Popup::_input_from_window));
}

Popup::~Popup() {
Expand Down
2 changes: 2 additions & 0 deletions scene/gui/popup.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class Popup : public Window {

virtual void _parent_focused();

void unhandled_input(const Ref<InputEvent> &p_event) override;

virtual void _post_popup() override;

public:
Expand Down

0 comments on commit 24b02a6

Please sign in to comment.