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>
22 #include "../common/common.h"
23 #include "../ipc/ip.h"
27 #include <zvt/zvtterm.h>
31 #include "gtkviscreen.h"
32 #include "gtkviwindow.h"
35 static int vi_key_press_event
__P((GtkWidget
*, GdkEventKey
*, GtkVi
*));
44 GtkVi
* vi
= (GtkVi
*)(ipvi
->private_data
);
46 return zvt_term_forkpty(ZVT_TERM(vi
->term
), 0);
51 * PUBLIC: int gtk_vi_init __P((GtkVi **, int, char*[]));
54 gtk_vi_init(vip
, argc
, 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
);
94 * PUBLIC: void gtk_vi_show_term __P((GtkVi*, gint));
97 gtk_vi_show_term(vi
, show
)
101 gtk_notebook_set_page(GTK_NOTEBOOK(vi
->vi_window
), show
? 1 : 0);
106 vi_key_press_event(zvt
, event
, vi
)
111 gtk_vi_key_press_event(vi
, event
);
113 gtk_signal_emit_stop_by_name(GTK_OBJECT(zvt
), "key_press_event");