summaryrefslogtreecommitdiff
path: root/src/input.c
AgeCommit message (Collapse)Author
2013-04-15Support UTF-8 in the input barJérémie Courrèges-Anglas
* introduce RP_IS_UTF8_{CHAR,CONT,START} macros. Those yield non-zero only if the locale is UTF-8. * use those macros in editor.c to properly handle UTF-8 multibyte characters. * use them also in input.c:update_input_window, to draw the cursor Reviewing and comments are welcome. Patches for generic support of multibyte encodings are welcome too. UTF-8 was chosen because of its processing simplicity and its wide use, not because of any political opinion or religious belief. ;)
2013-04-13get_more_input: use a proper while loop and a switch statementJérémie Courrèges-Anglas
2013-04-13get_more_input: remove useless variableJérémie Courrèges-Anglas
2013-04-10Get rid of several unused variablesJérémie Courrèges-Anglas
* cmd_definekey: actually use cmd * cmd_meta: remove ev1 * cmd_resize: remove nbytes * cmd_ratrelwarp: remove s * draw_string: remove lgv, lgc, mask; lgc wasn't XFreeGC'ed * get_more_input: remove nbytes * cleanup_frame: remove last_win * get_window_list: remove other_window Patch from Bernhard R. Link
2013-02-06rp_text_width: remove "font" argumentJérémie Courrèges-Anglas
* (globals.[ch]): remove rp_text_width "font" arg, since its value is always the global variable defaults.font (non-Xft case). remove one #ifdef while here * update rp_text_width() calls to match new signature
2009-07-15do not shadow identifiers (silencing gcc's -Wshadow warnings)Bernhard R. Link
2009-07-04fix inverted text when using xftwinliststyle-row_brokenShawn Betts
Now the inverted rectangle is drawn first and the text overtop in the bg color.
2008-10-22move all HAVE_HISTORY into history.cBernhard R. Link
2008-10-22define different history types and use themBernhard R. Link
(implementation does not separate them yet, though)
2008-05-29don't grab the key if the keysym doesn't map to a keycodeShawn Betts
Also, remove the restriction that a keysym must have a keycode in order to be bound.
2008-05-25properly indent calls to rp_text_width and rp_draw_stringShawn
2008-05-24fix whitespace errors in xft patchShawn
2008-05-24Add xft supportMidare Kiyura
2008-02-19grab top level key bindings asynchronouslyShawn
2008-02-11return a value in read_single_keyShawn Betts
2008-02-06Change the way input is readShawn
Before rp used xgrabkeyboard to read a key. Instead, the keyboard is frozen when a top level key is read. Then when rp reads a key it first sets the input focus to a suitable location such as key_window or input_window, then thaws the keyboard and waits for a keypress. When a key is pressed the keyboard is frozen again and the process repeats until ratpoison is done reading input. At that point the keyboard is thawed in a way that future keystrokes do not refreeze the keyboard.
2007-04-23(update_modifier_map): don't map both super andsabetts
hyper to the same modifier slot.
2006-12-14*** empty log message ***sabetts
2006-05-24* src/xinerama.c (free_xinerama): take void arguments. prototype updated.sabetts
(init_xinerama): likewise * src/window.c (init_window_stuff): take void arguments. prototype updated. (free_window_stuff): likewise * src/split.c (remove_all_splits): take void arguments. prototype updated. (current_frame): likewise (init_frame_lists): likewise (find_last_frame): likewise (current_window): likewise (remove_all_splits): likewise (hide_frame_indicator): likewise (show_frame_indicator): likewise * src/main.c (check_child_procs): take void arguments. prototype updated. (clean_up): likewise * src/number.c (numset_new): take void arguments. prototype updated. * src/manage.c (clear_unmanaged_list): take void arguments. prototype updated. (list_unmanaged_windows): likewise (ungrab_keys_all_wins): likewise (grab_keys_all_wins): likewise (current_screen): likewise (unhide_all_windows): likewise * src/main.c (sighandler): static function (hup_handler): likewise (alrm_handler): likewise (handler): likewise (print_version): likewise (print_help): likewise (show_welcome_message): take void arguments (init_defaults): likewise * src/input.c (ring_bell): take void arguments. prototype updated (update_modifier_map): likewise * src/history.c (get_history_filename): take void arguments (history_load): take void arguments. prototype updated (history_save): likewise (history_reset): likewise (history_previous): likewise (history_next): likewise (history_list_items): likewise * src/group.c (group_in_list): static function (init_groups): take void arguments. prototype updated (free_groups): likewise (group_next_group): likewise (group_prev_group): likewise * src/globals.c (x_export_selection): take void arguments (get_cut_buffer): likewise (get_primary_selection): likewise (get_selection): take void arguments. protype updated. (init_globals): likewise * src/events.c (selection_clear): take void arguments (handle_signals): likewise (listen_for_events): take void argumens. prototype updated * src/bar.c (reset_alarm): take void arguments (show_last_message): take void arguments. prototype updated. (free_bar): likewise * src/actions.c (init_set_vars): static function. take void arguments (clear_frame_redos): take void arguments (pop_frame_undo): likewise (pop_frame_redo): likewise (keymap_new): static function (parse_keydesc): likewise (trivial_completions): likewise (keymap_completions): likewise (window_completions): likewise (group_completions): likewise (colon_completions): likewise (exec_completions): likewise (hook_completions): likewise (var_completions): likewise (update_all_gcs): take void arguments (grab_rat): likewise (ungrab_rat): likewise (init_user_commands): take void arguments. prototype updated. (free_keymaps): likewise (free_aliases): likewise
2006-05-14(update_modifier_map): use XGetKeyboardMapping.sabetts
2006-04-20* src/split.c (show_frame_message): use XmbDrawString and XmbTextEscapementsabetts
* src/screen.c (init_screen): don't include the font in the gc * src/ratpoison.h: include Xlocale.h * src/manage.c (get_wmname): support i18n characters * src/main.c (init_defaults): call load_query_font_set and set_extents_of_fontset (main): call setlocale (clean_up): call XFreeFontSet (set_extents_of_fontset): new function (load_query_font_set): likewise * src/input.c (update_input_window): use XmbTextEscapement and XmbDrawString * src/globals.h (FONT_HEIGHT): use rp_font_ascent and rp_font_descent (MAX_FONT_WIDTH): use rp_font_width new globals rp_font_ascent, rp_font_descent, rp_font_width * src/globals.c: new globals rp_font_ascent, rp_font_descent, rp_font_width * src/data.h (struct rp_defaults): font is a XFontSet * src/bar.c (max_line_length): call XmbTextEscapement (draw_string): call XmbDrawString (get_mark_box): call XmbTextEscapement * src/actions.c (read_frame): call XmbTextEscapement (cmd_license): likewise (read_frame): call XmbDrawString (cmd_license): likewise (cmd_help): likewise (update_gc): don't include the font (set_font): call load_query_font_set
2006-04-02(handle_key): call XAllowEventssabetts
2006-04-02*** empty log message ***sabetts
2006-04-01(grab_key): grab the keyboard synchronouslysabetts
2006-03-16remove tabs and trailing whitespace.sabetts
2005-02-22* src/main.c (read_startup_files): use xsprintf when generatingsabetts
path to ratpoisonrc. * src/input.c (get_more_input): Use HAVE_HISTORY to ifdef out history_reset. * src/actions.c (command): new variable, raw, which records whether to tell parse_args not to parse the last arg. (cmd_set): likewise
2004-12-04update copyright.sabetts
2004-12-02Updated copyright notices.sabetts
2004-11-04*** empty log message ***sabetts
2004-05-20* src/input.c (rp_mask_to_x11_mask): handle the shift modifiersabetts
(x11_mask_to_rp_mask): likewise (keysym_to_keycode_mod): Make sure lower != keysym before adding the shift mask. (keysym_to_string): handle the shift modifier. use 's' for super instead of 'S' (cook_keycode): keep the shift modifier if XLookupString didn't gobble it. * src/data.h (RP_SHIFT_MASK): new define * src/actions.c (parse_keydesc): parse the shift modifier change super to 's' from 'S'.
2004-05-05(grab_key): use keysym_to_keycode_mod to get thesabetts
keycode and modifier for the keysym. (keysym_to_keycode_mod): new function
2004-04-24* src/data.h (struct rp_defaults): new members, font_string,sabetts
fgcolor_string, bgcolor_string. * src/actions.c (set_font): return defaults.font_string when data is NULL (set_fgcolor): likewise for fgcolor_string (set_bgcolor): likewise for bgcolor_string * src/manage.c (ungrab_top_level_keys): properly grab capital letters. * src/main.c (init_defaults): init fgcolor_string, bgcolor_string, and font_string * src/input.c (grab_key): change keysym type to KeySym. convert keysym to keycode. All callers updated.
2004-04-18* src/manage.h (ungrab_keys_all_wins): new prototypesabetts
(grab_keys_all_wins): likewise * src/manage.c (grab_top_level_keys): renamed from grab_prefix_key (all callers updated). Grab all keys in the top level keymap. (ungrab_top_level_keys): renamed from ungrab_prefix_key (all callers updated). ungrab all keys in the top level keymap. (ungrab_keys_all_wins): new function (grab_keys_all_wins): likewise * src/globals.c: (rp_key_hook): rename from rp_prefix_hook. Dependant code updated. (set_rp_window_focus): change 'prefix' hook to 'key' hook. * src/events.c (handle_key): handle a top level key press. (handle_key): new arguments ks, and mod. (key_press): pass the keysym and modifier to handle_key * src/conf.h (TOP_KEYMAP): new define * src/actions.c (cmd_v_split, cmd_h_split): swap names. (user_commands): bind split to cmd_v_split. (initialize_default_keybindings): initialize the top level keymap (cmd_definekey): update the keys grabbed when changing a key on the top level keymap. (cmd_escape): update the escape key in the top level map. (cmd_delkmap): don't allow the deletion of the top level keymap.
2003-11-02(cook_keycode): null terminate the string.sabetts
2003-08-31* src/input.c (get_more_input): use XGrabKeyboard and XUngrabKeyboardsabetts
for changing focus to read key presses. * src/events.c (handle_key): use XGrabKeyboard and XUngrabKeyboard for changing focus to read key presses. * src/actions.c (cmd_resize): use XGrabKeyboard and XUngrabKeyboard for changing focus to read key presses. (cmd_license): likewise (cmd_help): likewise (cmd_fselect): likewise
2003-08-29* src/window.c (give_window_focus): use set_rp_window_focus.sabetts
* src/split.c (set_active_frame): use set_window_focus. (blank_frame): likewise * src/main.c (main): use set_window_focus. * src/input.c (get_more_input): use set_window_focus * src/globals.h (set_window_focus): new prototype (set_rp_window_focus): likewise * src/events.c (handle_key): use set_window_focus. * src/actions.c (cmd_resize): use set_window_focus. (cmd_license): likewise (cmd_help): likewise (cmd_tmpwm): likewise (cmd_fselect): likewise * src/globals.c (set_rp_window_focus): new function (set_window_focus): likewise
2003-05-27* src/editor.c (saved_command): new local globalsabetts
(edit_binding): new typedef (edit_binding): new struct (edit_bindings): new local global (input_line_new): new function (input_line_free): likewise (execute_edit_action): likewise (editor_forward_char): likewise (editor_backward_char): likewise (editor_forward_word): likewise (editor_backward_word): likewise (editor_beginning_of_line): likewise (editor_end_of_line): likewise (editor_delete_char): likewise (editor_backward_delete_char): likewise (editor_kill_word): likewise (editor_backward_kill_word): likewise (editor_kill_line): likewise (editor_backward_kill_line): likewise (editor_history_previous): likewise (editor_history_next): likewise (editor_abort): likewise (editor_no_action): likewise (editor_insert): likewise (editor_enter): likewise (paste_cut_buffer): likewise (paste_primary_selection): likewise (editor_paste_selection): likewise (editor_complete): likewise (editor_forward_char): new prototype (editor_backward_char): likewise (editor_forward_word): likewise (editor_backward_word): likewise (editor_beginning_of_line): likewise (editor_end_of_line): likewise (editor_delete_char): likewise (editor_backward_delete_char): likewise (editor_kill_word): likewise (editor_backward_kill_word): likewise (editor_kill_line): likewise (editor_paste_selection): likewise (editor_abort): likewise (editor_no_action): likewise (editor_enter): likewise (editor_history_previous): likewise (editor_history_next): likewise (editor_complete): likewise (editor_backward_kill_line): likewise * src/sbuf.h (sbuf): add node field. * src/main.c (xrealloc): don't print debugger output (init_defaults): init history_size (main): initialize rp_selection (main): load history (clean_up): save history * src/linkedlist.h (list_first): new macro * src/input.h (free_history): remove prototype (ring_bell): new function * src/input.c: include unistd.h (input_history): remove (input_num_history_entries): likewise (update_input_window): remove prompt, input, and input_len arguments. add line argument. (update_input_window): use line argument. (ring_bell): new function (get_input): take completion_fn argument. prototype and callers updated. (free_history): remove function (get_more_input): take completion_fn argument. prototype and callers updated. use line structure and its functionality. * src/globals.h (MAX_FONT_WIDTH): new define (rp_selection): new extern * src/globals.c (rp_selection): new global * src/completions.h (completions_new): new prototype (completions_free): likewise (completions_assign): likewise (completions_update): likewise (completions_next_completion): likewise * src/completions.c (completions_new): new function (completions_free): likewise (completions_assign): likewise (completions_update): likewise (completions_next_completion): likewise * src/Makefile.am (ratpoison_SOURCES): add editor.c editor.h history.h and history.c * src/data.h (rp_completions): new typedef (rp_input_line): likewise (completion_fn): likewise (rp_defaults): new field, history_size (rp_completions): new struct (rp_input_line): new struct * src/conf.h (MAX_HISTORY_SIZE): new define (HISTORY_FILE): likewise (VISUAL_BELL): likewise (MODIFIER_PREFIX): set to RP_CONTROL_MASK (INPUT_ABORT_MODIFIER): likewise (INPUT_PREV_HISTORY_MODIFIER): likewise (INPUT_NEXT_HISTORY_MODIFIER): likewise (RESIZE_VGROW_MODIFIER): likewise (RESIZE_VSHRINK_MODIFIER): likewise (RESIZE_HGROW_MODIFIER): likewise (RESIZE_HSHRINK_MODIFIER): likewise * src/actions.c (trivial_completions): new function (window_completions): likewise (colon_completions): likewise (exec_completions): likewise (cmd_select): pass window_completions to get_input (cmd_rename): pass trivial_completions to get_input (cmd_colon): pass colon_completions to get_input and get_more_input (cmd_exec): pass exec_completions to get_input (cmd_newwm): pass trivial_completions to get_input (cmd_resize): convert the keysym modifier to something ratpoison understands.
2003-05-25* src/window.c: do not include ctype.hsabetts
* src/ratpoison.h (str_comp): new prototype * src/messages.h (MESSAGE_PROMPT_SWITCH_TO_GROUP): new define * src/main.c: include ctype.h (str_comp): moved from window.c * src/group.h (groups_find_group_by_name): new prototype. (groups_find_group_by_number): likewise. (groups_merge): likewise (group_move_window): likewise * src/group.c: include string.h (group_new): new argument, name. All callers updated. prototype updated. (init_groups): create the first group with DEFAULT_GROUP_NAME as its name. (group_new): new argument, name. All callers updated. Prototype updated. (group_free): free the group's name. (group_add_new_group): new argument, name. All callers updated. Prototype updated. (groups_find_group_by_name): new function (groups_find_group_by_number): likewise (group_move_window): likewise (groups_merge): likewise * src/conf.h (DEFAULT_GROUP_NAME): new define * src/actions.h (cmd_gselect): new prototype (cmd_groups): likewise (cmd_gmove): likewise (cmd_gmerge): likewise (cmd_gnewbg): likewise * src/actions.c (user_commands): new commands gselect, groups, gmove, gmerge, gnewbg. (cmd_gnewbg): new function (find_group): likewise (cmd_gselect): likewise (cmd_groups): likewise (cmd_gmove): likewise (cmd_gmerge): likewise
2003-05-25(read_key): Do not wait for the key releasesabetts
event. Remove gobble_rel argument. Callers updated.
2003-05-15(struct rp_screen): rename fromsabetts
screen_info. Dependant code updated.
2003-04-08* src/Makefile.am (ratpoison_SOURCES): add linkedlist.hsabetts
* src/bar.c (marked_message): pass correct arguments to bar_y. * src/actions.c (cmd_defwinliststyle): error messages print the correct command name.
2003-04-05* src/window.c (get_window_list): if wrap_window_list is on thensabetts
the end of the mark is the length of the buffer minus the start of the mark. * src/main.c (init_defaults): init wrap_window_list to 0. * src/input.c (update_input_window): store the height in a variable. * src/data.h (struct rp_defaults): new member, wrap_window_list. * src/bar.h [message]: wrap msg arg in parens. (marked_wrapped_message): new prototype * src/bar.c (bar_y): new argument, height. All callers updated. (bar_y): use height in calculations. (update_window_names): print a column of windows if defaults.wrap_window_list is on. (count_lines): new function (max_line_length): likewise (pos_in_line): likewise (line_beginning): likewise (marked_wrapped_message): likewise * src/actions.c (user_commands): new commands 'verbexec' and 'defwrapwinlist'. Move @end take to after the def* commands. (cmd_verbexec): new function. Added prototype. (cmd_defwrapwinlist): likewise
2003-03-26* src/split.h (show_frame_message): new prototypesabetts
* src/split.c (show_frame_message): new function * src/main.c (init_screen): listen for key release events in the key_window and input_window. * src/input.c (read_key): new argument, gobble_rel. All callers updated. * src/actions.c (cmd_remove): only remove the current frame if it isn't the ONLY one. (cmd_remove): display a message informing the user if the frame cannot be removed. (cmd_resize): clean up resize loop. (cmd_resize): display a window indicating which frame is being resized.
2003-02-27* src/main.c (free_screen): new functionsabetts
(clean_up): call free_screen on each screen. free the screen array. free defaults.window_fmt. * src/number.h (free_numbers): new prototype * src/number.c (free_numbers): new function * src/manage.c (get_wmname): use XGetWindowProperty to get the window name. (unmanaged_window): free wname after using it. * src/main.c (wm_name): new global (main): internalize WM_NAME atom. (clean_up): free data structures for keybindings, aliases, the bar, window numbers, and input history. * src/input.h (free_history): new prototype * src/input.c (free_history): new function * src/events.c (execute_remote_command): free properties returned by XGetWindowProperty(). * src/data.h (wm_name): new extern * src/communications.c (recieve_command_result): free properties returned by XGetWindowProperty(). * src/bar.h (free_bar): new prototype * src/bar.c (update_window_names): bar_buffer is not static. (update_window_names): free bar_buffer after using it. (marked_message): free the GC after using it. (free_bar): new function. * src/actions.h (free_keybindings): new prototype (free_aliases): likewise * src/actions.c (free_keybindings): new function (free_aliases): likewise (cmd_tmpwm): unmap the key window before calling the new wm, and remap it afterwards.
2003-02-23* configure.in: don't check for variable argument support insabetts
preprocessor. * src/ratpoison.h (PRINT_LINE): new macro. (PRE_PRINT_LOCATION): remove macro (PRINT_ERROR): takes one argument which is the argument list ,parens and all, to be passed to printf. Callers updated. * src/actions.c (cmd_number): use list delete entry macro (cmd_number): likewise (cmd_escape): use list looping macro (cmd_escape): likewise (cmd_defpadding): likewise (cmd_defborder): likewise * src/events.c (mapping_notify): use list looping macro (mapping_notify): likewise * src/list.c: rename rp_unmapped_window_sentinel to rp_unmapped_window and rp_mapped_window_sentinel to rp_mapped_window. Use LIST_HEAD to create them. externs updated. (add_to_window_list): use list add entry macro. (find_window_in_list): list head is of type list_head. Prototype and callers updated. (find_window_in_list): use list looping macro (init_window_list): remove function (find_window_number): use list looping macro (find_window_name): likewise (find_window_prev): use list previous entry macro (find_window_next): use list next entry macro (find_window_other): use list looping macro (append_to_list): remove function (insert_into_list): use list looping macro (insert_into_list): use list add entry macro (remove_from_list): remove function (get_window_list): use list looping macro * src/main.c (main): do not call init_window_list() * src/manage.c (unmanage): use list delete macro (map_window): likewise (withdraw_window): use list moving macro to move entry to another list. (hide_others): use list looping macro * src/split.c (num_frames): use list looping macro (frames_screen): likewise (maximize_all_windows_in_frame): likewise (delete_frame_from_list): remove function (create_initial_frame): remove list init code. Add current frame to screen's frame list. (init_frame_list): use list init macro (find_last_frame): use list looping macro (find_windows_frame): likewise (find_frame_next): use list next entry macro (find_frame_prev): use list previous entry macro (find_window_for_frame): use list looping macro (split_frame): use list add entry macro (remove_all_splits): use list looping macro (resize_frame_vertically): likewise (resize_frame_horizontally): likewise (total_frame_area): likewise (frame_overlaps): likewise (remove_frame): likewise (find_frame_up): likewise (find_frame_down): likewise (find_frame_left): likewise (find_frame_right): likewise
2002-01-15fixed crash on solarissabetts
2001-12-21* src/input.c (input_history): new static globalsabetts
(input_num_history_entries): likewise (get_more_input): cycle through the input history. * src/conf.h (INPUT_PREV_HISTORY_KEY): new define (INPUT_PREV_HISTORY_MODIFIER): likewise (INPUT_NEXT_HISTORY_KEY): likewise (INPUT_NEXT_HISTORY_MODIFIER): likewise (INPUT_MAX_HISTORY): likewise * src/input.c (update_input_window): Draw the cursor in the right place.
2001-12-21* src/input.c (update_input_window): Draw the cursor in the right place.sabetts
* src/actions.h (cmd_defbarpadding): new prototype * src/actions.c (user_commands): new command entry "defbarpadding" (cmd_defbarpadding): new function
2001-10-18* src/split.c (show_frame_indicator): call XSync after clearing the window.sabetts
* src/input.c (get_more_input): clear the window after it is raised. Call XSync aftwards. * src/conf.h (MAX_LINK_DEPTH): new define * src/bar.c (marked_message): clear the window after it is raised. Call XSync aftwards. * src/actions.h (cmd_link): new prototype * src/actions.c (user_command): new command 'link' (find_command_by_keydesc): new function (resolve_command_from_keydesc): likewise (cmd_link): likewise
2001-10-18* src/split.h (find_last_frame): new prototypesabetts
* src/split.c (update_last_access): new function (find_last_frame): likewise (split_frame): update the new frame's last_access field (set_active_frame): update the new current frame's last_access field * src/input.h (x11_mask_to_rp_mask): new prototype (rp_mask_to_x11_mask): likewise * src/input.c (x11_mask_to_rp_mask): new function (rp_mask_to_x11_mask): likewise * src/events.c (handle_key): convert X11 modifier masks to rp modifier masks where appropriate. * src/actions.h (cmd_focuslast): new prototype * src/actions.c (initialize_default_keybindings): new keybinding for "focuslast" (cmd_focuslast): new function (user_command): new command "focuslast"