fix some keybinds not working in the chat input (fixes #135)
This commit is contained in:
@@ -11,7 +11,10 @@ ChatInputText::ChatInputText() {
|
||||
|
||||
// hack
|
||||
auto cb = [this](GdkEventKey *e) -> bool {
|
||||
return event(reinterpret_cast<GdkEvent *>(e));
|
||||
// we cant use Widget::event here specifically or else for some reason
|
||||
// it prevents the default binding set from activating sometimes
|
||||
// specifically event() will return true (why) preventing default handler from running
|
||||
return m_signal_key_press_proxy.emit(e);
|
||||
};
|
||||
m_textview.signal_key_press_event().connect(cb, false);
|
||||
m_textview.set_hexpand(false);
|
||||
@@ -90,12 +93,16 @@ ChatInputText::type_signal_image_paste ChatInputText::signal_image_paste() {
|
||||
return m_signal_image_paste;
|
||||
}
|
||||
|
||||
ChatInputText::type_signal_key_press_proxy ChatInputText::signal_key_press_proxy() {
|
||||
return m_signal_key_press_proxy;
|
||||
}
|
||||
|
||||
ChatInputTextContainer::ChatInputTextContainer() {
|
||||
// triple hack !!!
|
||||
auto cb = [this](GdkEventKey *e) -> bool {
|
||||
return event(reinterpret_cast<GdkEvent *>(e));
|
||||
};
|
||||
m_input.signal_key_press_event().connect(cb, false);
|
||||
m_input.signal_key_press_proxy().connect(cb);
|
||||
|
||||
m_upload_img.property_icon_name() = "document-send-symbolic";
|
||||
m_upload_img.property_icon_size() = Gtk::ICON_SIZE_LARGE_TOOLBAR;
|
||||
|
@@ -83,15 +83,18 @@ public:
|
||||
using type_signal_submit = sigc::signal<bool, Glib::ustring>;
|
||||
using type_signal_escape = sigc::signal<void>;
|
||||
using type_signal_image_paste = sigc::signal<void, Glib::RefPtr<Gdk::Pixbuf>>;
|
||||
using type_signal_key_press_proxy = sigc::signal<bool, GdkEventKey *>;
|
||||
|
||||
type_signal_submit signal_submit();
|
||||
type_signal_escape signal_escape();
|
||||
type_signal_image_paste signal_image_paste();
|
||||
type_signal_key_press_proxy signal_key_press_proxy();
|
||||
|
||||
private:
|
||||
type_signal_submit m_signal_submit;
|
||||
type_signal_escape m_signal_escape;
|
||||
type_signal_image_paste m_signal_image_paste;
|
||||
type_signal_key_press_proxy m_signal_key_press_proxy;
|
||||
};
|
||||
|
||||
// file upload, text
|
||||
|
Reference in New Issue
Block a user