From c0e146e4ec266edf348473c3db7ca8d16745f4f7 Mon Sep 17 00:00:00 2001 From: Alexander Gramiak Date: Thu, 9 May 2019 13:07:35 -0600 Subject: Introduce Emacs_Color struct and typedef This avoids clashing with the XColor struct from X. * src/dispextern [HAVE_X_WINDOWS]: Define Emacs_Color alias. [!HAVE_X_WINDOWS]: Rename XColor compatibility struct to Emacs_Color. Remove unused fields. * src/gtkutil.c: * src/gtkutil.h: * src/image.c: * src/nsterm.h: * src/nsterm.m: * src/termhooks.h: * src/w32fns.c: * src/w32term.c: * src/w32term.h: * src/xfaces.c: * src/xfns.c: * src/xterm.h: Use Emacs_Color over XColor outside of X-specific sections. --- src/w32fns.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/w32fns.c') diff --git a/src/w32fns.c b/src/w32fns.c index 525642bfaab..2f54bdc1da1 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -1174,7 +1174,7 @@ gamma_correct (struct frame *f, COLORREF *color) If ALLOC is nonzero, allocate a new colormap cell. */ bool -w32_defined_color (struct frame *f, const char *color, XColor *color_def, +w32_defined_color (struct frame *f, const char *color, Emacs_Color *color_def, bool alloc_p, bool _makeIndex) { register Lisp_Object tem; @@ -1248,7 +1248,7 @@ w32_defined_color (struct frame *f, const char *color, XColor *color_def, static int w32_decode_color (struct frame *f, Lisp_Object arg, int def) { - XColor cdef; + Emacs_Color cdef; CHECK_STRING (arg); @@ -6100,7 +6100,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, doc: /* SKIP: real doc in xfns.c. */) (Lisp_Object color, Lisp_Object frame) { - XColor foo; + Emacs_Color foo; struct frame *f = decode_window_system_frame (frame); CHECK_STRING (color); @@ -6115,7 +6115,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, doc: /* SKIP: real doc in xfns.c. */) (Lisp_Object color, Lisp_Object frame) { - XColor foo; + Emacs_Color foo; struct frame *f = decode_window_system_frame (frame); CHECK_STRING (color); -- cgit v1.2.3 From 06db2a052fb7335185e8d581d245ce214b3bba7c Mon Sep 17 00:00:00 2001 From: Alexander Gramiak Date: Thu, 9 May 2019 17:13:18 -0600 Subject: Introduce Emacs_Cursor typedef * src/dispextern.h [HAVE_X_WINDOWS]: Define Emacs_Cursor alias. Move the No_Cursor definition from xterm.h. (redisplay_interface): Use Emacs_Cursor over Cursor. * src/nsgui.h: * src/nsterm.h: * src/nsterm.m: * src/w32gui.h: * src/w32term.c: * src/xdisp.c: * src/xterm.c (x_define_frame_cursor): Use Emacs_Cursor over Cursor. --- src/dispextern.h | 10 +++++++--- src/nsgui.h | 6 ++---- src/nsterm.h | 36 ++++++++++++++++++------------------ src/nsterm.m | 2 +- src/w32fns.c | 12 ++++++------ src/w32gui.h | 4 +--- src/w32term.c | 8 ++++---- src/w32term.h | 36 ++++++++++++++++++------------------ src/xdisp.c | 6 +++--- src/xterm.c | 2 +- src/xterm.h | 2 -- 11 files changed, 61 insertions(+), 63 deletions(-) (limited to 'src/w32fns.c') diff --git a/src/dispextern.h b/src/dispextern.h index e3f4297e313..0acd03c0490 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -36,6 +36,9 @@ along with GNU Emacs. If not, see . */ #endif typedef XColor Emacs_Color; +typedef Cursor Emacs_Cursor; +#define No_Cursor (None) + #else /* !HAVE_X_WINDOWS */ /* XColor-like struct used by non-X code. */ @@ -46,6 +49,8 @@ typedef struct unsigned short red, green, blue; } Emacs_Color; +/* Accommodate X's usage of None as a null resource ID. */ +#define No_Cursor (NULL) #endif /* HAVE_X_WINDOWS */ #ifdef MSDOS @@ -93,8 +98,7 @@ typedef XImagePtr XImagePtr_or_DC; #endif #ifndef HAVE_WINDOW_SYSTEM -typedef int Cursor; -#define No_Cursor (0) +typedef void *Emacs_Cursor; #endif #ifndef NativeRectangle @@ -2889,7 +2893,7 @@ struct redisplay_interface void (*draw_glyph_string) (struct glyph_string *s); /* Define cursor CURSOR on frame F. */ - void (*define_frame_cursor) (struct frame *f, Cursor cursor); + void (*define_frame_cursor) (struct frame *f, Emacs_Cursor cursor); /* Clear the area at (X,Y,WIDTH,HEIGHT) of frame F. */ void (*clear_frame_area) (struct frame *f, int x, int y, diff --git a/src/nsgui.h b/src/nsgui.h index 81be68b574d..1a0453fa4a4 100644 --- a/src/nsgui.h +++ b/src/nsgui.h @@ -102,13 +102,11 @@ typedef void *Pixmap; #endif #ifdef __OBJC__ -typedef NSCursor * Cursor; +typedef NSCursor *Emacs_Cursor; #else -typedef void *Cursor; +typedef void *Emacs_Cursor; #endif -#define No_Cursor (0) - typedef int Window; diff --git a/src/nsterm.h b/src/nsterm.h index ad1af3098d6..66e12720401 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -872,10 +872,10 @@ struct ns_display_info Lisp_Object rdb; /* The cursor to use for vertical scroll bars. */ - Cursor vertical_scroll_bar_cursor; + Emacs_Cursor vertical_scroll_bar_cursor; /* The cursor to use for horizontal scroll bars. */ - Cursor horizontal_scroll_bar_cursor; + Emacs_Cursor horizontal_scroll_bar_cursor; /* Information about the range of text currently shown in mouse-face. */ @@ -931,24 +931,24 @@ struct ns_output #endif /* NSCursors are initialized in initFrameFromEmacs. */ - Cursor text_cursor; - Cursor nontext_cursor; - Cursor modeline_cursor; - Cursor hand_cursor; - Cursor hourglass_cursor; - Cursor horizontal_drag_cursor; - Cursor vertical_drag_cursor; - Cursor left_edge_cursor; - Cursor top_left_corner_cursor; - Cursor top_edge_cursor; - Cursor top_right_corner_cursor; - Cursor right_edge_cursor; - Cursor bottom_right_corner_cursor; - Cursor bottom_edge_cursor; - Cursor bottom_left_corner_cursor; + Emacs_Cursor text_cursor; + Emacs_Cursor nontext_cursor; + Emacs_Cursor modeline_cursor; + Emacs_Cursor hand_cursor; + Emacs_Cursor hourglass_cursor; + Emacs_Cursor horizontal_drag_cursor; + Emacs_Cursor vertical_drag_cursor; + Emacs_Cursor left_edge_cursor; + Emacs_Cursor top_left_corner_cursor; + Emacs_Cursor top_edge_cursor; + Emacs_Cursor top_right_corner_cursor; + Emacs_Cursor right_edge_cursor; + Emacs_Cursor bottom_right_corner_cursor; + Emacs_Cursor bottom_edge_cursor; + Emacs_Cursor bottom_left_corner_cursor; /* NS-specific */ - Cursor current_pointer; + Emacs_Cursor current_pointer; /* lord knows why Emacs needs to know about our Window ids.. */ Window window_desc, parent_desc; diff --git a/src/nsterm.m b/src/nsterm.m index deac229c98b..82a0d2348ee 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2576,7 +2576,7 @@ ns_frame_up_to_date (struct frame *f) static void -ns_define_frame_cursor (struct frame *f, Cursor cursor) +ns_define_frame_cursor (struct frame *f, Emacs_Cursor cursor) /* -------------------------------------------------------------------------- External (RIF): set frame mouse pointer type. -------------------------------------------------------------------------- */ diff --git a/src/w32fns.c b/src/w32fns.c index 2f54bdc1da1..d74e968d379 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -2247,15 +2247,15 @@ w32_set_z_group (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) /* Subroutines for creating a frame. */ -Cursor w32_load_cursor (LPCTSTR); +HCURSOR w32_load_cursor (LPCTSTR); -Cursor +HCURSOR w32_load_cursor (LPCTSTR name) { /* Try first to load cursor from application resource. */ - Cursor cursor = LoadImage ((HINSTANCE) GetModuleHandle (NULL), - name, IMAGE_CURSOR, 0, 0, - LR_DEFAULTCOLOR | LR_DEFAULTSIZE | LR_SHARED); + HCURSOR cursor = LoadImage ((HINSTANCE) GetModuleHandle (NULL), + name, IMAGE_CURSOR, 0, 0, + LR_DEFAULTCOLOR | LR_DEFAULTSIZE | LR_SHARED); if (!cursor) { /* Then try to load a shared predefined cursor. */ @@ -5217,7 +5217,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_EMACS_SETCURSOR: { - Cursor cursor = (Cursor) wParam; + HCURSOR cursor = (HCURSOR) wParam; f = w32_window_to_frame (dpyinfo, hwnd); if (f && cursor) { diff --git a/src/w32gui.h b/src/w32gui.h index b2ad28366c3..81b4820becf 100644 --- a/src/w32gui.h +++ b/src/w32gui.h @@ -45,9 +45,7 @@ typedef HBITMAP Bitmap; typedef XGCValues * GC; typedef HWND Window; typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */ -typedef HCURSOR Cursor; - -#define No_Cursor (0) +typedef HCURSOR Emacs_Cursor; #define XChar2b wchar_t diff --git a/src/w32term.c b/src/w32term.c index 6c53bc147a0..2be53cab894 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -85,7 +85,7 @@ static int any_help_event_p; extern unsigned int msh_mousewheel; extern int w32_codepage_for_font (char *fontname); -extern Cursor w32_load_cursor (LPCTSTR name); +extern HCURSOR w32_load_cursor (LPCTSTR name); /* This is display since w32 does not support multiple ones. */ @@ -166,7 +166,7 @@ int w32_message_fd = -1; static void w32_handle_tool_bar_click (struct frame *, struct input_event *); -static void w32_define_cursor (Window, Cursor); +static void w32_define_cursor (Window, Emacs_Cursor); static void w32_scroll_bar_clear (struct frame *); static void w32_raise_frame (struct frame *); @@ -3429,7 +3429,7 @@ static void w32_horizontal_scroll_bar_report_motion (struct frame **, Lisp_Objec Lisp_Object *, Lisp_Object *, Time *); static void -w32_define_cursor (Window window, Cursor cursor) +w32_define_cursor (Window window, Emacs_Cursor cursor) { PostMessage (window, WM_EMACS_SETCURSOR, (WPARAM) cursor, 0); } @@ -5806,7 +5806,7 @@ w32_draw_bar_cursor (struct window *w, struct glyph_row *row, /* RIF: Define cursor CURSOR on frame F. */ static void -w32_define_frame_cursor (struct frame *f, Cursor cursor) +w32_define_frame_cursor (struct frame *f, Emacs_Cursor cursor) { w32_define_cursor (FRAME_W32_WINDOW (f), cursor); } diff --git a/src/w32term.h b/src/w32term.h index 0dffd3db070..32c749e4874 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -114,10 +114,10 @@ struct w32_display_info Window root_window; /* The cursor to use for vertical scroll bars. */ - Cursor vertical_scroll_bar_cursor; + HCURSOR vertical_scroll_bar_cursor; /* The cursor to use for horizontal scroll bars. */ - Cursor horizontal_scroll_bar_cursor; + HCURSOR horizontal_scroll_bar_cursor; /* Resource data base */ const char *rdb; @@ -348,27 +348,27 @@ struct w32_output COLORREF scroll_bar_background_pixel; /* Descriptor for the cursor in use for this window. */ - Cursor text_cursor; - Cursor nontext_cursor; - Cursor modeline_cursor; - Cursor hand_cursor; - Cursor hourglass_cursor; - Cursor horizontal_drag_cursor; - Cursor vertical_drag_cursor; - Cursor left_edge_cursor; - Cursor top_left_corner_cursor; - Cursor top_edge_cursor; - Cursor top_right_corner_cursor; - Cursor right_edge_cursor; - Cursor bottom_right_corner_cursor; - Cursor bottom_edge_cursor; - Cursor bottom_left_corner_cursor; + HCURSOR text_cursor; + HCURSOR nontext_cursor; + HCURSOR modeline_cursor; + HCURSOR hand_cursor; + HCURSOR hourglass_cursor; + HCURSOR horizontal_drag_cursor; + HCURSOR vertical_drag_cursor; + HCURSOR left_edge_cursor; + HCURSOR top_left_corner_cursor; + HCURSOR top_edge_cursor; + HCURSOR top_right_corner_cursor; + HCURSOR right_edge_cursor; + HCURSOR bottom_right_corner_cursor; + HCURSOR bottom_edge_cursor; + HCURSOR bottom_left_corner_cursor; /* Non-zero means hourglass cursor is currently displayed. */ unsigned hourglass_p : 1; /* Non-hourglass cursor that is currently active. */ - Cursor current_cursor; + HCURSOR current_cursor; DWORD dwStyle; diff --git a/src/xdisp.c b/src/xdisp.c index 1aa677fcc78..0c1d9660324 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -31153,7 +31153,7 @@ Returns the alist element for the first matching AREA in MAP. */) /* Display frame CURSOR, optionally using shape defined by POINTER. */ static void -define_frame_cursor1 (struct frame *f, Cursor cursor, Lisp_Object pointer) +define_frame_cursor1 (struct frame *f, Emacs_Cursor cursor, Lisp_Object pointer) { #ifdef HAVE_WINDOW_SYSTEM if (!FRAME_WINDOW_P (f)) @@ -31205,7 +31205,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, struct window *w = XWINDOW (window); struct frame *f = XFRAME (w->frame); Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); - Cursor cursor = No_Cursor; + Emacs_Cursor cursor = No_Cursor; Lisp_Object pointer = Qnil; int dx, dy, width, height; ptrdiff_t charpos; @@ -31518,7 +31518,7 @@ note_mouse_highlight (struct frame *f, int x, int y) enum window_part part = ON_NOTHING; Lisp_Object window; struct window *w; - Cursor cursor = No_Cursor; + Emacs_Cursor cursor = No_Cursor; Lisp_Object pointer = Qnil; /* Takes precedence over cursor! */ struct buffer *b; diff --git a/src/xterm.c b/src/xterm.c index 4f4a1d6d02a..c8cddcabf5e 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -9356,7 +9356,7 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text /* RIF: Define cursor CURSOR on frame F. */ static void -x_define_frame_cursor (struct frame *f, Cursor cursor) +x_define_frame_cursor (struct frame *f, Emacs_Cursor cursor) { if (!f->pointer_invisible && f->output_data.x->current_cursor != cursor) diff --git a/src/xterm.h b/src/xterm.h index 758a1939d6e..54473045787 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -731,8 +731,6 @@ struct x_output #endif }; -#define No_Cursor (None) - enum { /* Values for focus_state, used as bit mask. -- cgit v1.2.3 From b3d3c0daa49f5cbed7c58c7508d4d36dba3757e5 Mon Sep 17 00:00:00 2001 From: Alexander Gramiak Date: Thu, 9 May 2019 22:08:06 -0600 Subject: Introduce Emacs_GC struct and typedef * src/dispextern.h [HAVE_X_WINDOWS]: Alias Emacs_GC to XGCValues. [!HAVE_X_WINDOWS]: Define Emacs_GC, GCForeground, and GCBackground. * src/nsgui.h: * src/w32gui.h:Remove obsolete XGCValues, GC, GCForeground, GCBackground, and GCFont definitions. * src/w32fns.c (w32_make_gc): Do not set unused font field. * src/w32term.c: Use Emacs_GC over XGCValues. Do not set unused font field. * src/xfaces.c: Use Emacs_GC over XGCValues and GC. --- src/dispextern.h | 22 +++++++++++++-- src/nsgui.h | 19 ------------- src/w32fns.c | 7 ++--- src/w32gui.h | 13 --------- src/w32term.c | 83 ++++++++++++++++++++++++++------------------------------ src/w32term.h | 8 +++--- src/xfaces.c | 34 +++++++++++------------ 7 files changed, 82 insertions(+), 104 deletions(-) (limited to 'src/w32fns.c') diff --git a/src/dispextern.h b/src/dispextern.h index 2077f891d10..05e09301b06 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -40,6 +40,7 @@ typedef Cursor Emacs_Cursor; #define No_Cursor (None) typedef Pixmap Emacs_Pixmap; typedef XRectangle Emacs_Rectangle; +typedef XGCValues Emacs_GC; #else /* !HAVE_X_WINDOWS */ /* XColor-like struct used by non-X code. */ @@ -59,6 +60,20 @@ typedef struct int x, y; unsigned width, height; } Emacs_Rectangle; + +/* XGCValues-like struct used by non-X GUI code. */ +typedef struct +{ + unsigned long foreground; + unsigned long background; +} Emacs_GC; + +/* Mask values to select foreground/background. */ +/* FIXME: The GC handling in w32 really should be redesigned as to not + need these. */ +#define GCForeground 0x01 +#define GCBackground 0x02 + #endif /* HAVE_X_WINDOWS */ #ifdef MSDOS @@ -1363,7 +1378,7 @@ struct glyph_string GC gc; #endif #if defined (HAVE_NTGUI) - XGCValues *gc; + Emacs_GC *gc; HDC hdc; #endif @@ -1605,8 +1620,11 @@ struct face /* If non-zero, this is a GC that we can use without modification for drawing the characters in this face. */ +# ifdef HAVE_X_WINDOWS GC gc; - +# else + Emacs_GC *gc; +# endif /* Background stipple or bitmap used for this face. This is an id as returned from load_pixmap. */ ptrdiff_t stipple; diff --git a/src/nsgui.h b/src/nsgui.h index 592e21f60af..87c06e68a22 100644 --- a/src/nsgui.h +++ b/src/nsgui.h @@ -76,25 +76,6 @@ typedef unichar XChar2b; /* Used in xdisp.c when comparing faces and frame colors. */ extern unsigned long ns_color_index_to_rgba(int idx, struct frame *f); -/* XXX: xfaces requires these structures, but the question is are we - forced to use them? */ -typedef struct _XGCValues -{ - unsigned long foreground; - unsigned long background; -#ifdef __OBJC__ - struct ns_font *font; -#else - void *font; -#endif -} XGCValues; - -typedef XGCValues * GC; - -#define GCForeground 0x01 -#define GCBackground 0x02 -#define GCFont 0x03 - #ifdef __OBJC__ typedef id Emacs_Pixmap; #else diff --git a/src/w32fns.c b/src/w32fns.c index d74e968d379..bb74fcc1640 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -5559,22 +5559,19 @@ w32_icon (struct frame *f, Lisp_Object parms) static void w32_make_gc (struct frame *f) { - XGCValues gc_values; + Emacs_GC gc_values; block_input (); /* Create the GC's of this frame. Note that many default values are used. */ - /* Normal video */ - gc_values.font = FRAME_FONT (f); - /* Cursor has cursor-color background, background-color foreground. */ gc_values.foreground = FRAME_BACKGROUND_PIXEL (f); gc_values.background = f->output_data.w32->cursor_pixel; f->output_data.w32->cursor_gc = XCreateGC (NULL, FRAME_W32_WINDOW (f), - (GCFont | GCForeground | GCBackground), + (GCForeground | GCBackground), &gc_values); /* Reliefs. */ diff --git a/src/w32gui.h b/src/w32gui.h index 69b6a556ff0..5e1730b92c7 100644 --- a/src/w32gui.h +++ b/src/w32gui.h @@ -27,21 +27,8 @@ along with GNU Emacs. If not, see . */ #define local_alloc(n) (HeapAlloc (local_heap, HEAP_ZERO_MEMORY, (n))) #define local_free(p) (HeapFree (local_heap, 0, ((LPVOID) (p)))) -/* Emulate X GC's by keeping color and font info in a structure. */ -typedef struct _XGCValues -{ - COLORREF foreground; - COLORREF background; - struct font *font; -} XGCValues; - -#define GCForeground 0x01 -#define GCBackground 0x02 -#define GCFont 0x03 - typedef HBITMAP Emacs_Pixmap; -typedef XGCValues * GC; typedef HWND Window; typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */ typedef HCURSOR Emacs_Cursor; diff --git a/src/w32term.c b/src/w32term.c index 5c492b3fa99..4a93b2a4043 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -237,23 +237,21 @@ record_event (char *locus, int type) static void -XChangeGC (void *ignore, XGCValues *gc, unsigned long mask, - XGCValues *xgcv) +XChangeGC (void *ignore, Emacs_GC *gc, unsigned long mask, + Emacs_GC *egc) { if (mask & GCForeground) - gc->foreground = xgcv->foreground; + gc->foreground = egc->foreground; if (mask & GCBackground) - gc->background = xgcv->background; - if (mask & GCFont) - gc->font = xgcv->font; + gc->background = egc->background; } -XGCValues * -XCreateGC (void *ignore, HWND wignore, unsigned long mask, XGCValues *xgcv) +Emacs_GC * +XCreateGC (void *ignore, HWND wignore, unsigned long mask, Emacs_GC *egc) { - XGCValues *gc = xzalloc (sizeof (XGCValues)); + Emacs_GC *gc = xzalloc (sizeof (*gc)); - XChangeGC (ignore, gc, mask, xgcv); + XChangeGC (ignore, gc, mask, egc); return gc; } @@ -396,7 +394,7 @@ w32_draw_underwave (struct glyph_string *s, COLORREF color) /* Draw a hollow rectangle at the specified position. */ static void -w32_draw_rectangle (HDC hdc, XGCValues *gc, int x, int y, +w32_draw_rectangle (HDC hdc, Emacs_GC *gc, int x, int y, int width, int height) { HBRUSH hb, oldhb; @@ -906,38 +904,37 @@ w32_set_cursor_gc (struct glyph_string *s) else { /* Cursor on non-default face: must merge. */ - XGCValues xgcv; + Emacs_GC egc; unsigned long mask; - xgcv.background = s->f->output_data.w32->cursor_pixel; - xgcv.foreground = s->face->background; + egc.background = s->f->output_data.w32->cursor_pixel; + egc.foreground = s->face->background; /* If the glyph would be invisible, try a different foreground. */ - if (xgcv.foreground == xgcv.background) - xgcv.foreground = s->face->foreground; - if (xgcv.foreground == xgcv.background) - xgcv.foreground = s->f->output_data.w32->cursor_foreground_pixel; - if (xgcv.foreground == xgcv.background) - xgcv.foreground = s->face->foreground; + if (egc.foreground == egc.background) + egc.foreground = s->face->foreground; + if (egc.foreground == egc.background) + egc.foreground = s->f->output_data.w32->cursor_foreground_pixel; + if (egc.foreground == egc.background) + egc.foreground = s->face->foreground; /* Make sure the cursor is distinct from text in this face. */ - if (xgcv.background == s->face->background - && xgcv.foreground == s->face->foreground) + if (egc.background == s->face->background + && egc.foreground == s->face->foreground) { - xgcv.background = s->face->foreground; - xgcv.foreground = s->face->background; + egc.background = s->face->foreground; + egc.foreground = s->face->background; } IF_DEBUG (w32_check_font (s->f, s->font)); - xgcv.font = s->font; - mask = GCForeground | GCBackground | GCFont; + mask = GCForeground | GCBackground; if (FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc) XChangeGC (NULL, FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc, - mask, &xgcv); + mask, &egc); else FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc - = XCreateGC (NULL, FRAME_W32_WINDOW (s->f), mask, &xgcv); + = XCreateGC (NULL, FRAME_W32_WINDOW (s->f), mask, &egc); s->gc = FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc; } @@ -972,21 +969,20 @@ w32_set_mouse_face_gc (struct glyph_string *s) { /* Otherwise construct scratch_cursor_gc with values from FACE but font FONT. */ - XGCValues xgcv; + Emacs_GC egc; unsigned long mask; - xgcv.background = s->face->background; - xgcv.foreground = s->face->foreground; + egc.background = s->face->background; + egc.foreground = s->face->foreground; IF_DEBUG (w32_check_font (s->f, s->font)); - xgcv.font = s->font; - mask = GCForeground | GCBackground | GCFont; + mask = GCForeground | GCBackground; if (FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc) XChangeGC (NULL, FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc, - mask, &xgcv); + mask, &egc); else FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc - = XCreateGC (NULL, FRAME_W32_WINDOW (s->f), mask, &xgcv); + = XCreateGC (NULL, FRAME_W32_WINDOW (s->f), mask, &egc); s->gc = FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc; } @@ -1551,7 +1547,7 @@ static void w32_setup_relief_color (struct frame *f, struct relief *relief, double factor, int delta, COLORREF default_pixel) { - XGCValues xgcv; + Emacs_GC egc; struct w32_output *di = f->output_data.w32; unsigned long mask = GCForeground; COLORREF pixel; @@ -1563,22 +1559,21 @@ w32_setup_relief_color (struct frame *f, struct relief *relief, double factor, /* TODO: Free colors (if using palette)? */ /* Allocate new color. */ - xgcv.foreground = default_pixel; + egc.foreground = default_pixel; pixel = background; if (w32_alloc_lighter_color (f, &pixel, factor, delta)) - xgcv.foreground = relief->pixel = pixel; + egc.foreground = relief->pixel = pixel; - xgcv.font = NULL; /* avoid compiler warnings */ if (relief->gc == 0) { #if 0 /* TODO: stipple */ - xgcv.stipple = dpyinfo->gray; + egc.stipple = dpyinfo->gray; mask |= GCStipple; #endif - relief->gc = XCreateGC (NULL, FRAME_W32_WINDOW (f), mask, &xgcv); + relief->gc = XCreateGC (NULL, FRAME_W32_WINDOW (f), mask, &egc); } else - XChangeGC (NULL, relief->gc, mask, &xgcv); + XChangeGC (NULL, relief->gc, mask, &egc); } @@ -1627,7 +1622,7 @@ w32_draw_relief_rect (struct frame *f, RECT *clip_rect) { int i; - XGCValues gc; + Emacs_GC gc; HDC hdc = get_frame_dc (f); if (raised_p) @@ -2286,7 +2281,7 @@ w32_draw_stretch_glyph_string (struct glyph_string *s) /* Clear rest using the GC of the original non-cursor face. */ if (width < background_width) { - XGCValues *gc = s->face->gc; + Emacs_GC *gc = s->face->gc; int y = s->y; int w = background_width - width, h = s->height; RECT r; diff --git a/src/w32term.h b/src/w32term.h index f1373beb81c..729e8d0fd49 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -142,7 +142,7 @@ struct w32_display_info int smallest_font_height; /* Reusable Graphics Context for drawing a cursor in a non-default face. */ - XGCValues *scratch_cursor_gc; + Emacs_GC *scratch_cursor_gc; /* Information about the range of text currently shown in mouse-face. */ @@ -308,7 +308,7 @@ struct w32_output HPALETTE old_palette; /* Here are the Graphics Contexts for the default font. */ - XGCValues *cursor_gc; /* cursor drawing */ + Emacs_GC *cursor_gc; /* cursor drawing */ /* The window used for this frame. May be zero while the frame object is being created @@ -388,7 +388,7 @@ struct w32_output /* Relief GCs, colors etc. */ struct relief { - XGCValues *gc; + Emacs_GC *gc; unsigned long pixel; } black_relief, white_relief; @@ -805,7 +805,7 @@ typedef struct tagTRACKMOUSEEVENT struct image; struct face; -XGCValues *XCreateGC (void *, HWND, unsigned long, XGCValues *); +Emacs_GC *XCreateGC (void *, HWND, unsigned long, Emacs_GC *); typedef DWORD (WINAPI * ClipboardSequence_Proc) (void); typedef BOOL (WINAPI * AppendMenuW_Proc) ( diff --git a/src/xfaces.c b/src/xfaces.c index a8fdca70c9e..d211ec8c460 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -513,12 +513,12 @@ x_free_gc (struct frame *f, GC gc) #ifdef HAVE_NTGUI /* W32 emulation of GCs */ -static GC -x_create_gc (struct frame *f, unsigned long mask, XGCValues *xgcv) +static Emacs_GC * +x_create_gc (struct frame *f, unsigned long mask, Emacs_GC *egc) { - GC gc; + Emacs_GC *gc; block_input (); - gc = XCreateGC (NULL, FRAME_W32_WINDOW (f), mask, xgcv); + gc = XCreateGC (NULL, FRAME_W32_WINDOW (f), mask, egc); unblock_input (); IF_DEBUG (++ngcs); return gc; @@ -528,7 +528,7 @@ x_create_gc (struct frame *f, unsigned long mask, XGCValues *xgcv) /* Free GC which was used on frame F. */ static void -x_free_gc (struct frame *f, GC gc) +x_free_gc (struct frame *f, Emacs_GC *gc) { IF_DEBUG ((--ngcs, eassert (ngcs >= 0))); xfree (gc); @@ -539,18 +539,18 @@ x_free_gc (struct frame *f, GC gc) #ifdef HAVE_NS /* NS emulation of GCs */ -static GC +static Emacs_GC * x_create_gc (struct frame *f, unsigned long mask, - XGCValues *xgcv) + Emacs_GC *egc) { - GC gc = xmalloc (sizeof *gc); - *gc = *xgcv; + Emacs_GC *gc = xmalloc (sizeof *gc); + *gc = *egc; return gc; } static void -x_free_gc (struct frame *f, GC gc) +x_free_gc (struct frame *f, Emacs_GC *gc) { xfree (gc); } @@ -4140,25 +4140,25 @@ prepare_face_for_display (struct frame *f, struct face *face) if (face->gc == 0) { - XGCValues xgcv; + Emacs_GC egc; unsigned long mask = GCForeground | GCBackground | GCGraphicsExposures; - xgcv.foreground = face->foreground; - xgcv.background = face->background; + egc.foreground = face->foreground; + egc.background = face->background; #ifdef HAVE_X_WINDOWS - xgcv.graphics_exposures = False; + egc.graphics_exposures = False; #endif block_input (); #ifdef HAVE_X_WINDOWS if (face->stipple) { - xgcv.fill_style = FillOpaqueStippled; - xgcv.stipple = image_bitmap_pixmap (f, face->stipple); + egc.fill_style = FillOpaqueStippled; + egc.stipple = image_bitmap_pixmap (f, face->stipple); mask |= GCFillStyle | GCStipple; } #endif - face->gc = x_create_gc (f, mask, &xgcv); + face->gc = x_create_gc (f, mask, &egc); if (face->font) font_prepare_for_face (f, face); unblock_input (); -- cgit v1.2.3