minix/external/bsd/nvi/dist/gtk/gtkvi.c
Lionel Sambuc 84d9c625bf Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC)
- Fix for possible unset uid/gid in toproto
 - Fix for default mtree style
 - Update libelf
 - Importing libexecinfo
 - Resynchronize GCC, mpc, gmp, mpfr
 - build.sh: Replace params with show-params.
     This has been done as the make target has been renamed in the same
     way, while a new target named params has been added. This new
     target generates a file containing all the parameters, instead of
     printing it on the console.
 - Update test48 with new etc/services (Fix by Ben Gras <ben@minix3.org)
     get getservbyport() out of the inner loop

Change-Id: Ie6ad5226fa2621ff9f0dee8782ea48f9443d2091
2014-07-28 17:05:06 +02:00

105 lines
1.8 KiB
C

/*-
* Copyright (c) 1999
* Sven Verdoolaege. All rights reserved.
* Copyright (c) 1996
* Rob Zimmermann. All rights reserved.
* Copyright (c) 1996
* Keith Bostic. All rights reserved.
*
* See the LICENSE file for redistribution information.
*/
#include "config.h"
#include <sys/types.h>
#include <sys/queue.h>
#include <bitstring.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include "../common/common.h"
#include "../ipc/ip.h"
#if 0
#include <zvt/zvtterm.h>
#include <zvt/vt.h>
#endif
#include "gtkvi.h"
#include "gtkviscreen.h"
#include "gtkviwindow.h"
#include "gtk_extern.h"
static int vi_key_press_event __P((GtkWidget*, GdkEventKey*, GtkVi*));
#if 0
static int
vi_fork(ipvi)
IPVI *ipvi;
{
GtkVi* vi = (GtkVi*)(ipvi->private_data);
return zvt_term_forkpty(ZVT_TERM(vi->term), 0);
}
#endif
/*
* PUBLIC: int gtk_vi_init __P((GtkVi **, int, char*[]));
*/
int
gtk_vi_init(GtkVi **vip, int argc, char **argv)
{
GtkVi *vi;
GtkWidget *term;
MALLOC_GOTO(NULL, vi, GtkVi*, sizeof(GtkVi));
memset(vi, 0, sizeof(GtkVi));
#if 0
term = zvt_term_new();
gtk_widget_show(term);
vi->term = term;
vt_parse_vt(&ZVT_TERM(term)->vx->vt, "test\n", 5);
#endif
/* doesn't work now; need to know when other process is running
gtk_signal_connect(GTK_OBJECT(term), "key_press_event",
(GtkSignalFunc) vi_key_press_event, vi);
*/
/*
vi_create(&vi->ipvi, IP_EX_ALLOWED);
*/
vi_create(&vi->ipvi, 0);
vi->ipvi->private_data = vi;
/* Run vi: the parent returns, the child is the vi process. */
vi->ipvi->run(vi->ipvi, argc, argv);
*vip = vi;
return 0;
alloc_err:
return 1;
}
#if 0
static int
vi_key_press_event(zvt, event, vi)
GtkVi *vi;
GtkWidget *zvt;
GdkEventKey *event;
{
gtk_vi_key_press_event(vi, event);
gtk_signal_emit_stop_by_name(GTK_OBJECT(zvt), "key_press_event");
/* handled */
return 1;
}
#endif