aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2015-06-22 16:55:49 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2015-06-22 16:55:49 +0200
commit6f48745171ab3ef898b24d8da9732c4f309b08c7 (patch)
tree329b0088f4952cc76c2c1f386c43cb329589b661
parentca6043bd631091661211d1e332d33219f967a043 (diff)
downloadsciteco-6f48745171ab3ef898b24d8da9732c4f309b08c7.tar.gz
fixed compilation of GTK+ UI
-rw-r--r--src/interface-gtk.cpp57
-rw-r--r--src/interface-gtk.h9
2 files changed, 34 insertions, 32 deletions
diff --git a/src/interface-gtk.cpp b/src/interface-gtk.cpp
index 965bdca..3253139 100644
--- a/src/interface-gtk.cpp
+++ b/src/interface-gtk.cpp
@@ -46,9 +46,9 @@ namespace SciTECO {
extern "C" {
static void scintilla_notify(ScintillaObject *sci, uptr_t idFrom,
- SCNotification *notify, gpointer user_data);
+ SCNotification *notify, gpointer user_data);
static gboolean cmdline_key_pressed(GtkWidget *widget, GdkEventKey *event,
- gpointer user_data);
+ gpointer user_data);
static gboolean exit_app(GtkWidget *w, GdkEventAny *e, gpointer p);
}
@@ -283,30 +283,8 @@ InterfaceGtk::widget_set_font(GtkWidget *widget, const gchar *font_name)
pango_font_description_free(font_desc);
}
-InterfaceGtk::~InterfaceGtk()
-{
- g_free(info_current);
- if (popup_widget)
- gtk_widget_destroy(popup_widget);
- if (window)
- gtk_widget_destroy(window);
-
- scintilla_release_resources();
-}
-
-/*
- * GTK+ callbacks
- */
-
-static void
-scintilla_notify(ScintillaObject *sci, uptr_t idFrom,
- SCNotification *notify, gpointer user_data)
-{
- interface.process_notify(notify);
-}
-
-static inline void
-handle_key_press(bool is_shift, bool is_ctl, guint keyval)
+void
+InterfaceGtk::handle_key_press(bool is_shift, bool is_ctl, guint keyval)
{
switch (keyval) {
case GDK_Escape:
@@ -379,8 +357,29 @@ handle_key_press(bool is_shift, bool is_ctl, guint keyval)
* So we set it here once after every keypress even if the
* info line did not change.
*/
- gtk_window_set_title(GTK_WINDOW(interface.window),
- interface.info_current);
+ gtk_window_set_title(GTK_WINDOW(window), info_current);
+}
+
+InterfaceGtk::~InterfaceGtk()
+{
+ g_free(info_current);
+ if (popup_widget)
+ gtk_widget_destroy(popup_widget);
+ if (window)
+ gtk_widget_destroy(window);
+
+ scintilla_release_resources();
+}
+
+/*
+ * GTK+ callbacks
+ */
+
+static void
+scintilla_notify(ScintillaObject *sci, uptr_t idFrom,
+ SCNotification *notify, gpointer user_data)
+{
+ interface.process_notify(notify);
}
static gboolean
@@ -397,7 +396,7 @@ cmdline_key_pressed(GtkWidget *widget, GdkEventKey *event,
#endif
try {
- handle_key_press(is_shift, is_ctl, event->keyval);
+ interface.handle_key_press(is_shift, is_ctl, event->keyval);
} catch (Quit) {
/*
* SciTECO should terminate, so we exit
diff --git a/src/interface-gtk.h b/src/interface-gtk.h
index 389b096..31deaf6 100644
--- a/src/interface-gtk.h
+++ b/src/interface-gtk.h
@@ -141,13 +141,16 @@ public:
gtk_main();
}
+ /*
+ * FIXME: This is for internal use only and could be
+ * hidden in a nested forward-declared friend struct.
+ */
+ void handle_key_press(bool is_shift, bool is_ctl, guint keyval);
+
private:
static void widget_set_font(GtkWidget *widget, const gchar *font_name);
void cmdline_insert_chr(gint &pos, gchar chr);
-
- friend static inline void handle_key_press(bool is_shift, bool is_ctl,
- guint keyval);
} InterfaceCurrent;
} /* namespace SciTECO */