summaryrefslogtreecommitdiffstats
path: root/panels/info-overview/gnome-control-center-print-renderer.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--panels/info-overview/gnome-control-center-print-renderer.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/panels/info-overview/gnome-control-center-print-renderer.c b/panels/info-overview/gnome-control-center-print-renderer.c
new file mode 100644
index 0000000..3e83703
--- /dev/null
+++ b/panels/info-overview/gnome-control-center-print-renderer.c
@@ -0,0 +1,61 @@
+/* -*- mode:c; c-basic-offset: 8; indent-tabs-mode: nil; -*- */
+/* Tool to set the property _GNOME_SESSION_ACCELERATED on the root window */
+/*
+ * Copyright (C) 2019 Red Hat, Inc.
+ *
+ * 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:
+ * Bastien Nocera <hadess@hadess.net>
+ * Matthias Clasen <mclasen@redhat.com>
+ */
+
+#include <gtk/gtk.h>
+#include <epoxy/gl.h>
+
+static char *
+get_gtk_gles_renderer (void)
+{
+ GtkWidget *win;
+ GdkGLContext *context;
+ char *renderer = NULL;
+
+ win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_widget_realize (win);
+ context = gdk_window_create_gl_context (gtk_widget_get_window (win), NULL);
+ if (!context)
+ return NULL;
+ gdk_gl_context_make_current (context);
+ renderer = g_strdup ((char *) glGetString (GL_RENDERER));
+ gdk_gl_context_clear_current ();
+ g_object_unref (context);
+
+ return renderer;
+}
+
+int
+main (int argc, char **argv)
+{
+ g_autofree char *renderer_string = NULL;
+
+ gtk_init (NULL, NULL);
+
+ renderer_string = get_gtk_gles_renderer ();
+ if (renderer_string) {
+ g_print ("%s", renderer_string);
+ return 0;
+ }
+ return 1;
+}