diff options
author | Simon Quigley <tsimonq2@ubuntu.com> | 2017-06-19 14:38:41 -0500 |
---|---|---|
committer | Simon Quigley <tsimonq2@ubuntu.com> | 2017-06-19 14:38:41 -0500 |
commit | 11b8179a57e675c6672cbe649c655230ae3e9744 (patch) | |
tree | 2919c366d51e154e65279156fef5b4f97b8fd2f9 /arch/common/display.h | |
parent | 720f5023a8f68aaaa54cb6b7bf46efee23b5b4c3 (diff) |
Import Upstream version 0.4.2.1
Diffstat (limited to 'arch/common/display.h')
-rw-r--r-- | arch/common/display.h | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/arch/common/display.h b/arch/common/display.h index 6731e3e3..b4fe643e 100644 --- a/arch/common/display.h +++ b/arch/common/display.h @@ -1,6 +1,6 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br> + * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@linuxmag.com.br> * * 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 @@ -21,15 +21,14 @@ get_glx_info(DisplayInfo *di) { gchar *output; if (g_spawn_command_line_sync("glxinfo", &output, NULL, NULL, NULL)) { - gchar **output_lines, **old; - - output_lines = g_strsplit(output, "\n", 0); - g_free(output); + gchar **output_lines; + gint i = 0; - old = output_lines; - while (*(++output_lines)) { - if (strstr(*output_lines, "OpenGL")) { - gchar **tmp = g_strsplit(*output_lines, ":", 0); + for (output_lines = g_strsplit(output, "\n", 0); + output_lines && output_lines[i]; + i++) { + if (strstr(output_lines[i], "OpenGL")) { + gchar **tmp = g_strsplit(output_lines[i], ":", 0); tmp[1] = g_strchug(tmp[1]); @@ -38,10 +37,13 @@ get_glx_info(DisplayInfo *di) get_str("OpenGL version str", di->ogl_version); g_strfreev(tmp); + } else if (strstr(output_lines[i], "direct rendering: Yes")) { + di->dri = TRUE; } } - g_strfreev(old); + g_free(output); + g_strfreev(output_lines); if (!di->ogl_vendor) di->ogl_vendor = "Unknown"; @@ -126,9 +128,13 @@ computer_get_display(void) DisplayInfo *di = g_new0(DisplayInfo, 1); GdkScreen *screen = gdk_screen_get_default(); - - di->width = gdk_screen_get_width(screen); - di->height = gdk_screen_get_height(screen); + + if (screen && GDK_IS_SCREEN(screen)) { + di->width = gdk_screen_get_width(screen); + di->height = gdk_screen_get_height(screen); + } else { + di->width = di->height = 0; + } get_glx_info(di); get_x11_info(di); |