Use signed long instead of unsigned long for binded actions.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2015-11-21 18:15:11 +03:00
parent 957185a47b
commit a6f5767f3f
22 changed files with 66 additions and 66 deletions

View File

@ -395,7 +395,7 @@ sort_command_names (void)
/* --------------------------------------------------------------------------------------------- */
static void
keymap_add (GArray * keymap, long key, unsigned long cmd, const char *caption)
keymap_add (GArray * keymap, long key, long cmd, const char *caption)
{
if (key != 0 && cmd != CK_IgnoreKey)
{
@ -413,7 +413,7 @@ keymap_add (GArray * keymap, long key, unsigned long cmd, const char *caption)
/* --------------------------------------------------------------------------------------------- */
void
keybind_cmd_bind (GArray * keymap, const char *keybind, unsigned long action)
keybind_cmd_bind (GArray * keymap, const char *keybind, long action)
{
char *caption = NULL;
long key;
@ -425,7 +425,7 @@ keybind_cmd_bind (GArray * keymap, const char *keybind, unsigned long action)
/* --------------------------------------------------------------------------------------------- */
unsigned long
long
keybind_lookup_action (const char *name)
{
const name_keymap_t key = { name, 0 };
@ -442,7 +442,7 @@ keybind_lookup_action (const char *name)
/* --------------------------------------------------------------------------------------------- */
const char *
keybind_lookup_actionname (unsigned long action)
keybind_lookup_actionname (long action)
{
size_t i;
@ -456,7 +456,7 @@ keybind_lookup_actionname (unsigned long action)
/* --------------------------------------------------------------------------------------------- */
const char *
keybind_lookup_keymap_shortcut (const global_keymap_t * keymap, unsigned long action)
keybind_lookup_keymap_shortcut (const global_keymap_t * keymap, long action)
{
if (keymap != NULL)
{
@ -471,7 +471,7 @@ keybind_lookup_keymap_shortcut (const global_keymap_t * keymap, unsigned long ac
/* --------------------------------------------------------------------------------------------- */
unsigned long
long
keybind_lookup_keymap_command (const global_keymap_t * keymap, long key)
{
if (keymap != NULL)

View File

@ -34,11 +34,11 @@
enum
{
/* special commands */
CK_InsertChar = -1,
CK_IgnoreKey = 0,
CK_InsertChar = -1L,
CK_IgnoreKey = 0L,
/* common */
CK_Enter = 1,
CK_Enter = 1L,
CK_Up,
CK_Down,
CK_Left,
@ -128,7 +128,7 @@ enum
CK_ExtendedKeyMap,
/* main commands */
CK_EditForceInternal = 100,
CK_EditForceInternal = 100L,
CK_View,
CK_ViewRaw,
CK_ViewFile,
@ -186,7 +186,7 @@ enum
CK_SelectInvert,
/* panels */
CK_PanelOtherCd = 200,
CK_PanelOtherCd = 200L,
CK_PanelOtherCdLink,
CK_Panelize,
CK_CopySingle,
@ -207,14 +207,14 @@ enum
CK_ScrollRight,
/* dialog */
CK_Ok = 300,
CK_Ok = 300L,
CK_Cancel,
/* input */
CK_Yank = 350,
CK_Yank = 350L,
/* help */
CK_Index = 400,
CK_Index = 400L,
CK_Back,
CK_LinkNext,
CK_LinkPrev,
@ -222,11 +222,11 @@ enum
CK_NodePrev,
/* tree */
CK_Forget = 450,
CK_Forget = 450L,
/* editor */
/* cursor movements */
CK_Tab = 500,
CK_Tab = 500L,
CK_Undo,
CK_ScrollUp,
CK_ScrollDown,
@ -308,7 +308,7 @@ enum
CK_Mail,
/* viewer */
CK_WrapMode = 600,
CK_WrapMode = 600L,
CK_MagicMode,
CK_NroffMode,
CK_HexMode,
@ -321,7 +321,7 @@ enum
CK_SearchBackwardContinue,
/* diff viewer */
CK_ShowSymbols = 700,
CK_ShowSymbols = 700L,
CK_SplitFull,
CK_Tab2,
CK_Tab3,
@ -339,7 +339,7 @@ enum
typedef struct name_keymap_t
{
const char *name;
unsigned long val;
long val;
} name_keymap_t;
typedef struct key_config_t
@ -354,7 +354,7 @@ typedef struct key_config_t
typedef struct global_keymap_t
{
long key;
unsigned long command;
long command;
char caption[KEYMAP_SHORTCUT_LENGTH];
} global_keymap_t;
@ -362,11 +362,11 @@ typedef struct global_keymap_t
/*** declarations of public functions ************************************************************/
void keybind_cmd_bind (GArray * keymap, const char *keybind, unsigned long action);
unsigned long keybind_lookup_action (const char *name);
const char *keybind_lookup_actionname (unsigned long action);
const char *keybind_lookup_keymap_shortcut (const global_keymap_t * keymap, unsigned long action);
unsigned long keybind_lookup_keymap_command (const global_keymap_t * keymap, long key);
void keybind_cmd_bind (GArray * keymap, const char *keybind, long action);
long keybind_lookup_action (const char *name);
const char *keybind_lookup_actionname (long action);
const char *keybind_lookup_keymap_shortcut (const global_keymap_t * keymap, long action);
long keybind_lookup_keymap_command (const global_keymap_t * keymap, long key);
/*** inline functions ****************************************************************************/

View File

@ -266,7 +266,7 @@ buttonbar_set_label (WButtonBar * bb, int idx, const char *text,
{
if ((bb != NULL) && (idx >= 1) && (idx <= BUTTONBAR_LABELS_NUM))
{
unsigned long command = CK_IgnoreKey;
long command = CK_IgnoreKey;
if (keymap != NULL)
command = keybind_lookup_keymap_command (keymap, KEY_F (idx));

View File

@ -28,7 +28,7 @@ typedef struct WButtonBar
struct
{
char *text;
unsigned long command;
long command;
Widget *receiver;
int end_coord; /* cumulative width of buttons so far */
} labels[BUTTONBAR_LABELS_NUM];

View File

@ -272,7 +272,7 @@ refresh_cmd (void)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
dlg_execute_cmd (WDialog * h, unsigned long command)
dlg_execute_cmd (WDialog * h, long command)
{
cb_ret_t ret = MSG_HANDLED;
switch (command)
@ -341,7 +341,7 @@ dlg_execute_cmd (WDialog * h, unsigned long command)
static cb_ret_t
dlg_handle_key (WDialog * h, int d_key)
{
unsigned long command;
long command;
command = keybind_lookup_keymap_command (dialog_map, d_key);

View File

@ -64,7 +64,7 @@ typedef enum
/* get string representation of shortcut assigned with command */
/* as menu is a widget of dialog, ask dialog about shortcut string */
typedef char *(*dlg_shortcut_str) (unsigned long command);
typedef char *(*dlg_shortcut_str) (long command);
/* get dialog name to show in dialog list */
typedef char *(*dlg_title_str) (const WDialog * h, size_t len);

View File

@ -679,7 +679,7 @@ port_region_marked_for_delete (WInput * in)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
input_execute_cmd (WInput * in, unsigned long command)
input_execute_cmd (WInput * in, long command)
{
cb_ret_t res = MSG_HANDLED;
@ -1133,7 +1133,7 @@ cb_ret_t
input_handle_char (WInput * in, int key)
{
cb_ret_t v;
unsigned long command;
long command;
if (quote != 0)
{
@ -1177,7 +1177,7 @@ input_handle_char (WInput * in, int key)
int
input_key_is_in_map (WInput * in, int key)
{
unsigned long command;
long command;
(void) in;

View File

@ -266,7 +266,7 @@ listbox_back_n (WListbox * l, int n)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
listbox_execute_cmd (WListbox * l, unsigned long command)
listbox_execute_cmd (WListbox * l, long command)
{
cb_ret_t ret = MSG_HANDLED;
Widget *w = WIDGET (l);
@ -331,7 +331,7 @@ listbox_execute_cmd (WListbox * l, unsigned long command)
static cb_ret_t
listbox_key (WListbox * l, int key)
{
unsigned long command;
long command;
if (l->list == NULL)
return MSG_NOT_HANDLED;

View File

@ -57,7 +57,7 @@ struct menu_entry_t
{
unsigned char first_letter;
hotkey_t text;
unsigned long command;
long command;
char *shortcut;
};
@ -774,7 +774,7 @@ menubar_event (Gpm_Event * event, void *data)
/* --------------------------------------------------------------------------------------------- */
menu_entry_t *
menu_entry_create (const char *name, unsigned long command)
menu_entry_create (const char *name, long command)
{
menu_entry_t *entry;

View File

@ -42,7 +42,7 @@ typedef struct WMenuBar
/*** declarations of public functions ************************************************************/
menu_entry_t *menu_entry_create (const char *name, unsigned long command);
menu_entry_t *menu_entry_create (const char *name, long command);
void menu_entry_free (menu_entry_t * me);
menu_t *create_menu (const char *name, GList * entries, const char *help_node);

View File

@ -3145,7 +3145,7 @@ dview_ok_to_exit (WDiff * dview)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
dview_execute_cmd (WDiff * dview, unsigned long command)
dview_execute_cmd (WDiff * dview, long command)
{
cb_ret_t res = MSG_HANDLED;
@ -3311,7 +3311,7 @@ dview_execute_cmd (WDiff * dview, unsigned long command)
static cb_ret_t
dview_handle_key (WDiff * dview, int key)
{
unsigned long command;
long command;
#ifdef HAVE_CHARSET
key = convert_from_input_c (key);

View File

@ -234,10 +234,10 @@ void edit_date_cmd (WEdit * edit);
void edit_goto_cmd (WEdit * edit);
gboolean eval_marks (WEdit * edit, off_t * start_mark, off_t * end_mark);
void edit_status (WEdit * edit, gboolean active);
void edit_execute_key_command (WEdit * edit, unsigned long command, int char_for_insertion);
void edit_execute_key_command (WEdit * edit, long command, int char_for_insertion);
void edit_update_screen (WEdit * edit);
void edit_save_size (WEdit * edit);
gboolean edit_handle_move_resize (WEdit * edit, unsigned long command);
gboolean edit_handle_move_resize (WEdit * edit, long command);
void edit_toggle_fullscreen (WEdit * edit);
void edit_move_to_line (WEdit * e, long line);
void edit_move_display (WEdit * e, long line);
@ -286,7 +286,7 @@ void edit_mail_dialog (WEdit * edit);
void format_paragraph (WEdit * edit, gboolean force);
/* either command or char_for_insertion must be passed as -1 */
void edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion);
void edit_execute_cmd (WEdit * edit, long command, int char_for_insertion);
/*** inline functions ****************************************************************************/

View File

@ -3185,7 +3185,7 @@ edit_find_bracket (WEdit * edit)
*/
void
edit_execute_key_command (WEdit * edit, unsigned long command, int char_for_insertion)
edit_execute_key_command (WEdit * edit, long command, int char_for_insertion)
{
if (command == CK_MacroStartRecord || command == CK_RepeatStartRecord
|| (macro_index < 0
@ -3234,7 +3234,7 @@ edit_execute_key_command (WEdit * edit, unsigned long command, int char_for_inse
all of them. It also does not check for the Undo command.
*/
void
edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion)
edit_execute_cmd (WEdit * edit, long command, int char_for_insertion)
{
Widget *w = WIDGET (edit);

View File

@ -3412,7 +3412,7 @@ edit_begin_end_macro_cmd (WEdit * edit)
/* edit is a pointer to the widget */
if (edit != NULL)
{
unsigned long command = macro_index < 0 ? CK_MacroStartRecord : CK_MacroStopRecord;
long command = macro_index < 0 ? CK_MacroStartRecord : CK_MacroStopRecord;
edit_execute_key_command (edit, command, -1);
}
}
@ -3425,7 +3425,7 @@ edit_begin_end_repeat_cmd (WEdit * edit)
/* edit is a pointer to the widget */
if (edit != NULL)
{
unsigned long command = macro_index < 0 ? CK_RepeatStartRecord : CK_RepeatStopRecord;
long command = macro_index < 0 ? CK_RepeatStartRecord : CK_RepeatStopRecord;
edit_execute_key_command (edit, command, -1);
}
}

View File

@ -225,7 +225,7 @@ edit_restore_size (WEdit * edit)
*/
static void
edit_window_move (WEdit * edit, unsigned long command)
edit_window_move (WEdit * edit, long command)
{
Widget *w = WIDGET (edit);
Widget *wh = WIDGET (w->owner);
@ -265,7 +265,7 @@ edit_window_move (WEdit * edit, unsigned long command)
*/
static void
edit_window_resize (WEdit * edit, unsigned long command)
edit_window_resize (WEdit * edit, long command)
{
Widget *w = WIDGET (edit);
Widget *wh = WIDGET (w->owner);
@ -359,7 +359,7 @@ edit_window_list (const WDialog * h)
/* --------------------------------------------------------------------------------------------- */
static char *
edit_get_shortcut (unsigned long command)
edit_get_shortcut (long command)
{
const char *ext_map;
const char *shortcut = NULL;
@ -708,7 +708,7 @@ edit_dialog_event (Gpm_Event * event, void *data)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
edit_dialog_command_execute (WDialog * h, unsigned long command)
edit_dialog_command_execute (WDialog * h, long command)
{
Widget *wh = WIDGET (h);
gboolean ret = MSG_HANDLED;
@ -817,7 +817,7 @@ edit_dialog_command_execute (WDialog * h, unsigned long command)
static gboolean
edit_translate_key (WEdit * edit, long x_key, int *cmd, int *ch)
{
unsigned long command = (unsigned long) CK_InsertChar;
long command = CK_InsertChar;
int char_for_insertion = -1;
/* an ordinary insertable character */
@ -929,7 +929,7 @@ edit_translate_key (WEdit * edit, long x_key, int *cmd, int *ch)
*cmd = (int) command; /* FIXME */
*ch = char_for_insertion;
return !(command == (unsigned long) CK_InsertChar && char_for_insertion == -1);
return !(command == CK_InsertChar && char_for_insertion == -1);
}
@ -1050,7 +1050,7 @@ edit_dialog_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, v
if (edit_widget_is_editor (we))
{
WEdit *e = (WEdit *) we;
unsigned long command;
long command;
if (!e->extmod)
command = keybind_lookup_keymap_command (editor_map, parm);
@ -1379,7 +1379,7 @@ edit_add_window (WDialog * h, int y, int x, int lines, int cols, const vfs_path_
*/
gboolean
edit_handle_move_resize (WEdit * edit, unsigned long command)
edit_handle_move_resize (WEdit * edit, long command)
{
gboolean ret = FALSE;

View File

@ -407,7 +407,7 @@ sort_cmd (void)
/* --------------------------------------------------------------------------------------------- */
static char *
midnight_get_shortcut (unsigned long command)
midnight_get_shortcut (long command)
{
const char *ext_map;
const char *shortcut = NULL;
@ -1095,7 +1095,7 @@ toggle_show_hidden (void)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
midnight_execute_cmd (Widget * sender, unsigned long command)
midnight_execute_cmd (Widget * sender, long command)
{
cb_ret_t res = MSG_HANDLED;
@ -1395,7 +1395,7 @@ midnight_execute_cmd (Widget * sender, unsigned long command)
static cb_ret_t
midnight_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
unsigned long command;
long command;
switch (msg)
{

View File

@ -3384,7 +3384,7 @@ directory_history_list (WPanel * panel)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
panel_execute_cmd (WPanel * panel, unsigned long command)
panel_execute_cmd (WPanel * panel, long command)
{
int res = MSG_HANDLED;

View File

@ -1029,7 +1029,7 @@ tree_toggle_navig (WTree * tree)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
tree_execute_cmd (WTree * tree, unsigned long command)
tree_execute_cmd (WTree * tree, long command)
{
cb_ret_t res = MSG_HANDLED;

View File

@ -858,7 +858,7 @@ help_select_link (void)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
help_execute_cmd (unsigned long command)
help_execute_cmd (long command)
{
cb_ret_t ret = MSG_HANDLED;
@ -927,7 +927,7 @@ help_execute_cmd (unsigned long command)
static cb_ret_t
help_handle_key (WDialog * h, int c)
{
unsigned long command;
long command;
command = keybind_lookup_keymap_command (help_map, c);
if ((command == CK_IgnoreKey) || (help_execute_cmd (command) == MSG_NOT_HANDLED))

View File

@ -690,7 +690,7 @@ load_keymap_from_section (const char *section_name, GArray * keymap, mc_config_t
values = mc_config_get_string_list (cfg, section_name, *profile_keys, NULL);
if (values != NULL)
{
int action;
long action;
action = keybind_lookup_action (*profile_keys);
if (action > 0)

View File

@ -58,7 +58,7 @@ typedef struct
typedef struct macro_action_t
{
unsigned long action;
long action;
int ch;
} macro_action_t;

View File

@ -382,7 +382,7 @@ mcview_load_next_prev (WView * view, int direction)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
mcview_execute_cmd (WView * view, unsigned long command)
mcview_execute_cmd (WView * view, long command)
{
int res = MSG_HANDLED;
@ -546,7 +546,7 @@ mcview_execute_cmd (WView * view, unsigned long command)
static cb_ret_t
mcview_handle_key (WView * view, int key)
{
unsigned long command;
long command;
#ifdef HAVE_CHARSET
key = convert_from_input_c (key);