diff options
| author | Alexander Gramiak | 2019-05-09 22:08:06 -0600 |
|---|---|---|
| committer | Alexander Gramiak | 2019-05-19 19:50:32 -0600 |
| commit | b3d3c0daa49f5cbed7c58c7508d4d36dba3757e5 (patch) | |
| tree | 72360d5d9cdd8bc9f6ad715128d5452889d0caa3 /src/w32term.c | |
| parent | 462b1fd7185ab8866c8db15b6e7a9b865e4d2389 (diff) | |
| download | emacs-b3d3c0daa49f5cbed7c58c7508d4d36dba3757e5.tar.gz emacs-b3d3c0daa49f5cbed7c58c7508d4d36dba3757e5.zip | |
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.
Diffstat (limited to 'src/w32term.c')
| -rw-r--r-- | src/w32term.c | 83 |
1 files changed, 39 insertions, 44 deletions
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) | |||
| 237 | 237 | ||
| 238 | 238 | ||
| 239 | static void | 239 | static void |
| 240 | XChangeGC (void *ignore, XGCValues *gc, unsigned long mask, | 240 | XChangeGC (void *ignore, Emacs_GC *gc, unsigned long mask, |
| 241 | XGCValues *xgcv) | 241 | Emacs_GC *egc) |
| 242 | { | 242 | { |
| 243 | if (mask & GCForeground) | 243 | if (mask & GCForeground) |
| 244 | gc->foreground = xgcv->foreground; | 244 | gc->foreground = egc->foreground; |
| 245 | if (mask & GCBackground) | 245 | if (mask & GCBackground) |
| 246 | gc->background = xgcv->background; | 246 | gc->background = egc->background; |
| 247 | if (mask & GCFont) | ||
| 248 | gc->font = xgcv->font; | ||
| 249 | } | 247 | } |
| 250 | 248 | ||
| 251 | XGCValues * | 249 | Emacs_GC * |
| 252 | XCreateGC (void *ignore, HWND wignore, unsigned long mask, XGCValues *xgcv) | 250 | XCreateGC (void *ignore, HWND wignore, unsigned long mask, Emacs_GC *egc) |
| 253 | { | 251 | { |
| 254 | XGCValues *gc = xzalloc (sizeof (XGCValues)); | 252 | Emacs_GC *gc = xzalloc (sizeof (*gc)); |
| 255 | 253 | ||
| 256 | XChangeGC (ignore, gc, mask, xgcv); | 254 | XChangeGC (ignore, gc, mask, egc); |
| 257 | 255 | ||
| 258 | return gc; | 256 | return gc; |
| 259 | } | 257 | } |
| @@ -396,7 +394,7 @@ w32_draw_underwave (struct glyph_string *s, COLORREF color) | |||
| 396 | 394 | ||
| 397 | /* Draw a hollow rectangle at the specified position. */ | 395 | /* Draw a hollow rectangle at the specified position. */ |
| 398 | static void | 396 | static void |
| 399 | w32_draw_rectangle (HDC hdc, XGCValues *gc, int x, int y, | 397 | w32_draw_rectangle (HDC hdc, Emacs_GC *gc, int x, int y, |
| 400 | int width, int height) | 398 | int width, int height) |
| 401 | { | 399 | { |
| 402 | HBRUSH hb, oldhb; | 400 | HBRUSH hb, oldhb; |
| @@ -906,38 +904,37 @@ w32_set_cursor_gc (struct glyph_string *s) | |||
| 906 | else | 904 | else |
| 907 | { | 905 | { |
| 908 | /* Cursor on non-default face: must merge. */ | 906 | /* Cursor on non-default face: must merge. */ |
| 909 | XGCValues xgcv; | 907 | Emacs_GC egc; |
| 910 | unsigned long mask; | 908 | unsigned long mask; |
| 911 | 909 | ||
| 912 | xgcv.background = s->f->output_data.w32->cursor_pixel; | 910 | egc.background = s->f->output_data.w32->cursor_pixel; |
| 913 | xgcv.foreground = s->face->background; | 911 | egc.foreground = s->face->background; |
| 914 | 912 | ||
| 915 | /* If the glyph would be invisible, try a different foreground. */ | 913 | /* If the glyph would be invisible, try a different foreground. */ |
| 916 | if (xgcv.foreground == xgcv.background) | 914 | if (egc.foreground == egc.background) |
| 917 | xgcv.foreground = s->face->foreground; | 915 | egc.foreground = s->face->foreground; |
| 918 | if (xgcv.foreground == xgcv.background) | 916 | if (egc.foreground == egc.background) |
| 919 | xgcv.foreground = s->f->output_data.w32->cursor_foreground_pixel; | 917 | egc.foreground = s->f->output_data.w32->cursor_foreground_pixel; |
| 920 | if (xgcv.foreground == xgcv.background) | 918 | if (egc.foreground == egc.background) |
| 921 | xgcv.foreground = s->face->foreground; | 919 | egc.foreground = s->face->foreground; |
| 922 | 920 | ||
| 923 | /* Make sure the cursor is distinct from text in this face. */ | 921 | /* Make sure the cursor is distinct from text in this face. */ |
| 924 | if (xgcv.background == s->face->background | 922 | if (egc.background == s->face->background |
| 925 | && xgcv.foreground == s->face->foreground) | 923 | && egc.foreground == s->face->foreground) |
| 926 | { | 924 | { |
| 927 | xgcv.background = s->face->foreground; | 925 | egc.background = s->face->foreground; |
| 928 | xgcv.foreground = s->face->background; | 926 | egc.foreground = s->face->background; |
| 929 | } | 927 | } |
| 930 | 928 | ||
| 931 | IF_DEBUG (w32_check_font (s->f, s->font)); | 929 | IF_DEBUG (w32_check_font (s->f, s->font)); |
| 932 | xgcv.font = s->font; | 930 | mask = GCForeground | GCBackground; |
| 933 | mask = GCForeground | GCBackground | GCFont; | ||
| 934 | 931 | ||
| 935 | if (FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc) | 932 | if (FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc) |
| 936 | XChangeGC (NULL, FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc, | 933 | XChangeGC (NULL, FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc, |
| 937 | mask, &xgcv); | 934 | mask, &egc); |
| 938 | else | 935 | else |
| 939 | FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc | 936 | FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc |
| 940 | = XCreateGC (NULL, FRAME_W32_WINDOW (s->f), mask, &xgcv); | 937 | = XCreateGC (NULL, FRAME_W32_WINDOW (s->f), mask, &egc); |
| 941 | 938 | ||
| 942 | s->gc = FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc; | 939 | s->gc = FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc; |
| 943 | } | 940 | } |
| @@ -972,21 +969,20 @@ w32_set_mouse_face_gc (struct glyph_string *s) | |||
| 972 | { | 969 | { |
| 973 | /* Otherwise construct scratch_cursor_gc with values from FACE | 970 | /* Otherwise construct scratch_cursor_gc with values from FACE |
| 974 | but font FONT. */ | 971 | but font FONT. */ |
| 975 | XGCValues xgcv; | 972 | Emacs_GC egc; |
| 976 | unsigned long mask; | 973 | unsigned long mask; |
| 977 | 974 | ||
| 978 | xgcv.background = s->face->background; | 975 | egc.background = s->face->background; |
| 979 | xgcv.foreground = s->face->foreground; | 976 | egc.foreground = s->face->foreground; |
| 980 | IF_DEBUG (w32_check_font (s->f, s->font)); | 977 | IF_DEBUG (w32_check_font (s->f, s->font)); |
| 981 | xgcv.font = s->font; | 978 | mask = GCForeground | GCBackground; |
| 982 | mask = GCForeground | GCBackground | GCFont; | ||
| 983 | 979 | ||
| 984 | if (FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc) | 980 | if (FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc) |
| 985 | XChangeGC (NULL, FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc, | 981 | XChangeGC (NULL, FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc, |
| 986 | mask, &xgcv); | 982 | mask, &egc); |
| 987 | else | 983 | else |
| 988 | FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc | 984 | FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc |
| 989 | = XCreateGC (NULL, FRAME_W32_WINDOW (s->f), mask, &xgcv); | 985 | = XCreateGC (NULL, FRAME_W32_WINDOW (s->f), mask, &egc); |
| 990 | 986 | ||
| 991 | s->gc = FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc; | 987 | s->gc = FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc; |
| 992 | } | 988 | } |
| @@ -1551,7 +1547,7 @@ static void | |||
| 1551 | w32_setup_relief_color (struct frame *f, struct relief *relief, double factor, | 1547 | w32_setup_relief_color (struct frame *f, struct relief *relief, double factor, |
| 1552 | int delta, COLORREF default_pixel) | 1548 | int delta, COLORREF default_pixel) |
| 1553 | { | 1549 | { |
| 1554 | XGCValues xgcv; | 1550 | Emacs_GC egc; |
| 1555 | struct w32_output *di = f->output_data.w32; | 1551 | struct w32_output *di = f->output_data.w32; |
| 1556 | unsigned long mask = GCForeground; | 1552 | unsigned long mask = GCForeground; |
| 1557 | COLORREF pixel; | 1553 | COLORREF pixel; |
| @@ -1563,22 +1559,21 @@ w32_setup_relief_color (struct frame *f, struct relief *relief, double factor, | |||
| 1563 | /* TODO: Free colors (if using palette)? */ | 1559 | /* TODO: Free colors (if using palette)? */ |
| 1564 | 1560 | ||
| 1565 | /* Allocate new color. */ | 1561 | /* Allocate new color. */ |
| 1566 | xgcv.foreground = default_pixel; | 1562 | egc.foreground = default_pixel; |
| 1567 | pixel = background; | 1563 | pixel = background; |
| 1568 | if (w32_alloc_lighter_color (f, &pixel, factor, delta)) | 1564 | if (w32_alloc_lighter_color (f, &pixel, factor, delta)) |
| 1569 | xgcv.foreground = relief->pixel = pixel; | 1565 | egc.foreground = relief->pixel = pixel; |
| 1570 | 1566 | ||
| 1571 | xgcv.font = NULL; /* avoid compiler warnings */ | ||
| 1572 | if (relief->gc == 0) | 1567 | if (relief->gc == 0) |
| 1573 | { | 1568 | { |
| 1574 | #if 0 /* TODO: stipple */ | 1569 | #if 0 /* TODO: stipple */ |
| 1575 | xgcv.stipple = dpyinfo->gray; | 1570 | egc.stipple = dpyinfo->gray; |
| 1576 | mask |= GCStipple; | 1571 | mask |= GCStipple; |
| 1577 | #endif | 1572 | #endif |
| 1578 | relief->gc = XCreateGC (NULL, FRAME_W32_WINDOW (f), mask, &xgcv); | 1573 | relief->gc = XCreateGC (NULL, FRAME_W32_WINDOW (f), mask, &egc); |
| 1579 | } | 1574 | } |
| 1580 | else | 1575 | else |
| 1581 | XChangeGC (NULL, relief->gc, mask, &xgcv); | 1576 | XChangeGC (NULL, relief->gc, mask, &egc); |
| 1582 | } | 1577 | } |
| 1583 | 1578 | ||
| 1584 | 1579 | ||
| @@ -1627,7 +1622,7 @@ w32_draw_relief_rect (struct frame *f, | |||
| 1627 | RECT *clip_rect) | 1622 | RECT *clip_rect) |
| 1628 | { | 1623 | { |
| 1629 | int i; | 1624 | int i; |
| 1630 | XGCValues gc; | 1625 | Emacs_GC gc; |
| 1631 | HDC hdc = get_frame_dc (f); | 1626 | HDC hdc = get_frame_dc (f); |
| 1632 | 1627 | ||
| 1633 | if (raised_p) | 1628 | if (raised_p) |
| @@ -2286,7 +2281,7 @@ w32_draw_stretch_glyph_string (struct glyph_string *s) | |||
| 2286 | /* Clear rest using the GC of the original non-cursor face. */ | 2281 | /* Clear rest using the GC of the original non-cursor face. */ |
| 2287 | if (width < background_width) | 2282 | if (width < background_width) |
| 2288 | { | 2283 | { |
| 2289 | XGCValues *gc = s->face->gc; | 2284 | Emacs_GC *gc = s->face->gc; |
| 2290 | int y = s->y; | 2285 | int y = s->y; |
| 2291 | int w = background_width - width, h = s->height; | 2286 | int w = background_width - width, h = s->height; |
| 2292 | RECT r; | 2287 | RECT r; |