[PATCH] add basic support for other platforms
- From: unixman archlinux info
- To: nautilus-list gnome org
- Subject: [PATCH] add basic support for other platforms
- Date: Sat, 04 Jul 2015 19:53:28 +0000
From 0a3b39fcfaa802b27ffe6ddff33d5070fea2d541 Mon Sep 17 00:00:00 2001
From: canatan <unixman archlinux info>
Date: Fri, 3 Jul 2015 00:29:16 +0000
Subject: [PATCH] Add basic support for platforms
Hi list.there are no big thinks here.i just move x11 stuff into ifdefs
according to gdk defines(gdkconfig.h) which is GDK_WINDOWING_X11
as you know
from here https://bugzilla.gnome.org/show_bug.cgi?id=751625
gtk is able to build platforms that it has not x11 libs other than
win32 or quartz. eg. a wayland platform that hasn't x11 stuff.
i tested it both on x11 an wayland.
just a minor issue that complains on wayland:
gtk_widget_size_allocate():attempt to allocate widget with width -14
it is based commit: 76c63eb3ee13affac097d6258a8fcc79ce92a321
Best reviews.
---
configure.ac | 1 -
eel/eel-gdk-extensions.c | 9 ++++++--
eel/eel-gtk-extensions.c | 6 +++--
libnautilus-private/nautilus-canvas-container.c | 29
+++++++++++++++++++------
src/nautilus-desktop-canvas-view.c | 24
+++++++++++++++-----
src/nautilus-desktop-window.c | 7 ++++++
src/nautilus-view.c | 5 +++++
src/nautilus-window.c | 12 ++++++++--
8 files changed, 73 insertions(+), 20 deletions(-)
diff --git a/configure.ac b/configure.ac
index 8efaf87..2f89c0d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -258,7 +258,6 @@ PKG_CHECK_MODULES(COMMON, [
gail-3.0
gnome-desktop-3.0 >= gnome_desktop_minver
libxml-2.0 >= xml_minver
- x11
])
dnl additional nautilus libs
diff --git a/eel/eel-gdk-extensions.c b/eel/eel-gdk-extensions.c
index 49ff0d2..d288fc9 100644
--- a/eel/eel-gdk-extensions.c
+++ b/eel/eel-gdk-extensions.c
@@ -30,7 +30,11 @@
#include "eel-string.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdk.h>
+
+#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
+#endif
+
#include <stdlib.h>
#include <pango/pango.h>
@@ -38,8 +42,9 @@ EelGdkGeometryFlags
eel_gdk_parse_geometry (const char *string, int *x_return, int
*y_return,
guint *width_return, guint *height_return)
{
+ EelGdkGeometryFlags gdk_flags = EEL_GDK_NO_VALUE;
+#ifdef GDK_WINDOWING_X11
int x11_flags;
- EelGdkGeometryFlags gdk_flags;
g_return_val_if_fail (string != NULL, EEL_GDK_NO_VALUE);
g_return_val_if_fail (x_return != NULL, EEL_GDK_NO_VALUE);
@@ -69,6 +74,6 @@ eel_gdk_parse_geometry (const char *string, int
*x_return, int *y_return,
if (x11_flags & YNegative) {
gdk_flags |= EEL_GDK_Y_NEGATIVE;
}
-
+#endif
return gdk_flags;
}
diff --git a/eel/eel-gtk-extensions.c b/eel/eel-gtk-extensions.c
index 38d7c00..aac044e 100644
--- a/eel/eel-gtk-extensions.c
+++ b/eel/eel-gtk-extensions.c
@@ -32,11 +32,13 @@
#include "eel-gnome-extensions.h"
#include "eel-string.h"
-#include <X11/Xlib.h>
+#ifdef GDK_WINDOWING_X11
#include <X11/Xatom.h>
+#include <gdk/gdkx.h>
+#endif
+
#include <gdk/gdk.h>
#include <gdk/gdkprivate.h>
-#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
#include <math.h>
diff --git a/libnautilus-private/nautilus-canvas-container.c
b/libnautilus-private/nautilus-canvas-container.c
index 67a8cb8..c578b3b 100644
--- a/libnautilus-private/nautilus-canvas-container.c
+++ b/libnautilus-private/nautilus-canvas-container.c
@@ -25,9 +25,13 @@
*/
#include <config.h>
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
#include <math.h>
+
+#ifdef GDK_WINDOWING_X11
+#include <X11/Xatom.h>
+#include <gdk/gdkx.h>
+#endif
+
#include "nautilus-canvas-container.h"
#include "nautilus-global-preferences.h"
@@ -42,7 +46,6 @@
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
-#include <gdk/gdkx.h>
#include <glib/gi18n.h>
#include <stdio.h>
#include <string.h>
@@ -2337,15 +2340,15 @@ static void
get_rubber_color (NautilusCanvasContainer *container,
GdkRGBA *bgcolor,
GdkRGBA *bordercolor)
-{
- Atom real_type;
+{
+#ifdef GDK_WINDOWING_X11
+ Atom representative_colors_atom,real_type;
+ Display *display;
gint result = -1;
gint real_format;
gulong items_read = 0;
gulong items_left = 0;
gchar *colors;
- Atom representative_colors_atom;
- Display *display;
if (nautilus_canvas_container_get_is_desktop (container)) {
representative_colors_atom = gdk_x11_get_xatom_by_name
("_GNOME_BACKGROUND_REPRESENTATIVE_COLORS");
@@ -2404,6 +2407,18 @@ get_rubber_color (NautilusCanvasContainer
*container,
gtk_style_context_restore (context);
}
+#endif
+
+ GtkStyleContext *context;
+
+ context = gtk_widget_get_style_context (GTK_WIDGET (container));
+ gtk_style_context_save (context);
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_RUBBERBAND);
+
+ gtk_style_context_get_background_color (context,
GTK_STATE_FLAG_NORMAL, bgcolor);
+ gtk_style_context_get_border_color (context, GTK_STATE_FLAG_NORMAL,
bordercolor);
+
+ gtk_style_context_restore (context);
}
static void
diff --git a/src/nautilus-desktop-canvas-view.c
b/src/nautilus-desktop-canvas-view.c
index 6890743..251fe9a 100644
--- a/src/nautilus-desktop-canvas-view.c
+++ b/src/nautilus-desktop-canvas-view.c
@@ -31,13 +31,16 @@
#include "nautilus-canvas-view-container.h"
#include "nautilus-view.h"
+#ifdef GDK_WINDOWING_X11
#include <X11/Xatom.h>
+#include <gdk/gdkx.h>
+#endif
+
#include <gtk/gtk.h>
#include <eel/eel-glib-extensions.h>
#include <eel/eel-gtk-extensions.h>
#include <eel/eel-vfs-extensions.h>
#include <fcntl.h>
-#include <gdk/gdkx.h>
#include <glib/gi18n.h>
#include <libnautilus-private/nautilus-desktop-icon-file.h>
#include <libnautilus-private/nautilus-directory-notify.h>
@@ -125,14 +128,16 @@ static void
net_workarea_changed (NautilusDesktopCanvasView *canvas_view,
GdkWindow *window)
{
- long *nworkareas = NULL;
- long *workareas = NULL;
- GdkAtom type_returned;
- int format_returned;
int length_returned;
NautilusCanvasContainer *canvas_container;
GdkScreen *screen;
+ long *workareas = NULL;
+ long *nworkareas = NULL;
+#ifdef GDK_WINDOWING_X11
+ GdkAtom type_returned;
+ int format_returned;
+
g_return_if_fail (NAUTILUS_IS_DESKTOP_CANVAS_VIEW (canvas_view));
canvas_container = get_canvas_container (canvas_view);
@@ -196,6 +201,12 @@ net_workarea_changed (NautilusDesktopCanvasView
*canvas_view,
canvas_container_set_workarea
(canvas_container, screen, workareas, length_returned / sizeof
(long));
}
+#endif
+
+ screen = gdk_window_get_screen (window);
+
+ canvas_container_set_workarea
+ (canvas_container, screen, workareas, length_returned / sizeof
(long));
if (nworkareas != NULL)
g_free (nworkareas);
@@ -209,6 +220,7 @@ desktop_canvas_view_property_filter (GdkXEvent
*gdk_xevent,
GdkEvent *event,
gpointer data)
{
+#ifdef GDK_WINDOWING_X11
XEvent *xevent = gdk_xevent;
NautilusDesktopCanvasView *canvas_view;
@@ -222,7 +234,7 @@ desktop_canvas_view_property_filter (GdkXEvent
*gdk_xevent,
default:
break;
}
-
+#endif
return GDK_FILTER_CONTINUE;
}
diff --git a/src/nautilus-desktop-window.c
b/src/nautilus-desktop-window.c
index 30197aa..7c95314 100644
--- a/src/nautilus-desktop-window.c
+++ b/src/nautilus-desktop-window.c
@@ -25,8 +25,11 @@
#include "nautilus-desktop-window.h"
#include "nautilus-window.h"
+#ifdef GDK_WINDOWING_X11
#include <X11/Xatom.h>
#include <gdk/gdkx.h>
+#endif
+
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <glib/gi18n.h>
@@ -114,6 +117,7 @@ selection_clear_event_cb (GtkWidget *widget,
static void
nautilus_desktop_window_init_selection (NautilusDesktopWindow *window)
{
+#ifdef GDK_WINDOWING_X11
char selection_name[32];
GdkAtom selection_atom;
Window selection_owner;
@@ -156,6 +160,7 @@ nautilus_desktop_window_init_selection
(NautilusDesktopWindow *window)
G_CALLBACK (selection_clear_event_cb), window);
window->details->desktop_selection = selection_widget;
+#endif
}
static void
@@ -315,6 +320,7 @@ unrealize (GtkWidget *widget)
static void
set_wmspec_desktop_hint (GdkWindow *window)
{
+#ifdef GDK_WINDOWING_X11
GdkAtom atom;
atom = gdk_atom_intern ("_NET_WM_WINDOW_TYPE_DESKTOP", FALSE);
@@ -323,6 +329,7 @@ set_wmspec_desktop_hint (GdkWindow *window)
gdk_atom_intern ("_NET_WM_WINDOW_TYPE", FALSE),
gdk_x11_xatom_to_atom (XA_ATOM), 32,
GDK_PROP_MODE_REPLACE, (guchar *) &atom, 1);
+#endif
}
static void
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index 160c636..df6046f 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -43,7 +43,10 @@
#include "nautilus-empty-view.h"
#endif
+#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
+#endif
+
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
@@ -816,6 +819,7 @@ nautilus_view_preview_files (NautilusView *view,
GList *files,
GArray *locations)
{
+#ifdef GDK_WINDOWING_X11
gchar *uri;
guint xid;
GtkWidget *toplevel;
@@ -827,6 +831,7 @@ nautilus_view_preview_files (NautilusView *view,
nautilus_previewer_call_show_file (uri, xid, TRUE);
g_free (uri);
+#endif
}
void
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index d315316..b156e65 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -47,13 +47,18 @@
#include <eel/eel-gtk-extensions.h>
#include <eel/eel-stock-dialogs.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
+
+#ifdef GDK_WINDOWING_X11
+#include <gdk/gdkx.h>
+#endif
+
#ifdef HAVE_X11_XF86KEYSYM_H
#include <X11/XF86keysym.h>
#endif
+
#include <libnautilus-private/nautilus-dnd.h>
#include <libnautilus-private/nautilus-file-utilities.h>
#include <libnautilus-private/nautilus-file-attributes.h>
@@ -1232,17 +1237,18 @@ static void
format_cb (GtkMenuItem *item,
gpointer user_data)
{
+#ifdef GDK_WINDOWING_X11
NautilusWindow *window = NAUTILUS_WINDOW (user_data);
GAppInfo *app_info;
gchar *cmdline, *device_identifier, *xid_string;
GVolume *volume;
- gint xid;
volume = g_object_get_data (G_OBJECT (item), "nautilus-volume");
g_assert (volume != NULL && G_IS_VOLUME (volume));
device_identifier = g_volume_get_identifier (volume,
G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
+
xid = (gint) gdk_x11_window_get_xid (gtk_widget_get_window (GTK_WIDGET
(window)));
xid_string = g_strdup_printf ("%d", xid);
@@ -1251,6 +1257,7 @@ format_cb (GtkMenuItem *item,
"--format-device ",
"--xid ", xid_string,
NULL);
+
app_info = g_app_info_create_from_commandline (cmdline, NULL, 0,
NULL);
g_app_info_launch (app_info, NULL, NULL, NULL);
@@ -1258,6 +1265,7 @@ format_cb (GtkMenuItem *item,
g_free (device_identifier);
g_free (xid_string);
g_clear_object (&app_info);
+#endif
}
/* Destroy notification function used from g_object_set_data_full() */
--
2.4.5
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]