[gtk+] Drop GdkVisual
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Drop GdkVisual
- Date: Wed, 1 Nov 2017 02:56:42 +0000 (UTC)
commit 0411cc5620469bfa76006448f87e9cbabdf5e2ad
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Oct 31 22:44:15 2017 -0400
Drop GdkVisual
This type was unused except for serving as a parent
for GdkX11Visual. Just move the fields to that type.
docs/reference/gdk/gdk4-docs.xml | 1 -
docs/reference/gdk/gdk4-sections.txt | 29 ----
gdk/gdkscreenprivate.h | 1 -
gdk/gdkvisual.c | 245 ----------------------------------
gdk/gdkvisual.h | 110 ---------------
gdk/gdkvisualprivate.h | 56 --------
gdk/gdkwindow.c | 1 -
gdk/meson.build | 1 -
gdk/x11/gdkglcontext-x11.c | 14 +-
gdk/x11/gdkglcontext-x11.h | 2 +-
gdk/x11/gdkscreen-x11.h | 8 +-
gdk/x11/gdkvisual-x11.c | 27 ++---
gdk/x11/gdkvisual-x11.h | 40 ++++++
gdk/x11/gdkwindow-x11.c | 2 +-
gdk/x11/gdkx11visual.h | 20 ++-
15 files changed, 75 insertions(+), 482 deletions(-)
---
diff --git a/docs/reference/gdk/gdk4-docs.xml b/docs/reference/gdk/gdk4-docs.xml
index b6e3628..a5eb28a 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 532211e..8722f67 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 3b0735e..b2f6e64 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/gdkwindow.c b/gdk/gdkwindow.c
index a1317b7..d204462 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 02557cc..c14a8a6 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 76ea3fc..7dad708 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 192ee9e..51fe3c0 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 e40670a..4ed6cc9 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 56654e2..ebb54c9 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 0000000..807c577
--- /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 d080b7a..8a53341 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 4b67aa2..55542b8 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]