summaryrefslogtreecommitdiff
path: root/src/window.c
AgeCommit message (Collapse)Author
2017-09-18Delete more unused codeJérémie Courrèges-Anglas
2017-09-18set_active_window_body can be staticJérémie Courrèges-Anglas
2017-09-18Kill unused paramJérémie Courrèges-Anglas
2016-11-17Add xrandr supportMathieu OTHACEHE
Drop deprecated xinerama support and replace it with xrandr. Signed-off-by: Mathieu OTHACEHE <m.othacehe@gmail.com>
2014-12-31Third try at cleaning set_active_window_bodyJérémie Courrèges-Anglas
Delete the weird logic and the nested loops. Use a true helper function, don't just move code around.
2014-12-31Style fixes in set_active_window_bodyJérémie Courrèges-Anglas
* Delete useless parens * Sprinkle whitespace * No "if (cond) statement;" on a single line (items from the GNU coding standards, cf. README.developers) Additionally, * Don't mix code and decls, for consistency * Compare pointers against NULL
2014-12-30Refactor duplicate branches of if() into a single block with leading ?:.Jeff Abrahamson
2014-03-24Kill code and simplify cmd_numberJérémie Courrèges-Anglas
* cmd_number needs at least one argument * The code that handled the zero argument case was thus unreachable, and was the last user of print_window_information, so kill that function.
2014-03-03Search windows names for exact match then for fuzzy matchJérémie Courrèges-Anglas
* Contrary to the recent find_group change, windows are still searched by number first. This is inconsistent and a choice has to be made.
2014-02-20Kill getsid(2) check in get_child_info.Jérémie Courrèges-Anglas
* Purpose not understood, usage can't be right on OSes where getsid fails with EPERM if ratpoison and the argument pid are not in the session; guess what, ratpoison calls setsid(2) in spawn()...
2014-01-06Revert b470085.Jérémie Courrèges-Anglas
* Wrong usage of pointers. Those two helper functions are supposed to update frame parameters passed as pointers, but this does not work. Assigning to a pointer merely changes its local value. * Additionally, forgotten assignment to "done" in find_non_dedicated_frame(), bug not visible in non-xinerama setups.
2014-01-05Kill code #if 0'ed since 2001.Jérémie Courrèges-Anglas
2013-11-21Don't assume getsid succeeds, fixes %p "glitches"Jérémie Courrèges-Anglas
* on eg. OpenBSD you get -1 with errno set to EPERM if you call getsid on a pid no in the same session group as you. This makes the session id check much less useful, and exhibits glitches with %p in winfmt. For now, just bail out if getsid fails...
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
2008-10-10allow window border color to be set seperately for focused and unfocused windowsKipling Inscore
2008-10-10clean up set_active_window_body() with 2 new helper functionsJ.R. Mauro
2007-07-18free more stuff at termination time to make valgrind output better readablebrl
2007-03-08* src/split.c (set_active_frame): call switch_frame hooksabetts
(show_frame_indicator): only show frame indicator (set_active_frame): new arg force_indicator. all callers updated. (show_frame_indicator): new arg force. all callers updated. * src/main.c (init_defaults): init bar_in_padding * src/globals.c (rp_switch_screen_hook): new hook * src/data.h (struct rp_defaults): new slot, bar_in_padding * src/bar.c (bar_x): honour bar_in_padding setting (bar_y): likewise * src/actions.c (init_set_vars): add barinpadding (set_barinpadding): new function * src/globals.h: new global rp_switch_screen_hook
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-03-16* src/window.c (_XOPEN_SOURCE): new definesabetts
* src/screen.c (is_a_root_window): w is unsigned int (init_screen): typecast _net_wm_pid as unsigned char*. * src/main.c (read_rc_file): linesize is size_t * src/frame.c (frame_read): use a temp var when reading the :dedicated value. * src/bar.c (max_line_length): i and start are size_t (draw_string): i is size_t (get_mark_box): mark_start and mark_end are size_t * src/actions.c (find_keybinding): state is unsigned int (remove_keybinding): likewise (frame_selector): n is unsigned int (frame_selector_match): i is size_t. typecast comparison as size_t.
2006-03-16remove tabs and trailing whitespace.sabetts
2006-03-15*** empty log message ***sabetts
2006-03-15(init_user_commands): add optional argument to "info"sabetts
(cmd_info): handle optional argument * src/format.c: new file * src/format.h: new file * Makefile.am (ratpoison_SOURCES): add format.c and format.h * src/actions.c (set_infofmt): new function (wingravity_to_string): char * instead of static char * because needed in format.c (cmd_info): use format_string * src/actions.h (wingravity_to_string): add prototype * src/data.h (info_fmt): new variable * src/main.c (init_defaults): set a value for defaults.info_fmt * src/ratpoison.h: include format.h * src/windows.c (get_window_list): use format_string (isdigit): remove function as the formatting is now done in format.c (concat_width): likewise (format_window_name): likewise
2006-02-26* src/window.c (add_to_window_list): only change the window'ssabetts
group and frame if window_mapped is 0. * src/data.h (struct rp_child_info): new field window_mapped * src/actions.c (spawn): init window_mapped field in child_info.
2006-01-05* src/conf.h (ASPECT_WINDOWS_ARE_TRANSIENTS): new definesabetts
* src/manage.c (window_is_transient): new function (maximize_normal): honour aspect ratio hint * src/window.c (update_window_gravity): use maxsize_gravity for windows with aspect hints. (set_active_window_body): call window_is_transient * src/split.c (cleanup_frame): call window_is_transient
2005-10-22(get_mouse_position): renamed fromsabetts
get_mouse_root_position. get pos relative to window.
2005-10-20* src/window.c: include unistd.hsabetts
(get_child_info): new function (add_to_window_list): get the window's client's pid if possible and assign the window the appropriate group and frame. (add_to_window_list): init intended_frame_number (save_mouse_position): save the position relative to the window (give_window_focus): restore the position relative to the window (set_active_window_body): put the window in the frame contained in intended_frame_number when appropriate. * src/screen.c (screen_find_frame_by_frame): new function (init_screen): add the net_supported atom to the root window. * src/main.c (main): init netwm atoms * src/group.c (groups_find_group_by_group): new function * src/globals.c (_net_wm_pid, _net_supported): new globals * src/data.h (struct rp_window): new field intended_frame_number. (struct rp_child_info): new fields group, frame, screen. * src/actions.c (spawn): call the command directly when new argument, raw, is non zero. all callers updated. (spawn): fill in the frame, group and screen for the child.
2005-06-11(isdigit): new functionsabetts
(format_window_name): read a length argument and crop window names to that length. (get_window_list): length argument applies to %c and %a.
2005-06-11(isdigit): new functionsabetts
(format_window_name): read a length argument and crop window names to that length.
2004-12-04update copyright.sabetts
2004-12-02Updated copyright notices.sabetts
2004-11-19* src/actions.c (set_vars): add maxundossabetts
(push_frame_undo): new function (pop_frame_undo): likewise (initialize_default_keybindings): add binding for "undo" (initialize_default_keybindings): add def alias for maxundos (cmd_other): call set_active_window_force instead of set_active_window (cmd_v_split): push the frame set (cmd_h_split): likewise (cmd_only): likewise (cmd_remove): likewise (cmd_shrink): likewise (cmd_tmpwm): likewise (cmd_license): update copyright. Add build date and time. (cmd_fselect): simplify code that returns the frame selected. (fdump): new function (cmd_fdump): call fdump to dump the screen's frame set. (frestore): new function (cmd_frestore): call frestore to restore the screen's frame set. (cmd_sfdump): new function (cmd_sdump): likewise (set_maxundos): likewise (cmd_cnext): likewise (cmd_cprev): likewise (cmd_inext): likewise (cmd_iprev): likewise (cmd_cother): likewise (cmd_iother): likewise (cmd_undo): likewise (cmd_prompt): likewise (cmd_describekey): likewise (cmd_dedicate): likewise * src/main.c (init_defaults): init maxundos to 20 (clean_up): free the undo history lists * src/window.h (set_active_window_body): new function (set_active_window_force): likewise * src/window.c (set_active_window): new function (set_active_window_force): likewise (set_active_window_body): renamed from set_active_window (set_active_window_body): Add code to handle dedicated frames. * src/screen.h (screen_dump): new prototype * src/screen.c (screen_dump): new function * src/linkedlist.h (list_last): new macro * src/group.h (group_last_window_by_class_complement): new prototype (group_last_window_by_class): likewise * src/group.c (group_last_window_by_class): new function (group_last_window_by_class_complement): likewise * src/globals.h (rp_frame_undos): new extern. (rp_num_frame_undos): likewise * src/globals.c (rp_frame_undos): new list. (rp_num_frame_undos): new global * src/frame.c (frame_new): init f->dedicated to 0. * src/data.h (struct rp_frame): add dedicated member. (struct rp_defaults): add maxundos member. (struct rp_frame_undo): new struct. * src/actions.c: new commands, cnext, cother, cprev,
2004-11-19* src/window.c (print_window_information): add argument,sabetts
group. print the window's number in the group. All callers updated. * src/actions.c (cmd_info): print the window's number in the current group.
2004-11-18* src/window.c (unhide_transient_for): add a newline to debuggingsabetts
output. (hide_transient_for_between): likewise. * src/manage.c (get_wmname): typecast name when passing to xstrdup. * src/main.c (main): typecast command[i] when passing to send_command. * src/events.c (execute_remote_command): typecast req[1] when passing to command. (receive_command): typecast result when passing to XChangeProperty. * src/editor.c (editor_history_previous): Add newline to debugging output. (editor_history_next): likewise. (paste_primary_selection): typecast data when passing to editor_insert. * src/communications.c (receive_command_result): typecast result when passing to strlen. (send_command): typecast cmd when passing the XChangeProperty. * src/actions.c (user_commands): add focusprev (cmd_prev): clean up (cmd_next): likewise (cmd_prev_frame): call find_frame_prev instead of find_frame_next. (cmd_frestore): grab the frame's number first when processing the frames.
2004-11-03* src/group.c (group_last_window): add argument, the screen to find thesabetts
window in. All callers updated. (group_prev_window): make sure the matched window is in the same screen as win. (group_next_window): likewise * src/window.c (find_window_other): add argument, the screen to find the window in. All callers updated.
2004-05-20(format_window_name): add %f format optionsabetts
2004-02-27* src/window.c (give_window_focus): save the mouse position beforesabetts
checking if win is NULL. (give_window_focus): set rp_current_screen to xine_screen_num of the window's screen. (set_active_window): when using xinerama get the frame from the current screen. * src/split.c (set_frames_window): update the window's scr attribute to point to the frame's screen. (find_window_for_frame): when xinerama is being used search all windows. (set_active_frame): update rp_current_screen to point to the frame's screen. * src/screen.h (init_screens): new prototype (is_rp_window_for_screen): likewise * src/screen.c: include string.h and X11/cursorfont.h (init_screens): new function (is_rp_window_for_screen): new function. (init_screen): fill in xine_screen_num when using xinerama. * src/ratpoison.h: include xinerama.h * src/manage.c (current_screen): use xine_screen_num to find the current screen. (scanwins): use is_rp_window_for_screen to skip over ratpoison windows. (scanwins): when using xinerama only manage windows inside the viewable area. * src/main.c (main): call init_xinerama and init_screens. Move screen initing code to these functions. (init_rat_cursor): move to screen.c (init_screen): likewise (find_screen): likewise (clean_up): call free_xinerama * src/group.c (group_last_window): only check windows in the current screen, unless xinerama is being used in which case all windows are accessible. (group_next_window): likewise (group_prev_window): likewise * src/globals.h: new globals rp_have_xinerama, xine_screen_num. * src/events.c (new_window): when using xinerama, the new window's screen is the current screen. (key_press): when using xinerama, use the current screen. * src/data.h (struct rp_screen): remove root_attr and add left, top, width, height. All dependant code updated. Add xine_screen_num. * src/actions.c (cmd_remove): show the frame indicator in the new current frame after removing the frame. * src/Makefile.am (ratpoison_SOURCES): add xinerama.c and xinerama.h
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-08-24(goto_window): don't do anything if the window issabetts
already the current window. (set_active_window): don't abort if last_win and win are the same.
2003-08-23(set_active_window): don't do anything if thesabetts
window is already the focused window.
2003-08-10(give_window_focus): only save the pointer positionsabetts
when win and last_win aren't the same window.
2003-07-17* src/window.c (set_active_window): run the switch window hook.sabetts
* src/split.c (set_active_frame): run the switch frame hook. * src/ratpoison.h: include hook.h * src/group.h (set_current_group): new prototype * src/group.c (set_current_group): new function * src/globals.h (rp_prefix_hook): new extern (rp_switch_win_hook): likewise (rp_switch_frame_hook): likewise (rp_switch_group_hook): likewise (rp_hook_db): likewise * src/globals.c (rp_prefix_hook): new hook (rp_switch_win_hook): likewise (rp_switch_frame_hook): likewise (rp_switch_group_hook): likewise (rp_hook_db): new global * src/events.c (handle_key): call the prefix hook. * src/data.h (struct rp_hook_db_entry): new struct * src/actions.h (cmd_addhook): new prototype (cmd_remhook): likewise * src/actions.c (user_commands): add commands addhook and remhook. (cmd_windows): show the window bar no matter what if the bar timeout is > 0. (cmd_gnext): call set_current_group (cmd_gprev): likewise (cmd_gnew): likewise (cmd_gselect): likewise (cmd_addhook): new function (cmd_remhook): likewise * src/Makefile.am (ratpoison_SOURCES): add hook.c and hook.h
2003-06-15(set_active_window): remove duplicate call tosabetts
unhide_window, it is made in give_window_focus. Call give_window_focus before calling hide_others.
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* src/bar.c (reset_alarm): new functionsabetts
(show_bar): call reset_alarm() (count_lines): make function static. clean up code. (max_line_length): likewise (pos_in_line): likewise (line_beginning): likewise (draw_string): new static function (correct_mark): likewise (prepare_bar): likewise (get_mark_box): likewise (draw_inverse_box): likewise (draw_mark): likewise (update_last_message): likewise (marked_message): Move most of the code to seperate function calls. Call reset_alarm(), prepare_bar(), draw_string(), correct_mark(), draw_mark(), and update_last_message(). * src/actions.c (cmd_select): fix crash bug. * src/window.c (get_window_list): mark_end is the length of the string. Don't do a special case if the window list is being displayed as a column.
2003-05-20 * src/linkedlist.h: Move all C function to linkedlist.csabetts
* src/window.c (find_window): add debugging output describing which window list the window was found in. * src/group.c (group_new): assign the group's number the number passed as an argument. * src/events.c (destroy_window): withdraw iconified and normal windows before unmanaging them. (handle_signals): delete the node from the list before freeing it. * src/bar.h (message): remove define. (marked_wrapped_message): remove prototype (message): new prototype * src/bar.c (message): new function (marked_wrapped_message): renamed to marked_message. remove marked_message.
2003-05-16* src/window.c (add_to_window_list): add the window to the currentsabetts
group. (find_window_name): search the current group for a matching window. (find_window_other): likewise. (format_window_name): take a rp_window_elem as an argument, not an rp_window. Print the group window's number, not the window's internal number. (get_window_list): loop through the current group. * src/split.c (find_window_for_frame): search the current group for a window to fit in the frame. * src/ratpoison.h: include globals.h and group.h * src/manage.c (unmanage): remove the window from any groups it was in. (map_window): map the window in any groups it is in. (withdraw_window): unmap the window in any groups it is in. * src/main.c: Move all globals to globals.h (main): initialize the group functions. * src/data.h: Move all defines and extern globals to globals.h (struct rp_window_elem): new struct (struct rp_group): likewise * src/actions.h (cmd_gnext): new prototype (cmd_gprev): likewise (cmd_gnew): likewise * src/actions.c (user_commands): new commands gnext, gprev, and gnew (cmd_prev): fix to work with new group code. (cmd_next): likewise (cmd_gnext): new function (cmd_gprev): likewise (cmd_gnew): likewise * src/Makefile.am (ratpoison_SOURCES): add files globals.h, globals.c, group.h and group.c
2003-05-15* src/data.h (struct rp_frame): renamed from rp_window_frame. Allsabetts
dependant code updated. * src/main.c: remove child_info global. Add rp_children global. (chld_handler): update the terminated and status fields of any terminated children. * src/events.c (handle_signals): loop through each child process and remove them from the list. Print a message for any child that doesn't return a 0 status. * src/data.h (rp_child_info): new fields, terminated and node. remove child_info global. Add rp_children global. * src/actions.c (spawn): Add the command to the list of children.
2003-05-15(struct rp_screen): rename fromsabetts
screen_info. Dependant code updated.
2003-05-09* src/manage.h (clear_unmanaged_list): new prototypesabetts
(list_unmanaged_windows): likewise (add_unmanaged_window): likewise * src/manage.c (unmanaged_window_list): no longer a const. (num_unmanaged_windows): new static global (clear_unmanaged_list): new function (list_unmanaged_windows): likewise (add_unmanaged_window): likewise (unmanaged_window): use num_unmanaged_windows to tell how many elements are in the unmanaged list. * src/actions.h (cmd_unmanage): new prototype (cmd_clrunmanaged): likewise * src/actions.c (user_commands): new commands unmanage, clrunmanaged. (cmd_unmanage): new function (cmd_clrunmanaged): likewise * src/bar.c (BAR_IS_HIDDEN): new define. (update_bar): new function. * src/actions.c (cmd_frestore): call update_bar() instead of update_window_names(). * src/actions.c (cmd_frestore): update the window list after restoring the frames.