From 4ac25d53af464b7436746ad230f59157c9b32b26 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Fri, 15 Apr 2022 11:57:14 +0000 Subject: [PATCH] Clean up keysyms from Haiku headers * src/haiku_support.cc (keysym_from_raw_char): Add keysym numbers here and use those instead. * src/haiku_support.h: Delete all the X11 keysym definitions. --- src/haiku_support.cc | 66 ++++++++++++++++++++++++++++++-------------- src/haiku_support.h | 38 ------------------------- 2 files changed, 45 insertions(+), 59 deletions(-) diff --git a/src/haiku_support.cc b/src/haiku_support.cc index 4fd2fc4aa5e..ddcd908fd25 100644 --- a/src/haiku_support.cc +++ b/src/haiku_support.cc @@ -81,6 +81,7 @@ along with GNU Emacs. If not, see . */ #include "haiku_support.h" +/* Some messages that Emacs sends to itself. */ enum { SCROLL_BAR_UPDATE = 3000, @@ -92,6 +93,29 @@ enum QUIT_APPLICATION = 3006, }; +/* X11 keysyms that we use. */ +enum + { + KEY_BACKSPACE = 0xff08, + KEY_TAB = 0xff09, + KEY_RETURN = 0xff0d, + KEY_PAUSE = 0xff13, + KEY_ESCAPE = 0xff1b, + KEY_DELETE = 0xffff, + KEY_HOME = 0xff50, + KEY_LEFT_ARROW = 0xff51, + KEY_UP_ARROW = 0xff52, + KEY_RIGHT_ARROW = 0xff53, + KEY_DOWN_ARROW = 0xff54, + KEY_PAGE_UP = 0xff55, + KEY_PAGE_DOWN = 0xff56, + KEY_END = 0xff57, + KEY_PRINT = 0xff61, + KEY_INSERT = 0xff63, + /* This is used to indicate the first function key. */ + KEY_F1 = 0xffbe, + }; + static color_space dpy_color_space = B_NO_COLOR_SPACE; static key_map *key_map = NULL; static char *key_chars = NULL; @@ -219,62 +243,62 @@ keysym_from_raw_char (int32 raw, int32 key, unsigned *code) switch (raw) { case B_BACKSPACE: - *code = XK_BackSpace; + *code = KEY_BACKSPACE; break; case B_RETURN: - *code = XK_Return; + *code = KEY_RETURN; break; case B_TAB: - *code = XK_Tab; + *code = KEY_TAB; break; case B_ESCAPE: - *code = XK_Escape; + *code = KEY_ESCAPE; break; case B_LEFT_ARROW: - *code = XK_Left; + *code = KEY_LEFT_ARROW; break; case B_RIGHT_ARROW: - *code = XK_Right; + *code = KEY_RIGHT_ARROW; break; case B_UP_ARROW: - *code = XK_Up; + *code = KEY_UP_ARROW; break; case B_DOWN_ARROW: - *code = XK_Down; + *code = KEY_DOWN_ARROW; break; case B_INSERT: - *code = XK_Insert; + *code = KEY_INSERT; break; case B_DELETE: - *code = XK_Delete; + *code = KEY_DELETE; break; case B_HOME: - *code = XK_Home; + *code = KEY_HOME; break; case B_END: - *code = XK_End; + *code = KEY_END; break; case B_PAGE_UP: - *code = XK_Page_Up; + *code = KEY_PAGE_UP; break; case B_PAGE_DOWN: - *code = XK_Page_Down; + *code = KEY_PAGE_DOWN; break; case B_FUNCTION_KEY: - *code = XK_F1 + key - 2; + *code = KEY_F1 + key - 2; - if (*code - XK_F1 == 12) - *code = XK_Print; - else if (*code - XK_F1 == 13) + if (*code - KEY_F1 == 12) + *code = KEY_PRINT; + else if (*code - KEY_F1 == 13) /* Okay, Scroll Lock is a bit too much: keyboard.c doesn't know about it yet, and it shouldn't, since that's a modifier key. - *code = XK_Scroll_Lock; */ + *code = KEY_SCROLL_LOCK; */ return -1; - else if (*code - XK_F1 == 14) - *code = XK_Pause; + else if (*code - KEY_F1 == 14) + *code = KEY_PAUSE; break; diff --git a/src/haiku_support.h b/src/haiku_support.h index eb54fe75dd9..237cedd8fc2 100644 --- a/src/haiku_support.h +++ b/src/haiku_support.h @@ -638,44 +638,6 @@ extern void *find_appropriate_view_for_draw (void *vw); extern _Noreturn void gui_abort (const char *msg); #endif /* _cplusplus */ -/* Borrowed from X.Org keysymdef.h */ -#define XK_BackSpace 0xff08 /* Back space, back char */ -#define XK_Tab 0xff09 -#define XK_Linefeed 0xff0a /* Linefeed, LF */ -#define XK_Clear 0xff0b -#define XK_Return 0xff0d /* Return, enter */ -#define XK_Pause 0xff13 /* Pause, hold */ -#define XK_Scroll_Lock 0xff14 -#define XK_Sys_Req 0xff15 -#define XK_Escape 0xff1b -#define XK_Delete 0xffff /* Delete, rubout */ -#define XK_Home 0xff50 -#define XK_Left 0xff51 /* Move left, left arrow */ -#define XK_Up 0xff52 /* Move up, up arrow */ -#define XK_Right 0xff53 /* Move right, right arrow */ -#define XK_Down 0xff54 /* Move down, down arrow */ -#define XK_Prior 0xff55 /* Prior, previous */ -#define XK_Page_Up 0xff55 -#define XK_Next 0xff56 /* Next */ -#define XK_Page_Down 0xff56 -#define XK_End 0xff57 /* EOL */ -#define XK_Begin 0xff58 /* BOL */ -#define XK_Select 0xff60 /* Select, mark */ -#define XK_Print 0xff61 -#define XK_Execute 0xff62 /* Execute, run, do */ -#define XK_Insert 0xff63 /* Insert, insert here */ -#define XK_Undo 0xff65 -#define XK_Redo 0xff66 /* Redo, again */ -#define XK_Menu 0xff67 -#define XK_Find 0xff68 /* Find, search */ -#define XK_Cancel 0xff69 /* Cancel, stop, abort, exit */ -#define XK_Help 0xff6a /* Help */ -#define XK_Break 0xff6b -#define XK_Mode_switch 0xff7e /* Character set switch */ -#define XK_script_switch 0xff7e /* Alias for mode_switch */ -#define XK_Num_Lock 0xff7f -#define XK_F1 0xffbe - #endif /* _HAIKU_SUPPORT_H_ */ // Local Variables: -- 2.39.5