summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gramiak <agrambot@gmail.com>2019-05-09 17:13:18 -0600
committerAlexander Gramiak <agrambot@gmail.com>2019-05-19 19:50:32 -0600
commit06db2a052fb7335185e8d581d245ce214b3bba7c (patch)
treee4dc82552110a777a37703dce446b1c632f6e82b
parentc0e146e4ec266edf348473c3db7ca8d16745f4f7 (diff)
downloademacs-06db2a052fb7335185e8d581d245ce214b3bba7c.tar.gz
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/>. */
#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.