diff options
-rw-r--r-- | src/events.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/events.c b/src/events.c index be6123b..57ab937 100644 --- a/src/events.c +++ b/src/events.c @@ -1,11 +1,14 @@ -/* Copyright (C) 2000 Shawn Betts - * - * This program is free software; you can redistribute it and/or modify +/* Ratpoison X events + * Copyright (C) 2000, 2001 Shawn Betts + * + * This file is part of ratpoison. + * + * ratpoison is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * - * This program is distributed in the hope that it will be useful, + * ratpoison is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. @@ -13,7 +16,8 @@ * You should have received a copy of the GNU General Public License * along with this software; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA */ + * Boston, MA 02111-1307 USA + */ #include <X11/X.h> #include <X11/Xlib.h> @@ -282,7 +286,7 @@ static void handle_key (screen_info *s) { char *keysym_name; - char msg[100]; + char *msg; const rp_action *i; int revert; Window fwin; /* Window currently in focus */ @@ -316,14 +320,22 @@ handle_key (screen_info *s) } keysym_name = keysym_to_string (keysym, mod); - snprintf (msg, 100, "%s unbound key!", keysym_name); + msg = (char *) malloc ( strlen ( keysym_name ) + 20 ); + if ( msg == NULL ) + { + PRINT_ERROR ("Out of memory\n"); + exit (EXIT_FAILURE); + } + snprintf (msg, strlen (keysym_name) + 13, "%s unbound key!", keysym_name); free (keysym_name); - PRINT_DEBUG ("%s\n", msg) + PRINT_DEBUG ("%s\n", msg); /* No key match, notify user. */ XSetInputFocus (dpy, fwin, revert, CurrentTime); display_msg_in_bar (s, msg, 0, 0); + + free (msg); } void |