2014-05-15 04:06:43 +00:00
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2014 Red Hat, Inc.
|
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This 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
|
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2014-07-10 14:33:27 +00:00
|
|
|
|
#include "config.h"
|
|
|
|
|
#include <glib/gi18n-lib.h>
|
|
|
|
|
|
2014-05-15 04:06:43 +00:00
|
|
|
|
#include "general.h"
|
2019-12-07 17:30:15 +00:00
|
|
|
|
#include "window.h"
|
2014-05-15 04:06:43 +00:00
|
|
|
|
|
2014-07-12 03:14:04 +00:00
|
|
|
|
#include "gtkdebug.h"
|
2014-07-12 03:45:18 +00:00
|
|
|
|
#include "gtklabel.h"
|
|
|
|
|
#include "gtkscale.h"
|
2014-07-12 03:14:04 +00:00
|
|
|
|
#include "gtkswitch.h"
|
|
|
|
|
#include "gtklistbox.h"
|
2014-05-15 04:06:43 +00:00
|
|
|
|
#include "gtkprivate.h"
|
2014-11-08 07:16:35 +00:00
|
|
|
|
#include "gtksizegroup.h"
|
|
|
|
|
#include "gtkimage.h"
|
|
|
|
|
#include "gtkadjustment.h"
|
|
|
|
|
#include "gtkbox.h"
|
2020-03-22 14:41:21 +00:00
|
|
|
|
#include "gtkbinlayout.h"
|
2020-04-28 04:37:00 +00:00
|
|
|
|
#include "gtkmediafileprivate.h"
|
2014-05-15 04:06:43 +00:00
|
|
|
|
|
2017-10-04 01:06:50 +00:00
|
|
|
|
|
2014-05-15 04:06:43 +00:00
|
|
|
|
#ifdef GDK_WINDOWING_X11
|
|
|
|
|
#include "x11/gdkx.h"
|
2014-11-08 07:16:35 +00:00
|
|
|
|
#include <epoxy/glx.h>
|
2014-05-15 04:06:43 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef GDK_WINDOWING_WIN32
|
|
|
|
|
#include "win32/gdkwin32.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef GDK_WINDOWING_QUARTZ
|
|
|
|
|
#include "quartz/gdkquartz.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef GDK_WINDOWING_WAYLAND
|
|
|
|
|
#include "wayland/gdkwayland.h"
|
2014-11-08 07:16:35 +00:00
|
|
|
|
#include <epoxy/egl.h>
|
2014-05-15 04:06:43 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef GDK_WINDOWING_BROADWAY
|
|
|
|
|
#include "broadway/gdkbroadway.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-10-04 01:06:50 +00:00
|
|
|
|
#ifdef GDK_RENDERING_VULKAN
|
|
|
|
|
#include <vulkan/vulkan.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-07-18 04:31:04 +00:00
|
|
|
|
struct _GtkInspectorGeneral
|
2014-05-15 04:06:43 +00:00
|
|
|
|
{
|
2020-07-18 04:31:04 +00:00
|
|
|
|
GtkWidget parent;
|
|
|
|
|
|
2019-05-28 22:34:47 +00:00
|
|
|
|
GtkWidget *swin;
|
|
|
|
|
GtkWidget *box;
|
2014-11-08 07:16:35 +00:00
|
|
|
|
GtkWidget *version_box;
|
|
|
|
|
GtkWidget *env_box;
|
2016-04-02 23:22:36 +00:00
|
|
|
|
GtkWidget *display_box;
|
2020-05-13 05:49:56 +00:00
|
|
|
|
GtkWidget *monitor_box;
|
2014-11-08 07:16:35 +00:00
|
|
|
|
GtkWidget *gl_box;
|
2017-10-04 01:06:50 +00:00
|
|
|
|
GtkWidget *vulkan_box;
|
2016-02-25 05:17:09 +00:00
|
|
|
|
GtkWidget *device_box;
|
2014-05-15 04:06:43 +00:00
|
|
|
|
GtkWidget *gtk_version;
|
|
|
|
|
GtkWidget *gdk_backend;
|
2017-10-04 01:06:50 +00:00
|
|
|
|
GtkWidget *gsk_renderer;
|
2019-07-28 15:39:16 +00:00
|
|
|
|
GtkWidget *pango_fontmap;
|
2020-04-28 04:37:00 +00:00
|
|
|
|
GtkWidget *media_backend;
|
2014-11-08 07:16:35 +00:00
|
|
|
|
GtkWidget *gl_version;
|
|
|
|
|
GtkWidget *gl_vendor;
|
2017-10-04 01:06:50 +00:00
|
|
|
|
GtkWidget *vk_device;
|
|
|
|
|
GtkWidget *vk_api_version;
|
|
|
|
|
GtkWidget *vk_driver_version;
|
2014-05-15 04:06:43 +00:00
|
|
|
|
GtkWidget *prefix;
|
|
|
|
|
GtkWidget *xdg_data_home;
|
|
|
|
|
GtkWidget *xdg_data_dirs;
|
|
|
|
|
GtkWidget *gtk_path;
|
|
|
|
|
GtkWidget *gtk_exe_prefix;
|
|
|
|
|
GtkWidget *gtk_data_prefix;
|
2014-07-10 21:37:26 +00:00
|
|
|
|
GtkWidget *gsettings_schema_dir;
|
2016-04-02 23:22:36 +00:00
|
|
|
|
GtkWidget *display_name;
|
|
|
|
|
GtkWidget *display_rgba;
|
|
|
|
|
GtkWidget *display_composited;
|
2014-11-08 07:16:35 +00:00
|
|
|
|
GtkSizeGroup *labels;
|
2019-12-07 17:30:15 +00:00
|
|
|
|
|
|
|
|
|
GdkDisplay *display;
|
2014-05-15 04:06:43 +00:00
|
|
|
|
};
|
|
|
|
|
|
2020-07-18 04:31:04 +00:00
|
|
|
|
typedef struct _GtkInspectorGeneralClass
|
|
|
|
|
{
|
|
|
|
|
GtkWidgetClass parent_class;
|
|
|
|
|
} GtkInspectorGeneralClass;
|
|
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (GtkInspectorGeneral, gtk_inspector_general, GTK_TYPE_WIDGET)
|
2014-05-15 04:06:43 +00:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
init_version (GtkInspectorGeneral *gen)
|
|
|
|
|
{
|
2017-10-04 01:06:50 +00:00
|
|
|
|
const char *backend;
|
2018-03-21 10:49:14 +00:00
|
|
|
|
GdkSurface *surface;
|
2017-10-04 01:06:50 +00:00
|
|
|
|
GskRenderer *gsk_renderer;
|
|
|
|
|
const char *renderer;
|
2014-05-15 04:06:43 +00:00
|
|
|
|
|
|
|
|
|
#ifdef GDK_WINDOWING_X11
|
2020-07-18 04:31:04 +00:00
|
|
|
|
if (GDK_IS_X11_DISPLAY (gen->display))
|
2014-05-15 04:06:43 +00:00
|
|
|
|
backend = "X11";
|
|
|
|
|
else
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef GDK_WINDOWING_WAYLAND
|
2020-07-18 04:31:04 +00:00
|
|
|
|
if (GDK_IS_WAYLAND_DISPLAY (gen->display))
|
2014-05-15 04:06:43 +00:00
|
|
|
|
backend = "Wayland";
|
|
|
|
|
else
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef GDK_WINDOWING_BROADWAY
|
2020-07-18 04:31:04 +00:00
|
|
|
|
if (GDK_IS_BROADWAY_DISPLAY (gen->display))
|
2014-05-15 04:06:43 +00:00
|
|
|
|
backend = "Broadway";
|
|
|
|
|
else
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef GDK_WINDOWING_WIN32
|
2020-07-18 04:31:04 +00:00
|
|
|
|
if (GDK_IS_WIN32_DISPLAY (gen->display))
|
2014-05-15 04:06:43 +00:00
|
|
|
|
backend = "Windows";
|
|
|
|
|
else
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef GDK_WINDOWING_QUARTZ
|
2020-07-18 04:31:04 +00:00
|
|
|
|
if (GDK_IS_QUARTZ_DISPLAY (gen->display))
|
2014-05-15 04:06:43 +00:00
|
|
|
|
backend = "Quartz";
|
|
|
|
|
else
|
|
|
|
|
#endif
|
|
|
|
|
backend = "Unknown";
|
|
|
|
|
|
2020-07-18 04:31:04 +00:00
|
|
|
|
surface = gdk_surface_new_toplevel (gen->display, 10, 10);
|
2018-03-21 10:49:14 +00:00
|
|
|
|
gsk_renderer = gsk_renderer_new_for_surface (surface);
|
2017-10-04 01:06:50 +00:00
|
|
|
|
if (strcmp (G_OBJECT_TYPE_NAME (gsk_renderer), "GskVulkanRenderer") == 0)
|
|
|
|
|
renderer = "Vulkan";
|
|
|
|
|
else if (strcmp (G_OBJECT_TYPE_NAME (gsk_renderer), "GskGLRenderer") == 0)
|
|
|
|
|
renderer = "GL";
|
|
|
|
|
else if (strcmp (G_OBJECT_TYPE_NAME (gsk_renderer), "GskCairoRenderer") == 0)
|
|
|
|
|
renderer = "Cairo";
|
|
|
|
|
else
|
|
|
|
|
renderer = "Unknown";
|
|
|
|
|
|
2017-11-04 14:20:04 +00:00
|
|
|
|
gsk_renderer_unrealize (gsk_renderer);
|
2017-10-04 01:06:50 +00:00
|
|
|
|
g_object_unref (gsk_renderer);
|
2018-03-21 10:49:14 +00:00
|
|
|
|
gdk_surface_destroy (surface);
|
2017-10-04 01:06:50 +00:00
|
|
|
|
|
2020-07-18 04:31:04 +00:00
|
|
|
|
gtk_label_set_text (GTK_LABEL (gen->gtk_version), GTK_VERSION);
|
|
|
|
|
gtk_label_set_text (GTK_LABEL (gen->gdk_backend), backend);
|
|
|
|
|
gtk_label_set_text (GTK_LABEL (gen->gsk_renderer), renderer);
|
2014-05-15 04:06:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-06 04:46:09 +00:00
|
|
|
|
static G_GNUC_UNUSED void
|
2016-04-02 23:22:36 +00:00
|
|
|
|
add_check_row (GtkInspectorGeneral *gen,
|
|
|
|
|
GtkListBox *list,
|
|
|
|
|
const gchar *name,
|
|
|
|
|
gboolean value,
|
|
|
|
|
gint indent)
|
2014-11-08 07:16:35 +00:00
|
|
|
|
{
|
|
|
|
|
GtkWidget *row, *box, *label, *check;
|
|
|
|
|
|
|
|
|
|
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 40);
|
2016-04-02 23:22:36 +00:00
|
|
|
|
g_object_set (box,
|
|
|
|
|
"margin-start", 10 + indent,
|
2020-02-26 01:57:20 +00:00
|
|
|
|
"margin-end", 10,
|
|
|
|
|
"margin-top", 10,
|
|
|
|
|
"margin-bottom", 10,
|
2016-04-02 23:22:36 +00:00
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
label = gtk_label_new (name);
|
2014-11-08 07:16:35 +00:00
|
|
|
|
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
|
|
|
|
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
|
|
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
2017-05-06 10:19:19 +00:00
|
|
|
|
gtk_widget_set_hexpand (label, TRUE);
|
2020-05-09 12:26:52 +00:00
|
|
|
|
gtk_box_append (GTK_BOX (box), label);
|
2016-04-02 23:22:36 +00:00
|
|
|
|
|
2017-11-15 00:43:13 +00:00
|
|
|
|
check = gtk_image_new_from_icon_name ("object-select-symbolic");
|
2014-11-08 07:16:35 +00:00
|
|
|
|
gtk_widget_set_halign (check, GTK_ALIGN_END);
|
|
|
|
|
gtk_widget_set_valign (check, GTK_ALIGN_BASELINE);
|
2016-04-02 23:22:36 +00:00
|
|
|
|
gtk_widget_set_opacity (check, value ? 1.0 : 0.0);
|
2020-05-09 12:26:52 +00:00
|
|
|
|
gtk_box_append (GTK_BOX (box), check);
|
2016-04-02 23:22:36 +00:00
|
|
|
|
|
|
|
|
|
row = gtk_list_box_row_new ();
|
2020-05-03 04:09:18 +00:00
|
|
|
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
|
2016-04-02 23:22:36 +00:00
|
|
|
|
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
|
|
|
|
|
|
2017-05-06 10:19:19 +00:00
|
|
|
|
gtk_widget_set_hexpand (box, FALSE);
|
2016-04-02 23:22:36 +00:00
|
|
|
|
gtk_list_box_insert (list, row, -1);
|
|
|
|
|
|
2020-07-18 04:31:04 +00:00
|
|
|
|
gtk_size_group_add_widget (GTK_SIZE_GROUP (gen->labels), label);
|
2016-04-02 23:22:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
add_label_row (GtkInspectorGeneral *gen,
|
|
|
|
|
GtkListBox *list,
|
|
|
|
|
const char *name,
|
|
|
|
|
const char *value,
|
|
|
|
|
gint indent)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *box;
|
|
|
|
|
GtkWidget *label;
|
|
|
|
|
GtkWidget *row;
|
|
|
|
|
|
|
|
|
|
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 40);
|
|
|
|
|
g_object_set (box,
|
|
|
|
|
"margin-start", 10 + indent,
|
2020-02-26 01:57:20 +00:00
|
|
|
|
"margin-end", 10,
|
|
|
|
|
"margin-top", 10,
|
|
|
|
|
"margin-bottom", 10,
|
2016-04-02 23:22:36 +00:00
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
label = gtk_label_new (name);
|
|
|
|
|
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
|
|
|
|
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
|
|
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
2017-05-06 10:19:19 +00:00
|
|
|
|
gtk_widget_set_hexpand (label, TRUE);
|
2020-05-09 12:26:52 +00:00
|
|
|
|
gtk_box_append (GTK_BOX (box), label);
|
2016-04-02 23:22:36 +00:00
|
|
|
|
|
|
|
|
|
label = gtk_label_new (value);
|
|
|
|
|
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
|
|
|
|
|
gtk_widget_set_halign (label, GTK_ALIGN_END);
|
|
|
|
|
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
|
|
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 1.0);
|
2020-05-09 12:26:52 +00:00
|
|
|
|
gtk_box_append (GTK_BOX (box), label);
|
2016-04-02 23:22:36 +00:00
|
|
|
|
|
|
|
|
|
row = gtk_list_box_row_new ();
|
2020-05-03 04:09:18 +00:00
|
|
|
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
|
2016-04-02 23:22:36 +00:00
|
|
|
|
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
|
|
|
|
|
|
2017-05-06 10:19:19 +00:00
|
|
|
|
gtk_widget_set_hexpand (box, FALSE);
|
2016-04-02 23:22:36 +00:00
|
|
|
|
gtk_list_box_insert (GTK_LIST_BOX (list), row, -1);
|
2014-11-08 07:16:35 +00:00
|
|
|
|
|
2020-07-18 04:31:04 +00:00
|
|
|
|
gtk_size_group_add_widget (GTK_SIZE_GROUP (gen->labels), label);
|
2014-11-08 07:16:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef GDK_WINDOWING_X11
|
|
|
|
|
static void
|
|
|
|
|
append_glx_extension_row (GtkInspectorGeneral *gen,
|
|
|
|
|
Display *dpy,
|
|
|
|
|
const gchar *ext)
|
|
|
|
|
{
|
2020-07-18 04:31:04 +00:00
|
|
|
|
add_check_row (gen, GTK_LIST_BOX (gen->gl_box), ext, epoxy_has_glx_extension (dpy, 0, ext), 0);
|
2014-11-08 07:16:35 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef GDK_WINDOWING_WAYLAND
|
|
|
|
|
static void
|
|
|
|
|
append_egl_extension_row (GtkInspectorGeneral *gen,
|
2016-10-10 18:10:38 +00:00
|
|
|
|
EGLDisplay dpy,
|
2014-11-08 07:16:35 +00:00
|
|
|
|
const gchar *ext)
|
|
|
|
|
{
|
2020-07-18 04:31:04 +00:00
|
|
|
|
add_check_row (gen, GTK_LIST_BOX (gen->gl_box), ext, epoxy_has_egl_extension (dpy, ext), 0);
|
2014-11-08 07:16:35 +00:00
|
|
|
|
}
|
2016-10-10 18:12:40 +00:00
|
|
|
|
|
|
|
|
|
static EGLDisplay
|
2016-10-10 18:37:09 +00:00
|
|
|
|
wayland_get_display (struct wl_display *wl_display)
|
2016-10-10 18:12:40 +00:00
|
|
|
|
{
|
|
|
|
|
EGLDisplay dpy = NULL;
|
|
|
|
|
|
|
|
|
|
if (epoxy_has_egl_extension (NULL, "EGL_KHR_platform_base"))
|
|
|
|
|
{
|
|
|
|
|
PFNEGLGETPLATFORMDISPLAYPROC getPlatformDisplay =
|
|
|
|
|
(void *) eglGetProcAddress ("eglGetPlatformDisplay");
|
|
|
|
|
|
|
|
|
|
if (getPlatformDisplay)
|
|
|
|
|
dpy = getPlatformDisplay (EGL_PLATFORM_WAYLAND_EXT,
|
2016-10-10 18:37:09 +00:00
|
|
|
|
wl_display,
|
2016-10-10 18:12:40 +00:00
|
|
|
|
NULL);
|
|
|
|
|
if (dpy)
|
|
|
|
|
return dpy;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (epoxy_has_egl_extension (NULL, "EGL_EXT_platform_base"))
|
|
|
|
|
{
|
|
|
|
|
PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplay =
|
|
|
|
|
(void *) eglGetProcAddress ("eglGetPlatformDisplayEXT");
|
|
|
|
|
|
|
|
|
|
if (getPlatformDisplay)
|
|
|
|
|
dpy = getPlatformDisplay (EGL_PLATFORM_WAYLAND_EXT,
|
2016-10-10 18:37:09 +00:00
|
|
|
|
wl_display,
|
2016-10-10 18:12:40 +00:00
|
|
|
|
NULL);
|
|
|
|
|
if (dpy)
|
|
|
|
|
return dpy;
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-10 18:37:09 +00:00
|
|
|
|
return eglGetDisplay ((EGLNativeDisplayType)wl_display);
|
2016-10-10 18:12:40 +00:00
|
|
|
|
}
|
2014-11-08 07:16:35 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2016-02-11 03:14:56 +00:00
|
|
|
|
|
2014-11-08 07:16:35 +00:00
|
|
|
|
static void
|
|
|
|
|
init_gl (GtkInspectorGeneral *gen)
|
|
|
|
|
{
|
|
|
|
|
#ifdef GDK_WINDOWING_X11
|
2020-07-18 04:31:04 +00:00
|
|
|
|
if (GDK_IS_X11_DISPLAY (gen->display))
|
2014-11-08 07:16:35 +00:00
|
|
|
|
{
|
2020-07-18 04:31:04 +00:00
|
|
|
|
Display *dpy = GDK_DISPLAY_XDISPLAY (gen->display);
|
2014-11-08 07:16:35 +00:00
|
|
|
|
int error_base, event_base;
|
2016-02-06 04:46:09 +00:00
|
|
|
|
gchar *version;
|
2014-11-08 07:16:35 +00:00
|
|
|
|
if (!glXQueryExtension (dpy, &error_base, &event_base))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
version = g_strconcat ("GLX ", glXGetClientString (dpy, GLX_VERSION), NULL);
|
2020-07-18 04:31:04 +00:00
|
|
|
|
gtk_label_set_text (GTK_LABEL (gen->gl_version), version);
|
2014-11-08 07:16:35 +00:00
|
|
|
|
g_free (version);
|
2020-07-18 04:31:04 +00:00
|
|
|
|
gtk_label_set_text (GTK_LABEL (gen->gl_vendor), glXGetClientString (dpy, GLX_VENDOR));
|
2014-11-08 07:16:35 +00:00
|
|
|
|
|
|
|
|
|
append_glx_extension_row (gen, dpy, "GLX_ARB_create_context_profile");
|
|
|
|
|
append_glx_extension_row (gen, dpy, "GLX_SGI_swap_control");
|
|
|
|
|
append_glx_extension_row (gen, dpy, "GLX_EXT_texture_from_pixmap");
|
|
|
|
|
append_glx_extension_row (gen, dpy, "GLX_SGI_video_sync");
|
|
|
|
|
append_glx_extension_row (gen, dpy, "GLX_EXT_buffer_age");
|
|
|
|
|
append_glx_extension_row (gen, dpy, "GLX_OML_sync_control");
|
|
|
|
|
append_glx_extension_row (gen, dpy, "GLX_ARB_multisample");
|
|
|
|
|
append_glx_extension_row (gen, dpy, "GLX_EXT_visual_rating");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef GDK_WINDOWING_WAYLAND
|
2020-07-18 04:31:04 +00:00
|
|
|
|
if (GDK_IS_WAYLAND_DISPLAY (gen->display))
|
2014-11-08 07:16:35 +00:00
|
|
|
|
{
|
2016-10-10 18:10:38 +00:00
|
|
|
|
EGLDisplay dpy;
|
2014-11-08 07:16:35 +00:00
|
|
|
|
EGLint major, minor;
|
2016-02-06 04:46:09 +00:00
|
|
|
|
gchar *version;
|
2014-11-08 07:16:35 +00:00
|
|
|
|
|
2020-07-18 04:31:04 +00:00
|
|
|
|
dpy = wayland_get_display (gdk_wayland_display_get_wl_display (gen->display));
|
2014-11-08 07:16:35 +00:00
|
|
|
|
|
|
|
|
|
if (!eglInitialize (dpy, &major, &minor))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
version = g_strconcat ("EGL ", eglQueryString (dpy, EGL_VERSION), NULL);
|
2020-07-18 04:31:04 +00:00
|
|
|
|
gtk_label_set_text (GTK_LABEL (gen->gl_version), version);
|
2014-11-08 07:16:35 +00:00
|
|
|
|
g_free (version);
|
2020-07-18 04:31:04 +00:00
|
|
|
|
gtk_label_set_text (GTK_LABEL (gen->gl_vendor), eglQueryString (dpy, EGL_VENDOR));
|
2014-11-08 07:16:35 +00:00
|
|
|
|
|
|
|
|
|
append_egl_extension_row (gen, dpy, "EGL_KHR_create_context");
|
|
|
|
|
append_egl_extension_row (gen, dpy, "EGL_EXT_buffer_age");
|
|
|
|
|
append_egl_extension_row (gen, dpy, "EGL_EXT_swap_buffers_with_damage");
|
|
|
|
|
append_egl_extension_row (gen, dpy, "EGL_KHR_surfaceless_context");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
#endif
|
|
|
|
|
{
|
2020-07-18 04:31:04 +00:00
|
|
|
|
gtk_label_set_text (GTK_LABEL (gen->gl_version), C_("GL version", "None"));
|
|
|
|
|
gtk_label_set_text (GTK_LABEL (gen->gl_vendor), C_("GL vendor", "None"));
|
2014-11-08 07:16:35 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-04 01:06:50 +00:00
|
|
|
|
#ifdef GDK_RENDERING_VULKAN
|
|
|
|
|
static gboolean
|
|
|
|
|
has_debug_extension (GdkVulkanContext *context)
|
|
|
|
|
{
|
|
|
|
|
uint32_t i;
|
|
|
|
|
uint32_t n_extensions;
|
|
|
|
|
vkEnumerateInstanceExtensionProperties (NULL, &n_extensions, NULL);
|
|
|
|
|
VkExtensionProperties *extensions = g_newa (VkExtensionProperties, n_extensions);
|
|
|
|
|
vkEnumerateInstanceExtensionProperties (NULL, &n_extensions, extensions);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < n_extensions; i++)
|
|
|
|
|
{
|
|
|
|
|
if (g_str_equal (extensions[i].extensionName, VK_EXT_DEBUG_REPORT_EXTENSION_NAME))
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
has_validation_layer (GdkVulkanContext *context)
|
|
|
|
|
{
|
|
|
|
|
uint32_t i;
|
|
|
|
|
uint32_t n_layers;
|
|
|
|
|
vkEnumerateInstanceLayerProperties (&n_layers, NULL);
|
|
|
|
|
VkLayerProperties *layers = g_newa (VkLayerProperties, n_layers);
|
|
|
|
|
vkEnumerateInstanceLayerProperties (&n_layers, layers);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < n_layers; i++)
|
|
|
|
|
{
|
|
|
|
|
if (g_str_equal (layers[i].layerName, "VK_LAYER_LUNARG_standard_validation"))
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
init_vulkan (GtkInspectorGeneral *gen)
|
|
|
|
|
{
|
|
|
|
|
#ifdef GDK_RENDERING_VULKAN
|
2018-03-21 10:49:14 +00:00
|
|
|
|
GdkSurface *surface;
|
2017-10-04 01:06:50 +00:00
|
|
|
|
GdkVulkanContext *context;
|
|
|
|
|
|
2020-07-18 04:31:04 +00:00
|
|
|
|
surface = gdk_surface_new_toplevel (gen->display, 10, 10);
|
2018-03-21 10:49:14 +00:00
|
|
|
|
context = gdk_surface_create_vulkan_context (surface, NULL);
|
|
|
|
|
gdk_surface_destroy (surface);
|
2017-10-04 01:06:50 +00:00
|
|
|
|
|
|
|
|
|
if (context)
|
|
|
|
|
{
|
|
|
|
|
VkPhysicalDevice vk_device;
|
|
|
|
|
VkPhysicalDeviceProperties props;
|
|
|
|
|
char *device_name;
|
|
|
|
|
char *api_version;
|
|
|
|
|
char *driver_version;
|
|
|
|
|
|
|
|
|
|
vk_device = gdk_vulkan_context_get_physical_device (context);
|
|
|
|
|
vkGetPhysicalDeviceProperties (vk_device, &props);
|
|
|
|
|
|
|
|
|
|
device_name = g_strdup_printf ("%s (%d)", props.deviceName, props.deviceType);
|
|
|
|
|
api_version = g_strdup_printf ("%d.%d.%d",
|
|
|
|
|
VK_VERSION_MAJOR (props.apiVersion),
|
|
|
|
|
VK_VERSION_MINOR (props.apiVersion),
|
|
|
|
|
VK_VERSION_PATCH (props.apiVersion));
|
|
|
|
|
driver_version = g_strdup_printf ("%d.%d.%d",
|
|
|
|
|
VK_VERSION_MAJOR (props.driverVersion),
|
|
|
|
|
VK_VERSION_MINOR (props.driverVersion),
|
|
|
|
|
VK_VERSION_PATCH (props.driverVersion));
|
|
|
|
|
|
2020-07-18 04:31:04 +00:00
|
|
|
|
gtk_label_set_text (GTK_LABEL (gen->vk_device), device_name);
|
|
|
|
|
gtk_label_set_text (GTK_LABEL (gen->vk_api_version), api_version);
|
|
|
|
|
gtk_label_set_text (GTK_LABEL (gen->vk_driver_version), driver_version);
|
2017-10-04 01:06:50 +00:00
|
|
|
|
|
|
|
|
|
g_free (device_name);
|
|
|
|
|
g_free (api_version);
|
|
|
|
|
g_free (driver_version);
|
|
|
|
|
|
2020-07-18 04:31:04 +00:00
|
|
|
|
add_check_row (gen, GTK_LIST_BOX (gen->vulkan_box), VK_KHR_SURFACE_EXTENSION_NAME, TRUE, 0);
|
2017-10-04 01:06:50 +00:00
|
|
|
|
#ifdef GDK_WINDOWING_X11
|
2020-07-18 04:31:04 +00:00
|
|
|
|
if (GDK_IS_X11_DISPLAY (gen->display))
|
|
|
|
|
add_check_row (gen, GTK_LIST_BOX (gen->vulkan_box), "VK_KHR_xlib_surface", TRUE, 0);
|
2017-10-04 01:06:50 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef GDK_WINDOWING_WAYLAND
|
2020-07-18 04:31:04 +00:00
|
|
|
|
if (GDK_IS_WAYLAND_DISPLAY (gen->display))
|
|
|
|
|
add_check_row (gen, GTK_LIST_BOX (gen->vulkan_box), "VK_KHR_wayland_surface", TRUE, 0);
|
2017-10-04 01:06:50 +00:00
|
|
|
|
#endif
|
2020-07-18 04:31:04 +00:00
|
|
|
|
add_check_row (gen, GTK_LIST_BOX (gen->vulkan_box), VK_EXT_DEBUG_REPORT_EXTENSION_NAME,
|
2017-10-04 01:06:50 +00:00
|
|
|
|
has_debug_extension (context), 0);
|
2020-07-18 04:31:04 +00:00
|
|
|
|
add_check_row (gen, GTK_LIST_BOX (gen->vulkan_box), "VK_LAYER_LUNARG_standard_validation",
|
2017-10-04 01:06:50 +00:00
|
|
|
|
has_validation_layer (context), 0);
|
|
|
|
|
|
|
|
|
|
g_object_unref (context);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
#endif
|
|
|
|
|
{
|
2020-07-18 04:31:04 +00:00
|
|
|
|
gtk_label_set_text (GTK_LABEL (gen->vk_device), C_("Vulkan device", "None"));
|
|
|
|
|
gtk_label_set_text (GTK_LABEL (gen->vk_api_version), C_("Vulkan version", "None"));
|
|
|
|
|
gtk_label_set_text (GTK_LABEL (gen->vk_driver_version), C_("Vulkan version", "None"));
|
2017-10-04 01:06:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-15 04:06:43 +00:00
|
|
|
|
static void
|
|
|
|
|
set_monospace_font (GtkWidget *w)
|
|
|
|
|
{
|
2014-10-07 04:42:46 +00:00
|
|
|
|
PangoAttrList *attrs;
|
|
|
|
|
|
|
|
|
|
attrs = pango_attr_list_new ();
|
|
|
|
|
pango_attr_list_insert (attrs, pango_attr_fallback_new (FALSE));
|
|
|
|
|
pango_attr_list_insert (attrs, pango_attr_family_new ("Monospace"));
|
|
|
|
|
gtk_label_set_attributes (GTK_LABEL (w), attrs);
|
|
|
|
|
pango_attr_list_unref (attrs);
|
2014-05-15 04:06:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_path_label (GtkWidget *w,
|
|
|
|
|
const gchar *var)
|
|
|
|
|
{
|
|
|
|
|
const gchar *v;
|
|
|
|
|
|
|
|
|
|
v = g_getenv (var);
|
2014-05-15 12:47:44 +00:00
|
|
|
|
if (v != NULL)
|
2014-05-15 04:06:43 +00:00
|
|
|
|
{
|
|
|
|
|
set_monospace_font (w);
|
|
|
|
|
gtk_label_set_text (GTK_LABEL (w), v);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *r;
|
|
|
|
|
r = gtk_widget_get_ancestor (w, GTK_TYPE_LIST_BOX_ROW);
|
|
|
|
|
gtk_widget_hide (r);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
init_env (GtkInspectorGeneral *gen)
|
|
|
|
|
{
|
2020-07-18 04:31:04 +00:00
|
|
|
|
set_monospace_font (gen->prefix);
|
|
|
|
|
gtk_label_set_text (GTK_LABEL (gen->prefix), _gtk_get_data_prefix ());
|
|
|
|
|
set_path_label (gen->xdg_data_home, "XDG_DATA_HOME");
|
|
|
|
|
set_path_label (gen->xdg_data_dirs, "XDG_DATA_DIRS");
|
|
|
|
|
set_path_label (gen->gtk_path, "GTK_PATH");
|
|
|
|
|
set_path_label (gen->gtk_exe_prefix, "GTK_EXE_PREFIX");
|
|
|
|
|
set_path_label (gen->gtk_data_prefix, "GTK_DATA_PREFIX");
|
|
|
|
|
set_path_label (gen->gsettings_schema_dir, "GSETTINGS_SCHEMA_DIR");
|
2014-05-15 04:06:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-02 23:22:36 +00:00
|
|
|
|
static const char *
|
|
|
|
|
translate_subpixel_layout (GdkSubpixelLayout subpixel)
|
2016-02-26 01:49:09 +00:00
|
|
|
|
{
|
2016-04-02 23:22:36 +00:00
|
|
|
|
switch (subpixel)
|
|
|
|
|
{
|
|
|
|
|
case GDK_SUBPIXEL_LAYOUT_NONE: return "none";
|
|
|
|
|
case GDK_SUBPIXEL_LAYOUT_UNKNOWN: return "unknown";
|
|
|
|
|
case GDK_SUBPIXEL_LAYOUT_HORIZONTAL_RGB: return "horizontal rgb";
|
|
|
|
|
case GDK_SUBPIXEL_LAYOUT_HORIZONTAL_BGR: return "horizontal bgr";
|
|
|
|
|
case GDK_SUBPIXEL_LAYOUT_VERTICAL_RGB: return "vertical rgb";
|
|
|
|
|
case GDK_SUBPIXEL_LAYOUT_VERTICAL_BGR: return "vertical bgr";
|
2017-10-24 16:26:08 +00:00
|
|
|
|
default: g_assert_not_reached (); return "none";
|
2016-04-02 23:22:36 +00:00
|
|
|
|
}
|
2016-02-26 01:49:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-28 16:36:10 +00:00
|
|
|
|
static void
|
2017-10-30 00:53:09 +00:00
|
|
|
|
populate_display (GdkDisplay *display, GtkInspectorGeneral *gen)
|
2014-12-28 16:36:10 +00:00
|
|
|
|
{
|
2016-02-25 06:21:27 +00:00
|
|
|
|
GList *children, *l;
|
|
|
|
|
GtkWidget *child;
|
2016-04-02 23:22:36 +00:00
|
|
|
|
GtkListBox *list;
|
2016-02-25 06:21:27 +00:00
|
|
|
|
|
2020-07-18 04:31:04 +00:00
|
|
|
|
gtk_widget_show (gen->display_composited);
|
|
|
|
|
list = GTK_LIST_BOX (gen->display_box);
|
2020-05-08 06:19:18 +00:00
|
|
|
|
children = NULL;
|
|
|
|
|
for (child = gtk_widget_get_first_child (GTK_WIDGET (list));
|
|
|
|
|
child != NULL;
|
|
|
|
|
child = gtk_widget_get_next_sibling (child))
|
|
|
|
|
{
|
|
|
|
|
if (GTK_IS_LIST_BOX_ROW (child))
|
|
|
|
|
children = g_list_prepend (children, child);
|
|
|
|
|
}
|
2016-02-25 06:21:27 +00:00
|
|
|
|
for (l = children; l; l = l->next)
|
|
|
|
|
{
|
|
|
|
|
child = l->data;
|
2020-07-18 04:31:04 +00:00
|
|
|
|
if (gtk_widget_is_ancestor (gen->display_name, child) ||
|
|
|
|
|
gtk_widget_is_ancestor (gen->display_rgba, child) ||
|
|
|
|
|
gtk_widget_is_ancestor (gen->display_composited, child))
|
2016-02-25 06:21:27 +00:00
|
|
|
|
continue;
|
|
|
|
|
|
2020-05-08 06:19:18 +00:00
|
|
|
|
gtk_list_box_remove (list, child);
|
2016-02-25 06:21:27 +00:00
|
|
|
|
}
|
|
|
|
|
g_list_free (children);
|
2014-12-28 16:36:10 +00:00
|
|
|
|
|
2020-07-18 04:31:04 +00:00
|
|
|
|
gtk_label_set_label (GTK_LABEL (gen->display_name), gdk_display_get_name (display));
|
2014-12-28 16:36:10 +00:00
|
|
|
|
|
2020-07-18 04:31:04 +00:00
|
|
|
|
gtk_widget_set_visible (gen->display_rgba,
|
2016-10-28 23:06:05 +00:00
|
|
|
|
gdk_display_is_rgba (display));
|
2020-07-18 04:31:04 +00:00
|
|
|
|
gtk_widget_set_visible (gen->display_composited,
|
2016-10-28 23:06:05 +00:00
|
|
|
|
gdk_display_is_composited (display));
|
2020-05-13 05:49:56 +00:00
|
|
|
|
}
|
2015-07-28 05:14:49 +00:00
|
|
|
|
|
2020-05-13 05:49:56 +00:00
|
|
|
|
static GtkWidget *
|
|
|
|
|
populate_monitor (gpointer item,
|
|
|
|
|
gpointer gen)
|
|
|
|
|
{
|
|
|
|
|
GtkListBox *list;
|
|
|
|
|
GdkMonitor *monitor = item;
|
|
|
|
|
gchar *name;
|
|
|
|
|
gchar *value;
|
|
|
|
|
GdkRectangle rect;
|
|
|
|
|
gint scale;
|
|
|
|
|
char *scale_str = NULL;
|
|
|
|
|
const char *manufacturer;
|
|
|
|
|
const char *model;
|
|
|
|
|
|
|
|
|
|
list = GTK_LIST_BOX (gtk_list_box_new ());
|
|
|
|
|
gtk_list_box_set_selection_mode (list, GTK_SELECTION_NONE);
|
|
|
|
|
|
|
|
|
|
/* XXX: add monitor # here when porting to listview */
|
|
|
|
|
name = g_strdup_printf ("Monitor %d", 1);
|
|
|
|
|
manufacturer = gdk_monitor_get_manufacturer (monitor);
|
|
|
|
|
model = gdk_monitor_get_model (monitor);
|
|
|
|
|
value = g_strdup_printf ("%s%s%s",
|
|
|
|
|
manufacturer ? manufacturer : "",
|
|
|
|
|
manufacturer || model ? " " : "",
|
|
|
|
|
model ? model : "");
|
|
|
|
|
add_label_row (gen, list, name, value, 0);
|
|
|
|
|
g_free (name);
|
|
|
|
|
g_free (value);
|
|
|
|
|
|
|
|
|
|
gdk_monitor_get_geometry (monitor, &rect);
|
|
|
|
|
scale = gdk_monitor_get_scale_factor (monitor);
|
|
|
|
|
if (scale != 1)
|
|
|
|
|
scale_str = g_strdup_printf (" @ %d", scale);
|
|
|
|
|
|
|
|
|
|
value = g_strdup_printf ("%d × %d%s at %d, %d",
|
|
|
|
|
rect.width, rect.height,
|
|
|
|
|
scale_str ? scale_str : "",
|
|
|
|
|
rect.x, rect.y);
|
|
|
|
|
add_label_row (gen, list, "Geometry", value, 10);
|
|
|
|
|
g_free (value);
|
|
|
|
|
g_free (scale_str);
|
|
|
|
|
|
|
|
|
|
value = g_strdup_printf ("%d × %d mm²",
|
|
|
|
|
gdk_monitor_get_width_mm (monitor),
|
|
|
|
|
gdk_monitor_get_height_mm (monitor));
|
|
|
|
|
add_label_row (gen, list, "Size", value, 10);
|
|
|
|
|
g_free (value);
|
|
|
|
|
|
|
|
|
|
if (gdk_monitor_get_refresh_rate (monitor) != 0)
|
|
|
|
|
value = g_strdup_printf ("%.2f Hz",
|
|
|
|
|
0.001 * gdk_monitor_get_refresh_rate (monitor));
|
|
|
|
|
else
|
|
|
|
|
value = g_strdup ("unknown");
|
|
|
|
|
add_label_row (gen, list, "Refresh rate", value, 10);
|
|
|
|
|
g_free (value);
|
|
|
|
|
|
|
|
|
|
value = g_strdup (translate_subpixel_layout (gdk_monitor_get_subpixel_layout (monitor)));
|
|
|
|
|
add_label_row (gen, list, "Subpixel layout", value, 10);
|
|
|
|
|
g_free (value);
|
|
|
|
|
|
|
|
|
|
return GTK_WIDGET (list);
|
2014-12-28 16:36:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-28 23:06:05 +00:00
|
|
|
|
static void
|
|
|
|
|
populate_display_notify_cb (GdkDisplay *display,
|
|
|
|
|
GParamSpec *pspec,
|
|
|
|
|
GtkInspectorGeneral *gen)
|
|
|
|
|
{
|
2017-10-30 00:53:09 +00:00
|
|
|
|
populate_display (display, gen);
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-25 06:21:27 +00:00
|
|
|
|
static void
|
|
|
|
|
init_display (GtkInspectorGeneral *gen)
|
|
|
|
|
{
|
2020-07-18 04:31:04 +00:00
|
|
|
|
g_signal_connect (gen->display, "notify", G_CALLBACK (populate_display_notify_cb), gen);
|
|
|
|
|
gtk_list_box_bind_model (GTK_LIST_BOX (gen->monitor_box),
|
|
|
|
|
gdk_display_get_monitors (gen->display),
|
2020-05-13 05:49:56 +00:00
|
|
|
|
populate_monitor,
|
|
|
|
|
gen, NULL);
|
2016-02-25 06:21:27 +00:00
|
|
|
|
|
2020-07-18 04:31:04 +00:00
|
|
|
|
populate_display (gen->display, gen);
|
2016-02-25 06:21:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-07-28 15:39:16 +00:00
|
|
|
|
static void
|
|
|
|
|
init_pango (GtkInspectorGeneral *gen)
|
|
|
|
|
{
|
|
|
|
|
PangoFontMap *fontmap;
|
|
|
|
|
const char *type;
|
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
|
|
fontmap = pango_cairo_font_map_get_default ();
|
|
|
|
|
type = G_OBJECT_TYPE_NAME (fontmap);
|
|
|
|
|
if (strcmp (type, "PangoCairoFcFontMap") == 0)
|
|
|
|
|
name = "fontconfig";
|
|
|
|
|
else if (strcmp (type, "PangoCairoCoreTextFontMap") == 0)
|
|
|
|
|
name = "coretext";
|
|
|
|
|
else if (strcmp (type, "PangoCairoWin32FontMap") == 0)
|
|
|
|
|
name = "win32";
|
|
|
|
|
else
|
|
|
|
|
name = type;
|
|
|
|
|
|
2020-07-18 04:31:04 +00:00
|
|
|
|
gtk_label_set_label (GTK_LABEL (gen->pango_fontmap), name);
|
2019-07-28 15:39:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-04-28 04:37:00 +00:00
|
|
|
|
static void
|
|
|
|
|
init_media (GtkInspectorGeneral *gen)
|
|
|
|
|
{
|
|
|
|
|
GIOExtension *e;
|
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
|
|
e = gtk_media_file_get_extension ();
|
|
|
|
|
name = g_io_extension_get_name (e);
|
2020-07-18 04:31:04 +00:00
|
|
|
|
gtk_label_set_label (GTK_LABEL (gen->media_backend), name);
|
2020-04-28 04:37:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-26 01:28:23 +00:00
|
|
|
|
static void populate_seats (GtkInspectorGeneral *gen);
|
|
|
|
|
|
2016-02-25 05:17:09 +00:00
|
|
|
|
static void
|
|
|
|
|
add_device (GtkInspectorGeneral *gen,
|
|
|
|
|
GdkDevice *device)
|
|
|
|
|
{
|
2016-02-26 01:49:09 +00:00
|
|
|
|
const gchar *name, *value;
|
2016-02-25 05:17:09 +00:00
|
|
|
|
GString *str;
|
2016-02-25 05:49:17 +00:00
|
|
|
|
int i;
|
2016-02-25 14:25:19 +00:00
|
|
|
|
guint n_touches;
|
2016-02-26 01:49:09 +00:00
|
|
|
|
gchar *text;
|
2016-04-09 16:14:33 +00:00
|
|
|
|
GdkAxisFlags axes;
|
|
|
|
|
const char *axis_name[] = {
|
|
|
|
|
"Ignore",
|
|
|
|
|
"X",
|
|
|
|
|
"Y",
|
2020-07-13 21:13:43 +00:00
|
|
|
|
"Delta X",
|
|
|
|
|
"Delta Y",
|
2016-04-09 16:14:33 +00:00
|
|
|
|
"Pressure",
|
|
|
|
|
"X Tilt",
|
|
|
|
|
"Y Tilt",
|
|
|
|
|
"Wheel",
|
|
|
|
|
"Distance",
|
|
|
|
|
"Rotation",
|
|
|
|
|
"Slider"
|
|
|
|
|
};
|
2016-04-09 19:47:56 +00:00
|
|
|
|
const char *source_name[] = {
|
|
|
|
|
"Mouse",
|
|
|
|
|
"Pen",
|
|
|
|
|
"Cursor",
|
|
|
|
|
"Keyboard",
|
|
|
|
|
"Touchscreen",
|
2016-06-23 19:46:45 +00:00
|
|
|
|
"Touchpad",
|
2020-01-18 15:51:54 +00:00
|
|
|
|
"Trackpoint",
|
|
|
|
|
"Pad"
|
2016-04-09 19:47:56 +00:00
|
|
|
|
};
|
2016-02-25 05:17:09 +00:00
|
|
|
|
|
2016-02-26 01:49:09 +00:00
|
|
|
|
name = gdk_device_get_name (device);
|
2016-04-09 19:47:56 +00:00
|
|
|
|
value = source_name[gdk_device_get_source (device)];
|
2020-07-18 04:31:04 +00:00
|
|
|
|
add_label_row (gen, GTK_LIST_BOX (gen->device_box), name, value, 10);
|
2016-02-25 05:49:17 +00:00
|
|
|
|
|
|
|
|
|
str = g_string_new ("");
|
|
|
|
|
|
2016-04-09 16:14:33 +00:00
|
|
|
|
axes = gdk_device_get_axes (device);
|
|
|
|
|
for (i = GDK_AXIS_X; i < GDK_AXIS_LAST; i++)
|
2016-02-25 05:49:17 +00:00
|
|
|
|
{
|
2016-04-09 16:14:33 +00:00
|
|
|
|
if ((axes & (1 << i)) != 0)
|
2016-02-25 05:49:17 +00:00
|
|
|
|
{
|
2016-04-09 16:14:33 +00:00
|
|
|
|
if (str->len > 0)
|
|
|
|
|
g_string_append (str, ", ");
|
|
|
|
|
g_string_append (str, axis_name[i]);
|
2016-02-25 05:49:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (str->len > 0)
|
2020-07-18 04:31:04 +00:00
|
|
|
|
add_label_row (gen, GTK_LIST_BOX (gen->device_box), "Axes", str->str, 20);
|
2016-02-26 01:49:09 +00:00
|
|
|
|
|
|
|
|
|
g_string_free (str, TRUE);
|
2016-02-25 05:49:17 +00:00
|
|
|
|
|
2016-02-25 13:26:34 +00:00
|
|
|
|
g_object_get (device, "num-touches", &n_touches, NULL);
|
|
|
|
|
if (n_touches > 0)
|
|
|
|
|
{
|
|
|
|
|
text = g_strdup_printf ("%d", n_touches);
|
2020-07-18 04:31:04 +00:00
|
|
|
|
add_label_row (gen, GTK_LIST_BOX (gen->device_box), "Touches", text, 20);
|
2016-02-25 13:26:34 +00:00
|
|
|
|
g_free (text);
|
|
|
|
|
}
|
2016-02-25 05:17:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-24 09:46:38 +00:00
|
|
|
|
static char *
|
|
|
|
|
get_seat_capabilities (GdkSeat *seat)
|
2016-02-25 05:17:09 +00:00
|
|
|
|
{
|
|
|
|
|
struct {
|
|
|
|
|
GdkSeatCapabilities cap;
|
|
|
|
|
const char *name;
|
|
|
|
|
} caps[] = {
|
|
|
|
|
{ GDK_SEAT_CAPABILITY_POINTER, "Pointer" },
|
|
|
|
|
{ GDK_SEAT_CAPABILITY_TOUCH, "Touch" },
|
|
|
|
|
{ GDK_SEAT_CAPABILITY_TABLET_STYLUS, "Tablet" },
|
|
|
|
|
{ GDK_SEAT_CAPABILITY_KEYBOARD, "Keyboard" },
|
|
|
|
|
{ 0, NULL }
|
|
|
|
|
};
|
|
|
|
|
GString *str;
|
2016-04-24 09:46:38 +00:00
|
|
|
|
GdkSeatCapabilities capabilities;
|
2016-02-25 05:17:09 +00:00
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
str = g_string_new ("");
|
|
|
|
|
capabilities = gdk_seat_get_capabilities (seat);
|
|
|
|
|
for (i = 0; caps[i].cap != 0; i++)
|
|
|
|
|
{
|
|
|
|
|
if (capabilities & caps[i].cap)
|
|
|
|
|
{
|
|
|
|
|
if (str->len > 0)
|
|
|
|
|
g_string_append (str, ", ");
|
|
|
|
|
g_string_append (str, caps[i].name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-24 09:46:38 +00:00
|
|
|
|
return g_string_free (str, FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
add_seat (GtkInspectorGeneral *gen,
|
|
|
|
|
GdkSeat *seat,
|
|
|
|
|
int num)
|
|
|
|
|
{
|
|
|
|
|
char *text;
|
|
|
|
|
char *caps;
|
|
|
|
|
GList *list, *l;
|
|
|
|
|
|
|
|
|
|
if (!g_object_get_data (G_OBJECT (seat), "inspector-connected"))
|
|
|
|
|
{
|
|
|
|
|
g_object_set_data (G_OBJECT (seat), "inspector-connected", GINT_TO_POINTER (1));
|
|
|
|
|
g_signal_connect_swapped (seat, "device-added", G_CALLBACK (populate_seats), gen);
|
|
|
|
|
g_signal_connect_swapped (seat, "device-removed", G_CALLBACK (populate_seats), gen);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
text = g_strdup_printf ("Seat %d", num);
|
|
|
|
|
caps = get_seat_capabilities (seat);
|
|
|
|
|
|
2020-07-18 04:31:04 +00:00
|
|
|
|
add_label_row (gen, GTK_LIST_BOX (gen->device_box), text, caps, 0);
|
2016-02-26 01:49:09 +00:00
|
|
|
|
g_free (text);
|
2016-04-24 09:46:38 +00:00
|
|
|
|
g_free (caps);
|
2016-02-25 05:17:09 +00:00
|
|
|
|
|
2020-06-18 18:22:20 +00:00
|
|
|
|
list = gdk_seat_get_physical_devices (seat, GDK_SEAT_CAPABILITY_ALL);
|
2016-02-25 05:17:09 +00:00
|
|
|
|
|
|
|
|
|
for (l = list; l; l = l->next)
|
|
|
|
|
add_device (gen, GDK_DEVICE (l->data));
|
|
|
|
|
|
|
|
|
|
g_list_free (list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2016-02-26 01:28:23 +00:00
|
|
|
|
populate_seats (GtkInspectorGeneral *gen)
|
2016-02-25 05:17:09 +00:00
|
|
|
|
{
|
2020-05-08 06:19:18 +00:00
|
|
|
|
GtkWidget *child;
|
2016-02-25 05:17:09 +00:00
|
|
|
|
GList *list, *l;
|
|
|
|
|
int i;
|
|
|
|
|
|
2020-07-18 04:31:04 +00:00
|
|
|
|
while ((child = gtk_widget_get_first_child (gen->device_box)))
|
|
|
|
|
gtk_list_box_remove (GTK_LIST_BOX (gen->device_box), child);
|
2016-02-26 01:28:23 +00:00
|
|
|
|
|
2020-07-18 04:31:04 +00:00
|
|
|
|
list = gdk_display_list_seats (gen->display);
|
2016-02-25 05:17:09 +00:00
|
|
|
|
|
|
|
|
|
for (l = list, i = 0; l; l = l->next, i++)
|
|
|
|
|
add_seat (gen, GDK_SEAT (l->data), i);
|
|
|
|
|
|
|
|
|
|
g_list_free (list);
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-26 01:28:23 +00:00
|
|
|
|
static void
|
|
|
|
|
init_device (GtkInspectorGeneral *gen)
|
|
|
|
|
{
|
2020-07-18 04:31:04 +00:00
|
|
|
|
g_signal_connect_swapped (gen->display, "seat-added", G_CALLBACK (populate_seats), gen);
|
|
|
|
|
g_signal_connect_swapped (gen->display, "seat-removed", G_CALLBACK (populate_seats), gen);
|
2016-02-26 01:28:23 +00:00
|
|
|
|
|
|
|
|
|
populate_seats (gen);
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-15 04:06:43 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_inspector_general_init (GtkInspectorGeneral *gen)
|
|
|
|
|
{
|
|
|
|
|
gtk_widget_init_template (GTK_WIDGET (gen));
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-08 07:16:35 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
keynav_failed (GtkWidget *widget, GtkDirectionType direction, GtkInspectorGeneral *gen)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *next;
|
|
|
|
|
|
2020-07-18 04:31:04 +00:00
|
|
|
|
if (direction == GTK_DIR_DOWN && widget == gen->version_box)
|
|
|
|
|
next = gen->env_box;
|
|
|
|
|
else if (direction == GTK_DIR_DOWN && widget == gen->env_box)
|
|
|
|
|
next = gen->display_box;
|
|
|
|
|
else if (direction == GTK_DIR_DOWN && widget == gen->display_box)
|
|
|
|
|
next = gen->monitor_box;
|
|
|
|
|
else if (direction == GTK_DIR_DOWN && widget == gen->monitor_box)
|
|
|
|
|
next = gen->gl_box;
|
|
|
|
|
else if (direction == GTK_DIR_DOWN && widget == gen->gl_box)
|
|
|
|
|
next = gen->vulkan_box;
|
|
|
|
|
else if (direction == GTK_DIR_DOWN && widget == gen->vulkan_box)
|
|
|
|
|
next = gen->device_box;
|
|
|
|
|
else if (direction == GTK_DIR_UP && widget == gen->device_box)
|
|
|
|
|
next = gen->vulkan_box;
|
|
|
|
|
else if (direction == GTK_DIR_UP && widget == gen->vulkan_box)
|
|
|
|
|
next = gen->gl_box;
|
|
|
|
|
else if (direction == GTK_DIR_UP && widget == gen->gl_box)
|
|
|
|
|
next = gen->monitor_box;
|
|
|
|
|
else if (direction == GTK_DIR_UP && widget == gen->monitor_box)
|
|
|
|
|
next = gen->display_box;
|
|
|
|
|
else if (direction == GTK_DIR_UP && widget == gen->display_box)
|
|
|
|
|
next = gen->env_box;
|
|
|
|
|
else if (direction == GTK_DIR_UP && widget == gen->env_box)
|
|
|
|
|
next = gen->version_box;
|
2014-11-08 07:16:35 +00:00
|
|
|
|
else
|
|
|
|
|
next = NULL;
|
|
|
|
|
|
|
|
|
|
if (next)
|
|
|
|
|
{
|
|
|
|
|
gtk_widget_child_focus (next, direction);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_inspector_general_constructed (GObject *object)
|
|
|
|
|
{
|
|
|
|
|
GtkInspectorGeneral *gen = GTK_INSPECTOR_GENERAL (object);
|
|
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (gtk_inspector_general_parent_class)->constructed (object);
|
|
|
|
|
|
2020-07-18 04:31:04 +00:00
|
|
|
|
g_signal_connect (gen->version_box, "keynav-failed", G_CALLBACK (keynav_failed), gen);
|
|
|
|
|
g_signal_connect (gen->env_box, "keynav-failed", G_CALLBACK (keynav_failed), gen);
|
|
|
|
|
g_signal_connect (gen->display_box, "keynav-failed", G_CALLBACK (keynav_failed), gen);
|
|
|
|
|
g_signal_connect (gen->monitor_box, "keynav-failed", G_CALLBACK (keynav_failed), gen);
|
|
|
|
|
g_signal_connect (gen->gl_box, "keynav-failed", G_CALLBACK (keynav_failed), gen);
|
|
|
|
|
g_signal_connect (gen->vulkan_box, "keynav-failed", G_CALLBACK (keynav_failed), gen);
|
|
|
|
|
g_signal_connect (gen->device_box, "keynav-failed", G_CALLBACK (keynav_failed), gen);
|
2014-11-08 07:16:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-05-28 22:34:47 +00:00
|
|
|
|
static void
|
2020-03-22 14:41:21 +00:00
|
|
|
|
gtk_inspector_general_dispose (GObject *object)
|
2019-05-28 22:34:47 +00:00
|
|
|
|
{
|
2020-03-22 14:41:21 +00:00
|
|
|
|
GtkInspectorGeneral *gen = GTK_INSPECTOR_GENERAL (object);
|
2019-05-28 22:34:47 +00:00
|
|
|
|
|
2020-07-18 04:31:04 +00:00
|
|
|
|
g_clear_pointer (&gen->swin, gtk_widget_unparent);
|
2019-05-28 22:34:47 +00:00
|
|
|
|
|
2020-03-22 14:41:21 +00:00
|
|
|
|
G_OBJECT_CLASS (gtk_inspector_general_parent_class)->dispose (object);
|
2019-05-28 22:34:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-15 04:06:43 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_inspector_general_class_init (GtkInspectorGeneralClass *klass)
|
|
|
|
|
{
|
2014-11-08 07:16:35 +00:00
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2014-05-15 04:06:43 +00:00
|
|
|
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
|
|
|
|
|
2014-11-08 07:16:35 +00:00
|
|
|
|
object_class->constructed = gtk_inspector_general_constructed;
|
2020-03-22 14:41:21 +00:00
|
|
|
|
object_class->dispose = gtk_inspector_general_dispose;
|
2019-05-28 22:34:47 +00:00
|
|
|
|
|
2014-11-30 20:59:53 +00:00
|
|
|
|
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/general.ui");
|
2020-07-18 04:31:04 +00:00
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, swin);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, box);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, version_box);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, env_box);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, display_box);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, monitor_box);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, gl_box);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, vulkan_box);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, gtk_version);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, gdk_backend);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, gsk_renderer);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, pango_fontmap);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, media_backend);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, gl_version);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, gl_vendor);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, vk_device);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, vk_api_version);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, vk_driver_version);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, prefix);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, xdg_data_home);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, xdg_data_dirs);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, gtk_path);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, gtk_exe_prefix);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, gtk_data_prefix);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, gsettings_schema_dir);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, labels);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, display_name);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, display_composited);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, display_rgba);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorGeneral, device_box);
|
2020-03-22 14:41:21 +00:00
|
|
|
|
|
|
|
|
|
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
|
2014-05-15 04:06:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-12-07 17:30:15 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_inspector_general_set_display (GtkInspectorGeneral *gen,
|
|
|
|
|
GdkDisplay *display)
|
|
|
|
|
{
|
2020-07-18 04:31:04 +00:00
|
|
|
|
gen->display = display;
|
2019-12-07 17:30:15 +00:00
|
|
|
|
|
|
|
|
|
init_version (gen);
|
|
|
|
|
init_env (gen);
|
|
|
|
|
init_display (gen);
|
|
|
|
|
init_pango (gen);
|
2020-04-28 04:37:00 +00:00
|
|
|
|
init_media (gen);
|
2019-12-07 17:30:15 +00:00
|
|
|
|
init_gl (gen);
|
|
|
|
|
init_vulkan (gen);
|
|
|
|
|
init_device (gen);
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-15 04:06:43 +00:00
|
|
|
|
// vim: set et sw=2 ts=2:
|