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"
26 #include <zvt/zvtterm.h>
29 #include "gtkviscreen.h"
30 #include "gtkviwindow.h"
33 static int vi_key_press_event
__P((GtkWidget
*, GdkEventKey
*, GtkVi
*));
41 GtkVi
* vi
= (GtkVi
*)(ipvi
->private_data
);
43 return zvt_term_forkpty(ZVT_TERM(vi
->term
), 0);
47 * PUBLIC: int gtk_vi_init __P((GtkVi **, int, char*[]));
50 gtk_vi_init(vip
, argc
, argv
)
58 MALLOC_GOTO(NULL
, vi
, GtkVi
*, sizeof(GtkVi
));
59 memset(vi
, 0, sizeof(GtkVi
));
61 term
= zvt_term_new();
62 gtk_widget_show(term
);
64 vt_parse_vt(&ZVT_TERM(term
)->vx
->vt
, "test\n", 5);
65 /* doesn't work now; need to know when other process is running
66 gtk_signal_connect(GTK_OBJECT(term), "key_press_event",
67 (GtkSignalFunc) vi_key_press_event, vi);
71 vi_create(&vi->ipvi, IP_EX_ALLOWED);
73 vi_create(&vi
->ipvi
, 0);
74 vi
->ipvi
->private_data
= vi
;
76 /* Run vi: the parent returns, the child is the vi process. */
77 vi
->ipvi
->run(vi
->ipvi
, argc
, argv
);
88 * PUBLIC: void gtk_vi_show_term __P((GtkVi*, gint));
91 gtk_vi_show_term(vi
, show
)
95 gtk_notebook_set_page(GTK_NOTEBOOK(vi
->vi_window
), show
? 1 : 0);
100 vi_key_press_event(zvt
, event
, vi
)
105 gtk_vi_key_press_event(vi
, event
);
107 gtk_signal_emit_stop_by_name(GTK_OBJECT(zvt
), "key_press_event");