summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsabetts <sabetts>2001-03-12 01:10:48 +0000
committersabetts <sabetts>2001-03-12 01:10:48 +0000
commit63e226ae9eec6ca3cdaa5bfdc530d51121594a93 (patch)
tree8eacee028d2f7ae5143440c41e7cfcc3d239c247 /src
parent0f1f9aa36796a34d01fb101c5ff5f0875104689e (diff)
downloadratpoison-63e226ae9eec6ca3cdaa5bfdc530d51121594a93.zip
merged rel-0-1-0 branch
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog766
-rw-r--r--src/actions.c33
-rw-r--r--src/data.h12
-rw-r--r--src/events.c27
-rw-r--r--src/events.h2
-rw-r--r--src/input.c231
-rw-r--r--src/input.h5
-rw-r--r--src/main.c12
8 files changed, 248 insertions, 840 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
deleted file mode 100644
index 7aa3805..0000000
--- a/src/ChangeLog
+++ /dev/null
@@ -1,766 +0,0 @@
-2001-03-07 Ryan Yeske <rcyeske@cut.hotdog.tmp>
-
- * main.c (read_rc_file): Fix typo that was resulting in exhausting
- all memory parsing the rc file.
-
- * actions.c (string_to_keysym): New function.
- (parse_keydesc): Call string_to_keysym.
-
- * main.c (read_startup_files): Use PRINT_DEBUG to report failure
- to load rc files.
-
-2001-03-05 Ryan Yeske <rcyeske@cut.hotdog.tmp>
-
- * actions.c: remove silly C,M,A,S,H #defines and propagate
- changes.
-
- * bar.c (update_window_names): Print a '+' for the last accessed
- window.
-
-2001-03-03 Ryan Yeske <rcyeske@cut.hotdog.tmp>
-
- * actions.c (cmd_bind): Do not pollute the message bar with
- chatter about the keybinding.
-
-2001-03-03 shawn <sabetts@livingston>
-
- * manage.c (maximize_normal): windows with resize increments
- resize properly when their original size is > the screen size.
- (maximize_transient): likewise
-
-2001-03-02 shawn <sabetts@diggin.lamenet.tmp>
-
- * main.c (print_version): updated copyright notice.
-
- * actions.c (initialize_default_keybindings): removed emacs
- binding.
-
-2001-03-01 Ryan Yeske <rcyeske@cut.hotdog.tmp>
-
- * ratpoison.h (xmalloc, xrealloc, fatal): Prototype.
-
- * main.c (xmalloc): Move here from sbuf.c.
- (xrealloc): Likewise.
- (fatal): Likewise.
-
- * number.c (find_empty_cell): Use xrealloc, remove error check.
- (init_numbers): Likewise.
-
- * manage.c (get_window_name): Likewise.
-
- * main.c (main): Likewise.
-
- * list.c (add_to_window_list): Likewise.
- (add_to_window_list): Likewise.
-
- * events.c (handle_key): Likewise.
-
- * input.c (keysym_to_string): Likewise.
- (get_more_input): Use xrealloc, remove error check.
-
- * actions.c (cmd_source): Open the file. Error report as
- appropriate.
- (cmd_windows): Call current_screen() to find the current screen.
- (cmd_clock): Show the clock even if no windows are open.
- (cmd_clock): Use xmalloc, remove error check.
- (initialize_default_keybindings): Use xmalloc.
- (cmd_bind): Use xmalloc.
- (cmd_rename): Use xmalloc, remove error check.
- (add_keybinding): Use xrealloc.
- (replace_keybinding): Use xrealloc.
-
- * main.c (read_rc_file): Take a file pointer rather than a
- filename.
- (read_startup_files): If ~/.ratpoisonrc is not readable try
- /etc/ratpoisonrc.
-
- * actions.c: Use PRINT_DEBUG instead of fprintf. Put useful error
- text in calls to message().
- (cmd_select): Show the window list if there is no such window
- number.
-
-2001-02-28 shawn <sabetts@badbox.secure.basis.org>
-
- * manage.c (map_window): calls update_window_information.
-
- * manage.h (map_window): new prototype.
-
- * events.c (new_window): calls update_window_information on new windows.
- (map_request): calls map_window on managed unmapped windows.
- (configure_request): removed commented out old crusty
- code. Updates window's structure based on what bits are set in the
- event's value_mask. Doesn't honour resize request. Windows are
- always maximized.
- (property_notify): doesn't call maximize when WM_NORMAL_HINTS are
- updated.
-
- * manage.c (manage): no longer maps the window, this code is in
- map_window.
- (map_window): new function
- (maximize): no longer sends a synthetic configure event.
- (scanwins): calls map_window on viewable windows.
- (update_window_information): renamed from manage. dependant code
- updated.
-
-2001-02-27 shawn <sabetts@diggin.lamenet.tmp>
-
- * actions.c (cmd_escape): updates the "other" command keybinding
-
- * manage.h (ungrab_prefix_key): new prototype
- (grab_prefix_key): likewise
-
- * manage.c (ungrab_prefix_key): new function
-
- * main.c (main): calls initialize_default_keybindings after
- init_window_list.
-
- * data.h (struct rp_action): key is of type KeySym. state is
- unsigned int.
-
- * conf.h (KEY_PREFIX): set to XK_t
-
- * actions.h (cmd_escape): new prototype
-
- * actions.c (cmd_escape): new function
-
- * data.h (struct key): move from actions.h
- (struct rp_key): rename from struct key. dependant code updated.
- (prefix_key): new global variable. code dependant on KEY_PREFIX
- and MODIFIER_PREFIX updated to use this.
-
- * actions.c: "maximize" user command calls cmd_maximize
- (initialize_default_keybindings): initializes prefix_key.
- Added "escape" command.
-
- * manage.c (force_maximize): moved from actions.c
- (maximize): likewise
- (maximize_normal): likewise
- (maximize_transient): likewise
-
- * actions.c (cmd_maximize): New function
-
- * main.c (handler): Prepends error message with "ERROR: ".
- Displays error in message bar. Returns 0.
-
- * events.c (destroy_window): sets rp_current_window to NULL when
- there are no more mapped windows.
- (destroy_window): calls set_current_window and find_window_other
- directly instead of cmd_other.
-
-2001-02-26 shawn <sabetts@diggin.lamenet.tmp>
-
- * list.c (save_mouse_position): stores the mouse position relative
- to the root window.
- (set_active_window): warps the mouse relative to the root window.
-
- * actions.h: prototype for force_maximize added
-
- * actions.c: the user command "maximize" calls force_maximize
- (force_maximize): New function
-
-2001-02-25 Ryan Yeske <rcyeske@cut.hotdog.tmp>
-
- * main.c (read_rc_file): rename from load_rc_file. Remove static
- keyword.
- (read_startup_files): rename from read_initialization_files.
-
- * actions.c (cmd_prev): Handle situation when there is no other
- window.
- (cmd_next): Likewise.
- (cmd_other): Likewise.
- (cmd_source): New function.
-
-2001-02-24 Ryan Yeske <rcyeske@cut.hotdog.tmp>
-
- * main.c (load_rc_file): new function
- (read_initialization_files): new function
- (main): read the initialization files
-
- * conf.h: remove themes support
-
- * themes.h: remove file
-
- * actions.c (replace_keybinding): add function
- (cmd_bind): handle binding of previously bound key
-
-2001-02-23 shawn <sabetts@diggin.lamenet.tmp>
-
- * main.c (main): passes return value of find_window_other() to
- set_active_window().
-
- * list.h (remove_from_window_list): removed prototype
- (find_window_in_list): new prototype
- (append_to_list): likewise
- (insert_into_list): likewise
- (remove_from_list): likewise
-
- * list.c: propogated use of rp_unmapped_window_sentinel and
- rp_mapped_window_sentinel.
- (find_window_in_list): new function
- (find_window): calls find_window_in_list to search mapped and
- unmapped window lists.
- (remove_from_window_list): removed function
- (init_window_list): initialized sentinels
- (find_window_prev): searches only the mapped window list.
- (find_window_next): likewise
- (find_window_other): likewise
- (append_to_list): new function
- (insert_into_list): new function
- (remove_from_list): new function
-
- * events.c (unmap_notify): Searches only the mapped window
- list. moves the window from the unmapped window list to the mapped
- window list.
-
- * data.h: removed rp_window_head and rp_window_tail, updated
- dependant files. Added rp_mapped_window_sentinel and
- rp_unmapped_window_sentinel globals.
-
- * bar.c (update_window_names): loops only through mapped window
- list.
-
-2001-02-21 Ryan Yeske <rcyeske@cut.hotdog.tmp>
-
- * manage.c (manage): comment out broken sort_window_list_by_number
- call
-
- * actions.h (key): new structure
-
- * actions.c (find_keybinding): return an rp_action*, not a char*
- (user_commands): add bind command
- (parse_keydesc): new function
- (cmd_bind): new function
-
- * actions.h: update find_keybinding prototype
-
- * events.c (handle_key): handle new return value of
- find_keybinding
-
- * actions.c (cmd_generate): Send the modifier prefix state as well
- as the keycode.
- (find_keybinding): Do not strdup the key action data.
- (add_keybinding): Strdup the key action data.
-
-2001-02-19 Ryan Yeske <rcyeske@cut.hotdog.tmp>
-
- * events.c (handle_key): Call find_keybinding() instead of looping
- through keytable here.
-
- * main.c (main): Call initialize_default_keybindings.
-
- * actions.c (find_keybinding): Added.
- (add_keybinding): Added.
- (initialize_default_keybindings): Added. Do not use static table
- of keybindings. Instead call add_keybinding() for each key.
-
- * Makefile.am (ratpoison_SOURCES): add themes.h
-
- * main.c (FONT_NAME): Rename to FONT
- (BAR_BG_COLOR): Rename to BACKGROUND
- (BAR_FG_COLOR): Rename to FOREGROUND
-
- * list.c (find_window_by_number): Rename to find_window_number.
- (find_window_by_name): Rename to find_window_name.
- (goto_window_name): Remove.
- (find_window_prev): Clean up.
- (find_window_next): Clean up.
-
- * list.h: Update prototypes.
-
- * conf.h: Include "themes.h".
-
- * actions.c (cmd_generate): Fix typo.
- (prev_window): Remove.
- (next_window): Remove.
- (last_window): Remove.
- (cmd_prev): Add.
- (cmd_next): Add.
- (cmd_other): Add.
- (string_to_window_number): Add.
- (cmd_select): Add.
- (cmd_rename): Add.
- (delete_window): Remove.
- (cmd_delete): Add.
- (cmd_delete): Remove.
- (cmd_kill): Add.
- (show_version): Remove.
- (cmd_version): Add.
- (command): Remove.
- (command): Remove.
- (cmd_colon): Deal with partial input.
- (cmd_exec): Add.
- (cmd_newwm): Remove.
- (cmd_newwm): Add.
- (cmd_clock): Remove.
- (cmd_clock): Add.
- (cmd_clock): Remove.
- (cmd_windows): Add.
- (goto_window_number): Remove.
- (abort_keypress): Remove.
- (cmd_abort): Add.
-
- * actions.c: Make :select command handle numbers.
- (cmd_unimplemented): new function.
-
- Commands are all cmd_ prefixed. Major changes within this file.
- * input.c (get_more_input): New function. Used to collect input
- on top of some existing input.
- (get_input): Calls get_more_input to do work.
-
- * conf.h (THEME): added themes support.
-
- * bar.h (message): New macro. Calls marked_message with (0, 0)
- highlight parameters.
-
- * bar.c (marked_message): New function
-
- * actions.h: Update prototypes.
-
-2001-02-19 shawn <sabetts@diggin.lamenet.tmp>
-
- * manage.c (manage): calls sort_window_list_by_number
-
- * list.h (sort_window_list_by_number): Added prototype
-
- * list.c (swap_list_elements): Added
- (sort_window_list_by_number): Added
-
- * input.c (update_input_window): Added
- (get_input): calls update_input_window in place of xlib calls.
- (get_input): exits if realloc fails
-
- * conf.h: Added INPUT_WINDOW_SIZE
-
- * bar.c (update_window_names): loops through window list from head
- to tail.
-
-2001-02-18 shawn <sabetts@diggin.lamenet.tmp>
-
- * conf.h: restructured comments. Added #define for AUTO_CLOSE.
-
- * manage.c (unmanage): kills ratpoison when there are no more
- windows.
-
-2001-02-17 Ryan Yeske <rcyeske@cut.hotdog.tmp>
-
- * actions.c (generate_key_event): Send KEY_PREFIX.
-
-2001-02-17 Ryan Yeske <rcyeske@cut.hotdog.tmp>
-
- * manage.c (current_screen): Rename get_screen() and move to this
- file.
-
- * input.c (get_input): Remove screen_info as paramater. Call
- current_screen() to get screen_info.
-
- * actions.c (get_screen): Remove.
-
-2001-02-17 Gergely Nagy <8@free.bsd.hu>
-
- * actions.c (goto_window_by_name, rename_current_window, command)
- (shell_command, switch_to, xterm_command): changed static char[100]s
- to dynamic char *s, as get_input() now supports this
- * input.h: reflect get_input change
- * input.c (get_input): use dynamically allocated strings
-
-2001-02-15 Gergely Nagy <8@free.bsd.hu>
-
- * getopt.c: fixed a warning
-
- * events.c (handle_key): use dynamically allocated strings
-
- * bar.c (display_msg_in_bar),
- * sbuf.c (xrealloc): changed an fprintf to PRINT_DEBUG
-
-2001-02-15 Ryan Yeske <rcyeske@cut.hotdog.tmp>
-
- * list.c (save_mouse_position): changed declaration of mask to
- unsigned int
- (get_mouse_root_position): changed declaration of mask to unsigned
- int
-
- * actions.c (xterm_command): added new function. Thanks to Ben
- Leslie <benno@sesgroup.net>
- (user_commands): added "xterm"
- (key_actions): added C-t C-! binding for "xterm"
-
- * messages.h (MESSAGE_PROMPT_XTERM_COMMAND): new message
-
-2001-02-14 Ryan Yeske <rcyeske@cut.hotdog.tmp>
-
- * actions.h (generate_key_event): added prototype
-
- * actions.c (key_actions): added additional keybindings to include
- C- versions for all keys.
- (generate_key_event): added command
-
-2001-02-13 Ryan Yeske <rcyeske@cut.hotdog.tmp>
-
- * bar.c (update_window_names): get indexes around current window
- text to pass to display_msg_in_bar
- (display_msg_in_bar): xor a rectangle around the text represented
- by mark_start and mark_end arguments
-
- * conf.h (BAR_FG_COLOR): changed to black
- (BAR_BG_COLOR): changed to white
- (FONT_NAME): changed to 9x15bold
- (BAR_Y_PADDING): changed to zero
- (BAR_X_PADDING): changed to zero
-
- * data.h (struct screen_info): removed bold_gc
-
- * events.c (handle_key): can no longer over modify keystrokes
- (handle_key): updated call to display_msg_in_bar to take extra
- highlighting parameters.
-
- * main.c (init_screen): removed bold_color
- (XGCValues gv): made global
-
- * actions.h (user_command): new struct
- (argtype): new enumeration
-
- * actions.h: many updated prototypes
-
- * actions.c (key_actions): every command is now executed by
- calling command() with a string version of the command, rewrote
- this table to reflect that.
- (user_commands): new symbol table added, a mapping between strings
- and functions and arguments.
- (spawn): now handles commands with arguments by calling them
- through "/bin/sh -c"
- (get_screen): new function.
-
- * actions.c: all calls to display_msg_in_bar updated to call with
- 2 additional highlight parameters.
-
- * actions.c (goto_win_by_name, rename_current_window, ...): most
- all user functions that need arguments will prompt the user for
- them, unless they are supplied. Allows the same function to be
- used interactively or internally.
-
- * bar.h (display_msg_in_bar): updated prototype
-
- * bar.c (display_msg_in_bar): takes two additional int arguments
- which are offsets into the string describing which part of the
- text to draw highlighted.
- (update_window_names): highlight current window
-
-2001-02-12 Ryan Yeske <rcyeske@cut.hotdog.tmp>
-
- * actions.c (spawn): will now execute commands with arguments by
- execl'ing through /bin/sh -c
-
-2001-02-11 Ryan Yeske <rcyeske@cut.hotdog.tmp>
-
- * ratpoison.h: #include "sbuf.h"
- removed duplicate #include "messages.h"
-
- * Makefile.am (ratpoison_SOURCES): added sbuf.c sbuf.h
-
- * bar.c (calc_bar_width): removed function
- (update_window_names): now builds up the entire window list string
- in dynamic storage before printing the window list. No longer
- displays the current window in a different colour.
-
-2001-02-11 shawn <sabetts@diggin.lamenet.tmp>
-
- * main.c (set_sig_handler): Added
- (main): Uses set_sig_handler() instead of signal()
-
- * manage.h (set_state): Added prototype
-
- * manage.c (send_configure): Now sends the window's x,y,width,height
- coordinates.
- (set_state): Added
-
- * events.c (map_request): Calls set_state when mapping an unmapped
- window.
-
- * actions.c (maximize_transient): takes an rp_window as the
- argument. Removed code to handle void *data. Incremental resizing
- only happens if the maximum size isn't set. Removed actual X
- maximization code.
- (maximize): Moved meat to maximize_normal().
-
-2001-02-10 Ryan Yeske <rcyeske@cut.hotdog.tmp>
-
- * ratpoison.h: #include "messages.h"
-
- * list.h (goto_window_number): moved prototype to actions.h
-
- * actions.h (goto_window_number): added prototype
- (goto_window): removed prototype
-
- * Makefile.am (ratpoison_SOURCES): added messages.h
-
- * actions.c (prev_window): display correct message when there is
- no other window or there are no windows at all.
- (next_window): display correct message when there is no other
- window or there are no windows at all.
- (key_actions): all number keys call goto_window_number with an
- argument instead of a dedicated function.
- (key_actions): XK_exclam now runs execute_command
-
- * actions.c: replaced all user message strings with #define'd
- messages.
-
- * actions.h (goto_window): removed
- (goto_window_0): removed
- (goto_window_1): removed
- (goto_window_2): removed
- (goto_window_3): removed
- (goto_window_4): removed
- (goto_window_5): removed
- (goto_window_6): removed
- (goto_window_7): removed
- (goto_window_8): removed
-
-2001-02-10 shawn <sabetts@diggin.lamenet.tmp>
-
- * communications.c (send_restart, send_kill): Added
-
- * ratpoison.h: includes communications.h
-
- * main.c (send_restart, send_kill): Moved to communications.c
-
- * list.c (get_mouse_root_position): Added
- (add_to_window_list): Initialize new rp_window fields
- (save_mouse_position): Added
- (set_active_window): Added code to save and restore the position
- of the mouse
-
- * events.c (property_notify): Added code to listen for a
- WM_TRANSIENT_FOR property change.
-
- * data.h (struct rp_window): Added transient, transient_for, mouse_x, mouse_y.
-
- * actions.c (maximize_transient): Added
- (maximize): Added code to handle transient windows differently
-
- * Makefile.am (ratpoison_SOURCES): Added communications.h and communications.c
-
-2001-01-02 shawn <sabetts@diggin.lamenet.tmp>
-
- * communications.c (send_restart): moved from main.c
- (send_kill): moved from main.c
-
- * main.c: Removed send_kill, send_restart
-
- * input.h: Added copyright notice.
-
- * input.c: Added copyright notice.
-
- * actions.c: Added copyright notice.
-
-2001-02-04 Ryan Yeske <rcyeske@cut.hotdog.tmp>
-
- * actions.c (prev_window): do not set active window when
- recursing.
- (next_window): do not set active window when recursing.
-
-2001-01-28 Ryan Yeske <rcyeske@soya.hotdog.tmp>
-
- * actions.c: changed rename_current_window key to `A', bound `a'
- to show_clock
-
-2001-01-02 shawn <sabetts@diggin.lamenet.tmp>
-
- * actions.h (show_clock): added prototype
-
- * actions.c (show_clock): added
-
-2000-12-15 shawn <sabetts@badbox.secure.basis.org>
-
- * actions.c (maximize): increment size in hints->width_inc and
- hints->height_inc intervals
-
- * manage.c (manage): set the dimension members of the rp_window struct
-
-2000-12-15 shawn <sabetts@diggin.lamenet.tmp>
-
- * manage.c (manage): added ColormapChangeMask and
- StructureNotifyMask to events listened for on managed windows.
-
- * main.c (main): propagated changes to set_active_window usage
-
- * events.c: propagated changes to set_active_window usage
-
- * data.h (struct rp_window): Added colormap member
-
- * list.c (set_active_window): Installs colormap
- (set_active_window): sets rp_current_window to window passed in as
- parameter
-
- * actions.c (prev_window): No longer uses rp_current_window to
- keep track of state
- (next_window): No longer uses rp_current_window to keep track of
- state
-
- * list.c (add_to_window_list): sets member colormap to the
- DefaultColormap
-
- * manage.c (update_window_name): fixed memory leak. Not freeing
- the win->name before updating it.
- (manage): Gets the colormap now.
-
- * list.c (add_to_window_list): Added init code for `hints'
-
- * events.c (property_notify): Added handler for XA_WM_NORMAL_HINTS.
-
- * data.h (struct rp_window): Added XSizeHints member
-
- * actions.c (maximize): Adhere to the window's Size Hints
-
-2000-12-14 shawn <sabetts@diggin.lamenet.tmp>
-
- * manage.h (update_normal_hints): added prototype
-
- * manage.c (update_normal_hints): added
-
- * list.c (add_to_window_list): added comment describing function
-
-2000-12-13 shawn <sabetts@diggin.lamenet.tmp>
-
- * actions.c: removed gross tabs from key_actions definition. Add
- C-t space to go to next window.
-
-2000-12-09 shawn <sabetts@diggin.lamenet.tmp>
-
- * data.h (struct rp_window): added x, y, width, height, border;
-
- * events.c (configure_request): Now honours request, but then
- maximizes it afterwards.
- (configure_request): updates the rp_window's geometry fields
-
- * manage.c (manage): commented out XMoveResizeWindow call
- (send_configure): added
-
- * actions.h (maximize): added prototype
-
- * actions.c (maximize): added
-
- * input.c (cook_keycode): properly handle LockMask
- (cook_keycode): updated comments
-
- * input.h: added prototype for keysym_to_string
-
- * input.c (keysym_to_string): added
-
- * bar.c (show_bar): update_window_names(s) is called whether the
- bar is raised or not.
-
- * conf.h: Added BAR_Y_PADDING BAR_X_PADDING
-
- * list.c (goto_window_name): return success or failure
-
- * list.h: updated prototype for goto_window_name
-
- * events.c (handle_key): Added a message indicating an unbound
- key.
-
- * bar.c (display_msg_in_bar): added
- (update_window_names): uses BAR_X_PADDING instead of `5'
- (update_window_names): Updated BAR_PADDING to BAR_Y_PADDING
-
- * input.c (cook_keycode): mod is now an usigned int
- (read_key): Ignores modifier keys. Now returns keysym and
- modifiers.
- (get_input): Updated BAR_PADDING to BAR_Y_PADDING and
- BAR_X_PADDING.
-
- * events.c (handle_key): uses read_key instead of XMaskEvent to
- read a key.
-
- * actions.c (goto_window_number): window list is displayed on failure.
- (bye): added
- (switch_to): added
- (execute_command): no longer seg faults when no windows exist.
-
-2000-12-03 shawn <sabetts@diggin.lamenet.tmp>
-
- * input.h (cook_keycode): added prototype
-
- * actions.c: key_actions now uses the #define'd keysyms from X11/keysym.h
-
- * events.c (handle_key): calls cook_keycode() before processing the keysym.
-
- * input.c (read_key): calls cook_keycode() before returning the keysym
- (cook_keycode): added.
-
-2000-12-01 shawn <sabetts@diggin.lamenet.tmp>
-
- * list.c (find_window_by_name): added check to make sure the
- window's state is not STATE_UNMAPPED.
-
-2000-11-27 shawn <sabetts@diggin.lamenet.tmp>
-
- * events.c (handle_key): Code to generate the prefix event has
- been moved to generate_prefix().
-
- * actions.h (toggle_bar): added prefixes for generate_prefix, and
- abort_keypress.
-
- * actions.c (generate_prefix): added.
- (abort_keypress): added.
-
-2000-11-04 Ryan Yeske <rcyeske@vcn.bc.ca>
-
- * Makefile.am (ratpoison_SOURCES): added getopt.c, getopt1.c and
- getopt.h
-
-2000-10-30 Ryan Yeske <rcyeske@vcn.bc.ca>
-
- * actions.h (execute_command): added prototype
-
- * actions.c (rename_current_window): added test to skip renaming
- if user entered an empty string
- (execute_command): added command
- (key_actions): execute_command is called by pressing ':'
-
-2000-10-30 shawn <sabetts@badbox.secure.basis.org>
-
- * conf.h: added HIDE_MOUSE
-
-2000-10-24 Ryan Yeske <rcyeske@vcn.bc.ca>
-
- * bar.c (bar_x): rightmost border is no longer off screen
-
-2000-10-20 shawn <sabetts@badbox.secure.basis.org>
-
- * events.c (key_press): fixed MODIFIER_PREFIX bug
-
-2000-10-19 Ryan yeske <rcyeske@van.gobasis.com>
-
- * manage.c (unmanaged_window): added.
-
- * conf.h (PADDING_LEFT, PADDING_TOP, PADDING_RIGHT,
- PADDING_BOTTOM, UNMANAGED_WINDOW_LIST): added. Windows listed in
- UNMANAGED_WINDOW_LIST will not be managed. Space reserved for
- unmanaged windows can be defined with PADDING_*
-
-2000-10-19 shawn <sabetts@badbox.secure.basis.org>
-
- * manage.c (get_window_name): added
-
-2000-10-17 shawn <sabetts@vcn.bc.ca>
-
- * events.c (configure_request): resize windows to the max-1. Call
- XConfigureWindow as well as XSendEvent.
-
- * manage.c (scanwins): Now only maps visible windows
-
- * conf.h: Removed keystroke related defines
-
- * actions.c: Moved all key activated functions here. Added
- key_actions array.
-
- * events.c (unmap_notify): now properly unmaps windows
-
- * data.h: added ignore_badwindow
-
- * main.c (handler): added ability to ignore BadWindow errors
-
-2000-10-15 shawn <sabetts@vcn.bc.ca>
-
- * main.c, data.h, events.c: Added ability to kill and hup running
- ratpoison processes.
diff --git a/src/actions.c b/src/actions.c
index e4480da..debc821 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -410,23 +410,30 @@ cmd_select (void *data)
else
str = strdup ((char *) data);
- /* try by number */
- if ((n = string_to_window_number (str)) >= 0)
- {
- if ((w = find_window_number (n)))
- set_active_window (w);
- else
- /* show the window list as feedback */
- show_bar (current_screen ());
- }
- else
- /* try by name */
+ /* Only search if the string contains something to search for. */
+ if (strlen (str) > 0)
{
if ((w = find_window_name (str)))
set_active_window (w);
+
+ /* try by number */
+ if ((n = string_to_window_number (str)) >= 0)
+ {
+ if ((w = find_window_number (n)))
+ set_active_window (w);
+ else
+ /* show the window list as feedback */
+ show_bar (current_screen ());
+ }
else
- /* we need to format a string that includes the str */
- message (" no window by that name ");
+ /* try by name */
+ {
+ if ((w = find_window_name (str)))
+ set_active_window (w);
+ else
+ /* we need to format a string that includes the str */
+ message (" no window by that name ");
+ }
}
free (str);
diff --git a/src/data.h b/src/data.h
index 95822a7..142b015 100644
--- a/src/data.h
+++ b/src/data.h
@@ -144,4 +144,16 @@ extern int ignore_badwindow;
/* Arguments passed to ratpoison. */
extern char **myargv;
+struct modifier_info
+{
+/* unsigned int mode_switch_mask; */
+ unsigned int meta_mod_mask;
+ unsigned int alt_mod_mask;
+ unsigned int super_mod_mask;
+ unsigned int hyper_mod_mask;
+};
+
+/* Keeps track of which mod mask each modifier is under. */
+extern struct modifier_info rp_modifier_info;
+
#endif /* _RATPOISON_DATA_H */
diff --git a/src/events.c b/src/events.c
index 7e68c14..5043122 100644
--- a/src/events.c
+++ b/src/events.c
@@ -232,6 +232,20 @@ configure_request (XConfigureRequestEvent *e)
PRINT_DEBUG("request CWY %d\n", e->y);
}
+ if (e->value_mask & CWStackMode && win->state == STATE_MAPPED)
+ {
+ if (e->detail == Above)
+ {
+ set_active_window (win);
+ }
+ else if (e->detail == Below)
+ {
+ set_active_window (find_window_other ());
+ }
+
+ PRINT_DEBUG("request CWStackMode %d\n", e->detail);
+ }
+
PRINT_DEBUG ("'%s' new window size: %d %d %d %d %d\n", win->name,
win->x, win->y, win->width, win->height, win->border);
@@ -308,7 +322,7 @@ handle_key (screen_info *s)
XGetInputFocus (dpy, &fwin, &revert);
XSetInputFocus (dpy, s->key_window, RevertToPointerRoot, CurrentTime);
- read_key (&keysym, &mod);
+ read_key (&keysym, &mod, NULL, 0);
if ((key_action = find_keybinding (keysym, mod)))
{
@@ -337,8 +351,8 @@ void
key_press (XEvent *ev)
{
screen_info *s;
- unsigned int modifier = ev->xkey.state;
- int ks = XLookupKeysym((XKeyEvent *) ev, 0);
+ unsigned int modifier;
+ KeySym ks;
s = find_screen (ev->xkey.root);
@@ -348,12 +362,15 @@ key_press (XEvent *ev)
if (!s) return;
+ modifier = ev->xkey.state;
+ cook_keycode ( &ev->xkey, &ks, &modifier, NULL, 0);
+
if (ks == prefix_key.sym && (modifier == prefix_key.state))
{
handle_key (s);
}
else
- {
+ {
if (rp_current_window)
{
ignore_badwindow = 1;
@@ -486,7 +503,7 @@ delegate_event (XEvent *ev)
case KeyRelease:
PRINT_DEBUG ("KeyRelease %d %d\n", ev->xkey.keycode, ev->xkey.state);
break;
-
+
case UnmapNotify:
PRINT_DEBUG ("UnmapNotify\n");
unmap_notify (ev);
diff --git a/src/events.h b/src/events.h
index 7544aa4..9d86117 100644
--- a/src/events.h
+++ b/src/events.h
@@ -27,5 +27,5 @@ void delegate_event (XEvent *ev);
void key_press (XEvent *ev);
void map_request (XEvent *ev);
void unmap_notify (XEvent *ev);
-
+void keymap_state (XKeymapEvent *ev);
#endif /* _RATPOISON_EVENTS_H */
diff --git a/src/input.c b/src/input.c
index 64725d9..d64135f 100644
--- a/src/input.c
+++ b/src/input.c
@@ -28,6 +28,89 @@
#include "ratpoison.h"
+/* Figure out what keysyms are attached to what modifiers */
+void
+init_modifier_map ()
+{
+ unsigned int modmasks[] =
+ { Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask };
+ int row, col; /* The row and column in the modifier table. */
+ XModifierKeymap *mods;
+
+/* rp_modifier_info.mode_switch_mask = 0; */
+ rp_modifier_info.meta_mod_mask = 0;
+ rp_modifier_info.alt_mod_mask = 0;
+ rp_modifier_info.super_mod_mask = 0;
+ rp_modifier_info.hyper_mod_mask = 0;
+
+ mods = XGetModifierMapping (dpy);
+
+ for (row=3; row < 8; row++)
+ for (col=0; col < mods->max_keypermod; col++)
+ {
+ KeyCode code = mods->modifiermap[(row * mods->max_keypermod) + col];
+
+ if (code == 0) continue;
+
+ switch (XKeycodeToKeysym(dpy, code, 0))
+ {
+ case XK_Meta_L:
+ case XK_Meta_R:
+ rp_modifier_info.meta_mod_mask |= modmasks[row - 3];
+ PRINT_DEBUG ("Found Meta on %d\n",
+ rp_modifier_info.meta_mod_mask);
+ break;
+
+ case XK_Alt_L:
+ case XK_Alt_R:
+ rp_modifier_info.alt_mod_mask |= modmasks[row - 3];
+ PRINT_DEBUG ("Found Alt on %d\n",
+ rp_modifier_info.alt_mod_mask);
+ break;
+
+ case XK_Super_L:
+ case XK_Super_R:
+ rp_modifier_info.super_mod_mask |= modmasks[row - 3];
+ PRINT_DEBUG ("Found Super on %d\n",
+ rp_modifier_info.super_mod_mask);
+ break;
+
+ case XK_Hyper_L:
+ case XK_Hyper_R:
+ rp_modifier_info.hyper_mod_mask |= modmasks[row - 3];
+ PRINT_DEBUG ("Found Hyper on %d\n",
+ rp_modifier_info.hyper_mod_mask);
+ break;
+
+/* case XK_Mode_switch: */
+/* rp_modifier_info.mode_switch_mask |= modmasks[row - 3]; */
+/* PRINT_DEBUG ("Found Mode_switch on %d\n", */
+/* rp_modifier_info.mode_switch_mask); */
+/* break; */
+
+ default:
+ break;
+ }
+ }
+
+ /* Stolen from Emacs 21.0.90 - xterm.c */
+ /* If we couldn't find any meta keys, accept any alt keys as meta keys. */
+ if (! rp_modifier_info.meta_mod_mask)
+ {
+ rp_modifier_info.meta_mod_mask = rp_modifier_info.alt_mod_mask;
+ rp_modifier_info.alt_mod_mask = 0;
+ }
+
+ /* If some keys are both alt and meta,
+ make them just meta, not alt. */
+ if (rp_modifier_info.alt_mod_mask & rp_modifier_info.meta_mod_mask)
+ {
+ rp_modifier_info.alt_mod_mask &= ~rp_modifier_info.meta_mod_mask;
+ }
+
+ XFreeModifiermap (mods);
+}
+
/* Return the name of the keysym. caller must free returned pointer */
char *
keysym_to_string (KeySym keysym, unsigned int modifier)
@@ -63,63 +146,107 @@ keysym_to_string (KeySym keysym, unsigned int modifier)
/* Cooks a keycode + modifier into a keysym + modifier. This should be
used anytime meaningful key information is to be extracted from a
- KeyPress or KeyRelease event. */
-void
-cook_keycode (KeyCode keycode, KeySym *keysym, unsigned int *mod)
+ KeyPress or KeyRelease event.
+
+ returns the number of bytes in keysym_name. If you are not
+ interested in the keysym name pass in NULL for keysym_name and 0
+ for len. */
+int
+cook_keycode (XKeyEvent *ev, KeySym *keysym, unsigned int *mod, char *keysym_name, int len)
{
- KeySym normal, shifted;
+int nbytes;
- normal = XKeycodeToKeysym(dpy, keycode, 0);
- shifted = XKeycodeToKeysym(dpy, keycode, 1);
+ nbytes = XLookupString (ev, keysym_name, len, keysym, NULL);
- /* FIXME: eew, this looks gross. */
- if (*mod & (ShiftMask | LockMask))
- {
- /* if the shifted code is not defined, then we use the normal
- keysym and keep the shift mask */
- if (shifted == NoSymbol)
- {
- *keysym = normal;
- }
- /* But if the shifted code is defined, we use it and remove the
- shift mask */
- else if (*mod & ShiftMask)
- {
- *keysym = shifted;
- *mod &= ~(ShiftMask | LockMask);
- }
- /* If caps lock is on, use shifted for alpha keys */
- else if (normal >= XK_a
- && normal <= XK_z
- && *mod & LockMask)
- {
- *keysym = shifted;
- }
- else
- {
- *keysym = normal;
- }
- }
- else
- {
- *keysym = normal;
- }
+ *mod = ev->state;
+ *mod &= (rp_modifier_info.meta_mod_mask
+ | rp_modifier_info.alt_mod_mask
+ | rp_modifier_info.hyper_mod_mask
+ | rp_modifier_info.super_mod_mask
+ | ControlMask );
- PRINT_DEBUG ("cooked keysym: %ld '%c' mask: %d\n",
- *keysym, (char)*keysym, *mod);
+ return nbytes;
}
-void
-read_key (KeySym *keysym, unsigned int *modifiers)
+/* void */
+/* cook_keycode (KeyCode keycode, KeySym *keysym, unsigned int *mod) */
+/* { */
+/* KeySym normal, shifted; */
+
+/* /\* FIXME: Although this should theoretically work, the mod that */
+/* mode_switch is on doesn't seem to get activated. Instead the */
+/* 2<<13 bit gets set! It doesn't seem to matter which mod I put */
+/* Mode_switch on. So if this doesn't work try uncommented the line */
+/* below and commented the current one. *\/ */
+
+/* /\* if (*mod & 8192) *\/ */
+/* if (*mod & rp_modifier_info.mode_switch_mask) */
+/* { */
+/* normal = XKeycodeToKeysym(dpy, keycode, 2); */
+/* if (normal == NoSymbol) normal = XKeycodeToKeysym(dpy, keycode, 0); */
+/* shifted = XKeycodeToKeysym(dpy, keycode, 3); */
+/* if (shifted == NoSymbol) shifted = XKeycodeToKeysym(dpy, keycode, 1); */
+
+/* /\* Remove the mode switch modifier since we have dealt with it. *\/ */
+/* *mod &= ~rp_modifier_info.mode_switch_mask; */
+/* } */
+/* else */
+/* { */
+/* normal = XKeycodeToKeysym(dpy, keycode, 0); */
+/* shifted = XKeycodeToKeysym(dpy, keycode, 1); */
+/* } */
+
+/* /\* FIXME: eew, this looks gross. *\/ */
+/* if (*mod & (ShiftMask | LockMask)) */
+/* { */
+/* /\* if the shifted code is not defined, then we use the normal */
+/* keysym and keep the shift mask *\/ */
+/* if (shifted == NoSymbol) */
+/* { */
+/* *keysym = normal; */
+/* } */
+/* /\* But if the shifted code is defined, we use it and remove the */
+/* shift mask *\/ */
+/* else if (*mod & ShiftMask) */
+/* { */
+/* *keysym = shifted; */
+/* *mod &= ~(ShiftMask | LockMask); */
+/* } */
+/* /\* If caps lock is on, use shifted for alpha keys *\/ */
+/* else if (normal >= XK_a */
+/* && normal <= XK_z */
+/* && *mod & LockMask) */
+/* { */
+/* *keysym = shifted; */
+/* } */
+/* else */
+/* { */
+/* *keysym = normal; */
+/* } */
+/* } */
+/* else */
+/* { */
+/* *keysym = normal; */
+/* } */
+
+/* PRINT_DEBUG ("cooked keysym: %ld '%c' mask: %d\n", */
+/* *keysym, (char)*keysym, *mod); */
+/* } */
+
+int
+read_key (KeySym *keysym, unsigned int *modifiers, char *keysym_name, int len)
{
XEvent ev;
+ int nbytes;
do
{
XMaskEvent (dpy, KeyPressMask, &ev);
*modifiers = ev.xkey.state;
- cook_keycode (ev.xkey.keycode, keysym, modifiers);
+ nbytes = cook_keycode (&ev.xkey, keysym, modifiers, keysym_name, len);
} while (IsModifierKey (*keysym));
+
+ return nbytes;
}
static void
@@ -162,6 +289,10 @@ get_input (char *prompt)
char *
get_more_input (char *prompt, char *preinput)
{
+ /* Emacs 21 uses a 513 byte string to store the keysym name. */
+ char keysym_buf[513];
+ int keysym_bufsize = sizeof (keysym_buf);
+ int nbytes;
screen_info *s = current_screen ();
int cur_len = 0; /* Current length of the string. */
int allocated_len=100; /* The amount of memory we allocated for str */
@@ -192,7 +323,7 @@ get_more_input (char *prompt, char *preinput)
/* XSync (dpy, False); */
- read_key (&ch, &modifier);
+ nbytes = read_key (&ch, &modifier, keysym_buf, keysym_bufsize);
while (ch != XK_Return)
{
PRINT_DEBUG ("key %ld\n", ch);
@@ -203,18 +334,20 @@ get_more_input (char *prompt, char *preinput)
}
else
{
- if (cur_len > allocated_len - 1)
+ if (cur_len + nbytes > allocated_len - 1)
{
- allocated_len += 100;
+ allocated_len += nbytes + 100;
str = xrealloc ( str, allocated_len );
}
- str[cur_len] = ch;
- cur_len++;
+
+ strncpy (&str[cur_len], keysym_buf, nbytes);
+/* str[cur_len] = ch; */
+ cur_len+=nbytes;
update_input_window(s, prompt, str, cur_len);
}
- read_key (&ch, &modifier);
+ nbytes = read_key (&ch, &modifier, keysym_buf, keysym_bufsize);
}
str[cur_len] = 0;
diff --git a/src/input.h b/src/input.h
index 3a21471..e26f46f 100644
--- a/src/input.h
+++ b/src/input.h
@@ -23,9 +23,10 @@
#define _RATPOISON_INPUT_H 1
char *keysym_to_string (KeySym keysym, unsigned int modifier);
-void cook_keycode (KeyCode keycode, KeySym *keysym, unsigned int *mod);
+int cook_keycode (XKeyEvent *ev, KeySym *keysym, unsigned int *mod, char *keysym_name, int len);
char *get_input (char *prompt);
char *get_more_input (char *prompt, char *preinput);
-void read_key (KeySym *keysym, unsigned int *mode);
+int read_key (KeySym *keysym, unsigned int *modifiers, char *keysym_name, int len);
+void init_modifier_map ();
#endif /* ! _RATPOISON_INPUT_H */
diff --git a/src/main.c b/src/main.c
index 2d2c35f..a7c9674 100644
--- a/src/main.c
+++ b/src/main.c
@@ -65,6 +65,8 @@ XGCValues gv;
struct rp_key prefix_key;
+struct modifier_info rp_modifier_info;
+
/* Command line options */
static struct option ratpoison_longopts[] = { {"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'v'},
@@ -246,7 +248,8 @@ read_rc_file (FILE *file)
PRINT_DEBUG ("rcfile line: %s\n", line);
/* do it */
- command (line);
+ if (*line != '#')
+ command (line);
*line = '\0';
}
@@ -376,6 +379,7 @@ main (int argc, char *argv[])
init_numbers ();
init_window_list ();
initialize_default_keybindings ();
+ init_modifier_map ();
font = XLoadQueryFont (dpy, FONT);
if (font == NULL)
@@ -451,7 +455,7 @@ init_screen (screen_info *s, int screen_num)
XSelectInput(dpy, s->root,
PropertyChangeMask | ColormapChangeMask
- | SubstructureRedirectMask | KeyPressMask
+ | SubstructureRedirectMask | KeyPressMask | KeyReleaseMask
| SubstructureNotifyMask );
/* Create the program bar window. */
@@ -463,13 +467,13 @@ init_screen (screen_info *s, int screen_num)
/* Setup the window that will recieve all keystrokes once the prefix
key has been pressed. */
s->key_window = XCreateSimpleWindow (dpy, s->root, 0, 0, 1, 1, 0, WhitePixel (dpy, 0), BlackPixel (dpy, 0));
- XSelectInput (dpy, s->key_window, KeyPressMask);
+ XSelectInput (dpy, s->key_window, KeyPressMask );
XMapWindow (dpy, s->key_window);
/* Create the input window. */
s->input_window = XCreateSimpleWindow (dpy, s->root, 0, 0,
1, 1, 1, fg_color.pixel, bg_color.pixel);
- XSelectInput (dpy, s->input_window, KeyPressMask);
+ XSelectInput (dpy, s->input_window, KeyPressMask );
XSync (dpy, 0);