summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2011-03-21 12:00:14 +0100
committerMarc-André Lureau <marcandre.lureau@redhat.com>2011-03-21 12:00:14 +0100
commit279ef8bc87bf736b5600eba00947624d8139a189 (patch)
treea35615ace3386195d6229c30ff67b0efa2408465 /gtk
parent0a7791b22cbce2ed91ec05d9e5ed6b3d3ef6352c (diff)
gtk/display: start splitting display x11/windows backend
Diffstat (limited to 'gtk')
-rw-r--r--gtk/Makefile.am15
-rw-r--r--gtk/display/gnome-rr-private.h90
-rw-r--r--gtk/display/gnome-rr-windows.c38
-rw-r--r--gtk/display/gnome-rr-x11.c57
-rw-r--r--gtk/display/gnome-rr.c84
5 files changed, 197 insertions, 87 deletions
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 9e761d6..5edb178 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -253,9 +253,7 @@ libspice_client_glibinclude_HEADERS = \
channel-record.h \
$(NULL)
-
-spicy_SOURCES = \
- spicy.c \
+displaysrc = \
display/edid.h \
display/edid-parse.c \
display/display-name.c \
@@ -266,8 +264,19 @@ spicy_SOURCES = \
display/gnome-rr-private.h \
display/gnome-rr.c \
display/gnome-rr.h \
+ $(NULL)
+
+if WITH_DISPLAY_X11
+displaysrc += display/gnome-rr-x11.c
+else
+displaysrc += display/gnome-rr-windows.c
+endif
+
+spicy_SOURCES = \
+ spicy.c \
spice-cmdline.h \
spice-cmdline.c \
+ $(displaysrc) \
$(NULL)
spicy_LDADD = \
diff --git a/gtk/display/gnome-rr-private.h b/gtk/display/gnome-rr-private.h
index 850127c..23aa3d4 100644
--- a/gtk/display/gnome-rr-private.h
+++ b/gtk/display/gnome-rr-private.h
@@ -1,6 +1,32 @@
+/* gnome-rr-private.h
+ *
+ * Copyright 2007, 2008, Red Hat, Inc.
+ *
+ * This file is part of the Gnome Library.
+ *
+ * The Gnome Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * The Gnome Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Gnome Library; see the file COPYING.LIB. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Soren Sandmann <sandmann@redhat.com>
+ */
+
#ifndef GNOME_RR_PRIVATE_H
#define GNOME_RR_PRIVATE_H
+#include <config.h>
+
#ifdef HAVE_RANDR
#include <X11/extensions/Xrandr.h>
#endif
@@ -79,4 +105,68 @@ struct GnomeRRConfigPrivate
GnomeRROutputInfo **outputs;
};
+#ifndef HAVE_RANDR
+/* This is to avoid a ton of ifdefs wherever we use a type from libXrandr */
+typedef int RROutput;
+typedef int RRCrtc;
+typedef int RRMode;
+typedef int Rotation;
+#define RR_Rotate_0 1
+#define RR_Rotate_90 2
+#define RR_Rotate_180 4
+#define RR_Rotate_270 8
+#define RR_Reflect_X 16
+#define RR_Reflect_Y 32
+#endif
+
+struct GnomeRROutput
+{
+ ScreenInfo * info;
+ RROutput id;
+
+ char * name;
+ GnomeRRCrtc * current_crtc;
+ gboolean connected;
+ gulong width_mm;
+ gulong height_mm;
+ GnomeRRCrtc ** possible_crtcs;
+ GnomeRROutput ** clones;
+ GnomeRRMode ** modes;
+ int n_preferred;
+ guint8 * edid_data;
+ int edid_size;
+ char * connector_type;
+};
+
+struct GnomeRROutputWrap
+{
+ RROutput id;
+};
+
+struct GnomeRRCrtc
+{
+ ScreenInfo * info;
+ RRCrtc id;
+
+ GnomeRRMode * current_mode;
+ GnomeRROutput ** current_outputs;
+ GnomeRROutput ** possible_outputs;
+ int x;
+ int y;
+
+ GnomeRRRotation current_rotation;
+ GnomeRRRotation rotations;
+ int gamma_size;
+};
+
+struct GnomeRRMode
+{
+ ScreenInfo * info;
+ RRMode id;
+ char * name;
+ int width;
+ int height;
+ int freq; /* in mHz */
+};
+
#endif
diff --git a/gtk/display/gnome-rr-windows.c b/gtk/display/gnome-rr-windows.c
new file mode 100644
index 0000000..7e39b39
--- /dev/null
+++ b/gtk/display/gnome-rr-windows.c
@@ -0,0 +1,38 @@
+/* gnome-rr.c
+ *
+ * Copyright 2011, Red Hat, Inc.
+ *
+ * This file is part of the Gnome Library.
+ *
+ * The Gnome Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * The Gnome Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Gnome Library; see the file COPYING.LIB. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Marc-André Lureau <marcandre.lureau@redhat.com>
+ */
+
+#define GNOME_DESKTOP_USE_UNSTABLE_API
+
+#include <config.h>
+#include <glib/gi18n-lib.h>
+#include <string.h>
+
+#include <windows.h>
+#include <winuser.h>
+
+#include <gtk/gtk.h>
+
+#undef GNOME_DISABLE_DEPRECATED
+#include "gnome-rr.h"
+#include "gnome-rr-config.h"
diff --git a/gtk/display/gnome-rr-x11.c b/gtk/display/gnome-rr-x11.c
new file mode 100644
index 0000000..67e8a5c
--- /dev/null
+++ b/gtk/display/gnome-rr-x11.c
@@ -0,0 +1,57 @@
+/* gnome-rr-x11.c
+ *
+ * Copyright 2007, 2008, Red Hat, Inc.
+ *
+ * This file is part of the Gnome Library.
+ *
+ * The Gnome Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * The Gnome Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Gnome Library; see the file COPYING.LIB. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Soren Sandmann <sandmann@redhat.com>
+ */
+
+#define GNOME_DESKTOP_USE_UNSTABLE_API
+
+#include <config.h>
+#include <glib/gi18n-lib.h>
+#include <string.h>
+
+#ifdef HAVE_RANDR
+#include <X11/extensions/Xrandr.h>
+#endif
+
+#include <gtk/gtk.h>
+
+#ifdef HAVE_X11
+#include <X11/Xlib.h>
+#include <gdk/gdkx.h>
+#include <X11/Xatom.h>
+#endif
+
+#undef GNOME_DISABLE_DEPRECATED
+#include "gnome-rr.h"
+#include "gnome-rr-config.h"
+
+#include "gnome-rr-private.h"
+
+#define DISPLAY(o) ((o)->info->screen->priv->xdisplay)
+
+#ifdef HAVE_RANDR
+#define RANDR_LIBRARY_IS_AT_LEAST_1_3 (RANDR_MAJOR > 1 || (RANDR_MAJOR == 1 && RANDR_MINOR >= 3))
+#else
+#define RANDR_LIBRARY_IS_AT_LEAST_1_3 0
+#endif
+
+#define SERVERS_RANDR_IS_AT_LEAST_1_3(priv) (priv->rr_major_version > 1 || (priv->rr_major_version == 1 && priv->rr_minor_version >= 3))
diff --git a/gtk/display/gnome-rr.c b/gtk/display/gnome-rr.c
index d040f2d..0ddd215 100644
--- a/gtk/display/gnome-rr.c
+++ b/gtk/display/gnome-rr.c
@@ -28,48 +28,14 @@
#include <glib/gi18n-lib.h>
#include <string.h>
-#ifdef HAVE_RANDR
-#include <X11/extensions/Xrandr.h>
-#endif
-
#include <gtk/gtk.h>
-#ifdef HAVE_X11
-#include <X11/Xlib.h>
-#include <gdk/gdkx.h>
-#include <X11/Xatom.h>
-#endif
-
#undef GNOME_DISABLE_DEPRECATED
#include "gnome-rr.h"
#include "gnome-rr-config.h"
#include "gnome-rr-private.h"
-#define DISPLAY(o) ((o)->info->screen->priv->xdisplay)
-
-#ifndef HAVE_RANDR
-/* This is to avoid a ton of ifdefs wherever we use a type from libXrandr */
-typedef int RROutput;
-typedef int RRCrtc;
-typedef int RRMode;
-typedef int Rotation;
-#define RR_Rotate_0 1
-#define RR_Rotate_90 2
-#define RR_Rotate_180 4
-#define RR_Rotate_270 8
-#define RR_Reflect_X 16
-#define RR_Reflect_Y 32
-#endif
-
-#ifdef HAVE_RANDR
-#define RANDR_LIBRARY_IS_AT_LEAST_1_3 (RANDR_MAJOR > 1 || (RANDR_MAJOR == 1 && RANDR_MINOR >= 3))
-#else
-#define RANDR_LIBRARY_IS_AT_LEAST_1_3 0
-#endif
-
-#define SERVERS_RANDR_IS_AT_LEAST_1_3(priv) (priv->rr_major_version > 1 || (priv->rr_major_version == 1 && priv->rr_minor_version >= 3))
-
enum {
SCREEN_PROP_0,
SCREEN_PROP_GDK_SCREEN,
@@ -83,56 +49,6 @@ enum {
gint screen_signals[SCREEN_SIGNAL_LAST];
-struct GnomeRROutput
-{
- ScreenInfo * info;
- RROutput id;
-
- char * name;
- GnomeRRCrtc * current_crtc;
- gboolean connected;
- gulong width_mm;
- gulong height_mm;
- GnomeRRCrtc ** possible_crtcs;
- GnomeRROutput ** clones;
- GnomeRRMode ** modes;
- int n_preferred;
- guint8 * edid_data;
- int edid_size;
- char * connector_type;
-};
-
-struct GnomeRROutputWrap
-{
- RROutput id;
-};
-
-struct GnomeRRCrtc
-{
- ScreenInfo * info;
- RRCrtc id;
-
- GnomeRRMode * current_mode;
- GnomeRROutput ** current_outputs;
- GnomeRROutput ** possible_outputs;
- int x;
- int y;
-
- GnomeRRRotation current_rotation;
- GnomeRRRotation rotations;
- int gamma_size;
-};
-
-struct GnomeRRMode
-{
- ScreenInfo * info;
- RRMode id;
- char * name;
- int width;
- int height;
- int freq; /* in mHz */
-};
-
/* GnomeRRCrtc */
#ifdef HAVE_RANDR
static GnomeRRCrtc * crtc_new (ScreenInfo *info,