Compare commits

..
46 changed files with 180 additions and 1841 deletions

View file

@ -399,11 +399,6 @@ PKG_CHECK_MODULES(BASE_DEPENDENCIES,
gdk-pixbuf-2.0 >= gdk_pixbuf_required_version dnl
fribidi >= fribidi_required_version])
PKG_CHECK_EXISTS([atk >= 2.12],
[AC_DEFINE([HAVE_ATK_VALUE_2_12], [1],
[Define if ATK provides the 2.12 AtkValue interface])])
## In addition to checking that cairo is present, we also need to
## check that the correct cairo backend is there. E.g. if the GDK
## target is win32 we need the cairo-win32 backend and so on.
@ -474,7 +469,7 @@ if test "x$enable_rebuilds" = "xyes" && \
fi
AC_SUBST(REBUILD)
AC_CHECK_FUNCS(lstat mkstemp flockfile funlockfile getc_unlocked _lock_file _unlock_file _getc_nolock)
AC_CHECK_FUNCS(lstat mkstemp flockfile getc_unlocked)
AC_CHECK_FUNCS(localtime_r)
# _NL_TIME_FIRST_WEEKDAY is an enum and not a define
@ -1599,7 +1594,6 @@ else
gtk_save_libs="$LIBS"
LIBS="$CUPS_LIBS"
AC_CHECK_FUNCS(httpGetAuthString)
AC_CHECK_FUNCS(httpConnect2 httpReconnect2)
LIBS="$gtk_save_libs"
fi
fi

View file

@ -37,7 +37,7 @@ IGNORE_HFILES= \
# Extra files to add when scanning (relative to $srcdir)
EXTRA_HFILES= \
$(top_srcdir)/gdk/x11/gdkx.h
../../../gdk/x11/gdkx.h
# CFLAGS and LDFLAGS for compiling scan program. Only needed
# if $(DOC_MODULE).types is non-empty.

View file

@ -335,10 +335,6 @@ gdk_draw_indexed_image
gdk_draw_gray_image
gdk_draw_rgb_32_image
gdk_draw_rgb_32_image_dithalign
gdk_draw_rgb_48_image
gdk_draw_rgb_48_image_dithalign
gdk_draw_rgbx_64_image
gdk_draw_rgbx_64_image_dithalign
GdkRgbDither
<SUBSECTION>

View file

@ -145,7 +145,6 @@ gdk_c_sources = \
gdkrectangle.c \
gdkregion-generic.c \
gdkrgb.c \
gdkrgb16.c \
gdkscreen.c \
gdkselection.c \
gdkvisual.c \

View file

@ -1118,15 +1118,6 @@ gdk_draw_rgb_image_dithalign
#endif
#endif
#if IN_HEADER(__GDK_RGB_H__)
#if IN_FILE(__GDK_RGB16_C__)
gdk_draw_rgb_48_image
gdk_draw_rgb_48_image_dithalign
gdk_draw_rgbx_64_image
gdk_draw_rgbx_64_image_dithalign
#endif
#endif
#if IN_HEADER(__GDK_SCREEN_H__)
#if IN_FILE(__GDK_SCREEN_C__)
gdk_screen_get_type G_GNUC_CONST

View file

@ -1464,33 +1464,19 @@ gdk_rgb_convert_gray8_gray (GdkRgbInfo *image_info, GdkImage *image,
}
}
#if G_BYTE_ORDER == G_BIG_ENDIAN
#if defined(__powerpc__) || defined(__powerpc64__) || \
defined(__ppc__) || defined(__ppc64__) || \
defined(__PPC__) || defined(__PPC64__) || \
defined(__POWERPC__) || defined(_ARCH_PPC)
#define GDK_RGB_FAST_BE565_RGB
#define GDK_RGB_FAST_BE565_GRAY
#define GDK_RGB_FAST_BE565_DITHER
#elif defined(__s390x__)
#define GDK_RGB_FAST_BE565_RGB
#elif defined(__aarch64__)
#define GDK_RGB_FAST_BE565_RGB
#define GDK_RGB_FAST_BE565_GRAY
#elif defined(__arm__) && defined(__ARM_ARCH) && \
__ARM_ARCH >= 5
#define GDK_RGB_FAST_BE565_RGB
#define GDK_RGB_FAST_BE565_GRAY
#elif defined(__m68k__)
#define GDK_RGB_FAST_BE565_GRAY
#endif
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
#define HAIRY_CONVERT_565
#endif
#ifdef HAIRY_CONVERT_565
/* Render a 24-bit RGB image in buf into the GdkImage, without dithering.
The four-pixel inner loop uses compile-time-specialized native word
layouts for little- and big-endian systems. */
#if G_BYTE_ORDER == G_LITTLE_ENDIAN || defined(GDK_RGB_FAST_BE565_RGB)
This assumes native byte ordering - what should really be done is to
check whether the image byte_order is consistent with the _ENDIAN
config flag, and if not, use a different function.
This one is even faster than the one below - its inner loop loads 3
words (i.e. 4 24-bit pixels), does a lot of shifting and masking,
then writes 2 words. */
static void
gdk_rgb_convert_565 (GdkRgbInfo *image_info, GdkImage *image,
gint x0, gint y0, gint width, gint height,
@ -1534,7 +1520,6 @@ gdk_rgb_convert_565 (GdkRgbInfo *image_info, GdkImage *image,
r1b0g0r0 = ((guint32 *)bp2)[0];
g2r2b1g1 = ((guint32 *)bp2)[1];
b3g3r3b2 = ((guint32 *)bp2)[2];
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
((guint32 *)obptr)[0] =
((r1b0g0r0 & 0xf8) << 8) |
((r1b0g0r0 & 0xfc00) >> 5) |
@ -1549,22 +1534,6 @@ gdk_rgb_convert_565 (GdkRgbInfo *image_info, GdkImage *image,
((b3g3r3b2 & 0xf800) << 16) |
((b3g3r3b2 & 0xfc0000) << 3) |
((b3g3r3b2 & 0xf8000000) >> 11);
#else
((guint32 *)obptr)[0] =
(r1b0g0r0 & 0xf8000000) |
((r1b0g0r0 & 0x00fc0000) << 3) |
((r1b0g0r0 & 0x0000f800) << 5) |
((r1b0g0r0 & 0x000000f8) << 8) |
((g2r2b1g1 & 0xfc000000) >> 21) |
((g2r2b1g1 & 0x00f80000) >> 19);
((guint32 *)obptr)[1] =
((g2r2b1g1 & 0x0000f800) << 16) |
((g2r2b1g1 & 0x000000fc) << 19) |
((b3g3r3b2 & 0xf8000000) >> 11) |
((b3g3r3b2 & 0x00f80000) >> 8) |
((b3g3r3b2 & 0x0000fc00) >> 5) |
((b3g3r3b2 & 0x000000f8) >> 3);
#endif
bp2 += 12;
obptr += 8;
}
@ -1584,6 +1553,27 @@ gdk_rgb_convert_565 (GdkRgbInfo *image_info, GdkImage *image,
}
}
#else
/* Render a 24-bit RGB image in buf into the GdkImage, without dithering.
This assumes native byte ordering - what should really be done is to
check whether the image byte_order is consistent with the _ENDIAN
config flag, and if not, use a different function.
This routine is faster than the one included with Gtk 1.0 for a number
of reasons:
1. Shifting instead of lookup tables (less memory traffic).
2. Much less register pressure, especially because shifts are
in the code.
3. A memcpy is avoided (i.e. the transfer function).
4. On big-endian architectures, byte swapping is avoided.
That said, it wouldn't be hard to make it even faster - just make an
inner loop that reads 3 words (i.e. 4 24-bit pixels), does a lot of
shifting and masking, then writes 2 words.
*/
static void
gdk_rgb_convert_565 (GdkRgbInfo *image_info, GdkImage *image,
gint x0, gint y0, gint width, gint height,
@ -1617,7 +1607,7 @@ gdk_rgb_convert_565 (GdkRgbInfo *image_info, GdkImage *image,
}
#endif
#if G_BYTE_ORDER == G_LITTLE_ENDIAN || defined(GDK_RGB_FAST_BE565_GRAY)
#ifdef HAIRY_CONVERT_565
static void
gdk_rgb_convert_565_gray (GdkRgbInfo *image_info, GdkImage *image,
gint x0, gint y0, gint width, gint height,
@ -1655,7 +1645,6 @@ gdk_rgb_convert_565_gray (GdkRgbInfo *image_info, GdkImage *image,
guint32 g3g2g1g0;
g3g2g1g0 = ((guint32 *)bp2)[0];
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
((guint32 *)obptr)[0] =
((g3g2g1g0 & 0xf8) << 8) |
((g3g2g1g0 & 0xfc) << 3) |
@ -1670,22 +1659,6 @@ gdk_rgb_convert_565_gray (GdkRgbInfo *image_info, GdkImage *image,
(g3g2g1g0 & 0xf8000000) |
((g3g2g1g0 & 0xfc000000) >> 5) |
((g3g2g1g0 & 0xf8000000) >> 11);
#else
((guint32 *)obptr)[0] =
(g3g2g1g0 & 0xf8000000) |
((g3g2g1g0 & 0xfc000000) >> 5) |
((g3g2g1g0 & 0xf8000000) >> 11) |
((g3g2g1g0 & 0x00f80000) >> 8) |
((g3g2g1g0 & 0x00fc0000) >> 13) |
((g3g2g1g0 & 0x00f80000) >> 19);
((guint32 *)obptr)[1] =
((g3g2g1g0 & 0x0000f800) << 16) |
((g3g2g1g0 & 0x0000fc00) << 11) |
((g3g2g1g0 & 0x0000f800) << 5) |
((g3g2g1g0 & 0x000000f8) << 8) |
((g3g2g1g0 & 0x000000fc) << 3) |
((g3g2g1g0 & 0x000000f8) >> 3);
#endif
bp2 += 4;
obptr += 8;
}
@ -1772,7 +1745,7 @@ gdk_rgb_convert_565_br (GdkRgbInfo *image_info, GdkImage *image,
/* Thanks to Ray Lehtiniemi for a patch that resulted in a ~25% speedup
in this mode. */
#if G_BYTE_ORDER == G_LITTLE_ENDIAN || defined(GDK_RGB_FAST_BE565_DITHER)
#ifdef HAIRY_CONVERT_565
static void
gdk_rgb_convert_565_d (GdkRgbInfo *image_info, GdkImage *image,
gint x0, gint y0, gint width, gint height,
@ -1827,7 +1800,6 @@ gdk_rgb_convert_565_d (GdkRgbInfo *image_info, GdkImage *image,
r1b0g0r0 = ((guint32 *)bp2)[0];
g2r2b1g1 = ((guint32 *)bp2)[1];
b3g3r3b2 = ((guint32 *)bp2)[2];
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
rgb02 =
((r1b0g0r0 & 0xff) << 20) +
((r1b0g0r0 & 0xff00) << 2) +
@ -1874,54 +1846,6 @@ gdk_rgb_convert_565_d (GdkRgbInfo *image_info, GdkImage *image,
((rgb13 & 0x0f800000) << 4) |
((rgb13 & 0x0003f000) << 9) |
((rgb13 & 0x000000f8) << 13);
#else
rgb02 =
((r1b0g0r0 & 0xff000000) >> 4) +
((r1b0g0r0 & 0x00ff0000) >> 6) +
((r1b0g0r0 & 0x0000ff00) >> 8) +
dmp[x & (DM_WIDTH - 1)];
rgb02 += 0x10040100
- ((rgb02 & 0x1e0001e0) >> 5)
- ((rgb02 & 0x00070000) >> 6);
rgb13 =
((r1b0g0r0 & 0x000000ff) << 20) +
((g2r2b1g1 & 0xff000000) >> 14) +
((g2r2b1g1 & 0x00ff0000) >> 16) +
dmp[(x + 1) & (DM_WIDTH - 1)];
rgb13 += 0x10040100
- ((rgb13 & 0x1e0001e0) >> 5)
- ((rgb13 & 0x00070000) >> 6);
((guint32 *)obptr)[0] =
((rgb02 & 0x0f800000) << 4) |
((rgb02 & 0x0003f000) << 9) |
((rgb02 & 0x000000f8) << 13) |
((rgb13 & 0x0f800000) >> 12) |
((rgb13 & 0x0003f000) >> 7) |
((rgb13 & 0x000000f8) >> 3);
rgb02 =
((g2r2b1g1 & 0x0000ff00) << 12) +
((g2r2b1g1 & 0x000000ff) << 10) +
((b3g3r3b2 & 0xff000000) >> 24) +
dmp[(x + 2) & (DM_WIDTH - 1)];
rgb02 += 0x10040100
- ((rgb02 & 0x1e0001e0) >> 5)
- ((rgb02 & 0x00070000) >> 6);
rgb13 =
((b3g3r3b2 & 0x00ff0000) << 4) +
((b3g3r3b2 & 0x0000ff00) << 2) +
(b3g3r3b2 & 0x000000ff) +
dmp[(x + 3) & (DM_WIDTH - 1)];
rgb13 += 0x10040100
- ((rgb13 & 0x1e0001e0) >> 5)
- ((rgb13 & 0x00070000) >> 6);
((guint32 *)obptr)[1] =
((rgb02 & 0x0f800000) << 4) |
((rgb02 & 0x0003f000) << 9) |
((rgb02 & 0x000000f8) << 13) |
((rgb13 & 0x0f800000) >> 12) |
((rgb13 & 0x0003f000) >> 7) |
((rgb13 & 0x000000f8) >> 3);
#endif
bp2 += 12;
obptr += 8;
}
@ -1992,10 +1916,6 @@ gdk_rgb_convert_565_d (GdkRgbInfo *image_info, GdkImage *image,
}
#endif
#undef GDK_RGB_FAST_BE565_RGB
#undef GDK_RGB_FAST_BE565_GRAY
#undef GDK_RGB_FAST_BE565_DITHER
static void
gdk_rgb_convert_555 (GdkRgbInfo *image_info, GdkImage *image,
gint x0, gint y0, gint width, gint height,
@ -2322,68 +2242,6 @@ gdk_rgb_convert_8880_br (GdkRgbInfo *image_info, GdkImage *image,
}
}
#define DEFINE_GDK_RGB_CONVERT_101010(name, high, low, to_order) \
static void \
name (GdkRgbInfo *image_info, GdkImage *image, \
gint x0, gint y0, gint width, gint height, \
const guchar *buf, int rowstride, \
gint x_align, gint y_align, GdkRgbCmap *cmap) \
{ \
int y, w; \
guchar *obuf, *p; \
gint bpl; \
const guchar *bptr, *bp2; \
guint32 r, g, b; \
guint32 pixel; \
guint32 alpha_mask; \
\
alpha_mask = image_info->visual->depth == 32 ? 0xc0000000U : 0; \
\
bptr = buf; \
bpl = image->bpl; \
obuf = ((guchar *) image->mem) + y0 * bpl + x0 * 4; \
\
for (y = 0; y < height; y++) \
{ \
bp2 = bptr; \
p = obuf; \
w = width; \
\
while (w--) \
{ \
r = *bp2++; \
g = *bp2++; \
b = *bp2++; \
\
r = (r << 2) | (r >> 6); \
g = (g << 2) | (g >> 6); \
b = (b << 2) | (b >> 6); \
\
pixel = alpha_mask | \
(high << 20) | \
(g << 10) | \
low; \
\
*((guint32 *) p) = to_order (pixel); \
p += 4; \
} \
\
bptr += rowstride; \
obuf += bpl; \
} \
}
DEFINE_GDK_RGB_CONVERT_101010 (gdk_rgb_convert_101010_r_low_lsb,
b, r, GUINT32_TO_LE)
DEFINE_GDK_RGB_CONVERT_101010 (gdk_rgb_convert_101010_b_low_lsb,
r, b, GUINT32_TO_LE)
DEFINE_GDK_RGB_CONVERT_101010 (gdk_rgb_convert_101010_r_low_msb,
b, r, GUINT32_TO_BE)
DEFINE_GDK_RGB_CONVERT_101010 (gdk_rgb_convert_101010_b_low_msb,
r, b, GUINT32_TO_BE)
#undef DEFINE_GDK_RGB_CONVERT_101010
/* Generic truecolor/directcolor conversion function. Slow, but these
are oddball modes. */
static void
@ -2697,7 +2555,7 @@ gdk_rgb_convert_4_pack (GdkRgbInfo *image_info, GdkImage *image,
r = *bp2++;
g = *bp2++;
b = *bp2++;
dith = (dmp[(x_align + x) & (DM_WIDTH - 1)] << 2) | 3;
dith = (dmp[(x_align + x + 1) & (DM_WIDTH - 1)] << 2) | 3;
ix = (((r + dith) & 0x100) >> 2) |
(((g + 258 - dith) & 0x100) >> 5) |
(((b + dith) & 0x100) >> 8);
@ -2706,7 +2564,7 @@ gdk_rgb_convert_4_pack (GdkRgbInfo *image_info, GdkImage *image,
obptr++;
x++;
}
while (x + 1 < width)
while (x < width)
{
r = *bp2++;
g = *bp2++;
@ -2717,11 +2575,14 @@ gdk_rgb_convert_4_pack (GdkRgbInfo *image_info, GdkImage *image,
(((b + dith) & 0x100) >> 8);
pix0 = (colorcube_d[ix]);
x++;
if (x == width)
pix1 = (*obptr & 0x0F);
else
{
r = *bp2++;
g = *bp2++;
b = *bp2++;
dith = (dmp[(x_align + x) & (DM_WIDTH - 1)] << 2) | 3;
dith = (dmp[(x_align + x + 1) & (DM_WIDTH - 1)] << 2) | 3;
ix = (((r + dith) & 0x100) >> 2) |
(((g + 258 - dith) & 0x100) >> 5) |
(((b + dith) & 0x100) >> 8);
@ -2730,18 +2591,6 @@ gdk_rgb_convert_4_pack (GdkRgbInfo *image_info, GdkImage *image,
}
*obptr++ = (pix0 << 4) | pix1;
}
if (x < width)
{
r = *bp2++;
g = *bp2++;
b = *bp2++;
dith = (dmp[(x_align + x) & (DM_WIDTH - 1)] << 2) | 3;
ix = (((r + dith) & 0x100) >> 2) |
(((g + 258 - dith) & 0x100) >> 5) |
(((b + dith) & 0x100) >> 8);
pix0 = (colorcube_d[ix]);
*obptr = (pix0 << 4) | (*obptr & 0x0F);
}
bptr += rowstride;
obuf += bpl;
}
@ -3346,34 +3195,6 @@ gdk_rgb_select_conv (GdkRgbInfo *image_info)
#endif
}
#endif
else if (bpp == 32 && (depth == 30 || depth == 32) &&
vtype == GDK_VISUAL_TRUE_COLOR &&
byte_order == GDK_LSB_FIRST &&
red_mask == 0x000003ff &&
green_mask == 0x000ffc00 &&
blue_mask == 0x3ff00000)
conv = gdk_rgb_convert_101010_r_low_lsb;
else if (bpp == 32 && (depth == 30 || depth == 32) &&
vtype == GDK_VISUAL_TRUE_COLOR &&
byte_order == GDK_LSB_FIRST &&
red_mask == 0x3ff00000 &&
green_mask == 0x000ffc00 &&
blue_mask == 0x000003ff)
conv = gdk_rgb_convert_101010_b_low_lsb;
else if (bpp == 32 && (depth == 30 || depth == 32) &&
vtype == GDK_VISUAL_TRUE_COLOR &&
byte_order == GDK_MSB_FIRST &&
red_mask == 0x000003ff &&
green_mask == 0x000ffc00 &&
blue_mask == 0x3ff00000)
conv = gdk_rgb_convert_101010_r_low_msb;
else if (bpp == 32 && (depth == 30 || depth == 32) &&
vtype == GDK_VISUAL_TRUE_COLOR &&
byte_order == GDK_MSB_FIRST &&
red_mask == 0x3ff00000 &&
green_mask == 0x000ffc00 &&
blue_mask == 0x000003ff)
conv = gdk_rgb_convert_101010_b_low_msb;
else if (vtype == GDK_VISUAL_TRUE_COLOR && byte_order == GDK_LSB_FIRST)
{
conv = gdk_rgb_convert_truecolor_lsb;
@ -3440,7 +3261,7 @@ gdk_rgb_select_conv (GdkRgbInfo *image_info)
conv = gdk_rgb_convert_gray4_pack;
conv_d = gdk_rgb_convert_gray4_d_pack;
}
else if (bpp == 4 && depth <= 4 && depth >= 2 &&
else if (bpp == 4 && depth == 4 &&
vtype == GDK_VISUAL_STATIC_COLOR)
conv = gdk_rgb_convert_4_pack;

View file

@ -147,48 +147,6 @@ gboolean gdk_rgb_colormap_ditherable (GdkColormap *cmap);
#endif
#endif /* GDK_DISABLE_DEPRECATED */
void gdk_draw_rgb_48_image (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
gint width,
gint height,
GdkRgbDither dith,
const guint16 *rgb_buf,
gint rowstride);
void gdk_draw_rgb_48_image_dithalign (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
gint width,
gint height,
GdkRgbDither dith,
const guint16 *rgb_buf,
gint rowstride,
gint xdith,
gint ydith);
void gdk_draw_rgbx_64_image (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
gint width,
gint height,
GdkRgbDither dith,
const guint16 *rgbx_buf,
gint rowstride);
void gdk_draw_rgbx_64_image_dithalign
(GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
gint width,
gint height,
GdkRgbDither dith,
const guint16 *rgbx_buf,
gint rowstride,
gint xdith,
gint ydith);
G_END_DECLS

View file

@ -1,742 +0,0 @@
/* GTK - The GIMP Toolkit
* High-precision GdkRGB image conversion
*
* 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.
*/
#include "config.h"
#include <string.h>
#include "gdkinternals.h"
#include "gdkrgb.h"
#include "gdkscreen.h"
#include "gdkalias.h"
typedef void (*GdkRgb16ConvFunc) (GdkImage *image,
gint x0,
gint y0,
gint width,
gint height,
const guint16 *buf,
gint rowstride);
#define GDK_RGB16_STORE_RGB(p, r, g, b, a) G_STMT_START { \
(p)[0] = (r) >> 8; \
(p)[1] = (g) >> 8; \
(p)[2] = (b) >> 8; \
(p) += 3; \
} G_STMT_END
#define GDK_RGB16_STORE_BGR(p, r, g, b, a) G_STMT_START { \
(p)[0] = (b) >> 8; \
(p)[1] = (g) >> 8; \
(p)[2] = (r) >> 8; \
(p) += 3; \
} G_STMT_END
#define GDK_RGB16_STORE_BGRA(p, r, g, b, a) G_STMT_START { \
(p)[0] = (b) >> 8; \
(p)[1] = (g) >> 8; \
(p)[2] = (r) >> 8; \
(p)[3] = 0xff; \
(p) += 4; \
} G_STMT_END
#define GDK_RGB16_STORE_ARGB(p, r, g, b, a) G_STMT_START { \
(p)[0] = 0xff; \
(p)[1] = (r) >> 8; \
(p)[2] = (g) >> 8; \
(p)[3] = (b) >> 8; \
(p) += 4; \
} G_STMT_END
#define GDK_RGB16_STORE_RGB0_NATIVE(p, r, g, b, a) G_STMT_START { \
guint32 pixel__ = (((b) >> 8) << 16) | \
(((g) >> 8) << 8) | \
((r) >> 8); \
memcpy ((p), &pixel__, sizeof (pixel__)); \
(p) += 4; \
} G_STMT_END
#define GDK_RGB16_STORE_565(p, r, g, b, a) G_STMT_START { \
guint16 pixel__ = ((r) & 0xf800) | \
(((g) & 0xfc00) >> 5) | \
((b) >> 11); \
memcpy ((p), &pixel__, sizeof (pixel__)); \
(p) += 2; \
} G_STMT_END
#define GDK_RGB16_STORE_565_BR(p, r, g, b, a) G_STMT_START { \
guint16 pixel__ = ((r) & 0xf800) | \
(((g) & 0xfc00) >> 5) | \
((b) >> 11); \
pixel__ = (pixel__ >> 8) | (pixel__ << 8); \
memcpy ((p), &pixel__, sizeof (pixel__)); \
(p) += 2; \
} G_STMT_END
#define GDK_RGB16_STORE_555(p, r, g, b, a) G_STMT_START { \
guint16 pixel__ = (((r) & 0xf800) >> 1) | \
(((g) & 0xf800) >> 6) | \
((b) >> 11); \
memcpy ((p), &pixel__, sizeof (pixel__)); \
(p) += 2; \
} G_STMT_END
#define GDK_RGB16_STORE_555_BR(p, r, g, b, a) G_STMT_START { \
guint16 pixel__ = (((r) & 0xf800) >> 1) | \
(((g) & 0xf800) >> 6) | \
((b) >> 11); \
pixel__ = (pixel__ >> 8) | (pixel__ << 8); \
memcpy ((p), &pixel__, sizeof (pixel__)); \
(p) += 2; \
} G_STMT_END
#define GDK_RGB16_STORE_101010_R_LOW_LE(p, r, g, b, a) \
G_STMT_START { \
guint32 pixel__ = (a) | \
(((b) >> 6) << 20) | \
(((g) >> 6) << 10) | \
((r) >> 6); \
pixel__ = GUINT32_TO_LE (pixel__); \
memcpy ((p), &pixel__, sizeof (pixel__)); \
(p) += 4; \
} G_STMT_END
#define GDK_RGB16_STORE_101010_B_LOW_LE(p, r, g, b, a) \
G_STMT_START { \
guint32 pixel__ = (a) | \
(((r) >> 6) << 20) | \
(((g) >> 6) << 10) | \
((b) >> 6); \
pixel__ = GUINT32_TO_LE (pixel__); \
memcpy ((p), &pixel__, sizeof (pixel__)); \
(p) += 4; \
} G_STMT_END
#define GDK_RGB16_STORE_101010_R_LOW_BE(p, r, g, b, a) \
G_STMT_START { \
guint32 pixel__ = (a) | \
(((b) >> 6) << 20) | \
(((g) >> 6) << 10) | \
((r) >> 6); \
pixel__ = GUINT32_TO_BE (pixel__); \
memcpy ((p), &pixel__, sizeof (pixel__)); \
(p) += 4; \
} G_STMT_END
#define GDK_RGB16_STORE_101010_B_LOW_BE(p, r, g, b, a) \
G_STMT_START { \
guint32 pixel__ = (a) | \
(((r) >> 6) << 20) | \
(((g) >> 6) << 10) | \
((b) >> 6); \
pixel__ = GUINT32_TO_BE (pixel__); \
memcpy ((p), &pixel__, sizeof (pixel__)); \
(p) += 4; \
} G_STMT_END
#define DEFINE_GDK_RGB16_CONVERTER(name, words, pixel_bytes, store) \
static void \
name (GdkImage *image, \
gint x0, \
gint y0, \
gint width, \
gint height, \
const guint16 *buf, \
gint rowstride) \
{ \
const guchar *row; \
const guint16 *src; \
guchar *dst_row; \
guchar *dst; \
guint32 r, g, b; \
guint32 alpha_mask; \
gint x, y; \
\
row = (const guchar *) buf; \
dst_row = ((guchar *) image->mem) + \
y0 * image->bpl + x0 * (pixel_bytes); \
alpha_mask = image->depth == 32 ? 0xc0000000U : 0; \
(void) alpha_mask; \
\
for (y = 0; y < height; y++) \
{ \
src = (const guint16 *) row; \
dst = dst_row; \
\
for (x = 0; x < width; x++) \
{ \
r = src[0]; \
g = src[1]; \
b = src[2]; \
src += (words); \
store (dst, r, g, b, alpha_mask); \
} \
\
row += rowstride; \
dst_row += image->bpl; \
} \
}
#define DEFINE_GDK_RGB16_PAIR(suffix, pixel_bytes, store) \
DEFINE_GDK_RGB16_CONVERTER (gdk_rgb48_convert_ ## suffix, \
3, pixel_bytes, store) \
DEFINE_GDK_RGB16_CONVERTER (gdk_rgbx64_convert_ ## suffix, \
4, pixel_bytes, store)
DEFINE_GDK_RGB16_PAIR (rgb, 3, GDK_RGB16_STORE_RGB)
DEFINE_GDK_RGB16_PAIR (bgr, 3, GDK_RGB16_STORE_BGR)
DEFINE_GDK_RGB16_PAIR (bgra, 4, GDK_RGB16_STORE_BGRA)
DEFINE_GDK_RGB16_PAIR (argb, 4, GDK_RGB16_STORE_ARGB)
DEFINE_GDK_RGB16_PAIR (rgb0_native, 4, GDK_RGB16_STORE_RGB0_NATIVE)
DEFINE_GDK_RGB16_PAIR (565, 2, GDK_RGB16_STORE_565)
DEFINE_GDK_RGB16_PAIR (565_br, 2, GDK_RGB16_STORE_565_BR)
DEFINE_GDK_RGB16_PAIR (555, 2, GDK_RGB16_STORE_555)
DEFINE_GDK_RGB16_PAIR (555_br, 2, GDK_RGB16_STORE_555_BR)
DEFINE_GDK_RGB16_PAIR (101010_r_low_le, 4,
GDK_RGB16_STORE_101010_R_LOW_LE)
DEFINE_GDK_RGB16_PAIR (101010_b_low_le, 4,
GDK_RGB16_STORE_101010_B_LOW_LE)
DEFINE_GDK_RGB16_PAIR (101010_r_low_be, 4,
GDK_RGB16_STORE_101010_R_LOW_BE)
DEFINE_GDK_RGB16_PAIR (101010_b_low_be, 4,
GDK_RGB16_STORE_101010_B_LOW_BE)
#undef DEFINE_GDK_RGB16_PAIR
#undef DEFINE_GDK_RGB16_CONVERTER
#undef GDK_RGB16_STORE_RGB
#undef GDK_RGB16_STORE_BGR
#undef GDK_RGB16_STORE_BGRA
#undef GDK_RGB16_STORE_ARGB
#undef GDK_RGB16_STORE_RGB0_NATIVE
#undef GDK_RGB16_STORE_565
#undef GDK_RGB16_STORE_565_BR
#undef GDK_RGB16_STORE_555
#undef GDK_RGB16_STORE_555_BR
#undef GDK_RGB16_STORE_101010_R_LOW_LE
#undef GDK_RGB16_STORE_101010_B_LOW_LE
#undef GDK_RGB16_STORE_101010_R_LOW_BE
#undef GDK_RGB16_STORE_101010_B_LOW_BE
static GdkRgb16ConvFunc
gdk_rgb16_select_converter (GdkDrawable *drawable,
gboolean is_rgbx,
GdkRgbDither dith)
{
GdkVisual *visual;
GdkByteOrder byte_order;
GdkScreen *screen;
guint32 red_mask, green_mask, blue_mask;
gint depth;
gint bits_per_pixel;
gboolean byte_reversed;
gboolean mask_rgb;
gboolean mask_bgr;
#define SELECT_PAIR(suffix) \
return is_rgbx ? gdk_rgbx64_convert_ ## suffix \
: gdk_rgb48_convert_ ## suffix
/*
* Preserve the existing GdkRGB dither path for maximum dithering
* and for unknown future values.
*/
if (dith != GDK_RGB_DITHER_NONE &&
dith != GDK_RGB_DITHER_NORMAL)
return NULL;
visual = gdk_drawable_get_visual (drawable);
if (visual == NULL)
return NULL;
if (gdk_visual_get_visual_type (visual) != GDK_VISUAL_TRUE_COLOR)
return NULL;
screen = gdk_visual_get_screen (visual);
depth = gdk_visual_get_depth (visual);
byte_order = gdk_visual_get_byte_order (visual);
gdk_visual_get_red_pixel_details (visual, &red_mask, NULL, NULL);
gdk_visual_get_green_pixel_details (visual, &green_mask, NULL, NULL);
gdk_visual_get_blue_pixel_details (visual, &blue_mask, NULL, NULL);
bits_per_pixel = _gdk_windowing_get_bits_for_depth
(gdk_screen_get_display (screen), depth);
#if G_BYTE_ORDER == G_BIG_ENDIAN
byte_reversed = byte_order == GDK_LSB_FIRST;
#else
byte_reversed = byte_order == GDK_MSB_FIRST;
#endif
mask_rgb = red_mask == 0xff0000 &&
green_mask == 0x00ff00 &&
blue_mask == 0x0000ff;
mask_bgr = red_mask == 0x0000ff &&
green_mask == 0x00ff00 &&
blue_mask == 0xff0000;
if (bits_per_pixel == 16 &&
depth == 16 &&
red_mask == 0xf800 &&
green_mask == 0x07e0 &&
blue_mask == 0x001f)
{
if (byte_reversed)
SELECT_PAIR (565_br);
SELECT_PAIR (565);
}
if (bits_per_pixel == 16 &&
depth == 15 &&
red_mask == 0x7c00 &&
green_mask == 0x03e0 &&
blue_mask == 0x001f)
{
if (byte_reversed)
SELECT_PAIR (555_br);
SELECT_PAIR (555);
}
if (bits_per_pixel == 24 &&
depth == 24 &&
((mask_rgb && byte_order == GDK_LSB_FIRST) ||
(mask_bgr && byte_order == GDK_MSB_FIRST)))
SELECT_PAIR (bgr);
if (bits_per_pixel == 24 &&
depth == 24 &&
((mask_rgb && byte_order == GDK_MSB_FIRST) ||
(mask_bgr && byte_order == GDK_LSB_FIRST)))
SELECT_PAIR (rgb);
if (bits_per_pixel == 32 &&
(depth == 24 || depth == 32) &&
mask_rgb &&
byte_order == GDK_MSB_FIRST)
SELECT_PAIR (argb);
if (bits_per_pixel == 32 &&
(depth == 24 || depth == 32) &&
mask_rgb &&
byte_order == GDK_LSB_FIRST)
SELECT_PAIR (bgra);
#if G_BYTE_ORDER == G_BIG_ENDIAN
if (bits_per_pixel == 32 &&
depth == 24 &&
mask_bgr &&
byte_order == GDK_MSB_FIRST)
SELECT_PAIR (rgb0_native);
#else
if (bits_per_pixel == 32 &&
depth == 24 &&
mask_bgr &&
byte_order == GDK_LSB_FIRST)
SELECT_PAIR (rgb0_native);
#endif
if (bits_per_pixel == 32 &&
(depth == 30 || depth == 32) &&
byte_order == GDK_LSB_FIRST &&
red_mask == 0x000003ff &&
green_mask == 0x000ffc00 &&
blue_mask == 0x3ff00000)
SELECT_PAIR (101010_r_low_le);
if (bits_per_pixel == 32 &&
(depth == 30 || depth == 32) &&
byte_order == GDK_LSB_FIRST &&
red_mask == 0x3ff00000 &&
green_mask == 0x000ffc00 &&
blue_mask == 0x000003ff)
SELECT_PAIR (101010_b_low_le);
if (bits_per_pixel == 32 &&
(depth == 30 || depth == 32) &&
byte_order == GDK_MSB_FIRST &&
red_mask == 0x000003ff &&
green_mask == 0x000ffc00 &&
blue_mask == 0x3ff00000)
SELECT_PAIR (101010_r_low_be);
if (bits_per_pixel == 32 &&
(depth == 30 || depth == 32) &&
byte_order == GDK_MSB_FIRST &&
red_mask == 0x3ff00000 &&
green_mask == 0x000ffc00 &&
blue_mask == 0x000003ff)
SELECT_PAIR (101010_b_low_be);
#undef SELECT_PAIR
return NULL;
}
static void
gdk_rgb16_draw_direct (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
gint width,
gint height,
const guint16 *buf,
gint pixel_words,
gint rowstride,
GdkRgb16ConvFunc converter)
{
GdkScreen *screen;
GdkImage *image;
const guint16 *tile;
gint depth;
gint x0, y0;
gint xs0, ys0;
gint width1, height1;
screen = gdk_drawable_get_screen (drawable);
depth = gdk_drawable_get_depth (drawable);
for (y0 = 0; y0 < height; y0 += GDK_SCRATCH_IMAGE_HEIGHT)
{
height1 = MIN (height - y0, GDK_SCRATCH_IMAGE_HEIGHT);
for (x0 = 0; x0 < width; x0 += GDK_SCRATCH_IMAGE_WIDTH)
{
width1 = MIN (width - x0, GDK_SCRATCH_IMAGE_WIDTH);
tile = (const guint16 *)
((const guchar *) buf +
y0 * rowstride +
x0 * pixel_words * sizeof (guint16));
image = _gdk_image_get_scratch (screen,
width1,
height1,
depth,
&xs0,
&ys0);
converter (image,
xs0,
ys0,
width1,
height1,
tile,
rowstride);
gdk_draw_image (drawable,
gc,
image,
xs0,
ys0,
x + x0,
y + y0,
width1,
height1);
}
}
}
static void
gdk_rgb16_draw_fallback (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
gint width,
gint height,
GdkRgbDither dith,
const guint16 *buf,
gint pixel_words,
gint rowstride,
gint xdith,
gint ydith)
{
const guchar *input_row;
const guint16 *input;
guchar *stage;
guchar *output;
gint stage_rowstride;
gint x0, y0;
gint x1, y1;
gint width1, height1;
stage = g_malloc (MIN (width, GDK_SCRATCH_IMAGE_WIDTH) *
MIN (height, GDK_SCRATCH_IMAGE_HEIGHT) * 3);
for (y0 = 0; y0 < height; y0 += GDK_SCRATCH_IMAGE_HEIGHT)
{
height1 = MIN (height - y0, GDK_SCRATCH_IMAGE_HEIGHT);
for (x0 = 0; x0 < width; x0 += GDK_SCRATCH_IMAGE_WIDTH)
{
width1 = MIN (width - x0, GDK_SCRATCH_IMAGE_WIDTH);
stage_rowstride = width1 * 3;
input_row = (const guchar *) buf +
y0 * rowstride +
x0 * pixel_words * sizeof (guint16);
output = stage;
for (y1 = 0; y1 < height1; y1++)
{
input = (const guint16 *) input_row;
for (x1 = 0; x1 < width1; x1++)
{
*output++ = input[0] >> 8;
*output++ = input[1] >> 8;
*output++ = input[2] >> 8;
input += pixel_words;
}
input_row += rowstride;
}
gdk_draw_rgb_image_dithalign (drawable,
gc,
x + x0,
y + y0,
width1,
height1,
dith,
stage,
stage_rowstride,
xdith,
ydith);
}
}
g_free (stage);
}
static void
gdk_draw_rgb16_image (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
gint width,
gint height,
GdkRgbDither dith,
const guint16 *buf,
gint rowstride,
gint xdith,
gint ydith,
gboolean is_rgbx)
{
GdkRgb16ConvFunc converter;
gint pixel_words;
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
g_return_if_fail (GDK_IS_GC (gc));
g_return_if_fail (buf != NULL);
g_return_if_fail ((((guintptr) buf) & 1) == 0);
g_return_if_fail ((rowstride & 1) == 0);
if (width <= 0 || height <= 0)
return;
pixel_words = is_rgbx ? 4 : 3;
converter = gdk_rgb16_select_converter (drawable, is_rgbx, dith);
if (converter != NULL)
gdk_rgb16_draw_direct (drawable,
gc,
x,
y,
width,
height,
buf,
pixel_words,
rowstride,
converter);
else
gdk_rgb16_draw_fallback (drawable,
gc,
x,
y,
width,
height,
dith,
buf,
pixel_words,
rowstride,
xdith,
ydith);
}
/**
* gdk_draw_rgb_48_image:
* @drawable: a #GdkDrawable
* @gc: a #GdkGC
* @x: destination X coordinate
* @y: destination Y coordinate
* @width: image width
* @height: image height
* @dith: dithering mode
* @rgb_buf: host-endian RGB data with three 16-bit channels per pixel
* @rowstride: number of bytes between consecutive rows
*
* Draws 48-bit RGB image data.
**/
void
gdk_draw_rgb_48_image (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
gint width,
gint height,
GdkRgbDither dith,
const guint16 *rgb_buf,
gint rowstride)
{
gdk_draw_rgb16_image (drawable,
gc,
x,
y,
width,
height,
dith,
rgb_buf,
rowstride,
0,
0,
FALSE);
}
/**
* gdk_draw_rgb_48_image_dithalign:
* @drawable: a #GdkDrawable
* @gc: a #GdkGC
* @x: destination X coordinate
* @y: destination Y coordinate
* @width: image width
* @height: image height
* @dith: dithering mode
* @rgb_buf: host-endian RGB data with three 16-bit channels per pixel
* @rowstride: number of bytes between consecutive rows
* @xdith: X dither offset
* @ydith: Y dither offset
*
* Draws 48-bit RGB image data with explicit dither alignment.
**/
void
gdk_draw_rgb_48_image_dithalign (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
gint width,
gint height,
GdkRgbDither dith,
const guint16 *rgb_buf,
gint rowstride,
gint xdith,
gint ydith)
{
gdk_draw_rgb16_image (drawable,
gc,
x,
y,
width,
height,
dith,
rgb_buf,
rowstride,
xdith,
ydith,
FALSE);
}
/**
* gdk_draw_rgbx_64_image:
* @drawable: a #GdkDrawable
* @gc: a #GdkGC
* @x: destination X coordinate
* @y: destination Y coordinate
* @width: image width
* @height: image height
* @dith: dithering mode
* @rgbx_buf: host-endian RGBX data with four 16-bit channels per pixel
* @rowstride: number of bytes between consecutive rows
*
* Draws 64-bit RGBX image data. The X channel is ignored.
**/
void
gdk_draw_rgbx_64_image (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
gint width,
gint height,
GdkRgbDither dith,
const guint16 *rgbx_buf,
gint rowstride)
{
gdk_draw_rgb16_image (drawable,
gc,
x,
y,
width,
height,
dith,
rgbx_buf,
rowstride,
0,
0,
TRUE);
}
/**
* gdk_draw_rgbx_64_image_dithalign:
* @drawable: a #GdkDrawable
* @gc: a #GdkGC
* @x: destination X coordinate
* @y: destination Y coordinate
* @width: image width
* @height: image height
* @dith: dithering mode
* @rgbx_buf: host-endian RGBX data with four 16-bit channels per pixel
* @rowstride: number of bytes between consecutive rows
* @xdith: X dither offset
* @ydith: Y dither offset
*
* Draws 64-bit RGBX image data with explicit dither alignment.
* The X channel is ignored.
**/
void
gdk_draw_rgbx_64_image_dithalign (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
gint width,
gint height,
GdkRgbDither dith,
const guint16 *rgbx_buf,
gint rowstride,
gint xdith,
gint ydith)
{
gdk_draw_rgb16_image (drawable,
gc,
x,
y,
width,
height,
dith,
rgbx_buf,
rowstride,
xdith,
ydith,
TRUE);
}
#define __GDK_RGB16_C__
#include "gdkaliasdef.c"

View file

@ -92,7 +92,6 @@ gdk_OBJECTS = \
gdkrectangle.obj \
gdkregion-generic.obj \
gdkrgb.obj \
gdkrgb16.obj \
gdkscreen.obj \
gdkselection.obj \
gdkvisual.obj \

View file

@ -14,7 +14,7 @@ print <<EOF;
#include <glib.h>
#if defined(G_HAVE_GNUC_VISIBILITY) && !defined(__APPLE__)
#ifdef G_HAVE_GNUC_VISIBILITY
EOF

View file

@ -599,25 +599,6 @@
gdk_screen_get_rgba_colormap (_gdk_screen);
}
-(void)viewWillDraw
{
/* macOS 11 (Big Sur) and newer may use a higher precision backing
* format for layer contents. For GTK2's 8-bit drawing this can add
* avoidable conversion overhead. Use a dynamic Objective-C call here
* instead of a hard QuartzCore/CALayer dependency, so old SDKs and old
* macOS targets keep building and keep their old behaviour.
*/
if (gdk_quartz_osx_version () >= GDK_OSX_BIG_SUR)
{
id layer = [self layer];
if (layer && [layer respondsToSelector: @selector(setContentsFormat:)])
[layer setValue: @"RGBA8Uint" forKey: @"contentsFormat"];
}
[super viewWillDraw];
}
-(void)drawRect: (NSRect)rect
{
GdkRectangle gdk_rect;

View file

@ -893,8 +893,7 @@ gdk_quartz_drawable_release_context (GdkDrawable *drawable,
if (window_impl->in_paint_rect_count == 0)
{
_gdk_quartz_drawable_flush (drawable);
if (gdk_quartz_osx_version () < GDK_OSX_MOJAVE)
[window_impl->view unlockFocus];
[window_impl->view unlockFocus];
}
}
else if (GDK_IS_PIXMAP_IMPL_QUARTZ (drawable))

View file

@ -34,20 +34,9 @@ gdk_quartz_osx_version (void)
if (minor == GDK_OSX_UNSUPPORTED)
{
gint32 major = GDK_OSX_UNSUPPORTED;
OSErr err = Gestalt (gestaltSystemVersionMajor, (SInt32*)&major);
OSErr err = Gestalt (gestaltSystemVersionMinor, (SInt32*)&minor);
g_return_val_if_fail (err == noErr, GDK_OSX_UNSUPPORTED);
err = Gestalt (gestaltSystemVersionMinor, (SInt32*)&minor);
g_return_val_if_fail (err == noErr, GDK_OSX_UNSUPPORTED);
/* GTK2 encodes macOS 10.x releases by their minor version.
* Map macOS 11+ into the same sequence:
* 11 -> 16, 12 -> 17, 13 -> 18, ...
*/
if (major > 10)
minor = major + 5;
}
if (minor < GDK_OSX_MIN)

View file

@ -54,13 +54,7 @@ typedef enum
GDK_OSX_SIERRA = 12,
GDK_OSX_HIGH_SIERRA = 13,
GDK_OSX_MOJAVE = 14,
GDK_OSX_CATALINA = 15,
GDK_OSX_BIG_SUR = 16,
GDK_OSX_MONTEREY = 17,
GDK_OSX_VENTURA = 18,
GDK_OSX_SONOMA = 19,
GDK_OSX_SEQUOIA = 20,
GDK_OSX_CURRENT = 20,
GDK_OSX_CURRENT = 14,
GDK_OSX_NEW = 99
} GdkOSXVersion;

View file

@ -104,8 +104,7 @@ gdk_window_impl_quartz_get_context (GdkDrawable *drawable,
* and for widgets that send fake expose events like the arrow
* buttons in spinbuttons or the position marker in rulers.
*/
if (window_impl->in_paint_rect_count == 0 &&
gdk_quartz_osx_version () < GDK_OSX_MOJAVE)
if (window_impl->in_paint_rect_count == 0)
{
if (![window_impl->view lockFocusIfCanDraw])
return NULL;
@ -469,8 +468,7 @@ _gdk_windowing_before_process_all_updates (void)
{
in_process_all_updates = TRUE;
if (gdk_quartz_osx_version () < GDK_OSX_MOJAVE)
NSDisableScreenUpdates ();
NSDisableScreenUpdates ();
}
void
@ -491,9 +489,8 @@ _gdk_windowing_after_process_all_updates (void)
/* 10.14 needs to be told that the view needs to be redrawn, see
* https://gitlab.gnome.org/GNOME/gtk/issues/1479 */
if (gdk_quartz_osx_version () >= GDK_OSX_MOJAVE &&
gdk_quartz_osx_version () < GDK_OSX_BIG_SUR)
[[nswindow contentView] setNeedsDisplay:YES];
if (gdk_quartz_osx_version() >= GDK_OSX_MOJAVE)
[[nswindow contentView] setNeedsDisplay:YES];
[nswindow enableFlushWindow];
[nswindow flushWindow];
[nswindow release];
@ -505,8 +502,7 @@ _gdk_windowing_after_process_all_updates (void)
in_process_all_updates = FALSE;
if (gdk_quartz_osx_version () < GDK_OSX_MOJAVE)
NSEnableScreenUpdates ();
NSEnableScreenUpdates ();
}
static void

View file

@ -692,7 +692,6 @@ update_keymap (GdkKeymap *gdk_keymap)
if (hkls_len != keymap->layout_handles->len)
keymap->keysym_tab = g_renew (guint, keymap->keysym_tab, keysym_tab_size);
memset (key_state, 0, sizeof(key_state));
memset (keymap->keysym_tab, 0, keysym_tab_size);
g_array_set_size (keymap->layout_handles, hkls_len);
g_array_set_size (keymap->options, hkls_len);

View file

@ -2767,10 +2767,6 @@ _gdk_windowing_window_at_pointer (GdkDisplay *display,
* WindowFromPoint() can find our windows, we follow similar logic
* here, and ignore invisible and disabled windows.
*/
UINT cwp_flags = CWP_SKIPDISABLED |
CWP_SKIPINVISIBLE |
CWP_SKIPTRANSPARENT;
hwnd = GetDesktopWindow ();
do {
window = gdk_win32_handle_table_lookup ((GdkNativeWindow) hwnd);
@ -2781,7 +2777,8 @@ _gdk_windowing_window_at_pointer (GdkDisplay *display,
break;
screen_to_client (hwnd, screen_pt, &client_pt);
hwndc = ChildWindowFromPointEx (hwnd, client_pt, cwp_flags);
hwndc = ChildWindowFromPointEx (hwnd, client_pt, CWP_SKIPDISABLED |
CWP_SKIPINVISIBLE);
/* Verify that we're really inside the client area of the window */
if (hwndc != hwnd)
@ -2792,8 +2789,6 @@ _gdk_windowing_window_at_pointer (GdkDisplay *display,
hwndc = hwnd;
}
/* Only ignore top-level transparent windows */
cwp_flags &= ~CWP_SKIPTRANSPARENT;
} while (hwndc != hwnd && (hwnd = hwndc, 1));
}

View file

@ -1139,7 +1139,7 @@ $(GTK_UPDATE_ICON_CACHE_MANIFEST):
echo '</assembly>' ) >$@
$(GTK_UPDATE_ICON_CACHE_RC):
(echo -e '#include <winbase.h>\nCREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "'$(GTK_UPDATE_ICON_CACHE_MANIFEST)'"') >$@
(echo -e '#include <winbase.h>\nCREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST '$(GTK_UPDATE_ICON_CACHE_MANIFEST)) >$@
$(GTK_UPDATE_ICON_CACHE_MANIFEST_OBJECT): $(GTK_UPDATE_ICON_CACHE_RC) $(GTK_UPDATE_ICON_CACHE_MANIFEST)
$(WINDRES) --input $< --output $@ --output-format=coff

View file

@ -40,9 +40,6 @@
#include "gtktoolbar.h"
#include <gobject/gobjectnotifyqueue.c>
#include <gobject/gvaluecollector.h>
#ifdef GDK_WINDOWING_QUARTZ
#include "gdk/quartz/gdkquartz.h"
#endif
#include "gtkalias.h"
@ -1360,16 +1357,7 @@ gtk_container_idle_sizer (gpointer data)
gtk_container_check_resize (GTK_CONTAINER (widget));
}
#ifdef GDK_WINDOWING_QUARTZ
/* macOS 11 and newer can trigger expensive full-window redraws here.
* Keep the traditional update processing path for older Quartz targets,
* but let the normal GDK update idle handle updates on Big Sur and newer.
*/
if (gdk_quartz_osx_version () < GDK_OSX_BIG_SUR)
gdk_window_process_all_updates ();
#else
gdk_window_process_all_updates ();
#endif
return FALSE;
}

View file

@ -2945,10 +2945,6 @@ icon_info_ensure_scale_and_pixbuf (GtkIconInfo *icon_info,
if (mime_type && strcmp (mime_type, "image/svg+xml") == 0)
is_svg = TRUE;
#ifdef G_OS_WIN32
else if (content_type && strcmp (content_type, ".svg") == 0)
is_svg = TRUE;
#endif
}
g_object_unref (file_info);

View file

@ -309,249 +309,6 @@ add_builtin_module (const gchar *module_name,
return module;
}
/*
* Pango deprecated its configuration-file parser helpers in 1.38.
* Use a local implementation with newer Pango, while retaining the
* original Pango functions as a compile-time fallback for old systems.
*/
#if defined(PANGO_VERSION_CHECK)
#if PANGO_VERSION_CHECK(1, 38, 0)
#define GTK_IM_MODULE_USE_LOCAL_PARSER
#endif
#endif
#ifndef GTK_IM_MODULE_USE_LOCAL_PARSER
#define gtk_im_module_read_line pango_read_line
#define gtk_im_module_skip_space pango_skip_space
#define gtk_im_module_scan_string pango_scan_string
#else
/*
* Use one stdio lock per logical line where unlocked input functions
* are available. Selection is entirely compile-time.
*/
#if defined(HAVE_FLOCKFILE) && \
defined(HAVE_FUNLOCKFILE) && \
defined(HAVE_GETC_UNLOCKED)
#define GTK_IM_MODULE_LOCK(stream) flockfile (stream)
#define GTK_IM_MODULE_UNLOCK(stream) funlockfile (stream)
#define GTK_IM_MODULE_GETC(stream) getc_unlocked (stream)
#elif defined(HAVE__LOCK_FILE) && \
defined(HAVE__UNLOCK_FILE) && \
defined(HAVE__GETC_NOLOCK)
#define GTK_IM_MODULE_LOCK(stream) _lock_file (stream)
#define GTK_IM_MODULE_UNLOCK(stream) _unlock_file (stream)
#define GTK_IM_MODULE_GETC(stream) _getc_nolock (stream)
#else
#define GTK_IM_MODULE_LOCK(stream) ((void) 0)
#define GTK_IM_MODULE_UNLOCK(stream) ((void) 0)
#define GTK_IM_MODULE_GETC(stream) getc (stream)
#endif
static gboolean
gtk_im_module_scan_string (const gchar **pos,
GString *out)
{
const gchar *p;
const gchar *q;
const gchar *src;
gchar *dst;
gchar c;
p = *pos;
while (g_ascii_isspace (*p))
p++;
if (*p != '"')
return FALSE;
p++;
q = p;
while (*q != '\0')
{
if (*q == '"')
break;
if (*q == '\\')
{
q++;
if (*q == '\0')
return FALSE;
}
q++;
}
if (*q != '"')
return FALSE;
/*
* The decoded representation can never be longer than the quoted
* input. Resize the reusable GString once and decode directly into it.
*/
g_string_set_size (out, q - p);
src = p;
dst = out->str;
while (src < q)
{
c = *src++;
if (c != '\\')
{
*dst++ = c;
continue;
}
c = *src++;
switch (c)
{
case 'b':
c = '\b';
break;
case 'f':
c = '\f';
break;
case 'n':
c = '\n';
break;
case 'r':
c = '\r';
break;
case 't':
c = '\t';
break;
case 'v':
c = '\v';
break;
default:
/* Also handles escaped quotes and backslashes. */
break;
}
*dst++ = c;
}
g_string_truncate (out, dst - out->str);
*pos = q + 1;
return TRUE;
}
static gboolean
gtk_im_module_skip_space (const gchar **pos)
{
const gchar *p;
p = *pos;
while (g_ascii_isspace (*p))
p++;
*pos = p;
return *p != '\0';
}
static gint
gtk_im_module_read_line (FILE *stream,
GString *str)
{
gboolean escaped;
gboolean comment;
gint n_read;
gint lines;
gint c;
gint next_c;
escaped = FALSE;
comment = FALSE;
n_read = 0;
lines = 1;
GTK_IM_MODULE_LOCK (stream);
g_string_truncate (str, 0);
while (TRUE)
{
c = GTK_IM_MODULE_GETC (stream);
if (c == EOF)
{
if (escaped)
g_string_append_c (str, '\\');
break;
}
n_read++;
if (c == '\r' || c == '\n')
{
next_c = GTK_IM_MODULE_GETC (stream);
if (next_c != EOF &&
!((c == '\r' && next_c == '\n') ||
(c == '\n' && next_c == '\r')))
ungetc (next_c, stream);
if (escaped)
{
escaped = FALSE;
lines++;
continue;
}
break;
}
if (escaped)
{
escaped = FALSE;
if (c == '#')
g_string_append_c (str, '#');
else
{
g_string_append_c (str, '\\');
g_string_append_c (str, c);
}
}
else if (!comment)
{
if (c == '#')
comment = TRUE;
else if (c == '\\')
escaped = TRUE;
else
g_string_append_c (str, c);
}
}
GTK_IM_MODULE_UNLOCK (stream);
return n_read > 0 ? lines : 0;
}
#undef GTK_IM_MODULE_LOCK
#undef GTK_IM_MODULE_UNLOCK
#undef GTK_IM_MODULE_GETC
#endif /* GTK_IM_MODULE_USE_LOCAL_PARSER */
static void
gtk_im_module_initialize (void)
{
@ -635,13 +392,13 @@ gtk_im_module_initialize (void)
return;
}
while (!have_error && gtk_im_module_read_line (file, line_buf))
while (!have_error && pango_read_line (file, line_buf))
{
const char *p;
p = line_buf->str;
if (!gtk_im_module_skip_space (&p))
if (!pango_skip_space (&p))
{
/* Blank line marking the end of a module
*/
@ -661,8 +418,8 @@ gtk_im_module_initialize (void)
*/
module = g_object_new (GTK_TYPE_IM_MODULE, NULL);
if (!gtk_im_module_scan_string (&p, tmp_buf) ||
gtk_im_module_skip_space (&p))
if (!pango_scan_string (&p, tmp_buf) ||
pango_skip_space (&p))
{
g_warning ("Error parsing context info in '%s'\n %s",
filename, line_buf->str);
@ -681,30 +438,30 @@ gtk_im_module_initialize (void)
/* Read information about a context type
*/
if (!gtk_im_module_scan_string (&p, tmp_buf))
if (!pango_scan_string (&p, tmp_buf))
goto context_error;
info->context_id = g_strdup (tmp_buf->str);
if (!gtk_im_module_scan_string (&p, tmp_buf))
if (!pango_scan_string (&p, tmp_buf))
goto context_error;
info->context_name = g_strdup (tmp_buf->str);
if (!gtk_im_module_scan_string (&p, tmp_buf))
if (!pango_scan_string (&p, tmp_buf))
goto context_error;
info->domain = g_strdup (tmp_buf->str);
if (!gtk_im_module_scan_string (&p, tmp_buf))
if (!pango_scan_string (&p, tmp_buf))
goto context_error;
info->domain_dirname = g_strdup (tmp_buf->str);
#ifdef G_OS_WIN32
correct_localedir_prefix ((char **) &info->domain_dirname);
#endif
if (!gtk_im_module_scan_string (&p, tmp_buf))
if (!pango_scan_string (&p, tmp_buf))
goto context_error;
info->default_locales = g_strdup (tmp_buf->str);
if (gtk_im_module_skip_space (&p))
if (pango_skip_space (&p))
goto context_error;
infos = g_slist_prepend (infos, info);

View file

@ -192,7 +192,7 @@ _gtk_get_module_path (const gchar *type)
result = g_new (gchar *, count * 5 + 1);
count = 0;
for (path = paths; *path; path++)
for (path = get_module_path (); *path; path++)
{
gint use_version, use_host;

View file

@ -796,9 +796,7 @@ printer_status_cb (GtkPrintBackend *backend,
/* When the pause state change then we need to update sensitive property
* of GTK_RESPONSE_OK button inside of selected_printer_changed function. */
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->printer_treeview));
priv->internal_printer_change = TRUE;
selected_printer_changed (selection, dialog);
priv->internal_printer_change = FALSE;
if (gtk_print_backend_printer_list_is_done (backend) &&
gtk_printer_is_default (printer) &&

View file

@ -67,10 +67,7 @@ _gtk_quartz_create_image_from_pixbuf (GdkPixbuf *pixbuf)
}
[nsimage lockFocus];
if (gdk_quartz_osx_version () < GDK_OSX_YOSEMITE)
context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
else
context = [[NSGraphicsContext currentContext] CGContext];
context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
CGContextDrawImage (context, CGRectMake (0, 0, pixbuf_width, pixbuf_height), image);
[nsimage unlockFocus];

View file

@ -808,8 +808,6 @@ gtk_rc_parse_named (GtkRcContext *context,
gchar *path = NULL;
const gchar *home_dir;
gchar *subpath;
const gchar * const *xdg_data_dirs;
gint i;
if (type)
subpath = g_strconcat ("gtk-2.0-", type,
@ -831,22 +829,6 @@ gtk_rc_parse_named (GtkRcContext *context,
}
}
if (!path)
{
xdg_data_dirs = g_get_system_data_dirs ();
for (i = 0; xdg_data_dirs[i]; i++)
{
path = g_build_filename (xdg_data_dirs[i], "themes", name, subpath, NULL);
if (g_file_test (path, G_FILE_TEST_EXISTS))
break;
else
{
g_free (path);
path = NULL;
}
}
}
if (!path)
{
gchar *theme_dir = gtk_rc_get_theme_dir ();

View file

@ -74,11 +74,7 @@ struct _GtkTooltips
guint have_grab : 1;
guint use_sticky_delay : 1;
gint timer_tag;
struct
{
glong tv_sec;
glong tv_usec;
} last_popdown;
GTimeVal last_popdown;
};
struct _GtkTooltipsClass

View file

@ -46,12 +46,12 @@ struct _GtkTrayIconClass
{
GtkPlugClass parent_class;
void (*__gtk_reserved1) (void);
void (*__gtk_reserved2) (void);
void (*__gtk_reserved3) (void);
void (*__gtk_reserved4) (void);
void (*__gtk_reserved5) (void);
void (*__gtk_reserved6) (void);
void (*__gtk_reserved1);
void (*__gtk_reserved2);
void (*__gtk_reserved3);
void (*__gtk_reserved4);
void (*__gtk_reserved5);
void (*__gtk_reserved6);
};
GType gtk_tray_icon_get_type (void) G_GNUC_CONST;

View file

@ -14,7 +14,7 @@ print <<EOF;
#include <glib.h>
#if defined(G_HAVE_GNUC_VISIBILITY) && !defined(__APPLE__)
#ifdef G_HAVE_GNUC_VISIBILITY
EOF

View file

@ -159,6 +159,9 @@ query_module (const char *dir, const char *name, GString *contents)
{
void (*list) (const GtkIMContextInfo ***contexts,
guint *n_contexts);
G_GNUC_UNUSED void (*init) (GTypeModule *type_module);
G_GNUC_UNUSED void (*exit) (void);
G_GNUC_UNUSED GtkIMContext *(*create) (const gchar *context_id);
gpointer list_ptr;
gpointer init_ptr;
@ -193,6 +196,9 @@ query_module (const char *dir, const char *name, GString *contents)
int i;
list = list_ptr;
init = init_ptr;
exit = exit_ptr;
create = create_ptr;
print_escaped (contents, path);
g_string_append_c (contents, '\n');

View file

@ -132,7 +132,7 @@ static int object = 0;
static int object_after = 0;
void /* exported for GtkBuilder */
signal_normal (GtkWindow *window, GParamSpec *spec)
signal_normal (GtkWindow *window, GParamSpec spec)
{
g_assert (GTK_IS_WINDOW (window));
g_assert (normal == 0);
@ -142,7 +142,7 @@ signal_normal (GtkWindow *window, GParamSpec *spec)
}
void /* exported for GtkBuilder */
signal_after (GtkWindow *window, GParamSpec *spec)
signal_after (GtkWindow *window, GParamSpec spec)
{
g_assert (GTK_IS_WINDOW (window));
g_assert (normal == 1);
@ -152,7 +152,7 @@ signal_after (GtkWindow *window, GParamSpec *spec)
}
void /* exported for GtkBuilder */
signal_object (GtkButton *button, GParamSpec *spec)
signal_object (GtkButton *button, GParamSpec spec)
{
g_assert (GTK_IS_BUTTON (button));
g_assert (object == 0);
@ -162,7 +162,7 @@ signal_object (GtkButton *button, GParamSpec *spec)
}
void /* exported for GtkBuilder */
signal_object_after (GtkButton *button, GParamSpec *spec)
signal_object_after (GtkButton *button, GParamSpec spec)
{
g_assert (GTK_IS_BUTTON (button));
g_assert (object == 1);
@ -172,28 +172,28 @@ signal_object_after (GtkButton *button, GParamSpec *spec)
}
void /* exported for GtkBuilder */
signal_first (GtkButton *button, GParamSpec *spec)
signal_first (GtkButton *button, GParamSpec spec)
{
g_assert (normal == 0);
normal = 10;
}
void /* exported for GtkBuilder */
signal_second (GtkButton *button, GParamSpec *spec)
signal_second (GtkButton *button, GParamSpec spec)
{
g_assert (normal == 10);
normal = 20;
}
void /* exported for GtkBuilder */
signal_extra (GtkButton *button, GParamSpec *spec)
signal_extra (GtkButton *button, GParamSpec spec)
{
g_assert (normal == 20);
normal = 30;
}
void /* exported for GtkBuilder */
signal_extra2 (GtkButton *button, GParamSpec *spec)
signal_extra2 (GtkButton *button, GParamSpec spec)
{
g_assert (normal == 30);
normal = 40;

View file

@ -72,7 +72,6 @@ libgailincludedir=$(includedir)/gail-1.0/gail
gail_private_h_sources = \
gail.h \
gailvalue.h \
gailadjustment.h \
gailarrow.h \
gailbooleancell.h \

View file

@ -22,7 +22,6 @@
#include <string.h>
#include <gtk/gtk.h>
#include "gailadjustment.h"
#include "gailvalue.h"
static void gail_adjustment_class_init (GailAdjustmentClass *klass);
@ -33,25 +32,16 @@ static void gail_adjustment_real_initialize (AtkObject *obj,
static void atk_value_interface_init (AtkValueIface *iface);
#ifdef HAVE_ATK_VALUE_2_12
GAIL_DEFINE_ADJUSTMENT_VALUE_READERS (
gail_adjustment, GAIL_ADJUSTMENT (obj)->adjustment,
adjustment->value, adjustment->upper)
GAIL_DEFINE_ADJUSTMENT_VALUE_INCREMENT (
gail_adjustment, GAIL_ADJUSTMENT (obj)->adjustment,
GAIL_VALUE_MINIMUM_INCREMENT (adjustment))
static void
gail_adjustment_set_value (AtkValue *obj, gdouble value)
{
GtkAdjustment *adjustment;
adjustment = GAIL_ADJUSTMENT (obj)->adjustment;
if (adjustment != NULL)
gtk_adjustment_set_value (adjustment, value);
}
#endif
static void gail_adjustment_get_current_value (AtkValue *obj,
GValue *value);
static void gail_adjustment_get_maximum_value (AtkValue *obj,
GValue *value);
static void gail_adjustment_get_minimum_value (AtkValue *obj,
GValue *value);
static void gail_adjustment_get_minimum_increment (AtkValue *obj,
GValue *value);
static gboolean gail_adjustment_set_current_value (AtkValue *obj,
const GValue *value);
static void gail_adjustment_destroyed (GtkAdjustment *adjustment,
GailAdjustment *gail_adjustment);
@ -115,15 +105,9 @@ atk_value_interface_init (AtkValueIface *iface)
iface->get_minimum_value = gail_adjustment_get_minimum_value;
iface->get_minimum_increment = gail_adjustment_get_minimum_increment;
iface->set_current_value = gail_adjustment_set_current_value;
#ifdef HAVE_ATK_VALUE_2_12
iface->get_value_and_text = gail_adjustment_get_value_and_text;
iface->get_range = gail_adjustment_get_range;
iface->get_increment = gail_adjustment_get_increment;
iface->set_value = gail_adjustment_set_value;
#endif
}
void
static void
gail_adjustment_get_current_value (AtkValue *obj,
GValue *value)
{
@ -143,7 +127,7 @@ gail_adjustment_get_current_value (AtkValue *obj,
g_value_set_double (value,current_value);
}
void
static void
gail_adjustment_get_maximum_value (AtkValue *obj,
GValue *value)
{
@ -163,7 +147,7 @@ gail_adjustment_get_maximum_value (AtkValue *obj,
g_value_set_double (value, maximum_value);
}
void
static void
gail_adjustment_get_minimum_value (AtkValue *obj,
GValue *value)
{
@ -183,20 +167,48 @@ gail_adjustment_get_minimum_value (AtkValue *obj,
g_value_set_double (value, minimum_value);
}
void
gail_adjustment_get_minimum_increment (AtkValue *obj, GValue *value)
static void
gail_adjustment_get_minimum_increment (AtkValue *obj,
GValue *value)
{
GtkAdjustment *adjustment = GAIL_ADJUSTMENT (obj)->adjustment;
GtkAdjustment* adjustment;
gdouble minimum_increment;
adjustment = GAIL_ADJUSTMENT (obj)->adjustment;
if (adjustment == NULL)
{
/* State is defunct */
return;
}
memset (value, 0, sizeof (GValue));
if (adjustment->step_increment != 0 &&
adjustment->page_increment != 0)
{
if (ABS (adjustment->step_increment) < ABS (adjustment->page_increment))
minimum_increment = adjustment->step_increment;
else
minimum_increment = adjustment->page_increment;
}
else if (adjustment->step_increment == 0 &&
adjustment->page_increment == 0)
{
minimum_increment = 0;
}
else if (adjustment->step_increment == 0)
{
minimum_increment = adjustment->page_increment;
}
else
{
minimum_increment = adjustment->step_increment;
}
memset (value, 0, sizeof (GValue));
g_value_init (value, G_TYPE_DOUBLE);
g_value_set_double (value, GAIL_VALUE_MINIMUM_INCREMENT (adjustment));
g_value_set_double (value, minimum_increment);
}
gboolean
static gboolean
gail_adjustment_set_current_value (AtkValue *obj,
const GValue *value)
{

View file

@ -50,22 +50,6 @@ struct _GailAdjustmentClass
AtkObject *gail_adjustment_new (GtkAdjustment *adjustment);
G_GNUC_INTERNAL void
gail_adjustment_get_current_value (AtkValue *obj,
GValue *value);
G_GNUC_INTERNAL void
gail_adjustment_get_maximum_value (AtkValue *obj,
GValue *value);
G_GNUC_INTERNAL void
gail_adjustment_get_minimum_value (AtkValue *obj,
GValue *value);
G_GNUC_INTERNAL void
gail_adjustment_get_minimum_increment (AtkValue *obj,
GValue *value);
G_GNUC_INTERNAL gboolean
gail_adjustment_set_current_value (AtkValue *obj,
const GValue *value);
G_END_DECLS
#endif /* __GAIL_ADJUSTMENT_H__ */

View file

@ -22,7 +22,6 @@
#include <string.h>
#include <gtk/gtk.h>
#include "gailpaned.h"
#include "gailvalue.h"
static void gail_paned_class_init (GailPanedClass *klass);
@ -45,35 +44,6 @@ static void gail_paned_get_minimum_value (AtkValue *obj,
static gboolean gail_paned_set_current_value (AtkValue *obj,
const GValue *value);
#ifdef HAVE_ATK_VALUE_2_12
static void
gail_paned_get_value_and_text (AtkValue *obj, gdouble *value, gchar **text)
{
GtkWidget *widget = GTK_ACCESSIBLE (obj)->widget;
if (text != NULL)
*text = NULL;
if (value != NULL)
*value = widget != NULL
? gtk_paned_get_position (GTK_PANED (widget)) : 0.0;
}
static AtkRange *
gail_paned_get_range (AtkValue *obj)
{
GtkWidget *widget = GTK_ACCESSIBLE (obj)->widget;
GtkPaned *paned;
if (widget == NULL)
return NULL;
paned = GTK_PANED (widget);
return atk_range_new (paned->min_position, paned->max_position, NULL);
}
GAIL_DEFINE_WIDGET_VALUE_SETTER (
gail_paned, GTK_PANED, gtk_paned_set_position, (gint) value)
#endif
G_DEFINE_TYPE_WITH_CODE (GailPaned, gail_paned, GAIL_TYPE_CONTAINER,
G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
@ -142,11 +112,6 @@ atk_value_interface_init (AtkValueIface *iface)
iface->get_maximum_value = gail_paned_get_maximum_value;
iface->get_minimum_value = gail_paned_get_minimum_value;
iface->set_current_value = gail_paned_set_current_value;
#ifdef HAVE_ATK_VALUE_2_12
iface->get_value_and_text = gail_paned_get_value_and_text;
iface->get_range = gail_paned_get_range;
iface->set_value = gail_paned_set_value;
#endif
}
static void

View file

@ -26,7 +26,6 @@
#include <gtk/gtk.h>
#include "gailprogressbar.h"
#include "gailvalue.h"
#include "gailadjustment.h"
static void gail_progress_bar_class_init (GailProgressBarClass *klass);
@ -51,13 +50,6 @@ static void gail_progress_bar_get_minimum_value (AtkValue *obj,
static void gail_progress_bar_value_changed (GtkAdjustment *adjustment,
gpointer data);
#ifdef HAVE_ATK_VALUE_2_12
GAIL_DEFINE_ADJUSTMENT_VALUE_READERS (
gail_progress_bar,
GAIL_VALUE_ADJUSTMENT (GAIL_PROGRESS_BAR (obj)->adjustment),
adjustment->value, adjustment->upper)
#endif
G_DEFINE_TYPE_WITH_CODE (GailProgressBar, gail_progress_bar, GAIL_TYPE_WIDGET,
G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
@ -116,10 +108,6 @@ atk_value_interface_init (AtkValueIface *iface)
iface->get_current_value = gail_progress_bar_get_current_value;
iface->get_maximum_value = gail_progress_bar_get_maximum_value;
iface->get_minimum_value = gail_progress_bar_get_minimum_value;
#ifdef HAVE_ATK_VALUE_2_12
iface->get_value_and_text = gail_progress_bar_get_value_and_text;
iface->get_range = gail_progress_bar_get_range;
#endif
}
static void
@ -137,7 +125,7 @@ gail_progress_bar_get_current_value (AtkValue *obj,
*/
return;
gail_adjustment_get_current_value (ATK_VALUE (progress_bar->adjustment), value);
atk_value_get_current_value (ATK_VALUE (progress_bar->adjustment), value);
}
static void
@ -155,7 +143,7 @@ gail_progress_bar_get_maximum_value (AtkValue *obj,
*/
return;
gail_adjustment_get_maximum_value (ATK_VALUE (progress_bar->adjustment), value);
atk_value_get_maximum_value (ATK_VALUE (progress_bar->adjustment), value);
}
static void
@ -173,7 +161,7 @@ gail_progress_bar_get_minimum_value (AtkValue *obj,
*/
return;
gail_adjustment_get_minimum_value (ATK_VALUE (progress_bar->adjustment), value);
atk_value_get_minimum_value (ATK_VALUE (progress_bar->adjustment), value);
}
static void

View file

@ -23,7 +23,6 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "gailrange.h"
#include "gailvalue.h"
#include "gailadjustment.h"
#include "gail-private-macros.h"
@ -71,28 +70,6 @@ static gboolean gail_range_set_description (AtkAction *action,
gint i,
const gchar *desc);
#ifdef HAVE_ATK_VALUE_2_12
#define GAIL_RANGE_ADJUSTMENT(obj) \
(GTK_ACCESSIBLE (obj)->widget != NULL \
? GAIL_VALUE_ADJUSTMENT (GAIL_RANGE (obj)->adjustment) : NULL)
#define GAIL_RANGE_UPPER(obj, adjustment) \
(gtk_range_get_restrict_to_fill_level ( \
GTK_RANGE (GTK_ACCESSIBLE (obj)->widget)) \
? MIN ((adjustment)->upper - (adjustment)->page_size, \
gtk_range_get_fill_level ( \
GTK_RANGE (GTK_ACCESSIBLE (obj)->widget))) \
: (adjustment)->upper - (adjustment)->page_size)
GAIL_DEFINE_ADJUSTMENT_VALUE_READERS (
gail_range, GAIL_RANGE_ADJUSTMENT (obj), adjustment->value,
GAIL_RANGE_UPPER (obj, adjustment))
GAIL_DEFINE_ADJUSTMENT_VALUE_INCREMENT (
gail_range, GAIL_RANGE_ADJUSTMENT (obj),
GAIL_VALUE_MINIMUM_INCREMENT (adjustment))
GAIL_DEFINE_WIDGET_VALUE_SETTER (
gail_range, GTK_RANGE, gtk_range_set_value, value)
#endif
G_DEFINE_TYPE_WITH_CODE (GailRange, gail_range, GAIL_TYPE_WIDGET,
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
@ -186,12 +163,6 @@ atk_value_interface_init (AtkValueIface *iface)
iface->get_minimum_value = gail_range_get_minimum_value;
iface->get_minimum_increment = gail_range_get_minimum_increment;
iface->set_current_value = gail_range_set_current_value;
#ifdef HAVE_ATK_VALUE_2_12
iface->get_value_and_text = gail_range_get_value_and_text;
iface->get_range = gail_range_get_range;
iface->get_increment = gail_range_get_increment;
iface->set_value = gail_range_set_value;
#endif
}
static void
@ -209,7 +180,7 @@ gail_range_get_current_value (AtkValue *obj,
*/
return;
gail_adjustment_get_current_value (ATK_VALUE (range->adjustment), value);
atk_value_get_current_value (ATK_VALUE (range->adjustment), value);
}
static void
@ -230,7 +201,7 @@ gail_range_get_maximum_value (AtkValue *obj,
*/
return;
gail_adjustment_get_maximum_value (ATK_VALUE (range->adjustment), value);
atk_value_get_maximum_value (ATK_VALUE (range->adjustment), value);
gtk_range = GTK_RANGE (gtk_accessible_get_widget (GTK_ACCESSIBLE (range)));
g_return_if_fail (gtk_range);
@ -260,7 +231,7 @@ gail_range_get_minimum_value (AtkValue *obj,
*/
return;
gail_adjustment_get_minimum_value (ATK_VALUE (range->adjustment), value);
atk_value_get_minimum_value (ATK_VALUE (range->adjustment), value);
}
static void
@ -277,7 +248,7 @@ gail_range_get_minimum_increment (AtkValue *obj, GValue *value)
*/
return;
gail_adjustment_get_minimum_increment (ATK_VALUE (range->adjustment), value);
atk_value_get_minimum_increment (ATK_VALUE (range->adjustment), value);
}
static gboolean gail_range_set_current_value (AtkValue *obj,
@ -548,3 +519,5 @@ gail_range_set_description (AtkAction *action,
else
return FALSE;
}

View file

@ -21,7 +21,6 @@
#include <gtk/gtk.h>
#include "gailscalebutton.h"
#include "gailvalue.h"
#include "gailadjustment.h"
#include "gail-private-macros.h"
@ -66,24 +65,6 @@ static void gail_scale_button_get_minimum_increment (AtkValue *obj,
static gboolean gail_scale_button_set_current_value (AtkValue *obj,
const GValue *value);
#ifdef HAVE_ATK_VALUE_2_12
#define GAIL_SCALE_BUTTON_ADJUSTMENT(obj) \
(GTK_ACCESSIBLE (obj)->widget != NULL \
? gtk_scale_button_get_adjustment ( \
GTK_SCALE_BUTTON (GTK_ACCESSIBLE (obj)->widget)) : NULL)
GAIL_DEFINE_ADJUSTMENT_VALUE_READERS (
gail_scale_button, GAIL_SCALE_BUTTON_ADJUSTMENT (obj),
gtk_scale_button_get_value (
GTK_SCALE_BUTTON (GTK_ACCESSIBLE (obj)->widget)),
adjustment->upper)
GAIL_DEFINE_ADJUSTMENT_VALUE_INCREMENT (
gail_scale_button, GAIL_SCALE_BUTTON_ADJUSTMENT (obj),
adjustment->step_increment)
GAIL_DEFINE_WIDGET_VALUE_SETTER (
gail_scale_button, GTK_SCALE_BUTTON, gtk_scale_button_set_value, value)
#endif
G_DEFINE_TYPE_WITH_CODE (GailScaleButton, gail_scale_button, GAIL_TYPE_BUTTON,
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init));
@ -200,12 +181,6 @@ atk_value_interface_init (AtkValueIface *iface)
iface->get_minimum_value = gail_scale_button_get_minimum_value;
iface->get_minimum_increment = gail_scale_button_get_minimum_increment;
iface->set_current_value = gail_scale_button_set_current_value;
#ifdef HAVE_ATK_VALUE_2_12
iface->get_value_and_text = gail_scale_button_get_value_and_text;
iface->get_range = gail_scale_button_get_range;
iface->get_increment = gail_scale_button_get_increment;
iface->set_value = gail_scale_button_set_value;
#endif
}
static void
@ -320,3 +295,5 @@ gail_scale_button_notify_gtk (GObject *obj,
GAIL_WIDGET_CLASS (gail_scale_button_parent_class)->notify_gtk (obj, pspec);
}
}

View file

@ -22,7 +22,6 @@
#include <string.h>
#include <gtk/gtk.h>
#include "gailspinbutton.h"
#include "gailvalue.h"
#include "gailadjustment.h"
#include "gail-private-macros.h"
@ -50,19 +49,6 @@ static gboolean gail_spin_button_set_current_value (AtkValue *obj,
static void gail_spin_button_value_changed (GtkAdjustment *adjustment,
gpointer data);
#ifdef HAVE_ATK_VALUE_2_12
GAIL_DEFINE_ADJUSTMENT_VALUE_READERS (
gail_spin_button,
GAIL_VALUE_ADJUSTMENT (GAIL_SPIN_BUTTON (obj)->adjustment),
adjustment->value, adjustment->upper)
GAIL_DEFINE_ADJUSTMENT_VALUE_INCREMENT (
gail_spin_button,
GAIL_VALUE_ADJUSTMENT (GAIL_SPIN_BUTTON (obj)->adjustment),
GAIL_VALUE_MINIMUM_INCREMENT (adjustment))
GAIL_DEFINE_WIDGET_VALUE_SETTER (
gail_spin_button, GTK_SPIN_BUTTON, gtk_spin_button_set_value, value)
#endif
G_DEFINE_TYPE_WITH_CODE (GailSpinButton, gail_spin_button, GAIL_TYPE_ENTRY,
G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
@ -124,12 +110,6 @@ atk_value_interface_init (AtkValueIface *iface)
iface->get_minimum_value = gail_spin_button_get_minimum_value;
iface->get_minimum_increment = gail_spin_button_get_minimum_increment;
iface->set_current_value = gail_spin_button_set_current_value;
#ifdef HAVE_ATK_VALUE_2_12
iface->get_value_and_text = gail_spin_button_get_value_and_text;
iface->get_range = gail_spin_button_get_range;
iface->get_increment = gail_spin_button_get_increment;
iface->set_value = gail_spin_button_set_value;
#endif
}
static void
@ -147,7 +127,7 @@ gail_spin_button_get_current_value (AtkValue *obj,
*/
return;
gail_adjustment_get_current_value (ATK_VALUE (spin_button->adjustment), value);
atk_value_get_current_value (ATK_VALUE (spin_button->adjustment), value);
}
static void
@ -165,7 +145,7 @@ gail_spin_button_get_maximum_value (AtkValue *obj,
*/
return;
gail_adjustment_get_maximum_value (ATK_VALUE (spin_button->adjustment), value);
atk_value_get_maximum_value (ATK_VALUE (spin_button->adjustment), value);
}
static void
@ -183,7 +163,7 @@ gail_spin_button_get_minimum_value (AtkValue *obj,
*/
return;
gail_adjustment_get_minimum_value (ATK_VALUE (spin_button->adjustment), value);
atk_value_get_minimum_value (ATK_VALUE (spin_button->adjustment), value);
}
static void
@ -200,7 +180,7 @@ gail_spin_button_get_minimum_increment (AtkValue *obj, GValue *value)
*/
return;
gail_adjustment_get_minimum_increment (ATK_VALUE (spin_button->adjustment), value);
atk_value_get_minimum_increment (ATK_VALUE (spin_button->adjustment), value);
}
static gboolean
@ -218,7 +198,7 @@ gail_spin_button_set_current_value (AtkValue *obj,
*/
return FALSE;
return gail_adjustment_set_current_value (ATK_VALUE (spin_button->adjustment), value);
return atk_value_set_current_value (ATK_VALUE (spin_button->adjustment), value);
}
static void
@ -284,3 +264,4 @@ gail_spin_button_value_changed (GtkAdjustment *adjustment,
g_object_notify (G_OBJECT (spin_button), "accessible-value");
}

View file

@ -1,56 +0,0 @@
/* GAIL - The GNOME Accessibility Implementation Library
*
* 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.
*/
#ifndef __GAIL_VALUE_H__
#define __GAIL_VALUE_H__
#include <gtk/gtk.h>
#define GAIL_VALUE_ADJUSTMENT(accessible) \
((accessible) != NULL ? GAIL_ADJUSTMENT (accessible)->adjustment : NULL)
#define GAIL_VALUE_MINIMUM_INCREMENT(a) \
((a)->step_increment == 0.0 ? (a)->page_increment : \
(a)->page_increment == 0.0 ? (a)->step_increment : \
ABS ((a)->step_increment) < ABS ((a)->page_increment) \
? (a)->step_increment : (a)->page_increment)
#ifdef HAVE_ATK_VALUE_2_12
#define GAIL_DEFINE_ADJUSTMENT_VALUE_READERS(prefix, a_expr, value_expr, max_expr) \
static void prefix##_get_value_and_text (AtkValue *obj, gdouble *value, gchar **text) \
{ \
GtkAdjustment *adjustment = (a_expr); \
if (text != NULL) *text = NULL; \
if (value != NULL) *value = adjustment != NULL ? (value_expr) : 0.0; \
} \
static AtkRange *prefix##_get_range (AtkValue *obj) \
{ \
GtkAdjustment *adjustment = (a_expr); \
return adjustment != NULL \
? atk_range_new (adjustment->lower, (max_expr), NULL) : NULL; \
}
#define GAIL_DEFINE_ADJUSTMENT_VALUE_INCREMENT(prefix, a_expr, increment_expr) \
static gdouble prefix##_get_increment (AtkValue *obj) \
{ \
GtkAdjustment *adjustment = (a_expr); \
return adjustment != NULL ? (increment_expr) : 0.0; \
}
#define GAIL_DEFINE_WIDGET_VALUE_SETTER(prefix, cast, setter, value_expr) \
static void prefix##_set_value (AtkValue *obj, gdouble value) \
{ \
GtkWidget *widget = GTK_ACCESSIBLE (obj)->widget; \
if (widget != NULL) setter (cast (widget), (value_expr)); \
}
#endif
#endif /* __GAIL_VALUE_H__ */

View file

@ -12,8 +12,6 @@ module_LTLIBRARIES = \
libferret.la
endif
noinst_HEADERS = testvalue.h
noinst_LTLIBRARIES = \
libtestaction.la \
libtestbutton.la \

View file

@ -16,7 +16,6 @@
#include <strings.h>
#include "testlib.h"
#include "testvalue.h"
typedef enum
{
@ -1390,8 +1389,7 @@ _print_text_attributes (AtkText *aobject)
static gint
_print_value (AtkValue *aobject)
{
GValue val = { 0, };
GValue *value_back;
GValue *value_back, val;
gint group_num;
TabNumber tab_n = VALUE;
@ -1400,11 +1398,11 @@ _print_value (AtkValue *aobject)
group_num = _print_groupname(tab_n, VALUE_INTERFACE,
"Value Interface");
gail_test_value_get_current_value(aobject, value_back);
atk_value_get_current_value(aobject, value_back);
_print_value_type(group_num, "Value", value_back);
gail_test_value_get_minimum_value(aobject, value_back);
atk_value_get_minimum_value(aobject, value_back);
_print_value_type(group_num, "Minimum Value", value_back);
gail_test_value_get_maximum_value(aobject, value_back);
atk_value_get_maximum_value(aobject, value_back);
_print_value_type(group_num, "Maximum Value", value_back);
return(group_num);
}

View file

@ -2,7 +2,6 @@
#include <stdlib.h>
#include <gtk/gtk.h>
#include <testlib.h>
#include "testvalue.h"
static gint _test_paned (gpointer data);
static void _check_paned (AtkObject *obj);
@ -32,17 +31,17 @@ static void _property_change_handler (AtkObject *obj,
value = &val;
memset (value, 0, sizeof (GValue));
gail_test_value_get_current_value (ATK_VALUE (obj), value);
atk_value_get_current_value (ATK_VALUE (obj), value);
g_return_if_fail (G_VALUE_HOLDS_INT (value));
position = g_value_get_int (value);
g_print ("Position is %d previous position was %d\n",
position, last_position);
last_position = position;
gail_test_value_get_minimum_value (ATK_VALUE (obj), value);
atk_value_get_minimum_value (ATK_VALUE (obj), value);
g_return_if_fail (G_VALUE_HOLDS_INT (value));
position = g_value_get_int (value);
g_print ("Minimum Value is %d\n", position);
gail_test_value_get_maximum_value (ATK_VALUE (obj), value);
atk_value_get_maximum_value (ATK_VALUE (obj), value);
g_return_if_fail (G_VALUE_HOLDS_INT (value));
position = g_value_get_int (value);
g_print ("Maximum Value is %d\n", position);
@ -62,14 +61,14 @@ static gint _test_paned (gpointer data)
value = &val;
memset (value, 0, sizeof (GValue));
gail_test_value_get_current_value (ATK_VALUE (obj), value);
atk_value_get_current_value (ATK_VALUE (obj), value);
g_return_val_if_fail (G_VALUE_HOLDS_INT (value), FALSE);
position = g_value_get_int (value);
g_print ("Position is : %d\n", position);
last_position = position;
position *= 2;
g_value_set_int (value, position);
gail_test_value_set_current_value (ATK_VALUE (obj), value);
atk_value_set_current_value (ATK_VALUE (obj), value);
times++;
}
if (times < 4)

View file

@ -1,98 +0,0 @@
#ifndef __GAIL_TEST_VALUE_H__
#define __GAIL_TEST_VALUE_H__
#include "config.h"
#include <atk/atk.h>
#ifdef HAVE_ATK_VALUE_2_12
static void
gail_test_value_store_number (AtkValue *value,
GValue *result,
gdouble number)
{
if (G_VALUE_TYPE (result) == 0)
g_value_init (result,
atk_object_get_role (ATK_OBJECT (value)) ==
ATK_ROLE_SPLIT_PANE ? G_TYPE_INT : G_TYPE_DOUBLE);
if (G_VALUE_HOLDS_INT (result))
g_value_set_int (result, (gint) number);
else
{
g_return_if_fail (G_VALUE_HOLDS_DOUBLE (result));
g_value_set_double (result, number);
}
}
static void
gail_test_value_get_current_value (AtkValue *value,
GValue *result)
{
gdouble number;
atk_value_get_value_and_text (value, &number, NULL);
gail_test_value_store_number (value, result, number);
}
static void
gail_test_value_get_limit (AtkValue *value,
GValue *result,
gboolean upper)
{
AtkRange *range;
gdouble number;
range = atk_value_get_range (value);
g_return_if_fail (range != NULL);
if (upper)
number = atk_range_get_upper_limit (range);
else
number = atk_range_get_lower_limit (range);
atk_range_free (range);
gail_test_value_store_number (value, result, number);
}
#define gail_test_value_get_minimum_value(value, result) \
gail_test_value_get_limit ((value), (result), FALSE)
#define gail_test_value_get_maximum_value(value, result) \
gail_test_value_get_limit ((value), (result), TRUE)
#define GAIL_TEST_VALUE_NUMBER(value) \
(G_VALUE_HOLDS_INT (value) \
? (gdouble) g_value_get_int (value) \
: g_value_get_double (value))
#define gail_test_value_set_current_value(value, new_value) \
(atk_value_set_value ((value), \
GAIL_TEST_VALUE_NUMBER (new_value)), \
TRUE)
#else
#define GAIL_TEST_VALUE_IFACE(value) \
ATK_VALUE_GET_IFACE (value)
#define gail_test_value_get_current_value(value, result) \
(GAIL_TEST_VALUE_IFACE (value)->get_current_value ( \
(value), (result)))
#define gail_test_value_get_minimum_value(value, result) \
(GAIL_TEST_VALUE_IFACE (value)->get_minimum_value ( \
(value), (result)))
#define gail_test_value_get_maximum_value(value, result) \
(GAIL_TEST_VALUE_IFACE (value)->get_maximum_value ( \
(value), (result)))
#define gail_test_value_set_current_value(value, new_value) \
(GAIL_TEST_VALUE_IFACE (value)->set_current_value ( \
(value), (new_value)))
#endif
#endif /* __GAIL_TEST_VALUE_H__ */

View file

@ -1,7 +1,6 @@
#include <string.h>
#include <atk/atk.h>
#include <gtk/gtk.h>
#include "testvalue.h"
static void _traverse_children (AtkObject *obj);
static void _add_handler (AtkObject *obj);
@ -15,8 +14,8 @@ static void _value_change_handler (AtkObject *obj,
AtkPropertyValues *values)
{
const gchar *type_name = g_type_name (G_TYPE_FROM_INSTANCE (obj));
GValue val = { 0, };
GValue *value_back;
GValue *value_back, val;
value_back = &val;
if (!ATK_IS_VALUE (obj)) {
@ -34,17 +33,17 @@ static void _value_change_handler (AtkObject *obj,
g_print("Now calling the AtkValue interface functions\n");
gail_test_value_get_current_value (ATK_VALUE(obj), value_back);
atk_value_get_current_value (ATK_VALUE(obj), value_back);
g_return_if_fail (G_VALUE_HOLDS_DOUBLE (value_back));
g_print ("atk_value_get_current_value returns %f\n",
g_value_get_double (value_back) );
gail_test_value_get_maximum_value (ATK_VALUE (obj), value_back);
atk_value_get_maximum_value (ATK_VALUE (obj), value_back);
g_return_if_fail (G_VALUE_HOLDS_DOUBLE (value_back));
g_print ("atk_value_get_maximum returns %f\n",
g_value_get_double (value_back));
gail_test_value_get_minimum_value (ATK_VALUE (obj), value_back);
atk_value_get_minimum_value (ATK_VALUE (obj), value_back);
g_return_if_fail (G_VALUE_HOLDS_DOUBLE (value_back));
g_print ("atk_value_get_minimum returns %f\n",
g_value_get_double (value_back));
@ -104,8 +103,7 @@ static void _add_handler (AtkObject *obj)
static void _set_values (AtkObject *obj) {
GValue val = { 0, };
GValue *value_back;
GValue *value_back, val;
static gint count = 0;
gdouble double_value;
@ -127,7 +125,7 @@ static void _set_values (AtkObject *obj) {
text = "5.7";
atk_editable_text_set_text_contents(ATK_EDITABLE_TEXT(obj),text);
g_print("Set text to %s\n",text);
gail_test_value_get_current_value(ATK_VALUE(obj), value_back);
atk_value_get_current_value(ATK_VALUE(obj), value_back);
g_return_if_fail (G_VALUE_HOLDS_DOUBLE (value_back));
g_print("atk_value_get_current_value returns %f\n",
g_value_get_double( value_back));
@ -136,7 +134,7 @@ static void _set_values (AtkObject *obj) {
memset (value_back, 0, sizeof (GValue));
g_value_init (value_back, G_TYPE_DOUBLE);
g_value_set_double (value_back, 10.0);
if (gail_test_value_set_current_value (ATK_VALUE (obj), value_back))
if (atk_value_set_current_value (ATK_VALUE (obj), value_back))
{
double_value = g_value_get_double (value_back);
g_print("atk_value_set_current_value returns %f\n",

View file

@ -34,11 +34,6 @@
typedef void (*GtkCupsRequestStateFunc) (GtkCupsRequest *request);
static http_t *gtk_cups_http_connect (const char *host,
int port,
http_encryption_t encryption);
static int gtk_cups_http_reconnect (http_t *http);
static void _connect (GtkCupsRequest *request);
static void _post_send (GtkCupsRequest *request);
static void _post_write_request (GtkCupsRequest *request);
@ -176,7 +171,7 @@ gtk_cups_request_new_with_username (http_t *connection,
else
{
request->http = NULL;
request->http = gtk_cups_http_connect (request->server,
request->http = httpConnectEncrypt (request->server,
ippPort (),
cupsEncryption ());
@ -686,29 +681,6 @@ gtk_cups_request_set_ipp_version (GtkCupsRequest *request,
ippSetVersion (request->ipp_request, major, minor);
}
static http_t *
gtk_cups_http_connect (const char *host,
int port,
http_encryption_t encryption)
{
#ifdef HAVE_HTTPCONNECT2
return httpConnect2 (host, port, NULL, AF_UNSPEC, encryption, 1, 30000, NULL);
#else
return httpConnectEncrypt (host, port, encryption);
#endif
}
static int
gtk_cups_http_reconnect (http_t *http)
{
#ifdef HAVE_HTTPRECONNECT2
return httpReconnect2 (http, 30000, NULL);
#else
return httpReconnect (http);
#endif
}
static void
_connect (GtkCupsRequest *request)
{
@ -717,7 +689,7 @@ _connect (GtkCupsRequest *request)
if (request->http == NULL)
{
request->http = gtk_cups_http_connect (request->server,
request->http = httpConnectEncrypt (request->server,
ippPort (),
cupsEncryption ());
@ -772,7 +744,7 @@ _post_send (GtkCupsRequest *request)
if (httpPost (request->http, request->resource))
{
if (gtk_cups_http_reconnect (request->http))
if (httpReconnect (request->http))
{
request->state = GTK_CUPS_POST_DONE;
request->poll_state = GTK_CUPS_HTTP_IDLE;
@ -1074,7 +1046,7 @@ _post_check (GtkCupsRequest *request)
}
if (auth_result ||
gtk_cups_http_reconnect (request->http))
httpReconnect (request->http))
{
/* if the password has been used, reset password_state
* so that we ask for a new one next time around
@ -1133,7 +1105,7 @@ _post_check (GtkCupsRequest *request)
request->state = GTK_CUPS_POST_CONNECT;
/* Reconnect... */
gtk_cups_http_reconnect (request->http);
httpReconnect (request->http);
/* Upgrade with encryption... */
httpEncryption (request->http, HTTP_ENCRYPT_REQUIRED);
@ -1260,7 +1232,7 @@ _get_send (GtkCupsRequest *request)
if (httpGet (request->http, request->resource))
{
if (gtk_cups_http_reconnect (request->http))
if (httpReconnect (request->http))
{
request->state = GTK_CUPS_GET_DONE;
request->poll_state = GTK_CUPS_HTTP_IDLE;
@ -1369,7 +1341,7 @@ _get_check (GtkCupsRequest *request)
}
if (auth_result ||
gtk_cups_http_reconnect (request->http))
httpReconnect (request->http))
{
/* if the password has been used, reset password_state
* so that we ask for a new one next time around
@ -1401,7 +1373,7 @@ _get_check (GtkCupsRequest *request)
request->state = GTK_CUPS_GET_CONNECT;
/* Reconnect... */
gtk_cups_http_reconnect (request->http);
httpReconnect (request->http);
/* Upgrade with encryption... */
httpEncryption (request->http, HTTP_ENCRYPT_REQUIRED);

View file

@ -489,44 +489,6 @@ cups_free_print_stream_data (CupsPrintStreamData *data)
g_free (data);
}
static http_t *
gtk_cups_backend_http_connect (const char *host,
int port)
{
#ifdef HAVE_HTTPCONNECT2
return httpConnect2 (host,
port,
NULL,
AF_UNSPEC,
HTTP_ENCRYPT_IF_REQUESTED,
1,
30000,
NULL);
#else
return httpConnect (host, port);
#endif
}
static http_t *
gtk_cups_backend_http_connect_encrypt (const char *host,
int port,
http_encryption_t encryption)
{
#ifdef HAVE_HTTPCONNECT2
return httpConnect2 (host,
port,
NULL,
AF_UNSPEC,
encryption,
1,
30000,
NULL);
#else
return httpConnectEncrypt (host, port, encryption);
#endif
}
static void
cups_print_cb (GtkPrintBackendCups *print_backend,
GtkCupsResult *result,
@ -674,9 +636,7 @@ gtk_print_backend_cups_print_stream (GtkPrintBackend *print_backend,
{
http_t *http;
http = gtk_cups_backend_http_connect (
cups_printer->hostname,
cups_printer->port);
http = httpConnect (cups_printer->hostname, cups_printer->port);
if (http)
{
request = gtk_cups_request_new_with_username (http,
@ -2595,7 +2555,7 @@ cups_request_avahi_printer_info (const gchar *printer_uri,
AvahiService *service;
http_t *http;
http = gtk_cups_backend_http_connect (host, port);
http = httpConnect (host, port);
if (http)
{
service = (AvahiService *) g_new0 (AvahiService, 1);
@ -3478,7 +3438,7 @@ cups_request_ppd (GtkPrinter *printer)
}
}
http = gtk_cups_backend_http_connect_encrypt (cups_printer->hostname,
http = httpConnectEncrypt (cups_printer->hostname,
cups_printer->port,
cupsEncryption ());