Commit 0a3660f3 authored by Jeremy White's avatar Jeremy White

Add an initial creation of a spice server.

This is still very unformed, but the bones are taking shape.
parent a369a0c1
......@@ -3,6 +3,8 @@ AM_INIT_AUTOMAKE
PKG_CHECK_MODULES(X11, x11)
PKG_CHECK_MODULES(GTK2, gtk+-2.0)
PKG_CHECK_MODULES(SPICE, spice-server)
PKG_CHECK_MODULES(GLIB2, glib-2.0)
AC_PROG_CC
AC_CONFIG_FILES(Makefile src/Makefile)
......
bin_PROGRAMS = x11spice
AM_CFLAGS = $(XLL_CFLAGS) $(GTK2_CFLAGS)
x11spice_LDADD = $(X11_LIBS) $(GTK2_LIBS)
AM_CFLAGS = $(XLL_CFLAGS) $(GTK2_CFLAGS) $(SPICE_CFLAGS) $(GLIB2_CFLAGS)
x11spice_LDADD = $(X11_LIBS) $(GTK2_LIBS) $(SPICE_LIBS) $(GLIB2_LIBS)
x11spice_SOURCES = \
display.c \
gui.c \
options.c \
display.c \
spice.c \
main.c
......@@ -18,6 +18,9 @@
along with x11spice. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DISPLAY_H_
#define DISPLAY_H_
#include <X11/Xlib.h>
/*----------------------------------------------------------------------------
......@@ -35,3 +38,4 @@ typedef struct
display_t *display_open(options_t *options);
void display_close(display_t *display);
#endif
......@@ -18,6 +18,9 @@
along with x11spice. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GUI_H_
#define GUI_H_
#include <gtk/gtk.h>
/*----------------------------------------------------------------------------
......@@ -33,3 +36,5 @@ typedef struct
**--------------------------------------------------------------------------*/
int gui_init(gui_t *gui, int argc, char *argv[]);
void gui_run(gui_t *gui);
#endif
/*
Copyright (C) 2016 Jeremy White <jwhite@codeweavers.com>
All rights reserved.
This file is part of x11spice
x11spice is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
x11spice is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with x11spice. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LOCAL_SPICE_H_
#define LOCAL_SPICE_H_
#include <spice.h>
#include "options.h"
/*----------------------------------------------------------------------------
** Structure definitions
**--------------------------------------------------------------------------*/
typedef struct
{
SpiceServer *server;
SpiceCoreInterface *core;
QXLInstance display_sin;
QXLWorker *worker;
int compression_level;
} spice_t;
/*----------------------------------------------------------------------------
** Prototypes
**--------------------------------------------------------------------------*/
int spice_start(spice_t *s, options_t *options);
void spice_end(spice_t *s);
#endif
......@@ -23,6 +23,7 @@
#include "x11spice.h"
#include "options.h"
#include "local_spice.h"
#include "display.h"
#include "gui.h"
......@@ -33,6 +34,7 @@ int main(int argc, char *argv[])
options_t options;
display_t * display = NULL;
gui_t gui;
spice_t s;
/*------------------------------------------------------------------------
** Parse arguments
......@@ -53,11 +55,22 @@ int main(int argc, char *argv[])
}
/*------------------------------------------------------------------------
** Run the gui
** Initialize the GUI
**----------------------------------------------------------------------*/
rc = gui_init(&gui, argc, argv);
if (rc == 0)
gui_run(&gui);
if (rc)
goto exit;
/*------------------------------------------------------------------------
** Start up a spice server
**----------------------------------------------------------------------*/
rc = spice_start(&s, &options);
if (rc)
goto exit;
gui_run(&gui);
spice_end(&s);
/*------------------------------------------------------------------------
** Close the display, go home
......
......@@ -18,6 +18,8 @@
along with x11spice. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPTIONS_H_
#define OPTIONS_H_
/*----------------------------------------------------------------------------
** Structure definitions
......@@ -35,3 +37,5 @@ typedef struct
void options_init(options_t *options);
int options_parse_arguments(int argc, char *argv[], options_t *options);
void options_free(options_t *options);
#endif
This diff is collapsed.
......@@ -18,6 +18,8 @@
along with x11spice. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef X11SPICE_H_
#define X11SPICE_H_
/*----------------------------------------------------------------------------
** Constant definitions
......@@ -25,4 +27,6 @@
#define X11SPICE_ERR_BADARGS 1
#define X11SPICE_ERR_NODISPLAY 2
#define X11SPICE_ERR_GTK_FAILED 3
#define X11SPICE_ERR_SPICE_INIT_FAILED 4
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment