aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Gramiak2019-05-09 17:13:18 -0600
committerAlexander Gramiak2019-05-19 19:50:32 -0600
commit06db2a052fb7335185e8d581d245ce214b3bba7c (patch)
treee4dc82552110a777a37703dce446b1c632f6e82b
parentc0e146e4ec266edf348473c3db7ca8d16745f4f7 (diff)
downloademacs-06db2a052fb7335185e8d581d245ce214b3bba7c.tar.gz
emacs-06db2a052fb7335185e8d581d245ce214b3bba7c.zip
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.
-rw-r--r--src/dispextern.h10
-rw-r--r--src/nsgui.h6
-rw-r--r--src/nsterm.h36
-rw-r--r--src/nsterm.m2
-rw-r--r--src/w32fns.c12
-rw-r--r--src/w32gui.h4
-rw-r--r--src/w32term.c8
-rw-r--r--src/w32term.h36
-rw-r--r--src/xdisp.c6
-rw-r--r--src/xterm.c2
-rw-r--r--src/xterm.h2
11 files changed, 61 insertions, 63 deletions
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 <https://www.gnu.org/licenses/>. */
36#endif 36#endif
37 37
38typedef XColor Emacs_Color; 38typedef XColor Emacs_Color;
39typedef Cursor Emacs_Cursor;
40#define No_Cursor (None)
41
39#else /* !HAVE_X_WINDOWS */ 42#else /* !HAVE_X_WINDOWS */
40 43
41/* XColor-like struct used by non-X code. */ 44/* XColor-like struct used by non-X code. */
@@ -46,6 +49,8 @@ typedef struct
46 unsigned short red, green, blue; 49 unsigned short red, green, blue;
47} Emacs_Color; 50} Emacs_Color;
48 51
52/* Accommodate X's usage of None as a null resource ID. */
53#define No_Cursor (NULL)
49#endif /* HAVE_X_WINDOWS */ 54#endif /* HAVE_X_WINDOWS */
50 55
51#ifdef MSDOS 56#ifdef MSDOS
@@ -93,8 +98,7 @@ typedef XImagePtr XImagePtr_or_DC;
93#endif 98#endif
94 99
95#ifndef HAVE_WINDOW_SYSTEM 100#ifndef HAVE_WINDOW_SYSTEM
96typedef int Cursor; 101typedef void *Emacs_Cursor;
97#define No_Cursor (0)
98#endif 102#endif
99 103
100#ifndef NativeRectangle 104#ifndef NativeRectangle
@@ -2889,7 +2893,7 @@ struct redisplay_interface
2889 void (*draw_glyph_string) (struct glyph_string *s); 2893 void (*draw_glyph_string) (struct glyph_string *s);
2890 2894
2891 /* Define cursor CURSOR on frame F. */ 2895 /* Define cursor CURSOR on frame F. */
2892 void (*define_frame_cursor) (struct frame *f, Cursor cursor); 2896 void (*define_frame_cursor) (struct frame *f, Emacs_Cursor cursor);
2893 2897
2894 /* Clear the area at (X,Y,WIDTH,HEIGHT) of frame F. */ 2898 /* Clear the area at (X,Y,WIDTH,HEIGHT) of frame F. */
2895 void (*clear_frame_area) (struct frame *f, int x, int y, 2899 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;
102#endif 102#endif
103 103
104#ifdef __OBJC__ 104#ifdef __OBJC__
105typedef NSCursor * Cursor; 105typedef NSCursor *Emacs_Cursor;
106#else 106#else
107typedef void *Cursor; 107typedef void *Emacs_Cursor;
108#endif 108#endif
109 109
110#define No_Cursor (0)
111
112typedef int Window; 110typedef int Window;
113 111
114 112
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
872 Lisp_Object rdb; 872 Lisp_Object rdb;
873 873
874 /* The cursor to use for vertical scroll bars. */ 874 /* The cursor to use for vertical scroll bars. */
875 Cursor vertical_scroll_bar_cursor; 875 Emacs_Cursor vertical_scroll_bar_cursor;
876 876
877 /* The cursor to use for horizontal scroll bars. */ 877 /* The cursor to use for horizontal scroll bars. */
878 Cursor horizontal_scroll_bar_cursor; 878 Emacs_Cursor horizontal_scroll_bar_cursor;
879 879
880 /* Information about the range of text currently shown in 880 /* Information about the range of text currently shown in
881 mouse-face. */ 881 mouse-face. */
@@ -931,24 +931,24 @@ struct ns_output
931#endif 931#endif
932 932
933 /* NSCursors are initialized in initFrameFromEmacs. */ 933 /* NSCursors are initialized in initFrameFromEmacs. */
934 Cursor text_cursor; 934 Emacs_Cursor text_cursor;
935 Cursor nontext_cursor; 935 Emacs_Cursor nontext_cursor;
936 Cursor modeline_cursor; 936 Emacs_Cursor modeline_cursor;
937 Cursor hand_cursor; 937 Emacs_Cursor hand_cursor;
938 Cursor hourglass_cursor; 938 Emacs_Cursor hourglass_cursor;
939 Cursor horizontal_drag_cursor; 939 Emacs_Cursor horizontal_drag_cursor;
940 Cursor vertical_drag_cursor; 940 Emacs_Cursor vertical_drag_cursor;
941 Cursor left_edge_cursor; 941 Emacs_Cursor left_edge_cursor;
942 Cursor top_left_corner_cursor; 942 Emacs_Cursor top_left_corner_cursor;
943 Cursor top_edge_cursor; 943 Emacs_Cursor top_edge_cursor;
944 Cursor top_right_corner_cursor; 944 Emacs_Cursor top_right_corner_cursor;
945 Cursor right_edge_cursor; 945 Emacs_Cursor right_edge_cursor;
946 Cursor bottom_right_corner_cursor; 946 Emacs_Cursor bottom_right_corner_cursor;
947 Cursor bottom_edge_cursor; 947 Emacs_Cursor bottom_edge_cursor;
948 Cursor bottom_left_corner_cursor; 948 Emacs_Cursor bottom_left_corner_cursor;
949 949
950 /* NS-specific */ 950 /* NS-specific */
951 Cursor current_pointer; 951 Emacs_Cursor current_pointer;
952 952
953 /* lord knows why Emacs needs to know about our Window ids.. */ 953 /* lord knows why Emacs needs to know about our Window ids.. */
954 Window window_desc, parent_desc; 954 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)
2576 2576
2577 2577
2578static void 2578static void
2579ns_define_frame_cursor (struct frame *f, Cursor cursor) 2579ns_define_frame_cursor (struct frame *f, Emacs_Cursor cursor)
2580/* -------------------------------------------------------------------------- 2580/* --------------------------------------------------------------------------
2581 External (RIF): set frame mouse pointer type. 2581 External (RIF): set frame mouse pointer type.
2582 -------------------------------------------------------------------------- */ 2582 -------------------------------------------------------------------------- */
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)
2247 2247
2248/* Subroutines for creating a frame. */ 2248/* Subroutines for creating a frame. */
2249 2249
2250Cursor w32_load_cursor (LPCTSTR); 2250HCURSOR w32_load_cursor (LPCTSTR);
2251 2251
2252Cursor 2252HCURSOR
2253w32_load_cursor (LPCTSTR name) 2253w32_load_cursor (LPCTSTR name)
2254{ 2254{
2255 /* Try first to load cursor from application resource. */ 2255 /* Try first to load cursor from application resource. */
2256 Cursor cursor = LoadImage ((HINSTANCE) GetModuleHandle (NULL), 2256 HCURSOR cursor = LoadImage ((HINSTANCE) GetModuleHandle (NULL),
2257 name, IMAGE_CURSOR, 0, 0, 2257 name, IMAGE_CURSOR, 0, 0,
2258 LR_DEFAULTCOLOR | LR_DEFAULTSIZE | LR_SHARED); 2258 LR_DEFAULTCOLOR | LR_DEFAULTSIZE | LR_SHARED);
2259 if (!cursor) 2259 if (!cursor)
2260 { 2260 {
2261 /* Then try to load a shared predefined cursor. */ 2261 /* Then try to load a shared predefined cursor. */
@@ -5217,7 +5217,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
5217 5217
5218 case WM_EMACS_SETCURSOR: 5218 case WM_EMACS_SETCURSOR:
5219 { 5219 {
5220 Cursor cursor = (Cursor) wParam; 5220 HCURSOR cursor = (HCURSOR) wParam;
5221 f = w32_window_to_frame (dpyinfo, hwnd); 5221 f = w32_window_to_frame (dpyinfo, hwnd);
5222 if (f && cursor) 5222 if (f && cursor)
5223 { 5223 {
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;
45typedef XGCValues * GC; 45typedef XGCValues * GC;
46typedef HWND Window; 46typedef HWND Window;
47typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */ 47typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */
48typedef HCURSOR Cursor; 48typedef HCURSOR Emacs_Cursor;
49
50#define No_Cursor (0)
51 49
52#define XChar2b wchar_t 50#define XChar2b wchar_t
53 51
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;
85extern unsigned int msh_mousewheel; 85extern unsigned int msh_mousewheel;
86 86
87extern int w32_codepage_for_font (char *fontname); 87extern int w32_codepage_for_font (char *fontname);
88extern Cursor w32_load_cursor (LPCTSTR name); 88extern HCURSOR w32_load_cursor (LPCTSTR name);
89 89
90 90
91/* This is display since w32 does not support multiple ones. */ 91/* This is display since w32 does not support multiple ones. */
@@ -166,7 +166,7 @@ int w32_message_fd = -1;
166 166
167static void w32_handle_tool_bar_click (struct frame *, 167static void w32_handle_tool_bar_click (struct frame *,
168 struct input_event *); 168 struct input_event *);
169static void w32_define_cursor (Window, Cursor); 169static void w32_define_cursor (Window, Emacs_Cursor);
170 170
171static void w32_scroll_bar_clear (struct frame *); 171static void w32_scroll_bar_clear (struct frame *);
172static void w32_raise_frame (struct frame *); 172static void w32_raise_frame (struct frame *);
@@ -3429,7 +3429,7 @@ static void w32_horizontal_scroll_bar_report_motion (struct frame **, Lisp_Objec
3429 Lisp_Object *, Lisp_Object *, 3429 Lisp_Object *, Lisp_Object *,
3430 Time *); 3430 Time *);
3431static void 3431static void
3432w32_define_cursor (Window window, Cursor cursor) 3432w32_define_cursor (Window window, Emacs_Cursor cursor)
3433{ 3433{
3434 PostMessage (window, WM_EMACS_SETCURSOR, (WPARAM) cursor, 0); 3434 PostMessage (window, WM_EMACS_SETCURSOR, (WPARAM) cursor, 0);
3435} 3435}
@@ -5806,7 +5806,7 @@ w32_draw_bar_cursor (struct window *w, struct glyph_row *row,
5806/* RIF: Define cursor CURSOR on frame F. */ 5806/* RIF: Define cursor CURSOR on frame F. */
5807 5807
5808static void 5808static void
5809w32_define_frame_cursor (struct frame *f, Cursor cursor) 5809w32_define_frame_cursor (struct frame *f, Emacs_Cursor cursor)
5810{ 5810{
5811 w32_define_cursor (FRAME_W32_WINDOW (f), cursor); 5811 w32_define_cursor (FRAME_W32_WINDOW (f), cursor);
5812} 5812}
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
114 Window root_window; 114 Window root_window;
115 115
116 /* The cursor to use for vertical scroll bars. */ 116 /* The cursor to use for vertical scroll bars. */
117 Cursor vertical_scroll_bar_cursor; 117 HCURSOR vertical_scroll_bar_cursor;
118 118
119 /* The cursor to use for horizontal scroll bars. */ 119 /* The cursor to use for horizontal scroll bars. */
120 Cursor horizontal_scroll_bar_cursor; 120 HCURSOR horizontal_scroll_bar_cursor;
121 121
122 /* Resource data base */ 122 /* Resource data base */
123 const char *rdb; 123 const char *rdb;
@@ -348,27 +348,27 @@ struct w32_output
348 COLORREF scroll_bar_background_pixel; 348 COLORREF scroll_bar_background_pixel;
349 349
350 /* Descriptor for the cursor in use for this window. */ 350 /* Descriptor for the cursor in use for this window. */
351 Cursor text_cursor; 351 HCURSOR text_cursor;
352 Cursor nontext_cursor; 352 HCURSOR nontext_cursor;
353 Cursor modeline_cursor; 353 HCURSOR modeline_cursor;
354 Cursor hand_cursor; 354 HCURSOR hand_cursor;
355 Cursor hourglass_cursor; 355 HCURSOR hourglass_cursor;
356 Cursor horizontal_drag_cursor; 356 HCURSOR horizontal_drag_cursor;
357 Cursor vertical_drag_cursor; 357 HCURSOR vertical_drag_cursor;
358 Cursor left_edge_cursor; 358 HCURSOR left_edge_cursor;
359 Cursor top_left_corner_cursor; 359 HCURSOR top_left_corner_cursor;
360 Cursor top_edge_cursor; 360 HCURSOR top_edge_cursor;
361 Cursor top_right_corner_cursor; 361 HCURSOR top_right_corner_cursor;
362 Cursor right_edge_cursor; 362 HCURSOR right_edge_cursor;
363 Cursor bottom_right_corner_cursor; 363 HCURSOR bottom_right_corner_cursor;
364 Cursor bottom_edge_cursor; 364 HCURSOR bottom_edge_cursor;
365 Cursor bottom_left_corner_cursor; 365 HCURSOR bottom_left_corner_cursor;
366 366
367 /* Non-zero means hourglass cursor is currently displayed. */ 367 /* Non-zero means hourglass cursor is currently displayed. */
368 unsigned hourglass_p : 1; 368 unsigned hourglass_p : 1;
369 369
370 /* Non-hourglass cursor that is currently active. */ 370 /* Non-hourglass cursor that is currently active. */
371 Cursor current_cursor; 371 HCURSOR current_cursor;
372 372
373 DWORD dwStyle; 373 DWORD dwStyle;
374 374
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. */)
31153 31153
31154/* Display frame CURSOR, optionally using shape defined by POINTER. */ 31154/* Display frame CURSOR, optionally using shape defined by POINTER. */
31155static void 31155static void
31156define_frame_cursor1 (struct frame *f, Cursor cursor, Lisp_Object pointer) 31156define_frame_cursor1 (struct frame *f, Emacs_Cursor cursor, Lisp_Object pointer)
31157{ 31157{
31158#ifdef HAVE_WINDOW_SYSTEM 31158#ifdef HAVE_WINDOW_SYSTEM
31159 if (!FRAME_WINDOW_P (f)) 31159 if (!FRAME_WINDOW_P (f))
@@ -31205,7 +31205,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
31205 struct window *w = XWINDOW (window); 31205 struct window *w = XWINDOW (window);
31206 struct frame *f = XFRAME (w->frame); 31206 struct frame *f = XFRAME (w->frame);
31207 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 31207 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
31208 Cursor cursor = No_Cursor; 31208 Emacs_Cursor cursor = No_Cursor;
31209 Lisp_Object pointer = Qnil; 31209 Lisp_Object pointer = Qnil;
31210 int dx, dy, width, height; 31210 int dx, dy, width, height;
31211 ptrdiff_t charpos; 31211 ptrdiff_t charpos;
@@ -31518,7 +31518,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
31518 enum window_part part = ON_NOTHING; 31518 enum window_part part = ON_NOTHING;
31519 Lisp_Object window; 31519 Lisp_Object window;
31520 struct window *w; 31520 struct window *w;
31521 Cursor cursor = No_Cursor; 31521 Emacs_Cursor cursor = No_Cursor;
31522 Lisp_Object pointer = Qnil; /* Takes precedence over cursor! */ 31522 Lisp_Object pointer = Qnil; /* Takes precedence over cursor! */
31523 struct buffer *b; 31523 struct buffer *b;
31524 31524
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
9356/* RIF: Define cursor CURSOR on frame F. */ 9356/* RIF: Define cursor CURSOR on frame F. */
9357 9357
9358static void 9358static void
9359x_define_frame_cursor (struct frame *f, Cursor cursor) 9359x_define_frame_cursor (struct frame *f, Emacs_Cursor cursor)
9360{ 9360{
9361 if (!f->pointer_invisible 9361 if (!f->pointer_invisible
9362 && f->output_data.x->current_cursor != cursor) 9362 && 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
731#endif 731#endif
732}; 732};
733 733
734#define No_Cursor (None)
735
736enum 734enum
737{ 735{
738 /* Values for focus_state, used as bit mask. 736 /* Values for focus_state, used as bit mask.