3 * Sven Verdoolaege. All rights reserved.
5 * Rob Zimmermann. All rights reserved.
7 * Keith Bostic. All rights reserved.
9 * See the LICENSE file for redistribution information.
14 #include <sys/types.h>
15 #include <sys/queue.h>
17 #include <bitstring.h>
24 #include "../common/common.h"
25 #include "../ipc/ip.h"
28 #include <zvt/zvtterm.h>
32 #include "gtkviscreen.h"
33 #include "gtkviwindow.h"
34 #include "gtk_extern.h"
36 static int vi_key_press_event
__P((GtkWidget
*, GdkEventKey
*, GtkVi
*));
45 GtkVi
* vi
= (GtkVi
*)(ipvi
->private_data
);
47 return zvt_term_forkpty(ZVT_TERM(vi
->term
), 0);
52 * PUBLIC: int gtk_vi_init __P((GtkVi **, int, char*[]));
55 gtk_vi_init(GtkVi
**vip
, int argc
, char **argv
)
60 MALLOC_GOTO(NULL
, vi
, GtkVi
*, sizeof(GtkVi
));
61 memset(vi
, 0, sizeof(GtkVi
));
64 term
= zvt_term_new();
65 gtk_widget_show(term
);
67 vt_parse_vt(&ZVT_TERM(term
)->vx
->vt
, "test\n", 5);
69 /* doesn't work now; need to know when other process is running
70 gtk_signal_connect(GTK_OBJECT(term), "key_press_event",
71 (GtkSignalFunc) vi_key_press_event, vi);
75 vi_create(&vi->ipvi, IP_EX_ALLOWED);
77 vi_create(&vi
->ipvi
, 0);
78 vi
->ipvi
->private_data
= vi
;
80 /* Run vi: the parent returns, the child is the vi process. */
81 vi
->ipvi
->run(vi
->ipvi
, argc
, argv
);
93 vi_key_press_event(zvt
, event
, vi
)
98 gtk_vi_key_press_event(vi
, event
);
100 gtk_signal_emit_stop_by_name(GTK_OBJECT(zvt
), "key_press_event");