mirror of
https://gitlab.com/virt-viewer/virt-viewer.git
synced 2025-01-07 17:17:45 +03:00
Introduce standard naming convention to files & methods
All source files must be named virt-viewer-XXXX All methods named virt_viewer_XXX
This commit is contained in:
parent
cfdc8055be
commit
f3fa999769
@ -1,6 +1,6 @@
|
||||
|
||||
AC_INIT(virt-viewer, 0.3.1)
|
||||
AC_CONFIG_SRCDIR(src/main.c)
|
||||
AC_CONFIG_SRCDIR(src/virt-viewer-main.c)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
dnl Make automake keep quiet about wildcards & other GNUmake-isms
|
||||
AM_INIT_AUTOMAKE([-Wno-portability])
|
||||
|
@ -55,9 +55,9 @@ rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%dir %{_mingw32_datadir}/virt-viewer/
|
||||
%dir %{_mingw32_datadir}/virt-viewer/ui/
|
||||
%{_mingw32_datadir}/virt-viewer/ui/about.xml
|
||||
%{_mingw32_datadir}/virt-viewer/ui/auth.xml
|
||||
%{_mingw32_datadir}/virt-viewer/ui/viewer.xml
|
||||
%{_mingw32_datadir}/virt-viewer/ui/virt-viewer.xml
|
||||
%{_mingw32_datadir}/virt-viewer/ui/virt-viewer-about.xml
|
||||
%{_mingw32_datadir}/virt-viewer/ui/virt-viewer-auth.xml
|
||||
|
||||
%{_mingw32_mandir}/man1/virt-viewer.1*
|
||||
|
||||
|
@ -4,10 +4,10 @@ plugindir = $(libdir)/mozilla/plugins
|
||||
plugin_LTLIBRARIES = virt-viewer-plugin.la
|
||||
|
||||
virt_viewer_plugin_la_SOURCES = \
|
||||
../src/util.c ../src/util.h \
|
||||
../src/auth.c ../src/auth.h \
|
||||
../src/viewer.c ../src/viewer.h \
|
||||
../src/events.c ../src/events.h \
|
||||
../src/virt-viewer-util.c ../src/virt-viewer-util.h \
|
||||
../src/virt-viewer-auth.c ../src/virt-viewer-auth.h \
|
||||
../src/virt-viewer.c ../src/virt-viewer.h \
|
||||
../src/virt-viewer-events.c ../src/virt-viewer-events.h \
|
||||
virt-viewer-plugin.c virt-viewer-plugin.h \
|
||||
npshell.c npunix.c
|
||||
virt_viewer_plugin_la_LIBADD = \
|
||||
|
@ -2,19 +2,22 @@
|
||||
bin_PROGRAMS = virt-viewer
|
||||
|
||||
builderxmldir = $(pkgdatadir)/ui
|
||||
builderxml_DATA = viewer.xml about.xml auth.xml
|
||||
builderxml_DATA = \
|
||||
virt-viewer.xml \
|
||||
virt-viewer-about.xml \
|
||||
virt-viewer-auth.xml
|
||||
|
||||
EXTRA_DIST = $(builderxml_DATA)
|
||||
|
||||
virt_viewer_SOURCES = \
|
||||
main.c \
|
||||
util.h util.c \
|
||||
auth.h auth.c \
|
||||
events.h events.c \
|
||||
viewer.h viewer.c \
|
||||
viewer-priv.h \
|
||||
display.h display.c \
|
||||
display-vnc.h display-vnc.c \
|
||||
virt-viewer-main.c \
|
||||
virt-viewer-util.h virt-viewer-util.c \
|
||||
virt-viewer-auth.h virt-viewer-auth.c \
|
||||
virt-viewer-events.h virt-viewer-events.c \
|
||||
virt-viewer.h virt-viewer.c \
|
||||
virt-viewer-priv.h \
|
||||
virt-viewer-display.h virt-viewer-display.c \
|
||||
virt-viewer-display-vnc.h virt-viewer-display-vnc.c \
|
||||
view/autoDrawer.c \
|
||||
view/autoDrawer.h \
|
||||
view/drawer.c \
|
||||
@ -25,7 +28,7 @@ virt_viewer_SOURCES = \
|
||||
|
||||
if HAVE_SPICE_GTK
|
||||
virt_viewer_SOURCES += \
|
||||
display-spice.h display-spice.c
|
||||
virt-viewer-display-spice.h virt-viewer-display-spice.c
|
||||
endif
|
||||
|
||||
virt_viewer_LDADD = \
|
||||
|
@ -30,8 +30,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
</property>
|
||||
<property name="authors">Daniel P. Berrange</property>
|
||||
<property name="translator_credits" translatable="yes">The Fedora Translation Team</property>
|
||||
<signal name="response" handler="viewer_about_close"/>
|
||||
<signal name="delete_event" handler="viewer_about_delete"/>
|
||||
<signal name="response" handler="virt_viewer_about_close"/>
|
||||
<signal name="delete_event" handler="virt_viewer_about_delete"/>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkVBox" id="dialog-vbox1">
|
||||
<property name="visible">True</property>
|
@ -26,14 +26,17 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "auth.h"
|
||||
#include "virt-viewer-auth.h"
|
||||
|
||||
|
||||
int viewer_auth_collect_credentials(const char *type, const char *address,
|
||||
char **username, char **password)
|
||||
int
|
||||
virt_viewer_auth_collect_credentials(const char *type,
|
||||
const char *address,
|
||||
char **username,
|
||||
char **password)
|
||||
{
|
||||
GtkWidget *dialog = NULL;
|
||||
GtkBuilder *creds = viewer_load_ui("auth.xml");
|
||||
GtkBuilder *creds = virt_viewer_util_load_ui("virt-viewer-auth.xml");
|
||||
GtkWidget *credUsername;
|
||||
GtkWidget *credPassword;
|
||||
GtkWidget *promptUsername;
|
||||
@ -85,7 +88,10 @@ int viewer_auth_collect_credentials(const char *type, const char *address,
|
||||
return response == GTK_RESPONSE_OK ? 0 : -1;
|
||||
}
|
||||
|
||||
void viewer_auth_vnc_credentials(GtkWidget *vnc, GValueArray *credList, char **vncAddress)
|
||||
void
|
||||
virt_viewer_auth_vnc_credentials(GtkWidget *vnc,
|
||||
GValueArray *credList,
|
||||
char **vncAddress)
|
||||
{
|
||||
char *username = NULL, *password = NULL;
|
||||
gboolean wantPassword = FALSE, wantUsername = FALSE;
|
||||
@ -112,9 +118,9 @@ void viewer_auth_vnc_credentials(GtkWidget *vnc, GValueArray *credList, char **v
|
||||
}
|
||||
|
||||
if (wantUsername || wantPassword) {
|
||||
int ret = viewer_auth_collect_credentials("VNC", vncAddress ? *vncAddress : NULL,
|
||||
wantUsername ? &username : NULL,
|
||||
wantPassword ? &password : NULL);
|
||||
int ret = virt_viewer_auth_collect_credentials("VNC", vncAddress ? *vncAddress : NULL,
|
||||
wantUsername ? &username : NULL,
|
||||
wantPassword ? &password : NULL);
|
||||
|
||||
if (ret < 0) {
|
||||
vnc_display_close(VNC_DISPLAY(vnc));
|
||||
@ -165,9 +171,9 @@ void viewer_auth_vnc_credentials(GtkWidget *vnc, GValueArray *credList, char **v
|
||||
|
||||
|
||||
int
|
||||
viewer_auth_libvirt_credentials(virConnectCredentialPtr cred,
|
||||
unsigned int ncred,
|
||||
void *cbdata)
|
||||
virt_viewer_auth_libvirt_credentials(virConnectCredentialPtr cred,
|
||||
unsigned int ncred,
|
||||
void *cbdata)
|
||||
{
|
||||
char **username = NULL, **password = NULL;
|
||||
const char *uri = cbdata;
|
||||
@ -192,8 +198,8 @@ viewer_auth_libvirt_credentials(virConnectCredentialPtr cred,
|
||||
}
|
||||
|
||||
if (username || password) {
|
||||
ret = viewer_auth_collect_credentials("libvirt", uri,
|
||||
username, password);
|
||||
ret = virt_viewer_auth_collect_credentials("libvirt", uri,
|
||||
username, password);
|
||||
if (ret < 0)
|
||||
goto cleanup;
|
||||
} else {
|
@ -25,15 +25,19 @@
|
||||
|
||||
#include <libvirt/libvirt.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "virt-viewer-util.h"
|
||||
|
||||
void viewer_auth_vnc_credentials(GtkWidget *vnc, GValueArray *credList, char **message);
|
||||
void virt_viewer_auth_vnc_credentials(GtkWidget *vnc,
|
||||
GValueArray *credList,
|
||||
char **message);
|
||||
|
||||
int viewer_auth_collect_credentials(const char *type, const char *address,
|
||||
char **username, char **password);
|
||||
int virt_viewer_auth_collect_credentials(const char *type,
|
||||
const char *address,
|
||||
char **username,
|
||||
char **password);
|
||||
|
||||
int viewer_auth_libvirt_credentials(virConnectCredentialPtr cred,
|
||||
unsigned int ncred,
|
||||
void *cbdata);
|
||||
int virt_viewer_auth_libvirt_credentials(virConnectCredentialPtr cred,
|
||||
unsigned int ncred,
|
||||
void *cbdata);
|
||||
|
||||
#endif
|
@ -23,19 +23,20 @@
|
||||
*/
|
||||
|
||||
#include <spice-audio.h>
|
||||
#include "util.h"
|
||||
#include "display-spice.h"
|
||||
#include "auth.h"
|
||||
|
||||
#include "virt-viewer-util.h"
|
||||
#include "virt-viewer-display-spice.h"
|
||||
#include "virt-viewer-auth.h"
|
||||
|
||||
G_DEFINE_TYPE (VirtViewerDisplaySpice, virt_viewer_display_spice, VIRT_VIEWER_TYPE_DISPLAY)
|
||||
|
||||
|
||||
static void _spice_close(VirtViewerDisplay* display);
|
||||
static void _spice_send_keys(VirtViewerDisplay* display, const guint *keyvals, int nkeyvals);
|
||||
static GdkPixbuf* _spice_get_pixbuf(VirtViewerDisplay* display);
|
||||
static gboolean _spice_open_fd(VirtViewerDisplay* display, int fd);
|
||||
static gboolean _spice_open_host(VirtViewerDisplay* display, char *host, char *port);
|
||||
static gboolean _spice_channel_open_fd(VirtViewerDisplay* display, VirtViewerDisplayChannel* channel, int fd);
|
||||
static void virt_viewer_display_spice_close(VirtViewerDisplay *display);
|
||||
static void virt_viewer_display_spice_send_keys(VirtViewerDisplay *display, const guint *keyvals, int nkeyvals);
|
||||
static GdkPixbuf *virt_viewer_display_spice_get_pixbuf(VirtViewerDisplay *display);
|
||||
static gboolean virt_viewer_display_spice_open_fd(VirtViewerDisplay *display, int fd);
|
||||
static gboolean virt_viewer_display_spice_open_host(VirtViewerDisplay *display, char *host, char *port);
|
||||
static gboolean virt_viewer_display_spice_channel_open_fd(VirtViewerDisplay *display, VirtViewerDisplayChannel *channel, int fd);
|
||||
|
||||
|
||||
static void
|
||||
@ -43,12 +44,12 @@ virt_viewer_display_spice_class_init(VirtViewerDisplaySpiceClass *klass)
|
||||
{
|
||||
VirtViewerDisplayClass *dclass = VIRT_VIEWER_DISPLAY_CLASS(klass);
|
||||
|
||||
dclass->close = _spice_close;
|
||||
dclass->send_keys = _spice_send_keys;
|
||||
dclass->get_pixbuf = _spice_get_pixbuf;
|
||||
dclass->open_fd = _spice_open_fd;
|
||||
dclass->open_host = _spice_open_host;
|
||||
dclass->channel_open_fd = _spice_channel_open_fd;
|
||||
dclass->close = virt_viewer_display_spice_close;
|
||||
dclass->send_keys = virt_viewer_display_spice_send_keys;
|
||||
dclass->get_pixbuf = virt_viewer_display_spice_get_pixbuf;
|
||||
dclass->open_fd = virt_viewer_display_spice_open_fd;
|
||||
dclass->open_host = virt_viewer_display_spice_open_host;
|
||||
dclass->channel_open_fd = virt_viewer_display_spice_channel_open_fd;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -56,7 +57,10 @@ virt_viewer_display_spice_init(VirtViewerDisplaySpice *self G_GNUC_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
static void _spice_send_keys(VirtViewerDisplay* display, const guint *keyvals, int nkeyvals)
|
||||
static void
|
||||
virt_viewer_display_spice_send_keys(VirtViewerDisplay *display,
|
||||
const guint *keyvals,
|
||||
int nkeyvals)
|
||||
{
|
||||
VirtViewerDisplaySpice *self = VIRT_VIEWER_DISPLAY_SPICE(display);
|
||||
|
||||
@ -66,7 +70,8 @@ static void _spice_send_keys(VirtViewerDisplay* display, const guint *keyvals, i
|
||||
spice_display_send_keys(self->display, keyvals, nkeyvals, SPICE_DISPLAY_KEY_EVENT_CLICK);
|
||||
}
|
||||
|
||||
static GdkPixbuf* _spice_get_pixbuf(VirtViewerDisplay* display)
|
||||
static GdkPixbuf *
|
||||
virt_viewer_display_spice_get_pixbuf(VirtViewerDisplay *display)
|
||||
{
|
||||
VirtViewerDisplaySpice *self = VIRT_VIEWER_DISPLAY_SPICE(display);
|
||||
|
||||
@ -76,7 +81,8 @@ static GdkPixbuf* _spice_get_pixbuf(VirtViewerDisplay* display)
|
||||
return spice_display_get_pixbuf(self->display);
|
||||
}
|
||||
|
||||
static void _spice_close(VirtViewerDisplay* display)
|
||||
static void
|
||||
virt_viewer_display_spice_close(VirtViewerDisplay *display)
|
||||
{
|
||||
VirtViewerDisplaySpice *self = VIRT_VIEWER_DISPLAY_SPICE(display);
|
||||
|
||||
@ -96,7 +102,10 @@ static void _spice_close(VirtViewerDisplay* display)
|
||||
self->audio = NULL;
|
||||
}
|
||||
|
||||
static gboolean _spice_open_host(VirtViewerDisplay* display, char *host, char *port)
|
||||
static gboolean
|
||||
virt_viewer_display_spice_open_host(VirtViewerDisplay *display,
|
||||
char *host,
|
||||
char *port)
|
||||
{
|
||||
VirtViewerDisplaySpice *self = VIRT_VIEWER_DISPLAY_SPICE(display);
|
||||
|
||||
@ -111,7 +120,9 @@ static gboolean _spice_open_host(VirtViewerDisplay* display, char *host, char *p
|
||||
return spice_session_connect(self->session);
|
||||
}
|
||||
|
||||
static gboolean _spice_open_fd(VirtViewerDisplay* display, int fd)
|
||||
static gboolean
|
||||
virt_viewer_display_spice_open_fd(VirtViewerDisplay *display,
|
||||
int fd)
|
||||
{
|
||||
VirtViewerDisplaySpice *self = VIRT_VIEWER_DISPLAY_SPICE(display);
|
||||
|
||||
@ -120,8 +131,10 @@ static gboolean _spice_open_fd(VirtViewerDisplay* display, int fd)
|
||||
return spice_session_open_fd(self->session, fd);
|
||||
}
|
||||
|
||||
static gboolean _spice_channel_open_fd(VirtViewerDisplay* display,
|
||||
VirtViewerDisplayChannel* channel, int fd)
|
||||
static gboolean
|
||||
virt_viewer_display_spice_channel_open_fd(VirtViewerDisplay *display,
|
||||
VirtViewerDisplayChannel *channel,
|
||||
int fd)
|
||||
{
|
||||
VirtViewerDisplaySpice *self = VIRT_VIEWER_DISPLAY_SPICE(display);
|
||||
|
||||
@ -130,20 +143,22 @@ static gboolean _spice_channel_open_fd(VirtViewerDisplay* display,
|
||||
return spice_channel_open_fd(SPICE_CHANNEL(channel), fd);
|
||||
}
|
||||
|
||||
static void _spice_channel_open_fd_request(SpiceChannel *channel,
|
||||
G_GNUC_UNUSED gint tls,
|
||||
VirtViewerDisplay *display)
|
||||
static void
|
||||
virt_viewer_display_spice_channel_open_fd_request(SpiceChannel *channel,
|
||||
gint tls G_GNUC_UNUSED,
|
||||
VirtViewerDisplay *display)
|
||||
{
|
||||
VirtViewerDisplaySpice *self = VIRT_VIEWER_DISPLAY_SPICE(display);
|
||||
|
||||
g_return_if_fail(self != NULL);
|
||||
|
||||
viewer_channel_open_fd(display->viewer, (VirtViewerDisplayChannel *)channel);
|
||||
virt_viewer_channel_open_fd(display->viewer, (VirtViewerDisplayChannel *)channel);
|
||||
}
|
||||
|
||||
static void _spice_main_channel_event(G_GNUC_UNUSED SpiceChannel *channel,
|
||||
SpiceChannelEvent event,
|
||||
VirtViewerDisplay *display)
|
||||
static void
|
||||
virt_viewer_display_spice_main_channel_event(SpiceChannel *channel G_GNUC_UNUSED,
|
||||
SpiceChannelEvent event,
|
||||
VirtViewerDisplay *display)
|
||||
{
|
||||
VirtViewerDisplaySpice *self = VIRT_VIEWER_DISPLAY_SPICE(display);
|
||||
char *password = NULL;
|
||||
@ -157,19 +172,19 @@ static void _spice_main_channel_event(G_GNUC_UNUSED SpiceChannel *channel,
|
||||
break;
|
||||
case SPICE_CHANNEL_CLOSED:
|
||||
DEBUG_LOG("main channel: closed");
|
||||
viewer_quit(display->viewer);
|
||||
virt_viewer_quit(display->viewer);
|
||||
break;
|
||||
case SPICE_CHANNEL_ERROR_CONNECT:
|
||||
DEBUG_LOG("main channel: failed to connect");
|
||||
viewer_disconnected(display->viewer);
|
||||
virt_viewer_disconnected(display->viewer);
|
||||
break;
|
||||
case SPICE_CHANNEL_ERROR_AUTH:
|
||||
DEBUG_LOG("main channel: auth failure (wrong password?)");
|
||||
int ret = viewer_auth_collect_credentials("SPICE",
|
||||
display->viewer->pretty_address,
|
||||
NULL, &password);
|
||||
int ret = virt_viewer_auth_collect_credentials("SPICE",
|
||||
display->viewer->pretty_address,
|
||||
NULL, &password);
|
||||
if (ret < 0) {
|
||||
viewer_quit(display->viewer);
|
||||
virt_viewer_quit(display->viewer);
|
||||
} else {
|
||||
g_object_set(self->session, "password", password, NULL);
|
||||
spice_session_connect(self->session);
|
||||
@ -177,7 +192,7 @@ static void _spice_main_channel_event(G_GNUC_UNUSED SpiceChannel *channel,
|
||||
break;
|
||||
default:
|
||||
g_warning("unknown main channel event: %d", event);
|
||||
viewer_disconnected(display->viewer);
|
||||
virt_viewer_disconnected(display->viewer);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -190,7 +205,7 @@ static void _spice_main_channel_event(G_GNUC_UNUSED SpiceChannel *channel,
|
||||
* the display widget to be resized to fit the available space
|
||||
*/
|
||||
static void
|
||||
viewer_resize_display_widget(VirtViewer *viewer)
|
||||
virt_viewer_display_spice_resize_widget(VirtViewer *viewer)
|
||||
{
|
||||
gtk_widget_queue_resize(viewer->align);
|
||||
}
|
||||
@ -202,19 +217,24 @@ viewer_resize_display_widget(VirtViewer *viewer)
|
||||
* It either tries to resize the main window, or it triggers
|
||||
* recalculation of the display within existing window size
|
||||
*/
|
||||
static void viewer_resize_desktop(SpiceChannel *channel G_GNUC_UNUSED, gint format G_GNUC_UNUSED,
|
||||
gint width, gint height, gint stride G_GNUC_UNUSED,
|
||||
gint shmid G_GNUC_UNUSED, gpointer imgdata G_GNUC_UNUSED,
|
||||
VirtViewer *viewer)
|
||||
static void
|
||||
virt_viewer_display_spice_resize_desktop(SpiceChannel *channel G_GNUC_UNUSED,
|
||||
gint format G_GNUC_UNUSED,
|
||||
gint width,
|
||||
gint height,
|
||||
gint stride G_GNUC_UNUSED,
|
||||
gint shmid G_GNUC_UNUSED,
|
||||
gpointer imgdata G_GNUC_UNUSED,
|
||||
VirtViewer *viewer)
|
||||
{
|
||||
DEBUG_LOG("desktop resize %dx%d", width, height);
|
||||
viewer->desktopWidth = width;
|
||||
viewer->desktopHeight = height;
|
||||
|
||||
if (viewer->autoResize && viewer->window && !viewer->fullscreen) {
|
||||
viewer_resize_main_window(viewer);
|
||||
virt_viewer_resize_main_window(viewer);
|
||||
} else {
|
||||
viewer_resize_display_widget(viewer);
|
||||
virt_viewer_display_spice_resize_widget(viewer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -224,9 +244,10 @@ static void viewer_resize_desktop(SpiceChannel *channel G_GNUC_UNUSED, gint form
|
||||
* It attempts to fit the display widget into this space while
|
||||
* maintaining aspect ratio
|
||||
*/
|
||||
static gboolean viewer_resize_align(GtkWidget *widget,
|
||||
GtkAllocation *alloc,
|
||||
VirtViewer *viewer)
|
||||
static gboolean
|
||||
virt_viewer_display_spice_resize_align(GtkWidget *widget,
|
||||
GtkAllocation *alloc,
|
||||
VirtViewer *viewer)
|
||||
{
|
||||
double desktopAspect;
|
||||
double scrollAspect;
|
||||
@ -271,8 +292,10 @@ static gboolean viewer_resize_align(GtkWidget *widget,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void _spice_channel_new(SpiceSession *s, SpiceChannel *channel,
|
||||
VirtViewerDisplay *display)
|
||||
static void
|
||||
virt_viewer_display_spice_channel_new(SpiceSession *s,
|
||||
SpiceChannel *channel,
|
||||
VirtViewerDisplay *display)
|
||||
{
|
||||
VirtViewerDisplaySpice *self = VIRT_VIEWER_DISPLAY_SPICE(display);
|
||||
int id;
|
||||
@ -280,13 +303,13 @@ static void _spice_channel_new(SpiceSession *s, SpiceChannel *channel,
|
||||
g_return_if_fail(self != NULL);
|
||||
|
||||
g_signal_connect(channel, "open-fd",
|
||||
G_CALLBACK(_spice_channel_open_fd_request), self);
|
||||
G_CALLBACK(virt_viewer_display_spice_channel_open_fd_request), self);
|
||||
|
||||
g_object_get(channel, "channel-id", &id, NULL);
|
||||
|
||||
if (SPICE_IS_MAIN_CHANNEL(channel)) {
|
||||
g_signal_connect(channel, "channel-event",
|
||||
G_CALLBACK(_spice_main_channel_event), self);
|
||||
G_CALLBACK(virt_viewer_display_spice_main_channel_event), self);
|
||||
}
|
||||
|
||||
if (SPICE_IS_DISPLAY_CHANNEL(channel)) {
|
||||
@ -295,7 +318,7 @@ static void _spice_channel_new(SpiceSession *s, SpiceChannel *channel,
|
||||
return;
|
||||
|
||||
g_signal_connect(channel, "display-primary-create",
|
||||
G_CALLBACK(viewer_resize_desktop), display->viewer);
|
||||
G_CALLBACK(virt_viewer_display_spice_resize_desktop), display->viewer);
|
||||
|
||||
self->display = spice_display_new(s, id);
|
||||
display->widget = GTK_WIDGET(self->display);
|
||||
@ -306,12 +329,12 @@ static void _spice_channel_new(SpiceSession *s, SpiceChannel *channel,
|
||||
"scaling", TRUE,
|
||||
"auto-clipboard", TRUE,
|
||||
NULL);
|
||||
viewer_add_display_and_realize(display->viewer);
|
||||
virt_viewer_add_display_and_realize(display->viewer);
|
||||
|
||||
g_signal_connect(display->viewer->align, "size-allocate",
|
||||
G_CALLBACK(viewer_resize_align), display->viewer);
|
||||
G_CALLBACK(virt_viewer_display_spice_resize_align), display->viewer);
|
||||
|
||||
viewer_initialized(display->viewer);
|
||||
virt_viewer_initialized(display->viewer);
|
||||
}
|
||||
|
||||
if (SPICE_IS_INPUTS_CHANNEL(channel)) {
|
||||
@ -326,8 +349,10 @@ static void _spice_channel_new(SpiceSession *s, SpiceChannel *channel,
|
||||
}
|
||||
}
|
||||
|
||||
static void _spice_channel_destroy(G_GNUC_UNUSED SpiceSession *s, SpiceChannel *channel,
|
||||
VirtViewerDisplay *display)
|
||||
static void
|
||||
virt_viewer_display_spice_channel_destroy(G_GNUC_UNUSED SpiceSession *s,
|
||||
SpiceChannel *channel,
|
||||
VirtViewerDisplay *display)
|
||||
{
|
||||
VirtViewerDisplaySpice *self = VIRT_VIEWER_DISPLAY_SPICE(display);
|
||||
int id;
|
||||
@ -350,7 +375,8 @@ static void _spice_channel_destroy(G_GNUC_UNUSED SpiceSession *s, SpiceChannel *
|
||||
}
|
||||
}
|
||||
|
||||
VirtViewerDisplaySpice* virt_viewer_display_spice_new(VirtViewer *viewer)
|
||||
VirtViewerDisplaySpice *
|
||||
virt_viewer_display_spice_new(VirtViewer *viewer)
|
||||
{
|
||||
VirtViewerDisplaySpice *self;
|
||||
VirtViewerDisplay *d;
|
||||
@ -363,9 +389,9 @@ VirtViewerDisplaySpice* virt_viewer_display_spice_new(VirtViewer *viewer)
|
||||
|
||||
self->session = spice_session_new();
|
||||
g_signal_connect(self->session, "channel-new",
|
||||
G_CALLBACK(_spice_channel_new), self);
|
||||
G_CALLBACK(virt_viewer_display_spice_channel_new), self);
|
||||
g_signal_connect(self->session, "channel-destroy",
|
||||
G_CALLBACK(_spice_channel_destroy), self);
|
||||
G_CALLBACK(virt_viewer_display_spice_channel_destroy), self);
|
||||
|
||||
return self;
|
||||
}
|
@ -28,7 +28,7 @@
|
||||
#include <spice-widget.h>
|
||||
#include <spice-audio.h>
|
||||
|
||||
#include "display.h"
|
||||
#include "virt-viewer-display.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
@ -22,56 +22,69 @@
|
||||
* Author: Daniel P. Berrange <berrange@redhat.com>
|
||||
*/
|
||||
|
||||
#include "auth.h"
|
||||
#include "display-vnc.h"
|
||||
#include "virt-viewer-auth.h"
|
||||
#include "virt-viewer-display-vnc.h"
|
||||
|
||||
G_DEFINE_TYPE(VirtViewerDisplayVNC, virt_viewer_display_vnc, VIRT_VIEWER_TYPE_DISPLAY)
|
||||
|
||||
static void _vnc_close(VirtViewerDisplay* display);
|
||||
static void _vnc_send_keys(VirtViewerDisplay* display, const guint *keyvals, int nkeyvals);
|
||||
static GdkPixbuf* _vnc_get_pixbuf(VirtViewerDisplay* display);
|
||||
static gboolean _vnc_open_fd(VirtViewerDisplay* display, int fd);
|
||||
static gboolean _vnc_open_host(VirtViewerDisplay* display, char *host, char *port);
|
||||
static gboolean _vnc_channel_open_fd(VirtViewerDisplay* display,
|
||||
VirtViewerDisplayChannel* channel, int fd);
|
||||
static void virt_viewer_display_vnc_close(VirtViewerDisplay* display);
|
||||
static void virt_viewer_display_vnc_send_keys(VirtViewerDisplay* display, const guint *keyvals, int nkeyvals);
|
||||
static GdkPixbuf* virt_viewer_display_vnc_get_pixbuf(VirtViewerDisplay* display);
|
||||
static gboolean virt_viewer_display_vnc_open_fd(VirtViewerDisplay* display, int fd);
|
||||
static gboolean virt_viewer_display_vnc_open_host(VirtViewerDisplay* display, char *host, char *port);
|
||||
static gboolean virt_viewer_display_vnc_channel_open_fd(VirtViewerDisplay* display,
|
||||
VirtViewerDisplayChannel* channel, int fd);
|
||||
|
||||
static void virt_viewer_display_vnc_class_init(VirtViewerDisplayVNCClass *klass)
|
||||
static void
|
||||
virt_viewer_display_vnc_class_init(VirtViewerDisplayVNCClass *klass)
|
||||
{
|
||||
VirtViewerDisplayClass *dclass = VIRT_VIEWER_DISPLAY_CLASS(klass);
|
||||
|
||||
dclass->close = _vnc_close;
|
||||
dclass->send_keys = _vnc_send_keys;
|
||||
dclass->get_pixbuf = _vnc_get_pixbuf;
|
||||
dclass->open_fd = _vnc_open_fd;
|
||||
dclass->open_host = _vnc_open_host;
|
||||
dclass->channel_open_fd = _vnc_channel_open_fd;
|
||||
dclass->close = virt_viewer_display_vnc_close;
|
||||
dclass->send_keys = virt_viewer_display_vnc_send_keys;
|
||||
dclass->get_pixbuf = virt_viewer_display_vnc_get_pixbuf;
|
||||
dclass->open_fd = virt_viewer_display_vnc_open_fd;
|
||||
dclass->open_host = virt_viewer_display_vnc_open_host;
|
||||
dclass->channel_open_fd = virt_viewer_display_vnc_channel_open_fd;
|
||||
}
|
||||
|
||||
static void virt_viewer_display_vnc_init(VirtViewerDisplayVNC *self G_GNUC_UNUSED)
|
||||
static void
|
||||
virt_viewer_display_vnc_init(VirtViewerDisplayVNC *self G_GNUC_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
static void _vnc_mouse_grab(GtkWidget *vnc G_GNUC_UNUSED, VirtViewerDisplayVNC *self)
|
||||
static void
|
||||
virt_viewer_display_vnc_mouse_grab(GtkWidget *vnc G_GNUC_UNUSED,
|
||||
VirtViewerDisplayVNC *self)
|
||||
{
|
||||
viewer_set_title(VIRT_VIEWER_DISPLAY(self)->viewer, TRUE);
|
||||
virt_viewer_set_title(VIRT_VIEWER_DISPLAY(self)->viewer, TRUE);
|
||||
}
|
||||
|
||||
static void _vnc_mouse_ungrab(GtkWidget *vnc G_GNUC_UNUSED, VirtViewerDisplayVNC *self)
|
||||
static void
|
||||
virt_viewer_display_vnc_mouse_ungrab(GtkWidget *vnc G_GNUC_UNUSED,
|
||||
VirtViewerDisplayVNC *self)
|
||||
{
|
||||
viewer_set_title(VIRT_VIEWER_DISPLAY(self)->viewer, FALSE);
|
||||
virt_viewer_set_title(VIRT_VIEWER_DISPLAY(self)->viewer, FALSE);
|
||||
}
|
||||
|
||||
static void _vnc_key_grab(GtkWidget *vnc G_GNUC_UNUSED, VirtViewerDisplayVNC *self)
|
||||
static void
|
||||
virt_viewer_display_vnc_key_grab(GtkWidget *vnc G_GNUC_UNUSED,
|
||||
VirtViewerDisplayVNC *self)
|
||||
{
|
||||
viewer_disable_modifiers(VIRT_VIEWER_DISPLAY(self)->viewer);
|
||||
virt_viewer_disable_modifiers(VIRT_VIEWER_DISPLAY(self)->viewer);
|
||||
}
|
||||
|
||||
static void _vnc_key_ungrab(GtkWidget *vnc G_GNUC_UNUSED, VirtViewerDisplayVNC *self)
|
||||
static void
|
||||
virt_viewer_display_vnc_key_ungrab(GtkWidget *vnc G_GNUC_UNUSED,
|
||||
VirtViewerDisplayVNC *self)
|
||||
{
|
||||
viewer_enable_modifiers(VIRT_VIEWER_DISPLAY(self)->viewer);
|
||||
virt_viewer_enable_modifiers(VIRT_VIEWER_DISPLAY(self)->viewer);
|
||||
}
|
||||
|
||||
static void _vnc_send_keys(VirtViewerDisplay* display, const guint *keyvals, int nkeyvals)
|
||||
static void
|
||||
virt_viewer_display_vnc_send_keys(VirtViewerDisplay* display,
|
||||
const guint *keyvals,
|
||||
int nkeyvals)
|
||||
{
|
||||
VirtViewerDisplayVNC *self = VIRT_VIEWER_DISPLAY_VNC(display);
|
||||
|
||||
@ -82,7 +95,8 @@ static void _vnc_send_keys(VirtViewerDisplay* display, const guint *keyvals, int
|
||||
vnc_display_send_keys(self->vnc, keyvals, nkeyvals);
|
||||
}
|
||||
|
||||
static GdkPixbuf* _vnc_get_pixbuf(VirtViewerDisplay* display)
|
||||
static GdkPixbuf*
|
||||
virt_viewer_display_vnc_get_pixbuf(VirtViewerDisplay* display)
|
||||
{
|
||||
VirtViewerDisplayVNC *self = VIRT_VIEWER_DISPLAY_VNC(display);
|
||||
|
||||
@ -92,7 +106,9 @@ static GdkPixbuf* _vnc_get_pixbuf(VirtViewerDisplay* display)
|
||||
return vnc_display_get_pixbuf(self->vnc);
|
||||
}
|
||||
|
||||
static gboolean _vnc_open_fd(VirtViewerDisplay* display, int fd)
|
||||
static gboolean
|
||||
virt_viewer_display_vnc_open_fd(VirtViewerDisplay* display,
|
||||
int fd)
|
||||
{
|
||||
VirtViewerDisplayVNC *self = VIRT_VIEWER_DISPLAY_VNC(display);
|
||||
|
||||
@ -102,15 +118,19 @@ static gboolean _vnc_open_fd(VirtViewerDisplay* display, int fd)
|
||||
return vnc_display_open_fd(self->vnc, fd);
|
||||
}
|
||||
|
||||
static gboolean _vnc_channel_open_fd(VirtViewerDisplay* display G_GNUC_UNUSED,
|
||||
VirtViewerDisplayChannel* channel G_GNUC_UNUSED,
|
||||
int fd G_GNUC_UNUSED)
|
||||
static gboolean
|
||||
virt_viewer_display_vnc_channel_open_fd(VirtViewerDisplay* display G_GNUC_UNUSED,
|
||||
VirtViewerDisplayChannel* channel G_GNUC_UNUSED,
|
||||
int fd G_GNUC_UNUSED)
|
||||
{
|
||||
g_warning("channel_open_fd is not supported by VNC");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean _vnc_open_host(VirtViewerDisplay* display, char *host, char *port)
|
||||
static gboolean
|
||||
virt_viewer_display_vnc_open_host(VirtViewerDisplay* display,
|
||||
char *host,
|
||||
char *port)
|
||||
{
|
||||
VirtViewerDisplayVNC *self = VIRT_VIEWER_DISPLAY_VNC(display);
|
||||
|
||||
@ -120,7 +140,8 @@ static gboolean _vnc_open_host(VirtViewerDisplay* display, char *host, char *por
|
||||
return vnc_display_open_host(self->vnc, host, port);
|
||||
}
|
||||
|
||||
static void _vnc_close(VirtViewerDisplay* display)
|
||||
static void
|
||||
virt_viewer_display_vnc_close(VirtViewerDisplay* display)
|
||||
{
|
||||
VirtViewerDisplayVNC *self = VIRT_VIEWER_DISPLAY_VNC(display);
|
||||
|
||||
@ -130,22 +151,28 @@ static void _vnc_close(VirtViewerDisplay* display)
|
||||
vnc_display_close(self->vnc);
|
||||
}
|
||||
|
||||
static void viewer_bell(VirtViewer *viewer, gpointer data G_GNUC_UNUSED)
|
||||
static void
|
||||
virt_viewer_display_vnc_bell(VirtViewer *viewer,
|
||||
gpointer data G_GNUC_UNUSED)
|
||||
{
|
||||
gdk_window_beep(GTK_WIDGET(viewer->window)->window);
|
||||
}
|
||||
|
||||
static void viewer_vnc_auth_unsupported(VirtViewer *viewer,
|
||||
unsigned int authType, gpointer data G_GNUC_UNUSED)
|
||||
static void
|
||||
virt_viewer_display_vnc_auth_unsupported(VirtViewer *viewer,
|
||||
unsigned int authType,
|
||||
gpointer data G_GNUC_UNUSED)
|
||||
{
|
||||
viewer_simple_message_dialog(viewer->window,
|
||||
_("Unable to authenticate with VNC server at %s\n"
|
||||
"Unsupported authentication type %d"),
|
||||
viewer->pretty_address, authType);
|
||||
virt_viewer_simple_message_dialog(viewer->window,
|
||||
_("Unable to authenticate with VNC server at %s\n"
|
||||
"Unsupported authentication type %d"),
|
||||
viewer->pretty_address, authType);
|
||||
}
|
||||
|
||||
static void viewer_vnc_auth_failure(VirtViewer *viewer,
|
||||
const char *reason, gpointer data G_GNUC_UNUSED)
|
||||
static void
|
||||
virt_viewer_display_vnc_auth_failure(VirtViewer *viewer,
|
||||
const char *reason,
|
||||
gpointer data G_GNUC_UNUSED)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
int ret;
|
||||
@ -174,7 +201,7 @@ static void viewer_vnc_auth_failure(VirtViewer *viewer,
|
||||
* the display widget to be resized to fit the available space
|
||||
*/
|
||||
static void
|
||||
viewer_resize_display_widget(VirtViewer *viewer)
|
||||
virt_viewer_display_vnc_resize_widget(VirtViewer *viewer)
|
||||
{
|
||||
gtk_widget_queue_resize(viewer->align);
|
||||
}
|
||||
@ -186,16 +213,17 @@ viewer_resize_display_widget(VirtViewer *viewer)
|
||||
* It either tries to resize the main window, or it triggers
|
||||
* recalculation of the display within existing window size
|
||||
*/
|
||||
static void viewer_resize_desktop(VirtViewer *viewer, gint width, gint height)
|
||||
static void
|
||||
virt_viewer_display_vnc_resize_desktop(VirtViewer *viewer, gint width, gint height)
|
||||
{
|
||||
DEBUG_LOG("desktop resize %dx%d", width, height);
|
||||
viewer->desktopWidth = width;
|
||||
viewer->desktopHeight = height;
|
||||
|
||||
if (viewer->autoResize && viewer->window && !viewer->fullscreen) {
|
||||
viewer_resize_main_window(viewer);
|
||||
virt_viewer_resize_main_window(viewer);
|
||||
} else {
|
||||
viewer_resize_display_widget(viewer);
|
||||
virt_viewer_display_vnc_resize_widget(viewer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,9 +233,10 @@ static void viewer_resize_desktop(VirtViewer *viewer, gint width, gint height)
|
||||
* It attempts to fit the display widget into this space while
|
||||
* maintaining aspect ratio
|
||||
*/
|
||||
static gboolean viewer_resize_align(GtkWidget *widget,
|
||||
GtkAllocation *alloc,
|
||||
VirtViewer *viewer)
|
||||
static gboolean
|
||||
virt_viewer_display_vnc_resize_align(GtkWidget *widget,
|
||||
GtkAllocation *alloc,
|
||||
VirtViewer *viewer)
|
||||
{
|
||||
double desktopAspect;
|
||||
double scrollAspect;
|
||||
@ -249,7 +278,8 @@ static gboolean viewer_resize_align(GtkWidget *widget,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
VirtViewerDisplayVNC* virt_viewer_display_vnc_new(VirtViewer *viewer)
|
||||
VirtViewerDisplayVNC*
|
||||
virt_viewer_display_vnc_new(VirtViewer *viewer)
|
||||
{
|
||||
VirtViewerDisplayVNC *self;
|
||||
VirtViewerDisplay *d;
|
||||
@ -279,40 +309,40 @@ VirtViewerDisplayVNC* virt_viewer_display_vnc_new(VirtViewer *viewer)
|
||||
vnc_display_set_scaling(self->vnc, TRUE);
|
||||
|
||||
g_signal_connect_swapped(self->vnc, "vnc-connected",
|
||||
G_CALLBACK(viewer_connected), viewer);
|
||||
G_CALLBACK(virt_viewer_connected), viewer);
|
||||
g_signal_connect_swapped(self->vnc, "vnc-initialized",
|
||||
G_CALLBACK(viewer_initialized), viewer);
|
||||
G_CALLBACK(virt_viewer_initialized), viewer);
|
||||
g_signal_connect_swapped(self->vnc, "vnc-disconnected",
|
||||
G_CALLBACK(viewer_disconnected), viewer);
|
||||
G_CALLBACK(virt_viewer_disconnected), viewer);
|
||||
|
||||
/* When VNC desktop resizes, we have to resize the containing widget */
|
||||
g_signal_connect_swapped(self->vnc, "vnc-desktop-resize",
|
||||
G_CALLBACK(viewer_resize_desktop), viewer);
|
||||
G_CALLBACK(virt_viewer_display_vnc_resize_desktop), viewer);
|
||||
g_signal_connect_swapped(self->vnc, "vnc-bell",
|
||||
G_CALLBACK(viewer_bell), NULL);
|
||||
G_CALLBACK(virt_viewer_display_vnc_bell), NULL);
|
||||
g_signal_connect_swapped(self->vnc, "vnc-auth-failure",
|
||||
G_CALLBACK(viewer_vnc_auth_failure), viewer);
|
||||
G_CALLBACK(virt_viewer_display_vnc_auth_failure), viewer);
|
||||
g_signal_connect_swapped(self->vnc, "vnc-auth-unsupported",
|
||||
G_CALLBACK(viewer_vnc_auth_unsupported), viewer);
|
||||
G_CALLBACK(virt_viewer_display_vnc_auth_unsupported), viewer);
|
||||
g_signal_connect_swapped(self->vnc, "vnc-server-cut-text",
|
||||
G_CALLBACK(viewer_server_cut_text), viewer);
|
||||
G_CALLBACK(virt_viewer_server_cut_text), viewer);
|
||||
|
||||
g_signal_connect(self->vnc, "vnc-pointer-grab",
|
||||
G_CALLBACK(_vnc_mouse_grab), self);
|
||||
G_CALLBACK(virt_viewer_display_vnc_mouse_grab), self);
|
||||
g_signal_connect(self->vnc, "vnc-pointer-ungrab",
|
||||
G_CALLBACK(_vnc_mouse_ungrab), self);
|
||||
G_CALLBACK(virt_viewer_display_vnc_mouse_ungrab), self);
|
||||
g_signal_connect(self->vnc, "vnc-keyboard-grab",
|
||||
G_CALLBACK(_vnc_key_grab), self);
|
||||
G_CALLBACK(virt_viewer_display_vnc_key_grab), self);
|
||||
g_signal_connect(self->vnc, "vnc-keyboard-ungrab",
|
||||
G_CALLBACK(_vnc_key_ungrab), self);
|
||||
G_CALLBACK(virt_viewer_display_vnc_key_ungrab), self);
|
||||
|
||||
g_signal_connect(self->vnc, "vnc-auth-credential",
|
||||
G_CALLBACK(viewer_auth_vnc_credentials), &viewer->pretty_address);
|
||||
G_CALLBACK(virt_viewer_auth_vnc_credentials), &viewer->pretty_address);
|
||||
|
||||
viewer_add_display_and_realize(viewer);
|
||||
virt_viewer_add_display_and_realize(viewer);
|
||||
|
||||
g_signal_connect(viewer->align, "size-allocate",
|
||||
G_CALLBACK(viewer_resize_align), viewer);
|
||||
G_CALLBACK(virt_viewer_display_vnc_resize_align), viewer);
|
||||
|
||||
return self;
|
||||
}
|
@ -27,7 +27,7 @@
|
||||
#include <glib-object.h>
|
||||
#include <vncdisplay.h>
|
||||
|
||||
#include "display.h"
|
||||
#include "virt-viewer-display.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
@ -21,7 +21,7 @@
|
||||
*
|
||||
* Author: Daniel P. Berrange <berrange@redhat.com>
|
||||
*/
|
||||
#include "display.h"
|
||||
#include "virt-viewer-display.h"
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE(VirtViewerDisplay, virt_viewer_display, G_TYPE_OBJECT)
|
||||
|
@ -25,7 +25,8 @@
|
||||
#define _VIRT_VIEWER_DISPLAY_H
|
||||
|
||||
#include <glib-object.h>
|
||||
#include "viewer-priv.h"
|
||||
|
||||
#include "virt-viewer-priv.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
@ -27,9 +27,9 @@
|
||||
#include <glib.h>
|
||||
#include <libvirt/libvirt.h>
|
||||
|
||||
#include "events.h"
|
||||
#include "virt-viewer-events.h"
|
||||
|
||||
struct viewer_event_handle
|
||||
struct virt_viewer_events_handle
|
||||
{
|
||||
int watch;
|
||||
int fd;
|
||||
@ -44,14 +44,14 @@ struct viewer_event_handle
|
||||
|
||||
static int nextwatch = 1;
|
||||
static unsigned int nhandles = 0;
|
||||
static struct viewer_event_handle **handles = NULL;
|
||||
static struct virt_viewer_events_handle **handles = NULL;
|
||||
|
||||
static gboolean
|
||||
viewer_event_dispatch_handle(GIOChannel *source G_GNUC_UNUSED,
|
||||
virt_viewer_events_dispatch_handle(GIOChannel *source G_GNUC_UNUSED,
|
||||
GIOCondition condition,
|
||||
gpointer opaque)
|
||||
{
|
||||
struct viewer_event_handle *data = opaque;
|
||||
struct virt_viewer_events_handle *data = opaque;
|
||||
int events = 0;
|
||||
|
||||
if (condition & G_IO_IN)
|
||||
@ -72,13 +72,13 @@ viewer_event_dispatch_handle(GIOChannel *source G_GNUC_UNUSED,
|
||||
|
||||
|
||||
static
|
||||
int viewer_event_add_handle(int fd,
|
||||
int virt_viewer_events_add_handle(int fd,
|
||||
int events,
|
||||
virEventHandleCallback cb,
|
||||
void *opaque,
|
||||
virFreeCallback ff)
|
||||
{
|
||||
struct viewer_event_handle *data;
|
||||
struct virt_viewer_events_handle *data;
|
||||
GIOCondition cond = 0;
|
||||
|
||||
handles = g_realloc(handles, sizeof(*handles)*(nhandles+1));
|
||||
@ -102,7 +102,7 @@ int viewer_event_add_handle(int fd,
|
||||
|
||||
data->source = g_io_add_watch(data->channel,
|
||||
cond,
|
||||
viewer_event_dispatch_handle,
|
||||
virt_viewer_events_dispatch_handle,
|
||||
data);
|
||||
|
||||
handles[nhandles++] = data;
|
||||
@ -110,8 +110,8 @@ int viewer_event_add_handle(int fd,
|
||||
return data->watch;
|
||||
}
|
||||
|
||||
static struct viewer_event_handle *
|
||||
viewer_event_find_handle(int watch)
|
||||
static struct virt_viewer_events_handle *
|
||||
virt_viewer_events_find_handle(int watch)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0 ; i < nhandles ; i++)
|
||||
@ -122,10 +122,10 @@ viewer_event_find_handle(int watch)
|
||||
}
|
||||
|
||||
static void
|
||||
viewer_event_update_handle(int watch,
|
||||
virt_viewer_events_update_handle(int watch,
|
||||
int events)
|
||||
{
|
||||
struct viewer_event_handle *data = viewer_event_find_handle(watch);
|
||||
struct virt_viewer_events_handle *data = virt_viewer_events_find_handle(watch);
|
||||
|
||||
if (!data) {
|
||||
DEBUG_LOG("Update for missing handle watch %d", watch);
|
||||
@ -147,7 +147,7 @@ viewer_event_update_handle(int watch,
|
||||
cond |= G_IO_OUT;
|
||||
data->source = g_io_add_watch(data->channel,
|
||||
cond,
|
||||
viewer_event_dispatch_handle,
|
||||
virt_viewer_events_dispatch_handle,
|
||||
data);
|
||||
data->events = events;
|
||||
} else {
|
||||
@ -161,9 +161,9 @@ viewer_event_update_handle(int watch,
|
||||
}
|
||||
|
||||
static int
|
||||
viewer_event_remove_handle(int watch)
|
||||
virt_viewer_events_remove_handle(int watch)
|
||||
{
|
||||
struct viewer_event_handle *data = viewer_event_find_handle(watch);
|
||||
struct virt_viewer_events_handle *data = virt_viewer_events_find_handle(watch);
|
||||
|
||||
if (!data) {
|
||||
DEBUG_LOG("Remove of missing watch %d", watch);
|
||||
@ -182,7 +182,7 @@ viewer_event_remove_handle(int watch)
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct viewer_event_timeout
|
||||
struct virt_viewer_events_timeout
|
||||
{
|
||||
int timer;
|
||||
int interval;
|
||||
@ -195,12 +195,12 @@ struct viewer_event_timeout
|
||||
|
||||
static int nexttimer = 1;
|
||||
static unsigned int ntimeouts = 0;
|
||||
static struct viewer_event_timeout **timeouts = NULL;
|
||||
static struct virt_viewer_events_timeout **timeouts = NULL;
|
||||
|
||||
static gboolean
|
||||
viewer_event_dispatch_timeout(void *opaque)
|
||||
virt_viewer_events_dispatch_timeout(void *opaque)
|
||||
{
|
||||
struct viewer_event_timeout *data = opaque;
|
||||
struct virt_viewer_events_timeout *data = opaque;
|
||||
DEBUG_LOG("Dispatch timeout %p %p %d %p\n", data, data->cb, data->timer, data->opaque);
|
||||
(data->cb)(data->timer, data->opaque);
|
||||
|
||||
@ -208,12 +208,12 @@ viewer_event_dispatch_timeout(void *opaque)
|
||||
}
|
||||
|
||||
static int
|
||||
viewer_event_add_timeout(int interval,
|
||||
virt_viewer_events_add_timeout(int interval,
|
||||
virEventTimeoutCallback cb,
|
||||
void *opaque,
|
||||
virFreeCallback ff)
|
||||
{
|
||||
struct viewer_event_timeout *data;
|
||||
struct virt_viewer_events_timeout *data;
|
||||
|
||||
timeouts = g_realloc(timeouts, sizeof(*timeouts)*(ntimeouts+1));
|
||||
data = g_malloc(sizeof(*data));
|
||||
@ -226,7 +226,7 @@ viewer_event_add_timeout(int interval,
|
||||
data->ff = ff;
|
||||
if (interval >= 0)
|
||||
data->source = g_timeout_add(interval,
|
||||
viewer_event_dispatch_timeout,
|
||||
virt_viewer_events_dispatch_timeout,
|
||||
data);
|
||||
|
||||
timeouts[ntimeouts++] = data;
|
||||
@ -237,8 +237,8 @@ viewer_event_add_timeout(int interval,
|
||||
}
|
||||
|
||||
|
||||
static struct viewer_event_timeout *
|
||||
viewer_event_find_timeout(int timer)
|
||||
static struct virt_viewer_events_timeout *
|
||||
virt_viewer_events_find_timeout(int timer)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0 ; i < ntimeouts ; i++)
|
||||
@ -250,10 +250,10 @@ viewer_event_find_timeout(int timer)
|
||||
|
||||
|
||||
static void
|
||||
viewer_event_update_timeout(int timer,
|
||||
virt_viewer_events_update_timeout(int timer,
|
||||
int interval)
|
||||
{
|
||||
struct viewer_event_timeout *data = viewer_event_find_timeout(timer);
|
||||
struct virt_viewer_events_timeout *data = virt_viewer_events_find_timeout(timer);
|
||||
|
||||
if (!data) {
|
||||
DEBUG_LOG("Update of missing timer %d", timer);
|
||||
@ -268,7 +268,7 @@ viewer_event_update_timeout(int timer,
|
||||
|
||||
data->interval = interval;
|
||||
data->source = g_timeout_add(data->interval,
|
||||
viewer_event_dispatch_timeout,
|
||||
virt_viewer_events_dispatch_timeout,
|
||||
data);
|
||||
} else {
|
||||
if (!data->source)
|
||||
@ -280,9 +280,9 @@ viewer_event_update_timeout(int timer,
|
||||
}
|
||||
|
||||
static int
|
||||
viewer_event_remove_timeout(int timer)
|
||||
virt_viewer_events_remove_timeout(int timer)
|
||||
{
|
||||
struct viewer_event_timeout *data = viewer_event_find_timeout(timer);
|
||||
struct virt_viewer_events_timeout *data = virt_viewer_events_find_timeout(timer);
|
||||
|
||||
if (!data) {
|
||||
DEBUG_LOG("Remove of missing timer %d", timer);
|
||||
@ -306,12 +306,12 @@ viewer_event_remove_timeout(int timer)
|
||||
}
|
||||
|
||||
|
||||
void viewer_event_register(void) {
|
||||
virEventRegisterImpl(viewer_event_add_handle,
|
||||
viewer_event_update_handle,
|
||||
viewer_event_remove_handle,
|
||||
viewer_event_add_timeout,
|
||||
viewer_event_update_timeout,
|
||||
viewer_event_remove_timeout);
|
||||
void virt_viewer_events_register(void) {
|
||||
virEventRegisterImpl(virt_viewer_events_add_handle,
|
||||
virt_viewer_events_update_handle,
|
||||
virt_viewer_events_remove_handle,
|
||||
virt_viewer_events_add_timeout,
|
||||
virt_viewer_events_update_timeout,
|
||||
virt_viewer_events_remove_timeout);
|
||||
}
|
||||
|
@ -23,8 +23,8 @@
|
||||
#ifndef VIRT_VIEWER_EVENT_H
|
||||
#define VIRT_VIEWER_EVENT_H
|
||||
|
||||
#include "util.h"
|
||||
#include "virt-viewer-util.h"
|
||||
|
||||
void viewer_event_register(void);
|
||||
void virt_viewer_events_register(void);
|
||||
|
||||
#endif
|
@ -27,9 +27,9 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "viewer.h"
|
||||
#include "virt-viewer.h"
|
||||
|
||||
static void viewer_version(void)
|
||||
static void virt_viewer_version(void)
|
||||
{
|
||||
g_print(_("%s version %s\n"), PACKAGE, VERSION);
|
||||
|
||||
@ -53,7 +53,7 @@ int main(int argc, char **argv)
|
||||
const char *help_msg = N_("Run '" PACKAGE " --help' to see a full list of available command line options");
|
||||
const GOptionEntry options [] = {
|
||||
{ "version", 'V', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
|
||||
viewer_version, N_("display version information"), NULL },
|
||||
virt_viewer_version, N_("display version information"), NULL },
|
||||
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
|
||||
N_("display verbose information"), NULL },
|
||||
{ "direct", 'd', 0, G_OPTION_ARG_NONE, &direct,
|
||||
@ -104,7 +104,7 @@ int main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
ret = viewer_start (uri, args[0], zoom, direct, waitvm, reconnect, verbose, debug, NULL);
|
||||
ret = virt_viewer_start(uri, args[0], zoom, direct, waitvm, reconnect, verbose, debug, NULL);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
@ -106,20 +106,20 @@ struct _VirtViewerSize {
|
||||
gulong sig_id;
|
||||
};
|
||||
|
||||
void viewer_connected(VirtViewer *viewer);
|
||||
void viewer_initialized(VirtViewer *viewer);
|
||||
void viewer_disconnected(VirtViewer *viewer);
|
||||
void viewer_set_status(VirtViewer *viewer, const char *text);
|
||||
void viewer_set_title(VirtViewer *viewer, gboolean grabbed);
|
||||
void viewer_enable_modifiers(VirtViewer *viewer);
|
||||
void viewer_disable_modifiers(VirtViewer *viewer);
|
||||
void viewer_add_display_and_realize(VirtViewer *viewer);
|
||||
void viewer_server_cut_text(VirtViewer *viewer, const gchar *text);
|
||||
void viewer_resize_main_window(VirtViewer *viewer);
|
||||
void viewer_channel_open_fd(VirtViewer *viewer, VirtViewerDisplayChannel *channel);
|
||||
void viewer_quit(VirtViewer *viewer);
|
||||
void virt_viewer_connected(VirtViewer *viewer);
|
||||
void virt_viewer_initialized(VirtViewer *viewer);
|
||||
void virt_viewer_disconnected(VirtViewer *viewer);
|
||||
void virt_viewer_set_status(VirtViewer *viewer, const char *text);
|
||||
void virt_viewer_set_title(VirtViewer *viewer, gboolean grabbed);
|
||||
void virt_viewer_enable_modifiers(VirtViewer *viewer);
|
||||
void virt_viewer_disable_modifiers(VirtViewer *viewer);
|
||||
void virt_viewer_add_display_and_realize(VirtViewer *viewer);
|
||||
void virt_viewer_server_cut_text(VirtViewer *viewer, const gchar *text);
|
||||
void virt_viewer_resize_main_window(VirtViewer *viewer);
|
||||
void virt_viewer_channel_open_fd(VirtViewer *viewer, VirtViewerDisplayChannel *channel);
|
||||
void virt_viewer_quit(VirtViewer *viewer);
|
||||
|
||||
void viewer_simple_message_dialog(GtkWidget *window, const char *fmt, ...);
|
||||
void virt_viewer_simple_message_dialog(GtkWidget *window, const char *fmt, ...);
|
||||
|
||||
#endif // _VIRT_VIEWER_PRIV_H
|
||||
/*
|
@ -27,9 +27,9 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "virt-viewer-util.h"
|
||||
|
||||
GtkBuilder *viewer_load_ui(const char *name)
|
||||
GtkBuilder *virt_viewer_util_load_ui(const char *name)
|
||||
{
|
||||
struct stat sb;
|
||||
GtkBuilder *builder;
|
@ -32,6 +32,6 @@ extern gboolean doDebug;
|
||||
#define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
|
||||
|
||||
|
||||
GtkBuilder *viewer_load_ui(const char *name);
|
||||
GtkBuilder *virt_viewer_util_load_ui(const char *name);
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -23,16 +23,16 @@
|
||||
#ifndef VIRT_VIEWER_H
|
||||
#define VIRT_VIEWER_H
|
||||
|
||||
#include "util.h"
|
||||
#include "virt-viewer-util.h"
|
||||
|
||||
extern int viewer_start (const char *uri,
|
||||
const char *name,
|
||||
gint zoom,
|
||||
gboolean direct,
|
||||
gboolean waitvm,
|
||||
gboolean reconnect,
|
||||
gboolean verbose,
|
||||
gboolean debug,
|
||||
GtkWidget *container);
|
||||
extern int virt_viewer_start(const char *uri,
|
||||
const char *name,
|
||||
gint zoom,
|
||||
gboolean direct,
|
||||
gboolean waitvm,
|
||||
gboolean reconnect,
|
||||
gboolean verbose,
|
||||
gboolean debug,
|
||||
GtkWidget *container);
|
||||
|
||||
#endif /* VIRT_VIEWER_H */
|
@ -5,7 +5,7 @@
|
||||
<object class="GtkWindow" id="viewer">
|
||||
<property name="default_width">400</property>
|
||||
<property name="default_height">400</property>
|
||||
<signal name="delete_event" handler="viewer_delete"/>
|
||||
<signal name="delete_event" handler="virt_viewer_delete"/>
|
||||
<child>
|
||||
<object class="GtkVBox" id="viewer-box">
|
||||
<property name="visible">True</property>
|
||||
@ -26,7 +26,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Screenshot</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="viewer_menu_file_screenshot"/>
|
||||
<signal name="activate" handler="virt_viewer_menu_file_screenshot"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -40,7 +40,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="activate" handler="viewer_menu_file_quit"/>
|
||||
<signal name="activate" handler="virt_viewer_menu_file_quit"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@ -60,7 +60,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Full screen</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="toggled" handler="viewer_menu_view_fullscreen"/>
|
||||
<signal name="toggled" handler="virt_viewer_menu_view_fullscreen"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -76,7 +76,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label">gtk-zoom-in</property>
|
||||
<accelerator key="plus" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="viewer_menu_view_zoom_in"/>
|
||||
<signal name="activate" handler="virt_viewer_menu_view_zoom_in"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -84,7 +84,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label">gtk-zoom-out</property>
|
||||
<accelerator key="minus" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="viewer_menu_view_zoom_out"/>
|
||||
<signal name="activate" handler="virt_viewer_menu_view_zoom_out"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -97,7 +97,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label">gtk-zoom-100</property>
|
||||
<accelerator key="0" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<signal name="activate" handler="viewer_menu_view_zoom_reset"/>
|
||||
<signal name="activate" handler="virt_viewer_menu_view_zoom_reset"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@ -109,7 +109,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Automatically resize</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="toggled" handler="viewer_menu_view_resize"/>
|
||||
<signal name="toggled" handler="virt_viewer_menu_view_resize"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@ -129,7 +129,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Ctrl+Alt+_Del</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="viewer_menu_send"/>
|
||||
<signal name="activate" handler="virt_viewer_menu_send"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -137,7 +137,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Ctrl+Alt+_Backspace</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="viewer_menu_send"/>
|
||||
<signal name="activate" handler="virt_viewer_menu_send"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -150,7 +150,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Ctrl+Alt+F_1</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="viewer_menu_send"/>
|
||||
<signal name="activate" handler="virt_viewer_menu_send"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -158,7 +158,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Ctrl+Alt+F_2</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="viewer_menu_send"/>
|
||||
<signal name="activate" handler="virt_viewer_menu_send"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -166,7 +166,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Ctrl+Alt+F_3</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="viewer_menu_send"/>
|
||||
<signal name="activate" handler="virt_viewer_menu_send"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -174,7 +174,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Ctrl+Alt+F_4</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="viewer_menu_send"/>
|
||||
<signal name="activate" handler="virt_viewer_menu_send"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -182,7 +182,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Ctrl+Alt+F_5</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="viewer_menu_send"/>
|
||||
<signal name="activate" handler="virt_viewer_menu_send"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -190,7 +190,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Ctrl+Alt+F_6</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="viewer_menu_send"/>
|
||||
<signal name="activate" handler="virt_viewer_menu_send"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -198,7 +198,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Ctrl+Alt+F_7</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="viewer_menu_send"/>
|
||||
<signal name="activate" handler="virt_viewer_menu_send"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -206,7 +206,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Ctrl+Alt+F_8</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="viewer_menu_send"/>
|
||||
<signal name="activate" handler="virt_viewer_menu_send"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -214,7 +214,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Ctrl+Alt+F_9</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="viewer_menu_send"/>
|
||||
<signal name="activate" handler="virt_viewer_menu_send"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -222,7 +222,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Ctrl+Alt+F1_0</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="viewer_menu_send"/>
|
||||
<signal name="activate" handler="virt_viewer_menu_send"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -230,7 +230,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Ctrl+Alt+F11</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="viewer_menu_send"/>
|
||||
<signal name="activate" handler="virt_viewer_menu_send"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -238,7 +238,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Ctrl+Alt+F12</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="viewer_menu_send"/>
|
||||
<signal name="activate" handler="virt_viewer_menu_send"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -251,7 +251,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_PrintScreen</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="viewer_menu_send"/>
|
||||
<signal name="activate" handler="virt_viewer_menu_send"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@ -272,7 +272,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="activate" handler="viewer_menu_help_about"/>
|
||||
<signal name="activate" handler="virt_viewer_menu_help_about"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
@ -97,9 +97,9 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_bindir}/%{name}
|
||||
%dir %{_datadir}/%{name}
|
||||
%dir %{_datadir}/%{name}/ui/
|
||||
%{_datadir}/%{name}/ui/auth.xml
|
||||
%{_datadir}/%{name}/ui/about.xml
|
||||
%{_datadir}/%{name}/ui/viewer.xml
|
||||
%{_datadir}/%{name}/ui/virt-viewer.xml
|
||||
%{_datadir}/%{name}/ui/virt-viewer-auth.xml
|
||||
%{_datadir}/%{name}/ui/virt-viewer-about.xml
|
||||
%{_mandir}/man1/%{name}*
|
||||
|
||||
%if %{_with_plugin}
|
||||
|
Loading…
Reference in New Issue
Block a user