aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYuuki Harano2019-06-25 21:36:39 +0900
committerJeff Walsh2020-11-22 14:46:55 +1100
commit330a346ca734d39c0233ef899e044d05e0e1ebe9 (patch)
treefb58fa9d6fdae8657a25ede315efeebffdd9eea2 /src
parentf4920a68831f769f0a1504c85145589bdb4c3eb9 (diff)
downloademacs-330a346ca734d39c0233ef899e044d05e0e1ebe9.tar.gz
emacs-330a346ca734d39c0233ef899e044d05e0e1ebe9.zip
Migrate to Emacs_GC
* ../src/xfaces.c (x_create_gc, x_free_gc): * ../src/pgtkterm.h (struct pgtk_output, struct pgtk_output): * ../src/pgtkterm.c (x_set_cursor_gc, x_set_mouse_face_gc) (x_setup_relief_color, x_draw_image_foreground_1) (x_draw_image_foreground) (pgtk_cr_draw_image, pgtk_draw_fringe_bitmap) (pgtk_begin_cr_clip, pgtk_set_cr_source_with_gc_foreground) (pgtk_set_cr_source_with_gc_background): * ../src/pgtkgui.h: * ../src/dispextern.h (struct glyph_string): clean up XGCValues emulation XGCValues, GC 廃止。 Emacs_GC に統一。
Diffstat (limited to 'src')
-rw-r--r--src/dispextern.h2
-rw-r--r--src/pgtkgui.h21
-rw-r--r--src/pgtkterm.c14
-rw-r--r--src/pgtkterm.h8
-rw-r--r--src/xfaces.c8
5 files changed, 17 insertions, 36 deletions
diff --git a/src/dispextern.h b/src/dispextern.h
index 35e12104106..126f2cb11e5 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1402,7 +1402,7 @@ struct glyph_string
1402 HDC hdc; 1402 HDC hdc;
1403#endif 1403#endif
1404#if defined (HAVE_PGTK) 1404#if defined (HAVE_PGTK)
1405 XGCValues xgcv; 1405 Emacs_GC xgcv;
1406#endif 1406#endif
1407 1407
1408 /* A pointer to the first glyph in the string. This glyph 1408 /* A pointer to the first glyph in the string. This glyph
diff --git a/src/pgtkgui.h b/src/pgtkgui.h
index 27e94b213d7..e7e614ea1fd 100644
--- a/src/pgtkgui.h
+++ b/src/pgtkgui.h
@@ -43,26 +43,7 @@ typedef unichar XChar2b;
43 (*(chp) & 0x00ff) 43 (*(chp) & 0x00ff)
44 44
45 45
46/* XXX: xfaces requires these structures, but the question is are we 46typedef void *Emacs_Cursor;
47 forced to use them? */
48typedef struct _XGCValues
49{
50 unsigned long foreground;
51 unsigned long background;
52 void *font;
53} XGCValues;
54
55typedef XGCValues * GC;
56
57#define GCForeground 0x01
58#define GCBackground 0x02
59#define GCFont 0x03
60
61typedef void *Pixmap;
62
63typedef void *Cursor;
64
65#define No_Cursor (0)
66 47
67typedef void * Color; 48typedef void * Color;
68typedef int Window; 49typedef int Window;
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index ed8d7e841be..9fbf41c6fbc 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -754,7 +754,7 @@ x_set_cursor_gc (struct glyph_string *s)
754 else 754 else
755 { 755 {
756 /* Cursor on non-default face: must merge. */ 756 /* Cursor on non-default face: must merge. */
757 XGCValues xgcv; 757 Emacs_GC xgcv;
758 758
759 PGTK_TRACE("x_set_cursor_gc: 2."); 759 PGTK_TRACE("x_set_cursor_gc: 2.");
760 xgcv.background = FRAME_X_OUTPUT(s->f)->cursor_color; 760 xgcv.background = FRAME_X_OUTPUT(s->f)->cursor_color;
@@ -815,7 +815,7 @@ x_set_mouse_face_gc (struct glyph_string *s)
815 { 815 {
816 /* Otherwise construct scratch_cursor_gc with values from FACE 816 /* Otherwise construct scratch_cursor_gc with values from FACE
817 except for FONT. */ 817 except for FONT. */
818 XGCValues xgcv; 818 Emacs_GC xgcv;
819 819
820 xgcv.background = s->face->background; 820 xgcv.background = s->face->background;
821 xgcv.foreground = s->face->foreground; 821 xgcv.foreground = s->face->foreground;
@@ -1433,7 +1433,7 @@ static void
1433x_setup_relief_color (struct frame *f, struct relief *relief, double factor, 1433x_setup_relief_color (struct frame *f, struct relief *relief, double factor,
1434 int delta, unsigned long default_pixel) 1434 int delta, unsigned long default_pixel)
1435{ 1435{
1436 XGCValues xgcv; 1436 Emacs_GC xgcv;
1437 struct pgtk_output *di = FRAME_X_OUTPUT(f); 1437 struct pgtk_output *di = FRAME_X_OUTPUT(f);
1438 unsigned long pixel; 1438 unsigned long pixel;
1439 unsigned long background = di->relief_background; 1439 unsigned long background = di->relief_background;
@@ -3107,7 +3107,7 @@ pgtk_clip_to_row (struct window *w, struct glyph_row *row,
3107} 3107}
3108 3108
3109static void 3109static void
3110pgtk_cr_draw_image (struct frame *f, GC gc, cairo_pattern_t *image, 3110pgtk_cr_draw_image (struct frame *f, Emacs_GC *gc, cairo_pattern_t *image,
3111 int src_x, int src_y, int width, int height, 3111 int src_x, int src_y, int width, int height,
3112 int dest_x, int dest_y, bool overlay_p) 3112 int dest_x, int dest_y, bool overlay_p)
3113{ 3113{
@@ -3198,7 +3198,7 @@ pgtk_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fr
3198 PGTK_TRACE("which: %d, max_fringe_bmp: %d.", p->which, max_fringe_bmp); 3198 PGTK_TRACE("which: %d, max_fringe_bmp: %d.", p->which, max_fringe_bmp);
3199 if (p->which && p->which < max_fringe_bmp) 3199 if (p->which && p->which < max_fringe_bmp)
3200 { 3200 {
3201 XGCValues gcv; 3201 Emacs_GC gcv;
3202 3202
3203 PGTK_TRACE("cursor_p=%d.", p->cursor_p); 3203 PGTK_TRACE("cursor_p=%d.", p->cursor_p);
3204 PGTK_TRACE("overlay_p_p=%d.", p->overlay_p); 3204 PGTK_TRACE("overlay_p_p=%d.", p->overlay_p);
@@ -6356,14 +6356,14 @@ pgtk_end_cr_clip (struct frame *f)
6356} 6356}
6357 6357
6358void 6358void
6359pgtk_set_cr_source_with_gc_foreground (struct frame *f, XGCValues *gc) 6359pgtk_set_cr_source_with_gc_foreground (struct frame *f, Emacs_GC *gc)
6360{ 6360{
6361 PGTK_TRACE("pgtk_set_cr_source_with_gc_foreground: %08lx", gc->foreground); 6361 PGTK_TRACE("pgtk_set_cr_source_with_gc_foreground: %08lx", gc->foreground);
6362 pgtk_set_cr_source_with_color(f, gc->foreground); 6362 pgtk_set_cr_source_with_color(f, gc->foreground);
6363} 6363}
6364 6364
6365void 6365void
6366pgtk_set_cr_source_with_gc_background (struct frame *f, XGCValues *gc) 6366pgtk_set_cr_source_with_gc_background (struct frame *f, Emacs_GC *gc)
6367{ 6367{
6368 PGTK_TRACE("pgtk_set_cr_source_with_gc_background: %08lx", gc->background); 6368 PGTK_TRACE("pgtk_set_cr_source_with_gc_background: %08lx", gc->background);
6369 pgtk_set_cr_source_with_color(f, gc->background); 6369 pgtk_set_cr_source_with_color(f, gc->background);
diff --git a/src/pgtkterm.h b/src/pgtkterm.h
index 10dc9fc9793..622b5ef76fe 100644
--- a/src/pgtkterm.h
+++ b/src/pgtkterm.h
@@ -255,7 +255,7 @@ struct pgtk_output
255 mapped to display an hourglass cursor. */ 255 mapped to display an hourglass cursor. */
256 GtkWidget *hourglass_widget; 256 GtkWidget *hourglass_widget;
257 257
258 XGCValues cursor_xgcv; 258 Emacs_GC cursor_xgcv;
259 259
260 /* lord knows why Emacs needs to know about our Window ids.. */ 260 /* lord knows why Emacs needs to know about our Window ids.. */
261 Window window_desc, parent_desc; 261 Window window_desc, parent_desc;
@@ -349,7 +349,7 @@ struct pgtk_output
349 /* Relief GCs, colors etc. */ 349 /* Relief GCs, colors etc. */
350 struct relief 350 struct relief
351 { 351 {
352 XGCValues xgcv; 352 Emacs_GC xgcv;
353 unsigned long pixel; 353 unsigned long pixel;
354 } 354 }
355 black_relief, white_relief; 355 black_relief, white_relief;
@@ -542,8 +542,8 @@ extern int pgtk_select (int nfds, fd_set *readfds, fd_set *writefds,
542/* Cairo related functions implemented in pgtkterm.c */ 542/* Cairo related functions implemented in pgtkterm.c */
543extern cairo_t *pgtk_begin_cr_clip (struct frame *f); 543extern cairo_t *pgtk_begin_cr_clip (struct frame *f);
544extern void pgtk_end_cr_clip (struct frame *f); 544extern void pgtk_end_cr_clip (struct frame *f);
545extern void pgtk_set_cr_source_with_gc_foreground (struct frame *f, XGCValues *gc); 545extern void pgtk_set_cr_source_with_gc_foreground (struct frame *f, Emacs_GC *gc);
546extern void pgtk_set_cr_source_with_gc_background (struct frame *f, XGCValues *gc); 546extern void pgtk_set_cr_source_with_gc_background (struct frame *f, Emacs_GC *gc);
547extern void pgtk_set_cr_source_with_color (struct frame *f, unsigned long color); 547extern void pgtk_set_cr_source_with_color (struct frame *f, unsigned long color);
548extern void pgtk_cr_draw_frame (cairo_t *cr, struct frame *f); 548extern void pgtk_cr_draw_frame (cairo_t *cr, struct frame *f);
549extern void pgtk_cr_destroy_surface(struct frame *f); 549extern void pgtk_cr_destroy_surface(struct frame *f);
diff --git a/src/xfaces.c b/src/xfaces.c
index a84e52157d9..7f26610e373 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -578,18 +578,18 @@ x_free_gc (struct frame *f, Emacs_GC *gc)
578#ifdef HAVE_PGTK 578#ifdef HAVE_PGTK
579/* PGTK emulation of GCs */ 579/* PGTK emulation of GCs */
580 580
581static GC 581static Emacs_GC *
582x_create_gc (struct frame *f, 582x_create_gc (struct frame *f,
583 unsigned long mask, 583 unsigned long mask,
584 XGCValues *xgcv) 584 Emacs_GC *xgcv)
585{ 585{
586 GC gc = xmalloc (sizeof *gc); 586 Emacs_GC *gc = xmalloc (sizeof *gc);
587 *gc = *xgcv; 587 *gc = *xgcv;
588 return gc; 588 return gc;
589} 589}
590 590
591static void 591static void
592x_free_gc (struct frame *f, GC gc) 592x_free_gc (struct frame *f, Emacs_GC *gc)
593{ 593{
594 xfree (gc); 594 xfree (gc);
595} 595}