[gnome-session] check-accelerated: move exit code for helper to separate header
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session] check-accelerated: move exit code for helper to separate header
- Date: Tue, 20 Aug 2013 14:37:50 +0000 (UTC)
commit 74c0294078f7cc6d304ea61b4b2fe4fc1e14cca6
Author: Frederic Crozat <fcrozat suse com>
Date: Wed Jul 24 15:10:59 2013 +0200
check-accelerated: move exit code for helper to separate header
https://bugzilla.gnome.org/show_bug.cgi?id=704402
tools/Makefile.am | 4 ++-
tools/gnome-session-check-accelerated-common.h | 27 ++++++++++++++++++++++++
tools/gnome-session-check-accelerated-helper.c | 8 ++++--
tools/gnome-session-check-accelerated.c | 5 +++-
4 files changed, 39 insertions(+), 5 deletions(-)
---
diff --git a/tools/Makefile.am b/tools/Makefile.am
index ba8a6e8..57b82c7 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -42,6 +42,7 @@ gnome_session_inhibit_LDADD = \
$(GNOME_SESSION_LIBS)
gnome_session_check_accelerated_helper_SOURCES = \
+ gnome-session-check-accelerated-common.h \
gnome-session-check-accelerated-helper.c
gnome_session_check_accelerated_helper_CPPFLAGS = \
@@ -52,7 +53,8 @@ gnome_session_check_accelerated_helper_LDADD = \
$(GL_TEST_LIBS) \
$(X11_LIBS)
-gnome_session_check_accelerated_SOURCES = \
+gnome_session_check_accelerated_SOURCES = \
+ gnome-session-check-accelerated-common.h \
gnome-session-check-accelerated.c
gnome_session_check_accelerated_CPPFLAGS = \
diff --git a/tools/gnome-session-check-accelerated-common.h b/tools/gnome-session-check-accelerated-common.h
new file mode 100644
index 0000000..5cb2a85
--- /dev/null
+++ b/tools/gnome-session-check-accelerated-common.h
@@ -0,0 +1,27 @@
+/* -*- mode:c; c-basic-offset: 8; indent-tabs-mode: nil; -*- */
+/* Tool to set the property _GNOME_SESSION_ACCELERATED on the root window */
+/*
+ * Copyright (C) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
+ *
+ *
+ * This program 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author:
+ * Frederic Crozat <fcrozat suse com>
+ */
+
+/* Exit value for helper */
+#define HELPER_ACCEL 0
+#define HELPER_NO_ACCEL 1
diff --git a/tools/gnome-session-check-accelerated-helper.c b/tools/gnome-session-check-accelerated-helper.c
index cdf76dd..4575f96 100644
--- a/tools/gnome-session-check-accelerated-helper.c
+++ b/tools/gnome-session-check-accelerated-helper.c
@@ -84,6 +84,8 @@
#include <GL/gl.h>
#include <GL/glx.h>
+#include "gnome-session-check-accelerated-common.h"
+
#define SIZE_UNSET 0
#define SIZE_ERROR -1
static int max_texture_size = SIZE_UNSET;
@@ -402,13 +404,13 @@ main (int argc, char **argv)
{
int kcmdline_parsed;
Display *display = NULL;
- int ret = 1;
+ int ret = HELPER_NO_ACCEL;
kcmdline_parsed = _parse_kcmdline ();
if (kcmdline_parsed > CMDLINE_UNSET) {
if (kcmdline_parsed == CMDLINE_NON_FALLBACK_FORCED) {
_print_error ("Non-fallback mode forced by kernel command line.");
- ret = 0;
+ ret = HELPER_ACCEL;
goto out;
} else if (kcmdline_parsed == CMDLINE_FALLBACK_FORCED) {
_print_error ("Fallback mode forced by kernel command line.");
@@ -442,7 +444,7 @@ main (int argc, char **argv)
goto out;
}
- ret = 0;
+ ret = HELPER_ACCEL;
out:
if (display)
diff --git a/tools/gnome-session-check-accelerated.c b/tools/gnome-session-check-accelerated.c
index 3f10778..4163d41 100644
--- a/tools/gnome-session-check-accelerated.c
+++ b/tools/gnome-session-check-accelerated.c
@@ -28,6 +28,9 @@
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <X11/Xatom.h>
+#include <sys/wait.h>
+
+#include "gnome-session-check-accelerated-common.h"
/* Wait up to this long for a running check to finish */
#define PROPERTY_CHANGE_TIMEOUT 5000
@@ -163,7 +166,7 @@ main (int argc, char **argv)
g_printerr ("gnome-session-check-accelerated: Failed to run helper: %s\n", error->message);
g_clear_error (&error);
} else {
- is_accelerated = (estatus == 0);
+ is_accelerated = (WEXITSTATUS(estatus) == HELPER_ACCEL);
if (!is_accelerated)
g_printerr ("gnome-session-check-accelerated: Helper exited with code %d\n",
estatus);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]