gdk: Deprecated some pixbuf apis

These are already documented as 'don't use
in new apis'. Lets make it official and
deprecate them properly.
This commit is contained in:
Matthias Clasen 2023-05-15 18:21:08 -04:00
parent d517b25ea3
commit ed265f6a7e
7 changed files with 24 additions and 8 deletions

View File

@ -157,6 +157,9 @@ convert_no_alpha (guchar *dest_data,
* *
* Returns: (nullable) (transfer full): A newly-created pixbuf with a * Returns: (nullable) (transfer full): A newly-created pixbuf with a
* reference count of 1 * reference count of 1
*
* Deprecated: 4.12: Use [class@Gdk.Texture] and subclasses instead
* cairo surfaces and pixbufs
*/ */
GdkPixbuf * GdkPixbuf *
gdk_pixbuf_get_from_surface (cairo_surface_t *surface, gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
@ -234,6 +237,9 @@ pixbuf_texture_unref_cb (guchar *pixels,
* to draw it on screen. * to draw it on screen.
* *
* Returns: (transfer full) (nullable): a new `GdkPixbuf` * Returns: (transfer full) (nullable): a new `GdkPixbuf`
*
* Deprecated: 4.12: Use [class@Gdk.Texture] and subclasses instead
* cairo surfaces and pixbufs
*/ */
GdkPixbuf * GdkPixbuf *
gdk_pixbuf_get_from_texture (GdkTexture *texture) gdk_pixbuf_get_from_texture (GdkTexture *texture)

View File

@ -33,13 +33,13 @@
G_BEGIN_DECLS G_BEGIN_DECLS
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_12
GdkPixbuf *gdk_pixbuf_get_from_surface (cairo_surface_t *surface, GdkPixbuf *gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
int src_x, int src_x,
int src_y, int src_y,
int width, int width,
int height); int height);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_12
GdkPixbuf *gdk_pixbuf_get_from_texture (GdkTexture *texture); GdkPixbuf *gdk_pixbuf_get_from_texture (GdkTexture *texture);
G_END_DECLS G_END_DECLS

View File

@ -0,0 +1,7 @@
gdk_deprecated_sources = [
'deprecated/gdkpixbuf.c',
]
gdk_deprecated_headers = [
'deprecated/gdkpixbuf.h',
]

View File

@ -61,7 +61,7 @@
#include <gdk/gdkmonitor.h> #include <gdk/gdkmonitor.h>
#include <gdk/gdkpaintable.h> #include <gdk/gdkpaintable.h>
#include <gdk/gdkpango.h> #include <gdk/gdkpango.h>
#include <gdk/gdkpixbuf.h> #include <gdk/deprecated/gdkpixbuf.h>
#include <gdk/gdkpopup.h> #include <gdk/gdkpopup.h>
#include <gdk/gdkpopuplayout.h> #include <gdk/gdkpopuplayout.h>
#include <gdk/gdkrectangle.h> #include <gdk/gdkrectangle.h>

View File

@ -22,7 +22,7 @@
#endif #endif
#include <gdk/gdktypes.h> #include <gdk/gdktypes.h>
#include <gdk/gdkpixbuf.h> #include <gdk/deprecated/gdkpixbuf.h>
#include <pango/pangocairo.h> #include <pango/pangocairo.h>
G_BEGIN_DECLS G_BEGIN_DECLS

View File

@ -22,7 +22,7 @@
#include "gdkcontentserializer.h" #include "gdkcontentserializer.h"
#include "gdkcontentformats.h" #include "gdkcontentformats.h"
#include "gdkpixbuf.h" #include "deprecated/gdkpixbuf.h"
#include "filetransferportalprivate.h" #include "filetransferportalprivate.h"
#include "gdktextureprivate.h" #include "gdktextureprivate.h"
#include "gdkrgba.h" #include "gdkrgba.h"
@ -642,7 +642,9 @@ pixbuf_serializer (GdkContentSerializer *serializer)
else if (G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE)) else if (G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE))
{ {
GdkTexture *texture = g_value_get_object (value); GdkTexture *texture = g_value_get_object (value);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
pixbuf = gdk_pixbuf_get_from_texture (texture); pixbuf = gdk_pixbuf_get_from_texture (texture);
G_GNUC_END_IGNORE_DEPRECATIONS
} }
else else
{ {

View File

@ -1,3 +1,5 @@
subdir('deprecated')
gdk_public_sources = files([ gdk_public_sources = files([
'gdk.c', 'gdk.c',
'gdkapplaunchcontext.c', 'gdkapplaunchcontext.c',
@ -38,7 +40,6 @@ gdk_public_sources = files([
'gdkmonitor.c', 'gdkmonitor.c',
'gdkpaintable.c', 'gdkpaintable.c',
'gdkpango.c', 'gdkpango.c',
'gdkpixbuf.c',
'gdkpipeiostream.c', 'gdkpipeiostream.c',
'gdkrectangle.c', 'gdkrectangle.c',
'gdkrgba.c', 'gdkrgba.c',
@ -94,7 +95,6 @@ gdk_public_headers = files([
'gdkmonitor.h', 'gdkmonitor.h',
'gdkpaintable.h', 'gdkpaintable.h',
'gdkpango.h', 'gdkpango.h',
'gdkpixbuf.h',
'gdkrectangle.h', 'gdkrectangle.h',
'gdkrgba.h', 'gdkrgba.h',
'gdkseat.h', 'gdkseat.h',
@ -112,8 +112,9 @@ gdk_public_headers = files([
'gdkdragsurface.h', 'gdkdragsurface.h',
]) ])
install_headers(gdk_public_headers, subdir: 'gtk-4.0/gdk/') install_headers(gdk_public_headers, subdir: 'gtk-4.0/gdk/')
install_headers(gdk_deprecated_headers, subdir: 'gtk-4.0/gdk/deprecated')
gdk_sources = gdk_public_sources gdk_sources = gdk_public_sources + gdk_deprecated_sources
gdk_private_h_sources = files([ gdk_private_h_sources = files([
'gdkeventsprivate.h', 'gdkeventsprivate.h',