summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2017-10-31 22:44:15 -0400
committerMatthias Clasen <mclasen@redhat.com>2017-10-31 22:44:15 -0400
commit0411cc5620469bfa76006448f87e9cbabdf5e2ad (patch)
tree17e45bb0ddbe9cd597159ee86bfbe983ac4d7e68
parent727aa6cb08f15ee2ee98851b0f4db0cdc44771c1 (diff)
downloadgtk+-0411cc5620469bfa76006448f87e9cbabdf5e2ad.tar.gz
Drop GdkVisual
This type was unused except for serving as a parent for GdkX11Visual. Just move the fields to that type.
-rw-r--r--docs/reference/gdk/gdk4-docs.xml1
-rw-r--r--docs/reference/gdk/gdk4-sections.txt29
-rw-r--r--gdk/gdkscreenprivate.h1
-rw-r--r--gdk/gdkvisual.c245
-rw-r--r--gdk/gdkvisual.h110
-rw-r--r--gdk/gdkvisualprivate.h56
-rw-r--r--gdk/gdkwindow.c1
-rw-r--r--gdk/meson.build1
-rw-r--r--gdk/x11/gdkglcontext-x11.c14
-rw-r--r--gdk/x11/gdkglcontext-x11.h2
-rw-r--r--gdk/x11/gdkscreen-x11.h8
-rw-r--r--gdk/x11/gdkvisual-x11.c27
-rw-r--r--gdk/x11/gdkvisual-x11.h40
-rw-r--r--gdk/x11/gdkwindow-x11.c2
-rw-r--r--gdk/x11/gdkx11visual.h20
15 files changed, 75 insertions, 482 deletions
diff --git a/docs/reference/gdk/gdk4-docs.xml b/docs/reference/gdk/gdk4-docs.xml
index b6e362845c..a5eb28a967 100644
--- a/docs/reference/gdk/gdk4-docs.xml
+++ b/docs/reference/gdk/gdk4-docs.xml
@@ -29,7 +29,6 @@
<xi:include href="xml/regions.xml" />
<xi:include href="xml/pixbufs.xml" />
<xi:include href="xml/rgba_colors.xml" />
- <xi:include href="xml/visuals.xml" />
<xi:include href="xml/cursors.xml" />
<xi:include href="xml/windows.xml" />
<xi:include href="xml/gdkframeclock.xml" />
diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt
index 532211eb49..8722f6713f 100644
--- a/docs/reference/gdk/gdk4-sections.txt
+++ b/docs/reference/gdk/gdk4-sections.txt
@@ -79,7 +79,6 @@ gdk_scroll_direction_get_type
gdk_setting_action_get_type
gdk_status_get_type
gdk_visibility_state_get_type
-gdk_visual_type_get_type
gdk_window_attributes_type_get_type
gdk_window_edge_get_type
gdk_window_hints_get_type
@@ -215,34 +214,6 @@ gdk_rgba_get_type
</SECTION>
<SECTION>
-<TITLE>Visuals</TITLE>
-<FILE>visuals</FILE>
-GdkVisual
-GdkVisualType
-GdkByteOrder
-gdk_visual_get_blue_pixel_details
-gdk_visual_get_depth
-gdk_visual_get_green_pixel_details
-gdk_visual_get_red_pixel_details
-gdk_visual_get_visual_type
-gdk_visual_get_screen
-
-<SUBSECTION Standard>
-GDK_TYPE_BYTE_ORDER
-GDK_TYPE_VISUAL_TYPE
-GDK_TYPE_VISUAL
-GDK_IS_VISUAL
-GDK_IS_VISUAL_CLASS
-GDK_VISUAL
-GDK_VISUAL_CLASS
-GDK_VISUAL_GET_CLASS
-
-<SUBSECTION Private>
-GdkVisualClass
-gdk_visual_get_type
-</SECTION>
-
-<SECTION>
<TITLE>Windows</TITLE>
<FILE>windows</FILE>
GdkWindow
diff --git a/gdk/gdkscreenprivate.h b/gdk/gdkscreenprivate.h
index 3b0735edd6..b2f6e64acd 100644
--- a/gdk/gdkscreenprivate.h
+++ b/gdk/gdkscreenprivate.h
@@ -19,7 +19,6 @@
#define __GDK_SCREEN_PRIVATE_H__
#include "gdkscreen.h"
-#include "gdkvisual.h"
G_BEGIN_DECLS
diff --git a/gdk/gdkvisual.c b/gdk/gdkvisual.c
deleted file mode 100644
index af579546aa..0000000000
--- a/gdk/gdkvisual.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * gdkvisual.c
- *
- * Copyright 2001 Sun Microsystems Inc.
- *
- * Erwann Chenede <erwann.chenede@sun.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "config.h"
-
-#include "gdkvisualprivate.h"
-#include "gdkscreenprivate.h"
-
-
-/**
- * SECTION:visuals
- * @Short_description: Low-level display hardware information
- * @Title: Visuals
- *
- * A #GdkVisual describes a particular video hardware display format.
- * It includes information about the number of bits used for each color,
- * the way the bits are translated into an RGB value for display, and
- * the way the bits are stored in memory. For example, a piece of display
- * hardware might support 24-bit color, 16-bit color, or 8-bit color;
- * meaning 24/16/8-bit pixel sizes. For a given pixel size, pixels can
- * be in different formats; for example the “red” element of an RGB pixel
- * may be in the top 8 bits of the pixel, or may be in the lower 4 bits.
- *
- * There are several standard visuals. The visual returned by
- * gdk_screen_get_system_visual() is the system’s default visual, and
- * the visual returned by gdk_screen_get_rgba_visual() should be used for
- * creating windows with an alpha channel.
- *
- * A number of functions are provided for determining the “best” available
- * visual. For the purposes of making this determination, higher bit depths
- * are considered better, and for visuals of the same bit depth,
- * %GDK_VISUAL_PSEUDO_COLOR is preferred at 8bpp, otherwise, the visual
- * types are ranked in the order of(highest to lowest)
- * %GDK_VISUAL_DIRECT_COLOR, %GDK_VISUAL_TRUE_COLOR,
- * %GDK_VISUAL_PSEUDO_COLOR, %GDK_VISUAL_STATIC_COLOR,
- * %GDK_VISUAL_GRAYSCALE, then %GDK_VISUAL_STATIC_GRAY.
- */
-
-G_DEFINE_TYPE (GdkVisual, gdk_visual, G_TYPE_OBJECT)
-
-static void
-gdk_visual_init (GdkVisual *visual)
-{
-}
-
-static void
-gdk_visual_finalize (GObject *object)
-{
- G_OBJECT_CLASS (gdk_visual_parent_class)->finalize (object);
-}
-
-static void
-gdk_visual_class_init (GdkVisualClass *visual_class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (visual_class);
-
- object_class->finalize = gdk_visual_finalize;
-}
-
-/**
- * gdk_visual_get_visual_type:
- * @visual: A #GdkVisual.
- *
- * Returns the type of visual this is (PseudoColor, TrueColor, etc).
- *
- * Returns: A #GdkVisualType stating the type of @visual.
- *
- * Since: 2.22
- */
-GdkVisualType
-gdk_visual_get_visual_type (GdkVisual *visual)
-{
- g_return_val_if_fail (GDK_IS_VISUAL (visual), 0);
-
- return visual->type;
-}
-
-/**
- * gdk_visual_get_depth:
- * @visual: A #GdkVisual.
- *
- * Returns the bit depth of this visual.
- *
- * Returns: The bit depth of this visual.
- *
- * Since: 2.22
- */
-gint
-gdk_visual_get_depth (GdkVisual *visual)
-{
- g_return_val_if_fail (GDK_IS_VISUAL (visual), 0);
-
- return visual->depth;
-}
-
-static void
-gdk_visual_get_pixel_details (GdkVisual *visual,
- gulong pixel_mask,
- guint32 *mask,
- gint *shift,
- gint *precision)
-{
- gulong m = 0;
- gint s = 0;
- gint p = 0;
-
- if (pixel_mask != 0)
- {
- m = pixel_mask;
- while (!(m & 0x1))
- {
- s++;
- m >>= 1;
- }
-
- while (m & 0x1)
- {
- p++;
- m >>= 1;
- }
- }
-
- if (mask)
- *mask = pixel_mask;
-
- if (shift)
- *shift = s;
-
- if (precision)
- *precision = p;
-}
-
-/**
- * gdk_visual_get_red_pixel_details:
- * @visual: A #GdkVisual
- * @mask: (out) (allow-none): A pointer to a #guint32 to be filled in, or %NULL
- * @shift: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL
- * @precision: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL
- *
- * Obtains values that are needed to calculate red pixel values in TrueColor
- * and DirectColor. The “mask” is the significant bits within the pixel.
- * The “shift” is the number of bits left we must shift a primary for it
- * to be in position (according to the "mask"). Finally, "precision" refers
- * to how much precision the pixel value contains for a particular primary.
- *
- * Since: 2.22
- */
-void
-gdk_visual_get_red_pixel_details (GdkVisual *visual,
- guint32 *mask,
- gint *shift,
- gint *precision)
-{
- g_return_if_fail (GDK_IS_VISUAL (visual));
-
- gdk_visual_get_pixel_details (visual, visual->red_mask, mask, shift, precision);
-}
-
-/**
- * gdk_visual_get_green_pixel_details:
- * @visual: a #GdkVisual
- * @mask: (out) (allow-none): A pointer to a #guint32 to be filled in, or %NULL
- * @shift: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL
- * @precision: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL
- *
- * Obtains values that are needed to calculate green pixel values in TrueColor
- * and DirectColor. The “mask” is the significant bits within the pixel.
- * The “shift” is the number of bits left we must shift a primary for it
- * to be in position (according to the "mask"). Finally, "precision" refers
- * to how much precision the pixel value contains for a particular primary.
- *
- * Since: 2.22
- */
-void
-gdk_visual_get_green_pixel_details (GdkVisual *visual,
- guint32 *mask,
- gint *shift,
- gint *precision)
-{
- g_return_if_fail (GDK_IS_VISUAL (visual));
-
- gdk_visual_get_pixel_details (visual, visual->green_mask, mask, shift, precision);
-}
-
-/**
- * gdk_visual_get_blue_pixel_details:
- * @visual: a #GdkVisual
- * @mask: (out) (allow-none): A pointer to a #guint32 to be filled in, or %NULL
- * @shift: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL
- * @precision: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL
- *
- * Obtains values that are needed to calculate blue pixel values in TrueColor
- * and DirectColor. The “mask” is the significant bits within the pixel.
- * The “shift” is the number of bits left we must shift a primary for it
- * to be in position (according to the "mask"). Finally, "precision" refers
- * to how much precision the pixel value contains for a particular primary.
- *
- * Since: 2.22
- */
-void
-gdk_visual_get_blue_pixel_details (GdkVisual *visual,
- guint32 *mask,
- gint *shift,
- gint *precision)
-{
- g_return_if_fail (GDK_IS_VISUAL (visual));
-
- gdk_visual_get_pixel_details (visual, visual->blue_mask, mask, shift, precision);
-}
-
-/**
- * gdk_visual_get_screen:
- * @visual: a #GdkVisual
- *
- * Gets the screen to which this visual belongs
- *
- * Returns: (transfer none): the screen to which this visual belongs.
- *
- * Since: 2.2
- */
-GdkScreen *
-gdk_visual_get_screen (GdkVisual *visual)
-{
- g_return_val_if_fail (GDK_IS_VISUAL (visual), NULL);
-
- return visual->screen;
-}
diff --git a/gdk/gdkvisual.h b/gdk/gdkvisual.h
deleted file mode 100644
index 75a29e5402..0000000000
--- a/gdk/gdkvisual.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * 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/>.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#ifndef __GDK_VISUAL_H__
-#define __GDK_VISUAL_H__
-
-#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
-#error "Only <gdk/gdk.h> can be included directly."
-#endif
-
-#include <gdk/gdktypes.h>
-#include <gdk/gdkversionmacros.h>
-
-G_BEGIN_DECLS
-
-#define GDK_TYPE_VISUAL (gdk_visual_get_type ())
-#define GDK_VISUAL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_VISUAL, GdkVisual))
-#define GDK_IS_VISUAL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_VISUAL))
-
-/**
- * GdkVisualType:
- * @GDK_VISUAL_STATIC_GRAY: Each pixel value indexes a grayscale value
- * directly.
- * @GDK_VISUAL_GRAYSCALE: Each pixel is an index into a color map that
- * maps pixel values into grayscale values. The color map can be
- * changed by an application.
- * @GDK_VISUAL_STATIC_COLOR: Each pixel value is an index into a predefined,
- * unmodifiable color map that maps pixel values into RGB values.
- * @GDK_VISUAL_PSEUDO_COLOR: Each pixel is an index into a color map that
- * maps pixel values into rgb values. The color map can be changed by
- * an application.
- * @GDK_VISUAL_TRUE_COLOR: Each pixel value directly contains red, green,
- * and blue components. Use gdk_visual_get_red_pixel_details(), etc,
- * to obtain information about how the components are assembled into
- * a pixel value.
- * @GDK_VISUAL_DIRECT_COLOR: Each pixel value contains red, green, and blue
- * components as for %GDK_VISUAL_TRUE_COLOR, but the components are
- * mapped via a color table into the final output table instead of
- * being converted directly.
- *
- * A set of values that describe the manner in which the pixel values
- * for a visual are converted into RGB values for display.
- */
-typedef enum
-{
- GDK_VISUAL_STATIC_GRAY,
- GDK_VISUAL_GRAYSCALE,
- GDK_VISUAL_STATIC_COLOR,
- GDK_VISUAL_PSEUDO_COLOR,
- GDK_VISUAL_TRUE_COLOR,
- GDK_VISUAL_DIRECT_COLOR
-} GdkVisualType;
-
-/**
- * GdkVisual:
- *
- * A #GdkVisual contains information about
- * a particular visual.
- */
-
-GDK_AVAILABLE_IN_ALL
-GType gdk_visual_get_type (void) G_GNUC_CONST;
-
-GDK_AVAILABLE_IN_ALL
-GdkScreen *gdk_visual_get_screen (GdkVisual *visual);
-
-GDK_AVAILABLE_IN_ALL
-GdkVisualType gdk_visual_get_visual_type (GdkVisual *visual);
-GDK_AVAILABLE_IN_ALL
-gint gdk_visual_get_depth (GdkVisual *visual);
-GDK_AVAILABLE_IN_ALL
-void gdk_visual_get_red_pixel_details (GdkVisual *visual,
- guint32 *mask,
- gint *shift,
- gint *precision);
-GDK_AVAILABLE_IN_ALL
-void gdk_visual_get_green_pixel_details (GdkVisual *visual,
- guint32 *mask,
- gint *shift,
- gint *precision);
-GDK_AVAILABLE_IN_ALL
-void gdk_visual_get_blue_pixel_details (GdkVisual *visual,
- guint32 *mask,
- gint *shift,
- gint *precision);
-
-G_END_DECLS
-
-#endif /* __GDK_VISUAL_H__ */
diff --git a/gdk/gdkvisualprivate.h b/gdk/gdkvisualprivate.h
deleted file mode 100644
index 597221ede8..0000000000
--- a/gdk/gdkvisualprivate.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 2010 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/>.
- */
-
-#ifndef __GDK_VISUAL_PRIVATE_H__
-#define __GDK_VISUAL_PRIVATE_H__
-
-#include "gdkvisual.h"
-
-G_BEGIN_DECLS
-
-#define GDK_VISUAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_VISUAL, GdkVisualClass))
-#define GDK_IS_VISUAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_VISUAL))
-#define GDK_VISUAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_VISUAL, GdkVisualClass))
-
-typedef struct _GdkVisualClass GdkVisualClass;
-
-struct _GdkVisual
-{
- GObject parent_instance;
-
- /*< private >*/
- GdkVisualType type;
- gint depth;
- GdkByteOrder byte_order;
- gint colormap_size;
- gint bits_per_rgb;
-
- guint32 red_mask;
- guint32 green_mask;
- guint32 blue_mask;
-
- GdkScreen *screen;
-};
-
-struct _GdkVisualClass
-{
- GObjectClass parent_class;
-};
-
-G_END_DECLS
-
-#endif
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index a1317b727a..d204462ec4 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -35,7 +35,6 @@
#include "gdkscreenprivate.h"
#include "gdkdisplayprivate.h"
#include "gdkdeviceprivate.h"
-#include "gdkvisualprivate.h"
#include "gdkmarshalers.h"
#include "gdkframeclockidle.h"
#include "gdkwindowimpl.h"
diff --git a/gdk/meson.build b/gdk/meson.build
index 02557cc4bd..c14a8a692b 100644
--- a/gdk/meson.build
+++ b/gdk/meson.build
@@ -32,7 +32,6 @@ gdk_public_sources = files([
'gdkseat.c',
'gdkseatdefault.c',
'gdkselection.c',
- 'gdkvisual.c',
'gdkvulkancontext.c',
'gdkwindow.c',
'gdkwindowimpl.c',
diff --git a/gdk/x11/gdkglcontext-x11.c b/gdk/x11/gdkglcontext-x11.c
index 76ea3fcc71..7dad7087b0 100644
--- a/gdk/x11/gdkglcontext-x11.c
+++ b/gdk/x11/gdkglcontext-x11.c
@@ -30,7 +30,7 @@
#include "gdkx11screen.h"
#include "gdkx11window.h"
#include "gdkx11visual.h"
-#include "gdkvisualprivate.h"
+#include "gdkvisual-x11.h"
#include "gdkx11property.h"
#include <X11/Xatom.h>
@@ -956,7 +956,7 @@ struct glvisualinfo {
};
static gboolean
-visual_compatible (const GdkVisual *a, const GdkVisual *b)
+visual_compatible (const GdkX11Visual *a, const GdkX11Visual *b)
{
return a->type == b->type &&
a->depth == b->depth &&
@@ -968,7 +968,7 @@ visual_compatible (const GdkVisual *a, const GdkVisual *b)
}
static gboolean
-visual_is_rgba (const GdkVisual *visual)
+visual_is_rgba (const GdkX11Visual *visual)
{
return
visual->depth == 32 &&
@@ -979,12 +979,12 @@ visual_is_rgba (const GdkVisual *visual)
/* This picks a compatible (as in has the same X visual details) visual
that has "better" characteristics on the GL side */
-static GdkVisual *
+static GdkX11Visual *
pick_better_visual_for_gl (GdkX11Screen *x11_screen,
struct glvisualinfo *gl_info,
- GdkVisual *compatible)
+ GdkX11Visual *compatible)
{
- GdkVisual *visual;
+ GdkX11Visual *visual;
int i;
gboolean want_alpha = visual_is_rgba (compatible);
@@ -1138,7 +1138,7 @@ _gdk_x11_screen_update_visuals_for_gl (GdkScreen *screen)
{
for (i = 0; i < x11_screen->nvisuals; i++)
{
- GdkVisual *visual = x11_screen->visuals[i];
+ GdkX11Visual *visual = x11_screen->visuals[i];
int visual_id = gdk_x11_visual_get_xvisual (visual)->visualid;
if (visual_id == system_visual_id)
diff --git a/gdk/x11/gdkglcontext-x11.h b/gdk/x11/gdkglcontext-x11.h
index 192ee9e21f..51fe3c07f1 100644
--- a/gdk/x11/gdkglcontext-x11.h
+++ b/gdk/x11/gdkglcontext-x11.h
@@ -29,7 +29,7 @@
#include "gdkglcontextprivate.h"
#include "gdkdisplayprivate.h"
-#include "gdkvisual.h"
+#include "gdkx11visual.h"
#include "gdkwindow.h"
#include "gdkinternals.h"
#include "gdkmain.h"
diff --git a/gdk/x11/gdkscreen-x11.h b/gdk/x11/gdkscreen-x11.h
index e40670afe6..4ed6cc90c9 100644
--- a/gdk/x11/gdkscreen-x11.h
+++ b/gdk/x11/gdkscreen-x11.h
@@ -24,7 +24,7 @@
#include "gdkscreenprivate.h"
#include "gdkx11screen.h"
-#include "gdkvisual.h"
+#include "gdkx11visual.h"
#include <X11/X.h>
#include <X11/Xlib.h>
@@ -77,13 +77,13 @@ struct _GdkX11Screen
/* Visual Part */
gint nvisuals;
- GdkVisual **visuals;
- GdkVisual *system_visual;
+ GdkX11Visual **visuals;
+ GdkX11Visual *system_visual;
gint available_depths[7];
GdkVisualType available_types[6];
gint16 navailable_depths;
gint16 navailable_types;
- GdkVisual *rgba_visual;
+ GdkX11Visual *rgba_visual;
/* cache for window->translate vfunc */
GC subwindow_gcs[32];
diff --git a/gdk/x11/gdkvisual-x11.c b/gdk/x11/gdkvisual-x11.c
index 56654e2226..ebb54c9c27 100644
--- a/gdk/x11/gdkvisual-x11.c
+++ b/gdk/x11/gdkvisual-x11.c
@@ -24,26 +24,19 @@
#include "config.h"
-#include "gdkvisualprivate.h"
#include "gdkprivate-x11.h"
#include "gdkscreen-x11.h"
+#include "gdkvisual-x11.h"
#include <X11/Xlib.h>
#include <X11/Xutil.h>
-struct _GdkX11Visual
-{
- GdkVisual visual;
-
- Visual *xvisual;
-};
-
struct _GdkX11VisualClass
{
- GdkVisualClass visual_class;
+ GObjectClass parent_class;
};
-G_DEFINE_TYPE (GdkX11Visual, gdk_x11_visual, GDK_TYPE_VISUAL)
+G_DEFINE_TYPE (GdkX11Visual, gdk_x11_visual, G_TYPE_OBJECT)
static void
gdk_x11_visual_init (GdkX11Visual *x11_visual)
@@ -73,9 +66,9 @@ _gdk_x11_screen_init_visuals (GdkScreen *screen,
GdkX11Screen *x11_screen;
XVisualInfo *visual_list;
XVisualInfo visual_template;
- GdkVisual *temp_visual;
+ GdkX11Visual *temp_visual;
Visual *default_xvisual;
- GdkVisual **visuals;
+ GdkX11Visual **visuals;
int nxvisuals;
int nvisuals;
int i, j;
@@ -87,7 +80,7 @@ _gdk_x11_screen_init_visuals (GdkScreen *screen,
visual_template.screen = x11_screen->screen_num;
visual_list = XGetVisualInfo (x11_screen->xdisplay, VisualScreenMask, &visual_template, &nxvisuals);
- visuals = g_new (GdkVisual *, nxvisuals);
+ visuals = g_new (GdkX11Visual *, nxvisuals);
for (i = 0; i < nxvisuals; i++)
visuals[i] = g_object_new (GDK_TYPE_X11_VISUAL, NULL);
@@ -96,8 +89,6 @@ _gdk_x11_screen_init_visuals (GdkScreen *screen,
nvisuals = 0;
for (i = 0; i < nxvisuals; i++)
{
- visuals[nvisuals]->screen = screen;
-
if (visual_list[i].depth >= 1)
{
#ifdef __cplusplus
@@ -306,7 +297,7 @@ _gdk_x11_screen_init_visuals (GdkScreen *screen,
*
* Since: 2.2
*/
-GdkVisual *
+GdkX11Visual *
gdk_x11_screen_lookup_visual (GdkScreen *screen,
VisualID xvisualid)
{
@@ -331,9 +322,9 @@ gdk_x11_screen_lookup_visual (GdkScreen *screen,
* Returns: (transfer none): an Xlib Visual*.
**/
Visual *
-gdk_x11_visual_get_xvisual (GdkVisual *visual)
+gdk_x11_visual_get_xvisual (GdkX11Visual *visual)
{
- g_return_val_if_fail (GDK_IS_VISUAL (visual), NULL);
+ g_return_val_if_fail (GDK_IS_X11_VISUAL (visual), NULL);
return GDK_X11_VISUAL (visual)->xvisual;
}
diff --git a/gdk/x11/gdkvisual-x11.h b/gdk/x11/gdkvisual-x11.h
new file mode 100644
index 0000000000..807c577946
--- /dev/null
+++ b/gdk/x11/gdkvisual-x11.h
@@ -0,0 +1,40 @@
+/*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GDK_X11_VISUAL__
+#define __GDK_X11_VISUAL__
+
+G_BEGIN_DECLS
+
+struct _GdkX11Visual
+{
+ GObject parent_instance;
+
+ GdkVisualType type;
+ gint depth;
+ GdkByteOrder byte_order;
+ gint colormap_size;
+ gint bits_per_rgb;
+
+ guint32 red_mask;
+ guint32 green_mask;
+ guint32 blue_mask;
+
+ Visual *xvisual;
+};
+
+G_END_DECLS
+
+#endif
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index d080b7a0a7..8a53341a1b 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -29,7 +29,7 @@
#include "gdkwindow.h"
#include "gdkwindowimpl.h"
-#include "gdkvisualprivate.h"
+#include "gdkvisual-x11.h"
#include "gdkinternals.h"
#include "gdkdeviceprivate.h"
#include "gdkframeclockprivate.h"
diff --git a/gdk/x11/gdkx11visual.h b/gdk/x11/gdkx11visual.h
index 4b67aa2102..55542b8780 100644
--- a/gdk/x11/gdkx11visual.h
+++ b/gdk/x11/gdkx11visual.h
@@ -43,24 +43,30 @@ G_BEGIN_DECLS
#define GDK_IS_X11_VISUAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_X11_VISUAL))
#define GDK_X11_VISUAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_X11_VISUAL, GdkX11VisualClass))
-#ifdef GDK_COMPILATION
typedef struct _GdkX11Visual GdkX11Visual;
-#else
-typedef GdkVisual GdkX11Visual;
-#endif
typedef struct _GdkX11VisualClass GdkX11VisualClass;
+typedef enum
+{
+ GDK_VISUAL_STATIC_GRAY,
+ GDK_VISUAL_GRAYSCALE,
+ GDK_VISUAL_STATIC_COLOR,
+ GDK_VISUAL_PSEUDO_COLOR,
+ GDK_VISUAL_TRUE_COLOR,
+ GDK_VISUAL_DIRECT_COLOR
+} GdkVisualType;
+
GDK_AVAILABLE_IN_ALL
GType gdk_x11_visual_get_type (void);
GDK_AVAILABLE_IN_ALL
-Visual * gdk_x11_visual_get_xvisual (GdkVisual *visual);
+Visual * gdk_x11_visual_get_xvisual (GdkX11Visual *visual);
#define GDK_VISUAL_XVISUAL(visual) (gdk_x11_visual_get_xvisual (visual))
GDK_AVAILABLE_IN_ALL
-GdkVisual* gdk_x11_screen_lookup_visual (GdkScreen *screen,
- VisualID xvisualid);
+GdkX11Visual* gdk_x11_screen_lookup_visual (GdkScreen *screen,
+ VisualID xvisualid);
G_END_DECLS