Drop GdkVisual
authorMatthias Clasen <mclasen@redhat.com>
Wed, 1 Nov 2017 02:44:15 +0000 (22:44 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 1 Nov 2017 02:44:15 +0000 (22:44 -0400)
This type was unused except for serving as a parent
for GdkX11Visual. Just move the fields to that type.

15 files changed:
docs/reference/gdk/gdk4-docs.xml
docs/reference/gdk/gdk4-sections.txt
gdk/gdkscreenprivate.h
gdk/gdkvisual.c [deleted file]
gdk/gdkvisual.h [deleted file]
gdk/gdkvisualprivate.h [deleted file]
gdk/gdkwindow.c
gdk/meson.build
gdk/x11/gdkglcontext-x11.c
gdk/x11/gdkglcontext-x11.h
gdk/x11/gdkscreen-x11.h
gdk/x11/gdkvisual-x11.c
gdk/x11/gdkvisual-x11.h [new file with mode: 0644]
gdk/x11/gdkwindow-x11.c
gdk/x11/gdkx11visual.h

index b6e362845c531105134dbc025a9b44f4dcbf0212..a5eb28a9673b310eea989d3ea9a334dad7b0271f 100644 (file)
@@ -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" />
index 532211eb497289ee89cab1d576b3ba08f74b5d9f..8722f6713f5c4980e4c8519c40d75c00b4acc6c2 100644 (file)
@@ -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
@@ -214,34 +213,6 @@ GDK_TYPE_RGBA
 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>
index 3b0735edd6077b84f8475e4824f0bfe427525317..b2f6e64acd558e15443dcad67c4afcfddc39ab83 100644 (file)
@@ -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 (file)
index af57954..0000000
+++ /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 (file)
index 75a29e5..0000000
+++ /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 (file)
index 597221e..0000000
+++ /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
index a1317b727aa933947a9a1ce28f661b6b74e45495..d204462ec4f1face9d3b96c95b3d0bf071733fa7 100644 (file)
@@ -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"
index 02557cc4bdb30931ef7bfbb88079f76bc57ac033..c14a8a692bf00a944d6235588ac26e780adcb415 100644 (file)
@@ -32,7 +32,6 @@ gdk_public_sources = files([
   'gdkseat.c',
   'gdkseatdefault.c',
   'gdkselection.c',
-  'gdkvisual.c',
   'gdkvulkancontext.c',
   'gdkwindow.c',
   'gdkwindowimpl.c',
index 76ea3fcc719db6d076c8ba5c30871ddcacb74c56..7dad7087b078a8dbdfe2da8351a2b903987b0b5c 100644 (file)
@@ -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)
index 192ee9e21fb825ceb591ef2c2f10b2ae6672e095..51fe3c07f1406c4b97563ff4834b9501d70705c0 100644 (file)
@@ -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"
index e40670afe631ffcdfece1ddda3980a04ebf1eaff..4ed6cc90c9299ee9739476a11f8654ceb9f56533 100644 (file)
@@ -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];
index 56654e22261222d7e133cfcf61a1edb1c1d14c8e..ebb54c9c27365592d11b915784e3b7529d5412bb 100644 (file)
 
 #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 (file)
index 0000000..807c577
--- /dev/null
@@ -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
index d080b7a0a7bd1d4213191604fb5beb23d9deb555..8a53341a1bd6414d5e67a305a2775a1b2917e258 100644 (file)
@@ -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"
index 4b67aa21024b6b6df17e1d865ce9152feb764240..55542b8780c75d544b96f2bac0b3749bc6a42b84 100644 (file)
@@ -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