5 * Sven Verdoolaege. All rights reserved.
7 * Rob Zimmermann. All rights reserved.
9 * Keith Bostic. All rights reserved.
11 * See the LICENSE file for redistribution information.
16 #include <sys/types.h>
17 #include <sys/queue.h>
19 #include <bitstring.h>
26 #include "../common/common.h"
27 #include "../ipc/ip.h"
30 #include <zvt/zvtterm.h>
34 #include "gtkviscreen.h"
35 #include "gtkviwindow.h"
38 static int vi_key_press_event
__P((GtkWidget
*, GdkEventKey
*, GtkVi
*));
47 GtkVi
* vi
= (GtkVi
*)(ipvi
->private_data
);
49 return zvt_term_forkpty(ZVT_TERM(vi
->term
), 0);
54 * PUBLIC: int gtk_vi_init __P((GtkVi **, int, char*[]));
57 gtk_vi_init(GtkVi
**vip
, int argc
, char **argv
)
62 MALLOC_GOTO(NULL
, vi
, GtkVi
*, sizeof(GtkVi
));
63 memset(vi
, 0, sizeof(GtkVi
));
66 term
= zvt_term_new();
67 gtk_widget_show(term
);
69 vt_parse_vt(&ZVT_TERM(term
)->vx
->vt
, "test\n", 5);
71 /* doesn't work now; need to know when other process is running
72 gtk_signal_connect(GTK_OBJECT(term), "key_press_event",
73 (GtkSignalFunc) vi_key_press_event, vi);
77 vi_create(&vi->ipvi, IP_EX_ALLOWED);
79 vi_create(&vi
->ipvi
, 0);
80 vi
->ipvi
->private_data
= vi
;
82 /* Run vi: the parent returns, the child is the vi process. */
83 vi
->ipvi
->run(vi
->ipvi
, argc
, argv
);
95 vi_key_press_event(zvt
, event
, vi
)
100 gtk_vi_key_press_event(vi
, event
);
102 gtk_signal_emit_stop_by_name(GTK_OBJECT(zvt
), "key_press_event");