distrib: run libtoolize
[nvi.git] / gtk / gtkvi.c
blobbbafb98ce26f050bd7d3979f678f7da05d998083
1 /*-
2 * Copyright (c) 1999
3 * Sven Verdoolaege. All rights reserved.
4 * Copyright (c) 1996
5 * Rob Zimmermann. All rights reserved.
6 * Copyright (c) 1996
7 * Keith Bostic. All rights reserved.
9 * See the LICENSE file for redistribution information.
12 #include "config.h"
14 #include <sys/types.h>
15 #include <sys/queue.h>
17 #include <bitstring.h>
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <string.h>
22 #include <gtk/gtk.h>
24 #include "../common/common.h"
25 #include "../ipc/ip.h"
27 #if 0
28 #include <zvt/zvtterm.h>
29 #include <zvt/vt.h>
30 #endif
31 #include "gtkvi.h"
32 #include "gtkviscreen.h"
33 #include "gtkviwindow.h"
34 #include "extern.h"
36 static int vi_key_press_event __P((GtkWidget*, GdkEventKey*, GtkVi*));
40 #if 0
41 static int
42 vi_fork(ipvi)
43 IPVI *ipvi;
45 GtkVi* vi = (GtkVi*)(ipvi->private_data);
47 return zvt_term_forkpty(ZVT_TERM(vi->term), 0);
49 #endif
51 /*
52 * PUBLIC: int gtk_vi_init __P((GtkVi **, int, char*[]));
54 int
55 gtk_vi_init(GtkVi **vip, int argc, char **argv)
57 GtkVi *vi;
58 GtkWidget *term;
60 MALLOC_GOTO(NULL, vi, GtkVi*, sizeof(GtkVi));
61 memset(vi, 0, sizeof(GtkVi));
63 #if 0
64 term = zvt_term_new();
65 gtk_widget_show(term);
66 vi->term = term;
67 vt_parse_vt(&ZVT_TERM(term)->vx->vt, "test\n", 5);
68 #endif
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);
83 *vip = vi;
85 return 0;
87 alloc_err:
88 return 1;
91 #if 0
92 static int
93 vi_key_press_event(zvt, event, vi)
94 GtkVi *vi;
95 GtkWidget *zvt;
96 GdkEventKey *event;
98 gtk_vi_key_press_event(vi, event);
100 gtk_signal_emit_stop_by_name(GTK_OBJECT(zvt), "key_press_event");
101 /* handled */
102 return 1;
104 #endif