Skip to content

Commit 2d5a4cb

Browse files
author
Yuuki Harano
committed
X でしかコンパイルが通らなかったのを修正。
1 parent 29a86c5 commit 2d5a4cb

File tree

7 files changed

+25
-90
lines changed

7 files changed

+25
-90
lines changed

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2841,7 +2841,7 @@ LIBS=$OLD_LIBS
28412841
PGTK_OBJ=
28422842
PGTK_LIBS=
28432843
if test "$window_system" = "pgtk"; then
2844-
PGTK_OBJ="pgtkfns.o pgtkterm.o pgtkselect.o xsettings.o pgtkimage.o"
2844+
PGTK_OBJ="pgtkfns.o pgtkterm.o pgtkselect.o xsettings.o"
28452845
PGTK_LIBS="$GTK_LIBS -ldl"
28462846
AC_DEFINE([HAVE_PGTK], 1, [Define to 1 if you have pure Gtk+-3.])
28472847
fi

src/dispextern.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,6 @@ typedef Emacs_Pixmap Emacs_Pix_Context;
138138
typedef struct pgtk_display_info Display_Info;
139139
typedef Emacs_Pixmap XImagePtr;
140140
typedef XImagePtr XImagePtr_or_DC;
141-
typedef Emacs_Pixmap Emacs_Pix_Container;
142-
typedef Emacs_Pixmap Emacs_Pix_Context;
143141
#endif
144142

145143
#ifdef HAVE_WINDOW_SYSTEM

src/image.c

Lines changed: 19 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
6161
#include TERM_HEADER
6262
#endif /* HAVE_WINDOW_SYSTEM */
6363

64-
#ifdef HAVE_PGTK
65-
#include <pgtkimage.h>
66-
#endif
67-
6864
/* Work around GCC bug 54561. */
6965
#if GNUC_PREREQ (4, 3, 0)
7066
# pragma GCC diagnostic ignored "-Wclobbered"
@@ -134,19 +130,10 @@ typedef struct ns_bitmap_record Bitmap_Record;
134130

135131
#ifdef HAVE_PGTK
136132
typedef struct pgtk_bitmap_record Bitmap_Record;
137-
138-
#define GET_PIXEL(ximg, x, y) XGetPixel (ximg, x, y)
139-
#define NO_PIXMAP 0
140-
141-
#define PIX_MASK_RETAIN 0
142-
#define PIX_MASK_DRAW 1
143-
144-
#define x_defined_color(f, name, color_def, alloc) \
145-
pgtk_defined_color (f, name, color_def, alloc, 0)
146133
#endif /* HAVE_PGTK */
147134

148135
#if (defined HAVE_X_WINDOWS \
149-
&& ! (defined HAVE_NTGUI || defined USE_CAIRO || defined HAVE_NS || defined HAVE_PGTK))
136+
&& ! (defined HAVE_NTGUI || defined USE_CAIRO || defined HAVE_NS))
150137
/* W32_TODO : Color tables on W32. */
151138
# define COLOR_TABLE_SUPPORT 1
152139
#endif
@@ -302,22 +289,6 @@ XPutPixel (Emacs_Pix_Container image, int x, int y, unsigned long pixel)
302289
}
303290
#endif /* HAVE_NS */
304291

305-
#ifdef HAVE_PGTK
306-
/* Use with pgtk_image. */
307-
static unsigned long
308-
XGetPixel (XImagePtr ximage, int x, int y)
309-
{
310-
return pgtk_image_get_pixel (ximage, x, y);
311-
}
312-
313-
/* Use with pgtk_image. */
314-
static void
315-
XPutPixel (XImagePtr ximage, int x, int y, unsigned long pixel)
316-
{
317-
pgtk_image_put_pixel (ximage, x, y, pixel);
318-
}
319-
#endif /* HAVE_PGTK */
320-
321292
/* Code to deal with bitmaps. Bitmaps are referenced by their bitmap
322293
id, which is just an int that this section returns. Bitmaps are
323294
reference counted so they can be shared among frames.
@@ -461,9 +432,11 @@ image_create_bitmap_from_data (struct frame *f, char *bits,
461432
#endif
462433

463434
#ifdef HAVE_PGTK
464-
void *bitmap = pgtk_image_create_from_xbm (bits, width, height, 0xffffffff, 0xff000000);
465-
if (!bitmap)
466-
return -1;
435+
Emacs_Pixmap bitmap = image_pix_container_create_from_bitmap_data(f, bits,
436+
width,
437+
height,
438+
0xffffffff,
439+
0xff000000);
467440
#endif
468441

469442
id = image_allocate_bitmap_record (f);
@@ -606,8 +579,8 @@ free_bitmap_record (Display_Info *dpyinfo, Bitmap_Record *bm)
606579
ns_release_object (bm->img);
607580
#endif
608581

609-
#ifdef HAVE_NS
610-
pgtk_image_destroy (bm->img);
582+
#ifdef HAVE_PGTK
583+
// pgtk_image_destroy (bm->img);
611584
#endif
612585

613586
if (bm->file)
@@ -2755,18 +2728,6 @@ image_create_x_image_and_pixmap_1 (struct frame *f, int width, int height, int d
27552728
*pimg = *pixmap;
27562729
return 1;
27572730
#endif
2758-
2759-
#ifdef HAVE_PGTK
2760-
*pixmap = pgtk_image_create(width, height, depth);
2761-
if (*pixmap == 0)
2762-
{
2763-
*pimg = NULL;
2764-
image_error ("Unable to allocate pgtk_image for XPM pixmap");
2765-
return 0;
2766-
}
2767-
*pimg = *pixmap;
2768-
return 1;
2769-
#endif
27702731
}
27712732

27722733

@@ -2792,7 +2753,7 @@ image_destroy_x_image (Emacs_Pix_Container pimg)
27922753
ns_release_object (pimg);
27932754
#endif /* HAVE_NS */
27942755
#ifdef HAVE_PGTK
2795-
pgtk_image_destroy (pimg);
2756+
// pgtk_image_destroy (pimg);
27962757
#endif /* HAVE_PGTK */
27972758
}
27982759
#endif
@@ -2831,10 +2792,6 @@ gui_put_x_image (struct frame *f, Emacs_Pix_Container pimg,
28312792
eassert (pimg == pixmap);
28322793
ns_retain_object (pimg);
28332794
#endif
2834-
2835-
#ifdef HAVE_PGTK
2836-
eassert (pimg == pixmap);
2837-
#endif
28382795
}
28392796

28402797
/* Thin wrapper for image_create_x_image_and_pixmap_1, so that it matches
@@ -2953,9 +2910,6 @@ image_get_x_image (struct frame *f, struct image *img, bool mask_p)
29532910

29542911
ns_retain_object (pixmap);
29552912
return pixmap;
2956-
#elif defined (HAVE_PGTK)
2957-
XImagePtr pixmap = !mask_p ? img->pixmap : img->mask;
2958-
return pixmap;
29592913
#endif
29602914
}
29612915

@@ -3664,14 +3618,12 @@ xbm_load_image (struct frame *f, struct image *img, char *contents, char *end)
36643618
img->pixmap = NO_PIXMAP;
36653619
xfree (data);
36663620

3667-
#ifndef HAVE_PGTK
36683621
if (img->pixmap == NO_PIXMAP)
36693622
{
36703623
image_clear_image (f, img);
36713624
image_error ("Unable to create X pixmap for `%s'", img->spec);
36723625
}
36733626
else
3674-
#endif
36753627
success_p = 1;
36763628
}
36773629
else
@@ -4736,7 +4688,7 @@ xpm_load_image (struct frame *f,
47364688
Lisp_Object (*get_color_table) (Lisp_Object, const char *, int);
47374689
Lisp_Object frame, color_symbols, color_table;
47384690
int best_key;
4739-
#if !defined(HAVE_NS) && !defined(HAVE_PGTK)
4691+
#if !defined(HAVE_NS)
47404692
bool have_mask = false;
47414693
#endif
47424694
Emacs_Pix_Container ximg = NULL, mask_img = NULL;
@@ -4790,7 +4742,7 @@ xpm_load_image (struct frame *f,
47904742
}
47914743

47924744
if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0)
4793-
#if !defined(HAVE_NS) && !defined(HAVE_PGTK)
4745+
#if !defined(HAVE_NS)
47944746
|| !image_create_x_image_and_pixmap (f, img, width, height, 1,
47954747
&mask_img, 1)
47964748
#endif
@@ -4918,13 +4870,10 @@ xpm_load_image (struct frame *f,
49184870

49194871
PUT_PIXEL (ximg, x, y,
49204872
FIXNUMP (color_val) ? XFIXNUM (color_val) : frame_fg);
4921-
#if !defined(HAVE_NS) && !defined(HAVE_PGTK)
4873+
#if !defined(HAVE_NS)
49224874
PUT_PIXEL (mask_img, x, y,
49234875
(!EQ (color_val, Qt) ? PIX_MASK_DRAW
49244876
: (have_mask = true, PIX_MASK_RETAIN)));
4925-
#elif defined(HAVE_PGTK)
4926-
if (EQ (color_val, Qt))
4927-
pgtk_image_set_alpha (ximg, x, y, 0);
49284877
#else
49294878
if (EQ (color_val, Qt))
49304879
ns_set_alpha (ximg, x, y, 0);
@@ -4942,7 +4891,7 @@ xpm_load_image (struct frame *f,
49424891
IMAGE_BACKGROUND (img, f, ximg);
49434892

49444893
image_put_x_image (f, img, ximg, 0);
4945-
#if !defined(HAVE_NS) && !defined(HAVE_PGTK)
4894+
#if !defined(HAVE_NS)
49464895
if (have_mask)
49474896
{
49484897
/* Fill in the background_transparent field while we have the
@@ -5673,7 +5622,7 @@ image_disable_image (struct frame *f, struct image *img)
56735622
if (n_planes < 2 || cross_disabled_images)
56745623
{
56755624
#ifndef HAVE_NTGUI
5676-
#if !defined(HAVE_NS) && !defined(HAVE_PGTK) /* TODO: NS support, however this not needed for toolbars */
5625+
#if !defined(HAVE_NS) /* TODO: NS support, however this not needed for toolbars */
56775626

56785627
#ifndef USE_CAIRO
56795628
#define CrossForeground(f) BLACK_PIX_DEFAULT (f)
@@ -5740,7 +5689,7 @@ image_build_heuristic_mask (struct frame *f, struct image *img,
57405689
HGDIOBJ prev;
57415690
char *mask_img;
57425691
int row_width;
5743-
#elif !defined HAVE_NS && !defined HAVE_PGTK
5692+
#elif !defined HAVE_NS
57445693
Emacs_Pix_Container mask_img;
57455694
#endif
57465695
int x, y;
@@ -5751,7 +5700,7 @@ image_build_heuristic_mask (struct frame *f, struct image *img,
57515700
image_clear_image_1 (f, img, CLEAR_IMAGE_MASK);
57525701

57535702
#ifndef HAVE_NTGUI
5754-
#if !defined HAVE_NS && !defined HAVE_PGTK
5703+
#if !defined HAVE_NS
57555704
/* Create an image and pixmap serving as mask. */
57565705
if (! image_create_x_image_and_pixmap (f, img, img->width, img->height, 1,
57575706
&mask_img, 1))
@@ -5806,17 +5755,14 @@ image_build_heuristic_mask (struct frame *f, struct image *img,
58065755
#ifndef HAVE_NTGUI
58075756
for (y = 0; y < img->height; ++y)
58085757
for (x = 0; x < img->width; ++x)
5809-
#ifdef HAVE_PGTK
5810-
if (XGetPixel (ximg, x, y) == bg)
5811-
pgtk_image_set_alpha (ximg, x, y, 0);
5812-
#elif !defined HAVE_NS
5758+
#ifndef HAVE_NS
58135759
PUT_PIXEL (mask_img, x, y, (GET_PIXEL (ximg, x, y) != bg
58145760
? PIX_MASK_DRAW : PIX_MASK_RETAIN));
58155761
#else
58165762
if (XGetPixel (ximg, x, y) == bg)
58175763
ns_set_alpha (ximg, x, y, 0);
58185764
#endif /* HAVE_NS */
5819-
#if !defined HAVE_NS && !defined HAVE_PGTK
5765+
#if !defined HAVE_NS
58205766
/* Fill in the background_transparent field while we have the mask handy. */
58215767
image_background_transparent (img, f, mask_img);
58225768

@@ -9080,7 +9026,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
90809026

90819027
init_color_table ();
90829028

9083-
#if defined (HAVE_MAGICKEXPORTIMAGEPIXELS) && ! defined (HAVE_NS) && !defined (HAVE_PGTK)
9029+
#if defined (HAVE_MAGICKEXPORTIMAGEPIXELS) && ! defined (HAVE_NS)
90849030
if (imagemagick_render_type != 0)
90859031
{
90869032
/* Magicexportimage is normally faster than pixelpushing. This

src/pgtkgui.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ typedef XGCValues * GC;
5858
#define GCBackground 0x02
5959
#define GCFont 0x03
6060

61-
typedef void *Emacs_Pixmap;
62-
6361
typedef void *Emacs_Cursor;
6462

6563
typedef void * Color;

src/pgtkterm.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2289,10 +2289,9 @@ x_draw_image_glyph_string (struct glyph_string *s)
22892289
int y = s->y + s->img->vmargin;
22902290
int width = s->background_width;
22912291

2292-
cairo_set_source_surface (cr, s->img->cr_data,
2293-
x - s->slice.x,
2294-
y - s->slice.y);
2295-
cairo_rectangle (cr, x, y, width, height);
2292+
cairo_translate (cr, x - s->slice.x, y - s->slice.y);
2293+
cairo_set_source (cr, s->img->cr_data);
2294+
cairo_rectangle (cr, 0, 0, width, height);
22962295
cairo_fill (cr);
22972296
pgtk_end_cr_clip (s->f);
22982297
}
@@ -4652,7 +4651,7 @@ pgtk_query_frame_background_color (struct frame *f, Emacs_Color *bgcolor)
46524651
static void
46534652
pgtk_free_pixmap (struct frame *_f, Emacs_Pixmap pixmap)
46544653
{
4655-
pgtk_image_destroy(pixmap);
4654+
// pgtk_image_destroy(pixmap);
46564655
}
46574656

46584657
static struct terminal *

src/pgtkterm.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,6 @@ struct pgtk_bitmap_record
6464
#define GREEN_FROM_ULONG(color) (((color) >> 8) & 0xff)
6565
#define BLUE_FROM_ULONG(color) ((color) & 0xff)
6666

67-
/* Do not change `* 0x101' in the following lines to `<< 8'. If
68-
changed, image masks in 1-bit depth will not work. */
69-
#define RED16_FROM_ULONG(color) (RED_FROM_ULONG(color) * 0x101)
70-
#define GREEN16_FROM_ULONG(color) (GREEN_FROM_ULONG(color) * 0x101)
71-
#define BLUE16_FROM_ULONG(color) (BLUE_FROM_ULONG(color) * 0x101)
72-
7367
struct scroll_bar
7468
{
7569
/* These fields are shared by all vectors. */

src/termhooks.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ struct terminal
519519
BGCOLOR. */
520520
void (*query_frame_background_color) (struct frame *f, Emacs_Color *bgcolor);
521521

522-
#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI)
522+
#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) || defined (HAVE_PGTK)
523523
/* On frame F, translate pixel colors to RGB values for the NCOLORS
524524
colors in COLORS. Use cached information, if available. */
525525

0 commit comments

Comments
 (0)