| version 1.16 | | version 1.17 |
|---|
| | |
| char *rcsid_x11_xutil_c = | | char *rcsid_x11_xutil_c = |
| "$Id: xutil.c,v 1.16 2004/01/31 20:13:11 tchize Exp $"; | | "$Id: xutil.c,v 1.17 2005/02/10 07:03:56 mwedel Exp $"; |
| /* | | /* |
| Crossfire client, a client program for the crossfire program. | | Crossfire client, a client program for the crossfire program. |
| | | |
| | |
| #include <client.h> | | #include <client.h> |
| #include <item.h> | | #include <item.h> |
| #include <config.h> | | #include <config.h> |
| | | #include <p_cmd.h> |
| | | |
| #ifdef HAVE_LIBXPM | | #ifdef HAVE_LIBXPM |
| #include <X11/xpm.h> | | #include <X11/xpm.h> |
| | |
| Key_Entry *newkey; | | Key_Entry *newkey; |
| int i, direction=-1; | | int i, direction=-1; |
| | | |
| | | #if 0 |
| | | /* This is at least a meaningless check on my system that results in |
| | | * a compile warning (always false result), so may was well comment it |
| | | * out - MSW 2005-02-09 |
| | | */ |
| if (keycode>MAX_KEYCODE) { | | if (keycode>MAX_KEYCODE) { |
| LOG(LOG_WARNING,"x11::insert_key", "keycode that is passed is greater than 255."); | | LOG(LOG_WARNING,"x11::insert_key", "keycode that is passed is greater than 255."); |
| keycode=0; /* hopefully the rest of the data is OK */ | | keycode=0; /* hopefully the rest of the data is OK */ |
| } | | } |
| | | #endif |
| if (keys[keycode]==NULL) { | | if (keys[keycode]==NULL) { |
| keys[keycode]=malloc(sizeof(Key_Entry)); | | keys[keycode]=malloc(sizeof(Key_Entry)); |
| keys[keycode]->command=NULL; | | keys[keycode]->command=NULL; |
| | |
| | | |
| | | |
| | | |
| void bind_key(char *params) | | void bind_key(const char *params) |
| { | | { |
| char buf[MAX_BUF]; | | char buf[MAX_BUF]; |
| | | |
| | |
| return; | | return; |
| } | | } |
| | | |
| | | strncpy(bind_buf, params, sizeof(bind_buf)-1); |
| | | bind_buf[sizeof(bind_buf)-1]=0; |
| if (strlen(params) >= sizeof(bind_buf)) { | | if (strlen(params) >= sizeof(bind_buf)) { |
| params[sizeof(bind_buf) - 1] = '\0'; | | |
| draw_info("Keybinding too long! Truncated:",NDI_RED); | | draw_info("Keybinding too long! Truncated:",NDI_RED); |
| draw_info(params,NDI_RED); | | draw_info(bind_buf,NDI_RED); |
| } | | } |
| sprintf(buf, "Push key to bind '%s'.", params); | | |
| | | sprintf(buf, "Push key to bind '%s'.", bind_buf); |
| draw_info(buf,NDI_BLACK); | | draw_info(buf,NDI_BLACK); |
| strcpy(bind_buf, params); | | |
| bind_keycode=NULL; | | bind_keycode=NULL; |
| cpl.input_state = Configure_Keys; | | cpl.input_state = Configure_Keys; |
| return; | | return; |
| | |
| draw_info(" -g unbinds a global binding", NDI_BLACK); | | draw_info(" -g unbinds a global binding", NDI_BLACK); |
| } | | } |
| | | |
| void unbind_key(char *params) | | void unbind_key(const char *params) |
| { | | { |
| int count=0, keyentry, onkey,global=0; | | int count=0, keyentry, onkey,global=0; |
| Key_Entry *key, *tmp; | | Key_Entry *key, *tmp; |