--- a/gnt.h Sat Apr 19 20:05:35 2014 +0530
+++ b/gnt.h Tue Apr 22 13:18:02 2014 +0530
@@ -30,6 +30,20 @@
+# define NCURSES_WIDECHAR 0 +# define NCURSES_WIDECHAR 1 #include "gntclipboard.h"
--- a/gntbindable.h Sat Apr 19 20:05:35 2014 +0530
+++ b/gntbindable.h Tue Apr 22 13:18:02 2014 +0530
@@ -32,7 +32,6 @@
#define GNT_TYPE_BINDABLE (gnt_bindable_get_type())
#define GNT_BINDABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_BINDABLE, GntBindable))
--- a/gntcolors.c Sat Apr 19 20:05:35 2014 +0530
+++ b/gntcolors.c Tue Apr 22 13:18:02 2014 +0530
@@ -20,10 +20,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
#define GNT_LOG_DOMAIN "Colors"
--- a/gntinternal.h Sat Apr 19 20:05:35 2014 +0530
+++ b/gntinternal.h Tue Apr 22 13:18:02 2014 +0530
@@ -19,7 +19,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
#define G_LOG_DOMAIN "Gnt"
--- a/gntkeys.h Sat Apr 19 20:05:35 2014 +0530
+++ b/gntkeys.h Tue Apr 22 13:18:02 2014 +0530
@@ -29,7 +29,6 @@
@@ -44,6 +43,54 @@
#define SAFE(x) ((cur_term && (x)) ? (x) : "")
+/* This is needed so that g-ir-scanner does not take GNT_KEY_CTRL_* as + constants -- because if it does, the .gir contains the following invalid XML + characters, and parsing explodes */ +/* XXX: \xe1 is a hacky alias for \x00 key code */ +#define GNT_KEY_POPUP CONST("") /* not supported? */ +#define GNT_KEY_UP CONST("\xe0\x48") +#define GNT_KEY_DOWN CONST("\xe0\x50") +#define GNT_KEY_LEFT CONST("\xe0\x4B") +#define GNT_KEY_RIGHT CONST("\xe0\x4D") +#define GNT_KEY_CTRL_UP CONST("\xe0\x8d") +#define GNT_KEY_CTRL_DOWN CONST("\xe0\x91") +#define GNT_KEY_CTRL_LEFT CONST("\xe0\x73") +#define GNT_KEY_CTRL_RIGHT CONST("\xe0\x74") +#define GNT_KEY_PGUP CONST("\xe0\x49") +#define GNT_KEY_PGDOWN CONST("\xe0\x51") +#define GNT_KEY_HOME CONST("\xe0\x47") +#define GNT_KEY_END CONST("\xe0\x4f") +#define GNT_KEY_ENTER CONST("\x0d") +#define GNT_KEY_BACKSPACE CONST("\x08") +#define GNT_KEY_DEL CONST("\xe0\x53") +#define GNT_KEY_INS CONST("\xe0\x52") +#define GNT_KEY_BACK_TAB CONST("\xe1\x94") +#define GNT_KEY_F1 CONST("\xe1\x3b") +#define GNT_KEY_F2 CONST("\xe1\x3c") +#define GNT_KEY_F3 CONST("\xe1\x3d") +#define GNT_KEY_F4 CONST("\xe1\x3e") +#define GNT_KEY_F5 CONST("\xe1\x3f") +#define GNT_KEY_F6 CONST("\xe1\x40") +#define GNT_KEY_F7 CONST("\xe1\x41") +#define GNT_KEY_F8 CONST("\xe1\x42") +#define GNT_KEY_F9 CONST("\xe1\x43") +#define GNT_KEY_F10 CONST("\xe1\x44") +#define GNT_KEY_F11 CONST("\xe0\x85") +#define GNT_KEY_F12 CONST("\xe0\x86") #define GNT_KEY_POPUP SAFE(key_f16) /* Apparently */
@@ -69,10 +116,20 @@
#define GNT_KEY_INS SAFE(key_ic)
#define GNT_KEY_BACK_TAB ((cur_term && back_tab) ? back_tab : SAFE(key_btab))
-/* This is needed so that g-ir-scanner does not take GNT_KEY_CTRL_* as
- constants -- because if it does, the .gir contains the following invalid XML
- characters, and parsing explodes */
+#define GNT_KEY_F1 SAFE(key_f1) +#define GNT_KEY_F2 SAFE(key_f2) +#define GNT_KEY_F3 SAFE(key_f3) +#define GNT_KEY_F4 SAFE(key_f4) +#define GNT_KEY_F5 SAFE(key_f5) +#define GNT_KEY_F6 SAFE(key_f6) +#define GNT_KEY_F7 SAFE(key_f7) +#define GNT_KEY_F8 SAFE(key_f8) +#define GNT_KEY_F9 SAFE(key_f9) +#define GNT_KEY_F10 SAFE(key_f10) +#define GNT_KEY_F11 SAFE(key_f11) +#define GNT_KEY_F12 SAFE(key_f12) #define GNT_KEY_CTRL_A CONST("\001")
#define GNT_KEY_CTRL_B CONST("\002")
--- a/gntmain.c Sat Apr 19 20:05:35 2014 +0530
+++ b/gntmain.c Tue Apr 22 13:18:02 2014 +0530
@@ -30,7 +30,9 @@
@@ -61,6 +63,12 @@
* Notes: Interesting functions to look at:
* scr_dump, scr_init, scr_restore: for workspaces
@@ -98,6 +106,7 @@
@@ -214,22 +223,90 @@
gnt_widget_clicked(widget, event, x, y);
io_invoke_error(GIOChannel *source, GIOCondition cond, gpointer data)
+ /* XXX: it throws an error after evey io_invoke, I have no idea why */ int id = GPOINTER_TO_INT(data);
g_io_channel_unref(source);
io_invoke(GIOChannel *source, GIOCondition cond, gpointer null)
+ gboolean is_special = FALSE; + if (wm->mode == GNT_KP_MODE_WAIT_ON_CHILD) + g_source_remove(escape_stuff.timer); + escape_stuff.timer = 0; + ch = _getch(); /* we could use _getch_nolock */ + /* a small hack - we don't want to put NUL anywhere */ + if (ch == 0xE0 || ch == 0xE1) { + if (ch == 0x1B && !is_special) { /* ESC */ + escape_stuff.timer = g_timeout_add(250, escape_timeout, NULL); + gnt_wm_set_event_stack(wm, TRUE); + gsize converted_len = 0; + converted = g_locale_to_utf8(k, 1, NULL, &converted_len, NULL); + if (converted_len > 0 && converted_len <= 4) { + memcpy(k, converted, converted_len); + k[converted_len] = '\0'; + /* TODO: we could call detect_mouse_action here, but no + * events are triggered (yet?) for mouse on win32. + gnt_wm_process_input(wm, keys); + gnt_wm_set_event_stack(wm, FALSE); @@ -302,13 +379,25 @@
gnt_wm_set_event_stack(wm, FALSE);
+ channel = g_io_channel_win32_new_fd(STDIN_FILENO); channel = g_io_channel_unix_new(STDIN_FILENO);
+ gnt_warning("failed creating new channel%s", ""); g_io_channel_set_close_on_unref(channel, TRUE);
@@ -325,9 +414,7 @@
io_invoke_error, GINT_TO_POINTER(result), NULL);
- g_io_channel_unref(channel); /* Apparently this caused crashes for some people.
- But irssi does this, so I am going to assume the
- crashes were caused by some other stuff. */
+ g_io_channel_unref(channel); gnt_warning("setting up IO (%d)", channel_read_callback);
@@ -339,6 +426,7 @@
@@ -356,6 +444,7 @@
exit_confirmed(gpointer null)
@@ -425,10 +514,12 @@
signal(SIGWINCH, sighandler);
signal(SIGCHLD, sighandler);
signal(SIGINT, sighandler);
@@ -508,9 +599,11 @@
org_winch_handler = signal(SIGWINCH, sighandler);
signal(SIGCHLD, sighandler);
+ signal(SIGPIPE, SIG_IGN); signal(SIGINT, sighandler);
- signal(SIGPIPE, SIG_IGN);
#if !GLIB_CHECK_VERSION(2, 36, 0)
/* GLib type system is automaticaly initialized since 2.36. */
@@ -696,7 +789,9 @@
cp->callback(status, cp->data);
wm->mode = GNT_KP_MODE_NORMAL;