Merge branch 'wip/ebassi/gen-version-macros' into 'main'

Generate version and deprecation macros at build time

See merge request GNOME/gtk!5945
This commit is contained in:
Matthias Clasen 2023-05-09 18:23:40 +00:00
commit 91ca6d0851
71 changed files with 431 additions and 463 deletions

View File

@ -0,0 +1,201 @@
#!/usr/bin/env python3
#
# SPDX-FileCopyrightText: 2022 Collabora Inc.
# 2023 Emmanuele Bassi
#
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# Original author: Xavier Claessens <xclaesse@gmail.com>
import argparse
import textwrap
from pathlib import Path
# Disable line length warnings as wrapping the C code templates would be hard
# flake8: noqa: E501
def gen_versions_macros(args, current_major_version, current_minor_version, current_micro_version):
with args.out_path.open("w", encoding="utf-8") as ofile, args.in_path.open(
"r", encoding="utf-8"
) as ifile:
for line in ifile.readlines():
if "@GDK_VERSIONS@" in line:
ofile.write(
textwrap.dedent(
f"""\
/**
* GDK_MAJOR_VERSION:
*
* The major version component of the library's version, e.g. "1" for "1.2.3".
*/
#define GDK_MAJOR_VERSION ({current_major_version})
/**
* GDK_MINOR_VERSION:
*
* The minor version component of the library's version, e.g. "2" for "1.2.3".
*/
#define GDK_MINOR_VERSION ({current_minor_version})
/**
* GDK_MICRO_VERSION:
*
* The micro version component of the library's version, e.g. "3" for "1.2.3".
*/
#define GDK_MICRO_VERSION ({current_micro_version})
"""
)
)
for minor in range(0, current_minor_version + 2, 2):
ofile.write(
textwrap.dedent(
f"""\
/**
* GDK_VERSION_{current_major_version}_{minor}:
*
* A macro that evaluates to the {current_major_version}.{minor} version of GTK, in a format
* that can be used by the C pre-processor.
*
* Since: {current_major_version}.{minor}
*/
#define GDK_VERSION_{current_major_version}_{minor} (G_ENCODE_VERSION ({current_major_version}, {minor}))
"""
)
)
else:
ofile.write(line)
def gen_visibility_macros(args, current_major_version, current_minor_version, current_micro_version):
"""
Generates a set of macros for each minor stable version of GTK
- GDK_DEPRECATED
- GDK_DEPRECATED_IN_
- GDK_DEPRECATED_MACRO_IN_
- GDK_DEPRECATED_ENUMERATOR_IN_
- GDK_DEPRECATED_TYPE_IN_
- GDK_AVAILABLE_IN_ALL
- GDK_AVAILABLE_IN_
- GDK_AVAILABLE_STATIC_INLINE_IN_
- GDK_AVAILABLE_MACRO_IN_
- GDK_AVAILABLE_ENUMERATOR_IN_
- GDK_AVAILABLE_TYPE_IN_
- GDK_UNAVAILABLE(maj,min)
- GDK_UNAVAILABLE_STATIC_INLINE(maj,min)
"""
ns = args.namespace
with args.out_path.open("w", encoding="utf-8") as f:
f.write(
textwrap.dedent(
f"""\
#pragma once
#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined({ns}_STATIC_COMPILATION)
# define _{ns}_EXPORT __declspec(dllexport)
# define _{ns}_IMPORT __declspec(dllimport)
#elif __GNUC__ >= 4
# define _{ns}_EXPORT __attribute__((visibility("default")))
# define _{ns}_IMPORT
#else
# define _{ns}_EXPORT
# define _{ns}_IMPORT
#endif
#ifdef GTK_COMPILATION
# define _{ns}_API _{ns}_EXPORT
#else
# define _{ns}_API _{ns}_IMPORT
#endif
#define _{ns}_EXTERN _{ns}_API extern
#define {ns}_VAR _{ns}_EXTERN
#define {ns}_AVAILABLE_IN_ALL _{ns}_EXTERN
#ifdef GDK_DISABLE_DEPRECATION_WARNINGS
#define {ns}_DEPRECATED _{ns}_EXTERN
#define {ns}_DEPRECATED_FOR(f) _{ns}_EXTERN
#define {ns}_UNAVAILABLE(maj,min) _{ns}_EXTERN
#define {ns}_UNAVAILABLE_STATIC_INLINE(maj,min)
#else
#define {ns}_DEPRECATED G_DEPRECATED _{ns}_EXTERN
#define {ns}_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _{ns}_EXTERN
#define {ns}_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _{ns}_EXTERN
#define {ns}_UNAVAILABLE_STATIC_INLINE(maj,min) G_UNAVAILABLE(maj,min)
#endif
"""
)
)
for minor in range(0, current_minor_version + 2, 2):
f.write(
textwrap.dedent(
f"""
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_{minor}
#define {ns}_DEPRECATED_IN_{current_major_version}_{minor} {ns}_DEPRECATED
#define {ns}_DEPRECATED_IN_{current_major_version}_{minor}_FOR(f) {ns}_DEPRECATED_FOR (f)
#define {ns}_DEPRECATED_MACRO_IN_{current_major_version}_{minor} GDK_DEPRECATED_MACRO
#define {ns}_DEPRECATED_MACRO_IN_{current_major_version}_{minor}_FOR(f) GDK_DEPRECATED_MACRO_FOR (f)
#define {ns}_DEPRECATED_ENUMERATOR_IN_{current_major_version}_{minor} GDK_DEPRECATED_ENUMERATOR
#define {ns}_DEPRECATED_ENUMERATOR_IN_{current_major_version}_{minor}_FOR(f) GDK_DEPRECATED_ENUMERATOR_FOR (f)
#define {ns}_DEPRECATED_TYPE_IN_{current_major_version}_{minor} GDK_DEPRECATED_TYPE
#define {ns}_DEPRECATED_TYPE_IN_{current_major_version}_{minor}_FOR(f) GDK_DEPRECATED_TYPE_FOR (f)
#else
#define {ns}_DEPRECATED_IN_{current_major_version}_{minor} _{ns}_EXTERN
#define {ns}_DEPRECATED_IN_{current_major_version}_{minor}_FOR(f) _{ns}_EXTERN
#define {ns}_DEPRECATED_MACRO_IN_{current_major_version}_{minor}
#define {ns}_DEPRECATED_MACRO_IN_{current_major_version}_{minor}_FOR(f)
#define {ns}_DEPRECATED_ENUMERATOR_IN_{current_major_version}_{minor}
#define {ns}_DEPRECATED_ENUMERATOR_IN_{current_major_version}_{minor}_FOR(f)
#define {ns}_DEPRECATED_TYPE_IN_{current_major_version}_{minor}
#define {ns}_DEPRECATED_TYPE_IN_{current_major_version}_{minor}_FOR(f)
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_{current_major_version}_{minor}
#define {ns}_AVAILABLE_IN_{current_major_version}_{minor} {ns}_UNAVAILABLE ({current_major_version}, {minor})
#define {ns}_AVAILABLE_STATIC_INLINE_IN_{current_major_version}_{minor} GDK_UNAVAILABLE_STATIC_INLINE ({current_major_version}, {minor})
#define {ns}_AVAILABLE_MACRO_IN_{current_major_version}_{minor} GDK_UNAVAILABLE_MACRO ({current_major_version}, {minor})
#define {ns}_AVAILABLE_ENUMERATOR_IN_{current_major_version}_{minor} GDK_UNAVAILABLE_ENUMERATOR ({current_major_version}, {minor})
#define {ns}_AVAILABLE_TYPE_IN_{current_major_version}_{minor} GDK_UNAVAILABLE_TYPE ({current_major_version}, {minor})
#else
#define {ns}_AVAILABLE_IN_{current_major_version}_{minor} _{ns}_EXTERN
#define {ns}_AVAILABLE_STATIC_INLINE_IN_{current_major_version}_{minor}
#define {ns}_AVAILABLE_MACRO_IN_{current_major_version}_{minor}
#define {ns}_AVAILABLE_ENUMERATOR_IN_{current_major_version}_{minor}
#define {ns}_AVAILABLE_TYPE_IN_{current_major_version}_{minor}
#endif
"""
)
)
def main():
parser = argparse.ArgumentParser()
parser.add_argument("gtk_version", help="Current GLib version")
subparsers = parser.add_subparsers()
versions_parser = subparsers.add_parser(
"versions-macros", help="Generate versions macros"
)
versions_parser.add_argument("in_path", help="input file", type=Path)
versions_parser.add_argument("out_path", help="output file", type=Path)
versions_parser.set_defaults(func=gen_versions_macros)
visibility_parser = subparsers.add_parser(
"visibility-macros", help="Generate visibility macros"
)
visibility_parser.add_argument("namespace", help="Macro namespace")
visibility_parser.add_argument("out_path", help="output file", type=Path)
visibility_parser.set_defaults(func=gen_visibility_macros)
args = parser.parse_args()
version = [int(i) for i in args.gtk_version.split(".")]
args.func(args, version[0], version[1], version[2])
if __name__ == "__main__":
main()

View File

@ -51,15 +51,11 @@ struct _BlurOverlayClass
GtkAllocation *allocation);
};
GDK_AVAILABLE_IN_ALL
GType blur_overlay_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GtkWidget *blur_overlay_new (void);
GDK_AVAILABLE_IN_ALL
void blur_overlay_add_overlay (BlurOverlay *overlay,
GtkWidget *widget,
double blur);
GDK_AVAILABLE_IN_ALL
void blur_overlay_set_child (BlurOverlay *overlay,
GtkWidget *widget);

View File

@ -27,24 +27,17 @@ G_BEGIN_DECLS
#define GSK_TYPE_SHADER_PAINTABLE (gsk_shader_paintable_get_type ())
GDK_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (GskShaderPaintable, gsk_shader_paintable, GSK, SHADER_PAINTABLE, GObject)
GDK_AVAILABLE_IN_ALL
GdkPaintable * gsk_shader_paintable_new (GskGLShader *shader,
GBytes *data);
GDK_AVAILABLE_IN_ALL
GskGLShader * gsk_shader_paintable_get_shader (GskShaderPaintable *self);
GDK_AVAILABLE_IN_ALL
void gsk_shader_paintable_set_shader (GskShaderPaintable *self,
GskGLShader *shader);
GDK_AVAILABLE_IN_ALL
GBytes * gsk_shader_paintable_get_args (GskShaderPaintable *self);
GDK_AVAILABLE_IN_ALL
void gsk_shader_paintable_set_args (GskShaderPaintable *self,
GBytes *data);
GDK_AVAILABLE_IN_ALL
void gsk_shader_paintable_update_time (GskShaderPaintable *self,
int time_idx,
gint64 frame_time);

View File

@ -235,8 +235,7 @@ endif
demo_cflags = []
foreach flag: common_cflags
if flag not in ['-Werror=missing-prototypes', '-Wmissing-prototypes',
'-Werror=missing-declarations', '-Wmissing-declarations',
'-fvisibility=hidden']
'-Werror=missing-declarations', '-Wmissing-declarations']
demo_cflags += flag
endif
endforeach

View File

@ -24,7 +24,7 @@
#include "config.h"
#include "gdkversionmacros.h"
#include "version/gdkversionmacros.h"
#include "gdkresources.h"

View File

@ -75,7 +75,7 @@
#include <gdk/gdktoplevellayout.h>
#include <gdk/gdktoplevelsize.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
#include <gdk/version/gdkversionmacros.h>
#include <gdk/gdkvulkancontext.h>
#undef __GDK_H_INSIDE__

View File

@ -24,7 +24,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@ -1,5 +1,5 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2005 Red Hat, Inc.
* Copyright (C) 2005 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
@ -19,6 +19,9 @@
#include "gdkcairoprivate.h"
#include "gdkrgba.h"
#include "gdktexture.h"
#include <math.h>
/**

View File

@ -1,5 +1,5 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2005 Red Hat, Inc.
* Copyright (C) 2005 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
@ -21,8 +21,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdkrgba.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkpixbuf.h>
#include <pango/pangocairo.h>

View File

@ -24,11 +24,8 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <cairo.h>
G_BEGIN_DECLS
#define GDK_TYPE_CAIRO_CONTEXT (gdk_cairo_context_get_type ())

View File

@ -22,10 +22,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <gio/gio.h>
G_BEGIN_DECLS

View File

@ -21,8 +21,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@ -21,8 +21,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@ -22,10 +22,8 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS
#define GDK_TYPE_CONTENT_PROVIDER (gdk_content_provider_get_type ())

View File

@ -22,7 +22,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@ -21,8 +21,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@ -28,7 +28,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@ -21,12 +21,10 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkdevicetool.h>
#include <gdk/gdkenums.h>
G_BEGIN_DECLS
#define GDK_TYPE_DEVICE (gdk_device_get_type ())

View File

@ -23,7 +23,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@ -21,10 +21,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@ -1,7 +1,7 @@
/* GDK - The GIMP Drawing Kit
* gdkdisplay.c
*
* Copyright 2001 Sun Microsystems Inc.
*
* Copyright 2001 Sun Microsystems Inc.
*
* Erwann Chenede <erwann.chenede@sun.com>
*
@ -31,10 +31,11 @@
#include "gdkclipboardprivate.h"
#include "gdkdeviceprivate.h"
#include "gdkdisplaymanagerprivate.h"
#include "gdkframeclockidleprivate.h"
#include "gdkeventsprivate.h"
#include "gdkframeclockidleprivate.h"
#include "gdkglcontextprivate.h"
#include "gdkmonitorprivate.h"
#include "gdkrectangle.h"
#ifdef HAVE_EGL
#include <epoxy/egl.h>
@ -175,7 +176,7 @@ gdk_display_default_rate_egl_config (GdkDisplay *display,
return distance;
}
static GdkSeat *
gdk_display_real_get_default_seat (GdkDisplay *display)
{
@ -418,10 +419,10 @@ gdk_display_close (GdkDisplay *display)
if (!display->closed)
{
display->closed = TRUE;
g_signal_emit (display, signals[CLOSED], 0, FALSE);
g_object_run_dispose (G_OBJECT (display));
g_object_unref (display);
}
}
@ -808,7 +809,7 @@ _gdk_display_end_device_grab (GdkDisplay *display,
grab->implicit_ungrab = implicit;
return l->next == NULL;
}
return FALSE;
}
@ -1268,7 +1269,7 @@ gdk_display_init_gl (GdkDisplay *self)
* Note that even if this function succeeds, creating a `GdkGLContext`
* may still fail.
*
* This function is idempotent. Calling it multiple times will just
* This function is idempotent. Calling it multiple times will just
* return the same value or error.
*
* You never need to call this function, GDK will call it automatically

View File

@ -25,7 +25,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkevents.h>
#include <gdk/gdkseat.h>

View File

@ -28,10 +28,9 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkdevice.h>
#include <gdk/gdkenums.h>
#include <gdk/gdkevents.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkdevice.h>
#include <gdk/gdkevents.h>
G_BEGIN_DECLS

View File

@ -23,7 +23,6 @@
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@ -24,7 +24,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@ -24,9 +24,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@ -345,4 +345,3 @@ typedef enum {
} GdkMemoryFormat;
G_END_DECLS

View File

@ -28,12 +28,10 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkdevice.h>
#include <gdk/gdkdevicetool.h>
#include <gdk/gdkdrag.h>
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@ -21,8 +21,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <glib-object.h>
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@ -1,7 +1,7 @@
/* GDK - The GIMP Drawing Kit
*
* gdkglcontext.h: GL context abstraction
*
*
* Copyright © 2014 Emmanuele Bassi
*
* This library is free software; you can redistribute it and/or
@ -24,9 +24,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@ -22,6 +22,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkglcontext.h>
#include <gdk/gdktexture.h>

View File

@ -23,9 +23,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@ -28,7 +28,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@ -23,7 +23,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk/gdktexture.h>
G_BEGIN_DECLS

View File

@ -24,6 +24,7 @@
#include "gdkmonitorprivate.h"
#include "gdkdisplay.h"
#include "gdkenumtypes.h"
#include "gdkrectangle.h"
/**
* GdkMonitor:

View File

@ -25,8 +25,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdkrectangle.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@ -24,7 +24,6 @@
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@ -1,5 +1,5 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2000 Red Hat, Inc.
* Copyright (C) 2000 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
@ -22,7 +22,6 @@
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@ -18,14 +18,11 @@
#pragma once
#include <gdk/gdkversionmacros.h>
#include <gio/gio.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS
GIOStream * gdk_pipe_io_stream_new (void);
G_END_DECLS

View File

@ -28,12 +28,8 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <cairo.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktexture.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
G_BEGIN_DECLS

View File

@ -20,6 +20,7 @@
#include "gdkpopuplayout.h"
#include "gdkrectangle.h"
#include "gdksurface.h"
/**

View File

@ -22,9 +22,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@ -29,7 +29,7 @@
#include <unistd.h>
#endif
#include "gdkversionmacros.h"
#include "version/gdkversionmacros.h"
#include "gdkframeclockprivate.h"

View File

@ -29,7 +29,6 @@
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@ -29,7 +29,6 @@
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@ -24,7 +24,6 @@
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@ -28,7 +28,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkevents.h>
#include <gdk/gdkframeclock.h>

View File

@ -22,8 +22,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk-pixbuf/gdk-pixbuf.h>

View File

@ -21,9 +21,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@ -22,9 +22,8 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkmonitor.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
#include <gdk/gdkmonitor.h>
G_BEGIN_DECLS

View File

@ -23,7 +23,6 @@
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@ -42,6 +42,8 @@
* (or GTK). One such setting is what windowing API backend is in use.
*/
#include <gdk/gdkconfig.h>
#include <gdk/gdkenums.h>
#include <gdk/version/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@ -1,324 +0,0 @@
/* gdkversionmacros.h - version boundaries checks
* Copyright (C) 2012 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/>.
*/
#if !defined (__GDK_H_INSIDE__) && !defined (__GTK_CSS_H_INSIDE__) && !defined (GTK_COMPILATION) && !defined (GTK_CSS_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_VERSION_MACROS_H__
#define __GDK_VERSION_MACROS_H__
#include <glib.h>
/**
* GDK_MAJOR_VERSION:
*
* The major version component of the library's version, e.g. "1" for "1.2.3".
*/
#define GDK_MAJOR_VERSION (@GTK_MAJOR_VERSION@)
/**
* GDK_MINOR_VERSION:
*
* The minor version component of the library's version, e.g. "2" for "1.2.3".
*/
#define GDK_MINOR_VERSION (@GTK_MINOR_VERSION@)
/**
* GDK_MICRO_VERSION:
*
* The micro version component of the library's version, e.g. "3" for "1.2.3".
*/
#define GDK_MICRO_VERSION (@GTK_MICRO_VERSION@)
#ifndef _GDK_EXTERN
#define _GDK_EXTERN extern
#endif
/**
* GDK_DISABLE_DEPRECATION_WARNINGS:
*
* A macro that should be defined before including the `gdk.h` header.
*
* If this symbol is defined, no compiler warnings will be produced for
* uses of deprecated GDK and GTK APIs.
*/
#ifdef GDK_DISABLE_DEPRECATION_WARNINGS
#define GDK_DEPRECATED _GDK_EXTERN
#define GDK_DEPRECATED_FOR(f) _GDK_EXTERN
#define GDK_UNAVAILABLE(maj,min) _GDK_EXTERN
#else
#define GDK_DEPRECATED G_DEPRECATED _GDK_EXTERN
#define GDK_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _GDK_EXTERN
#define GDK_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _GDK_EXTERN
#endif
/* XXX: Every new stable minor release bump should add a macro here */
/**
* GDK_VERSION_4_0:
*
* A macro that evaluates to the 4.0 version of GDK, in a format
* that can be used by the C pre-processor.
*/
#define GDK_VERSION_4_0 (G_ENCODE_VERSION (4, 0))
/**
* GDK_VERSION_4_2:
*
* A macro that evaluates to the 4.2 version of GDK, in a format
* that can be used by the C pre-processor.
*
* Since: 4.2
*/
#define GDK_VERSION_4_2 (G_ENCODE_VERSION (4, 2))
/**
* GDK_VERSION_4_4:
*
* A macro that evaluates to the 4.4 version of GDK, in a format
* that can be used by the C pre-processor.
*
* Since: 4.4
*/
#define GDK_VERSION_4_4 (G_ENCODE_VERSION (4, 4))
/**
* GDK_VERSION_4_6:
*
* A macro that evaluates to the 4.6 version of GDK, in a format
* that can be used by the C pre-processor.
*
* Since: 4.6
*/
#define GDK_VERSION_4_6 (G_ENCODE_VERSION (4, 6))
/**
* GDK_VERSION_4_8:
*
* A macro that evaluates to the 4.8 version of GDK, in a format
* that can be used by the C pre-processor.
*
* Since: 4.8
*/
#define GDK_VERSION_4_8 (G_ENCODE_VERSION (4, 8))
/**
* GDK_VERSION_4_10:
*
* A macro that evaluates to the 4.10 version of GDK, in a format
* that can be used by the C pre-processor.
*
* Since: 4.10
*/
#define GDK_VERSION_4_10 (G_ENCODE_VERSION (4, 10))
/**
* GDK_VERSION_4_12:
*
* A macro that evaluates to the 4.12 version of GDK, in a format
* that can be used by the C pre-processor.
*
* Since: 4.12
*/
#define GDK_VERSION_4_12 (G_ENCODE_VERSION (4, 12))
/* evaluates to the current stable version; for development cycles,
* this means the next stable target, with a hard backstop to the
* beginning of the stable series
*/
#if GDK_MAJOR_VERSION >= 4 && (GDK_MINOR_VERSION % 2)
# define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION + 1))
#elif G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION) > GDK_VERSION_4_0
# define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION))
#else
# define GDK_VERSION_CUR_STABLE GDK_VERSION_4_0
#endif
/* evaluates to the previous stable version, with a hard backstop
* to the beginning of the stable series
*/
#if GDK_MAJOR_VERSION >= 4 && (GDK_MINOR_VERSION % 2)
# define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 1))
#elif GDK_MAJOR_VERSION >= 4 && GDK_MINOR_VERSION > 2
# define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 2))
#else
# define GDK_VERSION_PREV_STABLE GDK_VERSION_4_0
#endif
/**
* GDK_VERSION_MIN_REQUIRED:
*
* A macro that should be defined by the user prior to including
* the `gdk.h` header.
*
* The definition should be one of the predefined GDK version
* macros: %GDK_VERSION_4_0, %GDK_VERSION_4_2,...
*
* This macro defines the lower bound for the GDK API to use.
*
* If a function has been deprecated in a newer version of GDK,
* it is possible to use this symbol to avoid the compiler warnings
* without disabling warning for every deprecated function.
*/
#ifndef GDK_VERSION_MIN_REQUIRED
# define GDK_VERSION_MIN_REQUIRED (GDK_VERSION_CUR_STABLE)
#endif
/**
* GDK_VERSION_MAX_ALLOWED:
*
* A macro that should be defined by the user prior to including
* the `gdk.h` header.
*
* The definition should be one of the predefined GDK version
* macros: %GDK_VERSION_4_0, %GDK_VERSION_4_2,...
*
* This macro defines the upper bound for the GDK API to use.
*
* If a function has been introduced in a newer version of GDK,
* it is possible to use this symbol to get compiler warnings when
* trying to use that function.
*/
#ifndef GDK_VERSION_MAX_ALLOWED
# if GDK_VERSION_MIN_REQUIRED > GDK_VERSION_PREV_STABLE
# define GDK_VERSION_MAX_ALLOWED GDK_VERSION_MIN_REQUIRED
# else
# define GDK_VERSION_MAX_ALLOWED GDK_VERSION_CUR_STABLE
# endif
#endif
/* sanity checks */
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_MIN_REQUIRED
# error "GDK_VERSION_MAX_ALLOWED must be >= GDK_VERSION_MIN_REQUIRED"
#endif
#if GDK_VERSION_MIN_REQUIRED < GDK_VERSION_4_0
# error "GDK_VERSION_MIN_REQUIRED must be >= GDK_VERSION_4_0"
#endif
#define GDK_AVAILABLE_IN_ALL _GDK_EXTERN
/* XXX: Every new stable minor release should add a set of macros here */
/* This is not really necessary for 4.0, since there can't be an
* earlier version, and there are no deprecated symbols. We just
* include it for completeness, and because it's easier to copy
* this stanza every time a new development cycle starts.
*/
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_0
# define GDK_AVAILABLE_IN_4_0 GDK_UNAVAILABLE(4, 0)
#else
# define GDK_AVAILABLE_IN_4_0 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_0
# define GDK_DEPRECATED_IN_4_0 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_0_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_4_0 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_0_FOR(f) _GDK_EXTERN
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_2
# define GDK_AVAILABLE_IN_4_2 GDK_UNAVAILABLE(4, 2)
#else
# define GDK_AVAILABLE_IN_4_2 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_2
# define GDK_DEPRECATED_IN_4_2 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_2_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_4_2 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_2_FOR(f) _GDK_EXTERN
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_4
# define GDK_AVAILABLE_IN_4_4 GDK_UNAVAILABLE(4, 4)
#else
# define GDK_AVAILABLE_IN_4_4 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_4
# define GDK_DEPRECATED_IN_4_4 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_4_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_4_4 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_4_FOR(f) _GDK_EXTERN
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_6
# define GDK_AVAILABLE_IN_4_6 GDK_UNAVAILABLE(4, 6)
#else
# define GDK_AVAILABLE_IN_4_6 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_6
# define GDK_DEPRECATED_IN_4_6 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_6_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_4_6 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_6_FOR(f) _GDK_EXTERN
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_8
# define GDK_AVAILABLE_IN_4_8 GDK_UNAVAILABLE(4, 8)
#else
# define GDK_AVAILABLE_IN_4_8 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_8
# define GDK_DEPRECATED_IN_4_8 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_8_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_4_8 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_8_FOR(f) _GDK_EXTERN
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_10
# define GDK_AVAILABLE_IN_4_10 GDK_UNAVAILABLE(4, 10)
#else
# define GDK_AVAILABLE_IN_4_10 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_10
# define GDK_DEPRECATED_IN_4_10 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_10_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_4_10 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_10_FOR(f) _GDK_EXTERN
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_12
# define GDK_AVAILABLE_IN_4_12 GDK_UNAVAILABLE(4, 12)
#else
# define GDK_AVAILABLE_IN_4_12 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_12
# define GDK_DEPRECATED_IN_4_12 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_12_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_4_12 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_12_FOR(f) _GDK_EXTERN
#endif
#endif /* __GDK_VERSION_MACROS_H__ */

View File

@ -24,7 +24,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#ifdef GDK_RENDERING_VULKAN

View File

@ -146,7 +146,7 @@ gdk_enums = gnome.mkenums_simple('gdkenumtypes',
sources: gdk_public_headers,
decorator: 'GDK_AVAILABLE_IN_ALL',
body_prefix: '#include "config.h"',
header_prefix: '#include "gdkversionmacros.h"',
header_prefix: '#include "version/gdkversionmacros.h"\n',
install_dir: gtk_includedir / 'gtk-4.0/gdk',
install_header: true,
)
@ -183,13 +183,6 @@ gdkversion_cdata.set('GTK_MAJOR_VERSION', gtk_major_version)
gdkversion_cdata.set('GTK_MINOR_VERSION', gtk_minor_version)
gdkversion_cdata.set('GTK_MICRO_VERSION', gtk_micro_version)
gdkversionmacros = configure_file(
input: 'gdkversionmacros.h.in',
output: 'gdkversionmacros.h',
configuration: gdkversion_cdata,
install_dir: gtk_includedir / 'gtk-4.0/gdk',
)
gdkinc = include_directories('.')
gdkx11_inc = include_directories('x11')
gdkwayland_inc = include_directories('wayland')
@ -197,7 +190,7 @@ gdkwayland_inc = include_directories('wayland')
wlinc = include_directories('.')
win32rcinc = include_directories('win32/rc')
gdk_gen_headers = [gdkenum_h, gdkmarshal_h, gdkconfig, gdkversionmacros]
gdk_gen_headers = [gdkenum_h, gdkmarshal_h, gdkconfig, gdkversionmacros_h, gdk_visibility_h]
gdk_deps = [
libm,
@ -231,7 +224,8 @@ gdk_sources += [
gdk_enums,
gdk_marshalers,
gdkresources,
gdkversionmacros,
gdkversionmacros_h,
gdk_visibility_h,
gdk_private_h_sources,
gdk_public_headers
]

View File

@ -0,0 +1,146 @@
/* gdkversionmacros.h - version boundaries checks
* Copyright (C) 2012 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/>.
*/
#if !defined (__GDK_H_INSIDE__) && !defined (__GTK_CSS_H_INSIDE__) && !defined (GTK_COMPILATION) && !defined (GTK_CSS_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#pragma once
#include <glib.h>
/* These macros are used to mark deprecated symbols in GLib headers,
* and thus have to be exposed in installed headers. But please
* do *not* use them in other projects. Instead define your own wrappers
* around it.
*/
#if !defined(GDK_DISABLE_DEPRECATION_WARNINGS) && \
(G_GNUC_CHECK_VERSION(4, 6) || \
__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4))
#define _GDK_GNUC_DO_PRAGMA(x) _Pragma(G_STRINGIFY (x))
#define GDK_DEPRECATED_MACRO _GDK_GNUC_DO_PRAGMA(GCC warning "Deprecated pre-processor symbol")
#define GDK_DEPRECATED_MACRO_FOR(f) \
_GDK_GNUC_DO_PRAGMA(GCC warning G_STRINGIFY (Deprecated pre-processor symbol: replace with #f))
#define GDK_UNAVAILABLE_MACRO(maj,min) \
_GDK_GNUC_DO_PRAGMA(GCC warning G_STRINGIFY (Not available before maj.min))
#else
#define GDK_DEPRECATED_MACRO
#define GDK_DEPRECATED_MACRO_FOR(f)
#define GDK_UNAVAILABLE_MACRO(maj,min)
#endif
#if !defined(GDK_DISABLE_DEPRECATION_WARNINGS) && \
(G_GNUC_CHECK_VERSION(6, 1) || \
(defined (__clang_major__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 0))))
#define GDK_DEPRECATED_ENUMERATOR G_DEPRECATED
#define GDK_DEPRECATED_ENUMERATOR_FOR(f) G_DEPRECATED_FOR(f)
#define GDK_UNAVAILABLE_ENUMERATOR(maj,min) G_UNAVAILABLE(maj,min)
#else
#define GDK_DEPRECATED_ENUMERATOR
#define GDK_DEPRECATED_ENUMERATOR_FOR(f)
#define GDK_UNAVAILABLE_ENUMERATOR(maj,min)
#endif
#if !defined(GDK_DISABLE_DEPRECATION_WARNINGS) && \
(G_GNUC_CHECK_VERSION(3, 1) || \
(defined (__clang_major__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 0))))
#define GDK_DEPRECATED_TYPE G_DEPRECATED
#define GDK_DEPRECATED_TYPE_FOR(f) G_DEPRECATED_FOR(f)
#define GDK_UNAVAILABLE_TYPE(maj,min) G_UNAVAILABLE(maj,min)
#else
#define GDK_DEPRECATED_TYPE
#define GDK_DEPRECATED_TYPE_FOR(f)
#define GDK_UNAVAILABLE_TYPE(maj,min)
#endif
@GDK_VERSIONS@
/* evaluates to the current stable version; for development cycles,
* this means the next stable target, with a hard backstop to the
* beginning of the stable series
*/
#if GDK_MAJOR_VERSION >= 4 && (GDK_MINOR_VERSION % 2)
# define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION + 1))
#elif G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION) > GDK_VERSION_4_0
# define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION))
#else
# define GDK_VERSION_CUR_STABLE GDK_VERSION_4_0
#endif
/* evaluates to the previous stable version, with a hard backstop
* to the beginning of the stable series
*/
#if GDK_MAJOR_VERSION >= 4 && (GDK_MINOR_VERSION % 2)
# define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 1))
#elif GDK_MAJOR_VERSION >= 4 && GDK_MINOR_VERSION > 2
# define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 2))
#else
# define GDK_VERSION_PREV_STABLE GDK_VERSION_4_0
#endif
/**
* GDK_VERSION_MIN_REQUIRED:
*
* A macro that should be defined by the user prior to including
* the `gdk.h` header.
*
* The definition should be one of the predefined GDK version
* macros: %GDK_VERSION_4_0, %GDK_VERSION_4_2,...
*
* This macro defines the lower bound for the GDK API to use.
*
* If a function has been deprecated in a newer version of GDK,
* it is possible to use this symbol to avoid the compiler warnings
* without disabling warning for every deprecated function.
*/
#ifndef GDK_VERSION_MIN_REQUIRED
# define GDK_VERSION_MIN_REQUIRED (GDK_VERSION_CUR_STABLE)
#endif
/**
* GDK_VERSION_MAX_ALLOWED:
*
* A macro that should be defined by the user prior to including
* the `gdk.h` header.
*
* The definition should be one of the predefined GDK version
* macros: %GDK_VERSION_4_0, %GDK_VERSION_4_2,...
*
* This macro defines the upper bound for the GDK API to use.
*
* If a function has been introduced in a newer version of GDK,
* it is possible to use this symbol to get compiler warnings when
* trying to use that function.
*/
#ifndef GDK_VERSION_MAX_ALLOWED
# if GDK_VERSION_MIN_REQUIRED > GDK_VERSION_PREV_STABLE
# define GDK_VERSION_MAX_ALLOWED GDK_VERSION_MIN_REQUIRED
# else
# define GDK_VERSION_MAX_ALLOWED GDK_VERSION_CUR_STABLE
# endif
#endif
/* sanity checks */
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_MIN_REQUIRED
# error "GDK_VERSION_MAX_ALLOWED must be >= GDK_VERSION_MIN_REQUIRED"
#endif
#if GDK_VERSION_MIN_REQUIRED < GDK_VERSION_4_0
# error "GDK_VERSION_MIN_REQUIRED must be >= GDK_VERSION_4_0"
#endif
#include <gdk/version/gdk-visibility.h>

21
gdk/version/meson.build Normal file
View File

@ -0,0 +1,21 @@
gdkversionmacros_h = custom_target(
input: 'gdkversionmacros.h.in',
output: 'gdkversionmacros.h',
command: [gen_visibility_macros, meson.project_version(), 'versions-macros', '@INPUT@', '@OUTPUT@'],
install: true,
install_dir: gtk_includedir / 'gtk-4.0/gdk/version',
# FIXME: Not needed with Meson >= 0.64.0
install_tag: 'devel',
)
gdk_visibility_h = custom_target(
output: 'gdk-visibility.h',
command: [gen_visibility_macros, meson.project_version(), 'visibility-macros', 'GDK', '@OUTPUT@'],
install: true,
install_dir: gtk_includedir / 'gtk-4.0/gdk/version',
# FIXME: Not needed with Meson >= 0.64.0
install_tag: 'devel',
)

View File

@ -27,7 +27,7 @@
#define __GTK_CSS_H_INSIDE__
#include <glib.h>
#include <gdk/gdkversionmacros.h>
#include <gdk/version/gdkversionmacros.h>
#include <gtk/css/gtkcssenums.h>
#include <gtk/css/gtkcssenumtypes.h>

View File

@ -29,7 +29,7 @@
#endif
#include <glib.h>
#include <gdk/gdkversionmacros.h>
#include <gdk/version/gdkversionmacros.h>
/**
* GtkCssParserError:

View File

@ -7,7 +7,7 @@
#endif
#include <glib-object.h>
#include <gdk/gdkversionmacros.h>
#include <gdk/version/gdkversionmacros.h>
G_BEGIN_DECLS
/*** END file-header ***/

View File

@ -21,7 +21,7 @@
#pragma once
#include <glib.h>
#include <gdk/gdkversionmacros.h>
#include <gdk/version/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@ -22,7 +22,7 @@
#endif
#include <gio/gio.h>
#include <gdk/gdkversionmacros.h>
#include <gdk/version/gdkversionmacros.h>
#include <gtk/css/gtkcsslocation.h>
G_BEGIN_DECLS

View File

@ -41,6 +41,8 @@ libgtk_css = static_library('gtk_css',
gtk_css_public_sources,
gtk_css_private_sources,
gtk_css_enums,
gdkversionmacros_h,
gdk_visibility_h,
],
dependencies: gtk_css_deps,
include_directories: [ confinc, ],

View File

@ -1179,6 +1179,7 @@ libgtk = shared_library('gtk-4',
soversion: gtk_soversion,
version: gtk_library_version,
darwin_versions: darwin_versions,
gnu_symbol_visibility: 'hidden',
install: true,
)

View File

@ -344,13 +344,6 @@ common_cflags = cc.get_supported_arguments(test_cflags)
if get_option('default_library') != 'static'
if os_win32
cdata.set('DLL_EXPORT', true)
cdata.set('_GDK_EXTERN', '__declspec(dllexport) extern')
if cc.get_id() != 'msvc'
common_cflags += ['-fvisibility=hidden']
endif
else
cdata.set('_GDK_EXTERN', '__attribute__((visibility("default"))) extern')
common_cflags += ['-fvisibility=hidden']
endif
endif
@ -735,6 +728,11 @@ int main () {
endif
endif
if os_unix
cpdb_dep = dependency('cpdb-frontend', version : '>=2.0', required: get_option('print-cpdb'))
cups_dep = dependency('cups', version : '>=2.0', required: get_option('print-cups'))
endif
# Introspection
gir = find_program('g-ir-scanner', required : get_option('introspection'))
@ -747,14 +745,13 @@ build_gir = gir.found() and (get_option('introspection').enabled() or
project_build_root = meson.current_build_dir()
gen_visibility_macros = find_program('build-aux/meson/gen-visibility-macros.py')
subdir('gdk/version')
subdir('gtk/css')
subdir('gdk')
subdir('gsk')
subdir('gtk')
if os_unix
cpdb_dep = dependency('cpdb-frontend', version : '>=2.0', required: get_option('print-cpdb'))
cups_dep = dependency('cups', version : '>=2.0', required: get_option('print-cups'))
endif
subdir('modules')
if get_option('demos')
subdir('demos')
@ -870,7 +867,7 @@ else
endif
if not meson.is_subproject()
meson.add_dist_script('build-aux/meson/dist-data.py')
meson.add_dist_script('build-aux/meson/dist-data.py')
endif
if host_machine.system() != 'windows'

View File

@ -38,8 +38,7 @@ test_cargs = []
foreach flag: common_cflags
if flag not in ['-Werror=missing-prototypes', '-Wmissing-prototypes',
'-Werror=missing-declarations', '-Wmissing-declarations',
'-fvisibility=hidden']
'-Werror=missing-declarations', '-Wmissing-declarations']
test_cargs += flag
endif
endforeach

View File

@ -28,7 +28,7 @@ test('api', test_api,
test_data = executable('data',
sources: ['data.c'],
c_args: common_cflags,
c_args: common_cflags + ['-DGTK_COMPILATION'],
include_directories: [confinc, ],
dependencies: libgtk_static_dep,
)
@ -42,7 +42,7 @@ test('data', test_data,
transition = executable('transition',
sources: ['transition.c'],
c_args: common_cflags,
c_args: common_cflags + ['-DGTK_COMPILATION'],
dependencies: libgtk_static_dep,
)

View File

@ -57,7 +57,7 @@ internal_tests = [
foreach t : internal_tests
test_exe = executable(t, '@0@.c'.format(t),
c_args: common_cflags,
c_args: common_cflags + ['-DGTK_COMPILATION'],
dependencies: libgtk_static_dep,
install: false,
)

View File

@ -397,7 +397,7 @@ foreach t : internal_tests
test_exe = executable(test_name,
sources: test_srcs,
dependencies : libgtk_static_dep,
c_args : test_cargs + test_extra_cargs + common_cflags,
c_args : test_cargs + test_extra_cargs + common_cflags + ['-DGTK_COMPILATION'],
link_args : test_extra_ldflags,
)

View File

@ -149,8 +149,7 @@ endif
foreach flag: common_cflags
if flag not in ['-Werror=missing-prototypes', '-Wmissing-prototypes',
'-Werror=missing-declarations', '-Wmissing-declarations',
'-fvisibility=hidden']
'-Werror=missing-declarations', '-Wmissing-declarations']
test_cargs += flag
endif
endforeach
@ -193,7 +192,7 @@ foreach t : internal_tests
test_exe = executable(test_name,
sources: test_srcs,
c_args: test_cargs + test_extra_cargs,
c_args: test_cargs + test_extra_cargs + ['-DGTK_COMPILATION'],
link_args: test_extra_ldflags,
dependencies: libgtk_static_dep,
)

View File

@ -3,8 +3,7 @@
reftest_cflags = []
foreach flag: common_cflags
if flag not in ['-Werror=missing-prototypes', '-Wmissing-prototypes',
'-Werror=missing-declarations', '-Wmissing-declarations',
'-fvisibility=hidden']
'-Werror=missing-declarations', '-Wmissing-declarations']
reftest_cflags += flag
endif
endforeach