From 330a346ca734d39c0233ef899e044d05e0e1ebe9 Mon Sep 17 00:00:00 2001 From: Yuuki Harano Date: Tue, 25 Jun 2019 21:36:39 +0900 Subject: [PATCH] Migrate to Emacs_GC MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * ../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 に統一。 --- src/dispextern.h | 2 +- src/pgtkgui.h | 21 +-------------------- src/pgtkterm.c | 14 +++++++------- src/pgtkterm.h | 8 ++++---- src/xfaces.c | 8 ++++---- 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 HDC hdc; #endif #if defined (HAVE_PGTK) - XGCValues xgcv; + Emacs_GC xgcv; #endif /* 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; (*(chp) & 0x00ff) -/* XXX: xfaces requires these structures, but the question is are we - forced to use them? */ -typedef struct _XGCValues -{ - unsigned long foreground; - unsigned long background; - void *font; -} XGCValues; - -typedef XGCValues * GC; - -#define GCForeground 0x01 -#define GCBackground 0x02 -#define GCFont 0x03 - -typedef void *Pixmap; - -typedef void *Cursor; - -#define No_Cursor (0) +typedef void *Emacs_Cursor; typedef void * Color; typedef 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) else { /* Cursor on non-default face: must merge. */ - XGCValues xgcv; + Emacs_GC xgcv; PGTK_TRACE("x_set_cursor_gc: 2."); xgcv.background = FRAME_X_OUTPUT(s->f)->cursor_color; @@ -815,7 +815,7 @@ x_set_mouse_face_gc (struct glyph_string *s) { /* Otherwise construct scratch_cursor_gc with values from FACE except for FONT. */ - XGCValues xgcv; + Emacs_GC xgcv; xgcv.background = s->face->background; xgcv.foreground = s->face->foreground; @@ -1433,7 +1433,7 @@ static void x_setup_relief_color (struct frame *f, struct relief *relief, double factor, int delta, unsigned long default_pixel) { - XGCValues xgcv; + Emacs_GC xgcv; struct pgtk_output *di = FRAME_X_OUTPUT(f); unsigned long pixel; unsigned long background = di->relief_background; @@ -3107,7 +3107,7 @@ pgtk_clip_to_row (struct window *w, struct glyph_row *row, } static void -pgtk_cr_draw_image (struct frame *f, GC gc, cairo_pattern_t *image, +pgtk_cr_draw_image (struct frame *f, Emacs_GC *gc, cairo_pattern_t *image, int src_x, int src_y, int width, int height, int dest_x, int dest_y, bool overlay_p) { @@ -3198,7 +3198,7 @@ pgtk_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fr PGTK_TRACE("which: %d, max_fringe_bmp: %d.", p->which, max_fringe_bmp); if (p->which && p->which < max_fringe_bmp) { - XGCValues gcv; + Emacs_GC gcv; PGTK_TRACE("cursor_p=%d.", p->cursor_p); PGTK_TRACE("overlay_p_p=%d.", p->overlay_p); @@ -6356,14 +6356,14 @@ pgtk_end_cr_clip (struct frame *f) } void -pgtk_set_cr_source_with_gc_foreground (struct frame *f, XGCValues *gc) +pgtk_set_cr_source_with_gc_foreground (struct frame *f, Emacs_GC *gc) { PGTK_TRACE("pgtk_set_cr_source_with_gc_foreground: %08lx", gc->foreground); pgtk_set_cr_source_with_color(f, gc->foreground); } void -pgtk_set_cr_source_with_gc_background (struct frame *f, XGCValues *gc) +pgtk_set_cr_source_with_gc_background (struct frame *f, Emacs_GC *gc) { PGTK_TRACE("pgtk_set_cr_source_with_gc_background: %08lx", gc->background); 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 mapped to display an hourglass cursor. */ GtkWidget *hourglass_widget; - XGCValues cursor_xgcv; + Emacs_GC cursor_xgcv; /* lord knows why Emacs needs to know about our Window ids.. */ Window window_desc, parent_desc; @@ -349,7 +349,7 @@ struct pgtk_output /* Relief GCs, colors etc. */ struct relief { - XGCValues xgcv; + Emacs_GC xgcv; unsigned long pixel; } black_relief, white_relief; @@ -542,8 +542,8 @@ extern int pgtk_select (int nfds, fd_set *readfds, fd_set *writefds, /* Cairo related functions implemented in pgtkterm.c */ extern cairo_t *pgtk_begin_cr_clip (struct frame *f); extern void pgtk_end_cr_clip (struct frame *f); -extern void pgtk_set_cr_source_with_gc_foreground (struct frame *f, XGCValues *gc); -extern void pgtk_set_cr_source_with_gc_background (struct frame *f, XGCValues *gc); +extern void pgtk_set_cr_source_with_gc_foreground (struct frame *f, Emacs_GC *gc); +extern void pgtk_set_cr_source_with_gc_background (struct frame *f, Emacs_GC *gc); extern void pgtk_set_cr_source_with_color (struct frame *f, unsigned long color); extern void pgtk_cr_draw_frame (cairo_t *cr, struct frame *f); extern 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) #ifdef HAVE_PGTK /* PGTK emulation of GCs */ -static GC +static Emacs_GC * x_create_gc (struct frame *f, unsigned long mask, - XGCValues *xgcv) + Emacs_GC *xgcv) { - GC gc = xmalloc (sizeof *gc); + Emacs_GC *gc = xmalloc (sizeof *gc); *gc = *xgcv; return gc; } static void -x_free_gc (struct frame *f, GC gc) +x_free_gc (struct frame *f, Emacs_GC *gc) { xfree (gc); } -- 2.39.5