From 1707b10c7881ab275a60b5583ddb42b681d809fb Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Tue, 23 Jun 2015 00:01:38 +0200 Subject: GTK UI: disable keyboard and mouse interaction with Scintilla views * this has long been broken in the GTK UI. It must not be possible to let Scintilla react to mouse and keyboard events since all side-effects on the buffer state must be via the SciTECO language. --- src/interface-gtk.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/interface-gtk.cpp') diff --git a/src/interface-gtk.cpp b/src/interface-gtk.cpp index 83c20cb..d46e91e 100644 --- a/src/interface-gtk.cpp +++ b/src/interface-gtk.cpp @@ -58,6 +58,8 @@ static gboolean exit_app(GtkWidget *w, GdkEventAny *e, gpointer user_data); void ViewGtk::initialize_impl(void) { + gint events; + gdk_threads_enter(); sci = SCINTILLA(scintilla_new()); @@ -70,7 +72,21 @@ ViewGtk::initialize_impl(void) scintilla_set_id(sci, 0); gtk_widget_set_usize(get_widget(), 500, 300); + + /* + * This disables mouse and key events on this view. + * For some strange reason, masking events on + * the event box does NOT work. + * NOTE: Scroll events are still allowed - scrolling + * is currently not under direct control of SciTECO + * (i.e. it is OK the side effects of scrolling are not + * tracked). + */ gtk_widget_set_can_focus(get_widget(), FALSE); + events = gtk_widget_get_events(get_widget()); + events &= ~(GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); + events &= ~(GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK); + gtk_widget_set_events(get_widget(), events); g_signal_connect(G_OBJECT(sci), SCINTILLA_NOTIFY, G_CALLBACK(scintilla_notify), NULL); -- cgit v1.2.3