aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2015-06-23 00:01:38 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2015-06-23 00:01:38 +0200
commit1707b10c7881ab275a60b5583ddb42b681d809fb (patch)
treedcdc22878a331703b4218179fde70d3c64cfb7d6
parent730f801f1d75bc247c86f76345e71f9ea128a07d (diff)
downloadsciteco-1707b10c7881ab275a60b5583ddb42b681d809fb.tar.gz
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.
-rw-r--r--src/interface-gtk.cpp16
1 files changed, 16 insertions, 0 deletions
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);