summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* THIS IS A DEAD BRANCH now that everything has been merged to head. Let itconstraints_experimentsElijah Newren2005-11-212-8/+9
| | | | | | | 2005-11-21 Elijah Newren <newren@gmail.com> * README: THIS IS A DEAD BRANCH now that everything has been merged to head. Let it rest in peace...
* Define all the various constants used at the beginning of the function forElijah Newren2005-11-195-103/+184
| | | | | | | | | | | | | | | | | | | 2005-11-18 Elijah Newren <newren@gmail.com> * src/edge-resistance.c (apply_edge_resistance): Define all the various constants used at the beginning of the function for easier tweaking, modify the xinerama ones a bit, reorder the function slightly to try to make it easier to read * src/boxes.h (MetaEdgeType): * src/boxes.c (add_edges): * src/edge-resistance.c (apply_edge_resistance): * src/testboxes.c (new_onscreen_edge): rename META_EDGE_ONSCREEN to META_EDGE_SCREEN * src/testboxes.c (new_onscreen_edge): * src/testboxes.c (test_find_onscreen_edges): rename new_onscreen_edge() to new_screen_edge()
* Uh, I was pretty sure I had tested the last patch. I must have forgottenElijah Newren2005-11-192-11/+16
| | | | | | | | | | | 2005-11-18 Elijah Newren <newren@gmail.com> Uh, I was pretty sure I had tested the last patch. I must have forgotten the last part I added--the ConstraintFunc consolidation. How embarrassing. * src/constraints.c (do_all_constraints): fix up pointer arithmetic and make it actually work
* Do the cleanups requested by Havoc in his review.Elijah Newren2005-11-1911-338/+338
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2005-11-18 Elijah Newren <newren@gmail.com> Do the cleanups requested by Havoc in his review. * constraints-ideas.txt: Update for the recent changes * src/boxes.[ch]: (<general>): Fixup copyright information for meta_rectangle_(equal|intersect), remove PRINT_DEBUG #define (meta_rectangle_to_string): (meta_rectangle_region_to_string): (meta_rectangle_edge_to_string): (meta_rectangle_edge_list_to_string): remove hardcoded length of strings and use new (RECT|EDGE)_LENGTH #defines, s/snprintf/g_snprintf/ (merge_spanning_rects_in_region): (meta_rectangle_get_minimal_spanning_set_for_region): remove lots of overly verbose debugging spew that was #ifdef'd out anyway (meta_rectangle_find_linepoint_closest_to_point): fix up argument list and equations to follow coding style * src/constraints.c: (<general>): put #include <config.h> back in here, remove unneeded comment (enum ConstraintPriority): spaces around '=' (ConstraintFunc array all_constraints): (char* array all_constraint_names arrays): (struct Constraint): (Constraint array all_constraints): (do_all_constraints): get rid of the old two-array thing and just have the constraint function and names in one array tracking both fields (place_window_if_needed): make the single-direction maximization be a "hidden feature" only; don't auto-maximize in just a single direction (update_onscreen_requirements): (do_screen_and_xinerama_relative_constraints): add some commas that the compiler strangely never complained about missing before (constrain_to_single_xinerama): Don't apply this constraint for decorationless windows * src/place.c (find_first_fit): put an #ifdef WITH_VERBOSE_MODE around figuring out and logging the rectangle position * src/testboxes.c: (test_merge_regions): (test_regions_okay): (test_find_onscreen_edges): (test_find_nonintersected_xinerama_edges): remove hardcoded length of strings and use new (RECT|EDGE)_LENGTH #defines from boxes.[ch] * src/window.c: (meta_window_new_with_attrs): remove an unneeded comment (meta_window_move_resize_internal): rewrite the freakin' huge comment for clarity (meta_window_begin_wireframe): remove the comment explaining an easy fix and just fix it (update_move_timeout): remove an erroneous (copy & pasted) comment (meta_window_handle_mouse_grab_op_event): remove #ifdef'd out code * src/window.h (struct MetaWindow): simplify comment about window->rect * src/core.c (meta_core_maximize, meta_core_toggle_maximize, meta_core_unmaximize): * src/keybindings.c (handle_maximize_vert, handle_maximize_horiz, handle_toggle_maximize, handle_maximize, handle_unmaximize): * src/place.c (place_window_if_needed): * src/window.[ch] (meta_window_apply_session_info, meta_window_free, meta_window_maximize_internal, meta_window_maximize, meta_window_unmaximize, meta_window_client_message, menu_callback, update_move, enum MetaMaximizeFlags): change meta_window_(un)maximize(_internal) to use flags instead of boolean args
* Fix the breakage all these constraints_experiments changes caused toElijah Newren2005-11-194-57/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2005-11-18 Elijah Newren <newren@gmail.com> Fix the breakage all these constraints_experiments changes caused to reduced resources mode. Also fixes #304857 (wireframe can move off the top of the screen despite the fact that the window won't be allowed to) * src/edge-resistance.c: (apply_edge_resistance): if two edges are at the same location then the keyboard buildup ought to count towards both (otherwise the user can't move past that edge with the keyboard), be careful to not clear keyboard_buildup from edges that don't even align (meta_window_edge_resistance_for_move): (meta_window_edge_resistance_for_resize): need to use meta_window_get_xor_rect() instead of meta_window_get_outer_rect() for wireframe mode * src/keybindings.c: (process_keyboard_move_grab): (process_keyboard_resize_grab): apply edge resistance for wireframe moving/resizing too since it was there in the old code I replaced * src/window.c: (update_move): (update_resize): ignore operation if no movement was specified (happens for keyboard operations due to pointer warp), old position must be obtained differently for wireframe mode (warp_grab_pointer): grab_anchor_window_pos must be set differently in wireframe mode
* special case DOCK and DESKTOP windows out of the 2005-11-13 patchElijah Newren2005-11-172-1/+8
| | | | | | | 2005-11-16 Elijah Newren <newren@gmail.com> * src/window.c (meta_window_show_menu): special case DOCK and DESKTOP windows out of the 2005-11-13 patch
* handle the case where one strut completely overlaps the other. Patch fromElijah Newren2005-11-163-1/+31
| | | | | | | | | | | 2005-11-16 Elijah Newren <newren@gmail.com> * src/boxes.c (get_disjoint_strut_list_in_region): handle the case where one strut completely overlaps the other. Patch from Ray Strode. * src/testboxes.c (get_strut_list, test_find_onscreen_edges): add a test case that would segfault without the above fix
* Don't access workspace->screen_region and workspace->xinerama_regionElijah Newren2005-11-164-2/+37
| | | | | | | | | | | | 2005-11-16 Elijah Newren <newren@gmail.com> * src/constraints.c (setup_constraint_info): * src/workspace.[ch]: (meta_workspace_get_onscreen_region, meta_workspace_get_onxinerama_region): Don't access workspace->screen_region and workspace->xinerama_region directly but rather do it through new accessor functions in workspace.c that can ensure the workarea is validated.
* Update -- I NEED TESTERS NOW!!! :-)Elijah Newren2005-11-162-22/+12
| | | | | | 2005-11-15 Elijah Newren <newren@gmail.com> * README: Update -- I NEED TESTERS NOW!!! :-)
* Add another bug I fixed a while agoElijah Newren2005-11-162-0/+5
| | | | | | 2005-11-15 Elijah Newren <newren@gmail.com> * constraints-ideas.txt: Add another bug I fixed a while ago
* Split out edge resistance functions and structures from display.[ch] andElijah Newren2005-11-169-1178/+1262
| | | | | | | | | | | | | | | | | | | | | | | | | | 2005-11-15 Elijah Newren <newren@gmail.com> * src/Makefile.am: * src/display.[ch]: (macro WINDOW_EDGES_RELEVANT, struct ResistanceDataForAnEdge, struct MetaEdgeResistanceData, find_index_of_edge_near_position, points_on_same_side, find_nearest_position, movement_towards_edge, edge_resistance_timeout, apply_edge_resistance, apply_edge_snapping, meta_display_apply_edge_resistance, cleanup_edges, stupid_sort_requiring_extra_pointer_dereference, cache_edges, initialize_grab_edge_resistance_data, compute_resistance_and_snapping_edges): * src/keybindings.c (process_keyboard_move_grab, process_keyboard_resize_grab): * src/window.[ch]: (meta_window_edge_resistance_for_move, meta_window_edge_resistance_for_resize, update_move, update_resize): * src/edge-resistance.[ch]: (<EVERYTHING>): Split out edge resistance functions and structures from display.[ch] and window.[ch] and stick them into their own file, edge-resistance.[ch]. Some functions get renamed slightly due to becoming static or not-static-anymore (unstatic?)
* Add another bug I fixed a little while agoElijah Newren2005-11-162-5/+13
| | | | | | | 2005-11-15 Elijah Newren <newren@gmail.com> * constraints-ideas.txt: Add another bug I fixed a little while ago
* finally fix the long outstanding FIXME about when to clampElijah Newren2005-11-163-17/+12
| | | | | | | 2005-11-15 Elijah Newren <newren@gmail.com> * src/constraints.c (do_screen_and_xinerama_relative_constraints): finally fix the long outstanding FIXME about when to clamp
* Update, fix, and extend all the documentation on constraints.Elijah Newren2005-11-165-313/+406
| | | | | | | | | | | | | | | | | 2005-11-15 Elijah Newren <newren@gmail.com> Update, fix, and extend all the documentation on constraints. * src/constraints-ideas.txt: Update * doc/how-constraints-works.txt: New file * src/boxes.c: Update documentation (I've done the main optimization now) * src/constraints.c: Rip lots of the documentation out and stick it in doc/how-constraints-works.txt while simultaneously removing the old and incorrect stuff and extending other parts
* Make meta_rectangle_find_onscreen_edges() robust against overlappingElijah Newren2005-11-152-21/+169
| | | | | | | | | | | | | | | | | | | | | 2005-11-15 Elijah Newren <newren@gmail.com> Make meta_rectangle_find_onscreen_edges() robust against overlapping struts instead of just checking and throwing an error if they aren't. * src/boxes.c: (get_rect_minus_overlap): (replace_rect_with_list): (get_disjoint_strut_list_in_region): new functions (struts_are_disjoint): removed function (meta_rectangle_find_onscreen_edges): use get_disjoint_strut_list_in_region() to sanitize struts
* don't do a move or resize on ButtonRelease if the most recent move/resizeElijah Newren2005-11-142-14/+31
| | | | | | | | | | | 2005-11-13 Elijah Newren <newren@gmail.com> * src/window.c (meta_window_handle_mouse_grab_op_event): don't do a move or resize on ButtonRelease if the most recent move/resize was a snap event--snap move/resize users often release shift and the button at the same time and if shift happened to come first then it would previously result in a huge jarring movement of the window
* updateElijah Newren2005-11-143-3/+26
| | | | | | | | | | | 2005-11-13 Elijah Newren <newren@gmail.com> * constraints-ideas.txt: update * src/display.c (apply_edge_snapping): if mouse snap-moving, require that the user move at least a threshold number of pixels before snapping in a given direction to make it easier to do snap movement in a single direction.
* updateElijah Newren2005-11-1410-16/+181
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2005-11-13 Elijah Newren <newren@gmail.com> * constraints-ideas.txt: update * src/constraints.c (constraint_partially_onscreen): remove an old comment that no longer applies and is just misleading * src/common.h (enum MetaMenuOp): * src/core.c (meta_core_get_menu_accelerator): * src/menu.c (menuitems): * src/window.c (menu_callback): add META_MENU_OP_RECOVER for shoving the titlebar back onscreen * src/core.[ch] (meta_core_titlebar_is_onscreen): new function * src/frames.c (meta_frames_button_press_event): show the window menu instead of starting a resize operation when clicking on the window frame and the titlebar is offscreen. * src/window.[ch] (meta_window_shove_titlebar_onscreen): new function for checking if a window's titlebar is onscreen, (meta_window_titlebar_is_onscreen): new function shoving a window's titlebar back onscreen * src/window.c (meta_window_show_menu): add a recover titlebar option if the titlebar is offscreen
* Some renaming of structs & vars for sanity sake, plus the introduction ofElijah Newren2005-11-132-59/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2005-11-12 Elijah Newren <newren@gmail.com> Some renaming of structs & vars for sanity sake, plus the introduction of infinite resistance for top screen edges when moving the window via the titlebar. * src/display.c (struct ResistanceDataForAnEdge): add an allow_past_screen_edge field (apply_edge_resistance): add an infinite resistance valid for the relevant screen edges when resistance_data->allow_past_screen_edge is true. (initialize_grab_edge_resistance_data): pull out growing functionality from compute_resistance_and_snapping_edges() into a new function, initialize_grab_edge_resistance_data(). Also, make sure to initialize resistance_data->allow_past_screen_edge appropriately in this new function. (struct ResistanceDataForAnEdge, struct MetaEdgeResistanceData, edge_resistance_timeout, apply_edge_resistance, meta_display_apply_edge_resistance, cleanup_edges): rename the EdgeResistanceTimeoutData struct to EdgeResistanceTimeoutData, modify the names of most all fields to point out which are exclusively meant for timeout stuff and which aren't, rename the fields in the MetaEdgeResistanceData to clarify that they aren't just timeout data
* Get keyboard buildup edge resistance working, and convert old (and buggy)Elijah Newren2005-11-127-377/+430
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2005-11-12 Elijah Newren <newren@gmail.com> Get keyboard buildup edge resistance working, and convert old (and buggy) edge resistance for keyboard move/resize to new framework. Despite this being a large increase in functionality, I almost removed as many lines as I added from the cleanups that were made possible (388 lines added, 328 removed). * src/constraints-ideas.txt: Mark edge resistance as done (there may be a few bugs left, and I'm sure I'll need to tweak some of the parameters but there's nothing big left) * src/display.[hc]: (struct MetaDisplay): rename grab_last_used_state_for_resize field to grab_last_user_action_was_snap (meta_display_apply_edge_resistance): take a keyboard_op parameter and pass it on to apply_edge_resistance() and apply_edge_snapping() * src/display.c: (struct EdgeResistanceTimeoutData): add a keyboard_buildup field (meta_display_begin_grab_op): handle rename of grab_last_used_state_for_resize to grab_last_user_action_was_snap (points_on_same_side): new function (find_nearest_position): take an only_forward parameter and if true, only look for the nearest position in the direction away from old_postion towards (or past) position. (apply_edge_resistance): take a keyboard_op parameter, don't do timeout for keyboard op, add special case for keyboard op that does keyboard energy buildup resistance, explain the pixel distance mouse resistance better (apply_edge_snapping): take a keyboard_op parameter, add some comments, make sure that the snapping is in the right direction for keyboard ops (compute_resistance_and_snapping_edges): initialize the keyboard_buildup field of the edge resistance data * src/keybindings.c: (process_keyboard_move_grab, process_keyboard_resize_grab): SIMPLIFY MASSIVELY by using the new edge resistance and snapping functionality. * src/window.[ch]: (meta_window_edge_resistance_for_move, meta_window_edge_resistance_for_resize): new functions needed for handling common operations for both mouse and keyboard moves and resizes; most of the work is handled by meta_display_apply_edge_resistance() but these functions prepare the necessary input parameters and correctly interpret the output as needed. * src/window.c: (update_move, update_resize, meta_window_handle_mouse_grab_op_event): have update_move() and update_resize() take a snap boolean parameter instead of a mask unsigned int parameter since we don't really know the keystate in some places where these functions need to be called and don't really need that much info anyway (update_move, update_resize): move common functionality needed by keyboard move/resize into meta_window_edge_resistance_for_move() and meta_window_edge_resistance_for_resize() (update_move_timeout, update_resize_timeout, meta_window_handle_mouse_grab_op_event): handle rename of grab_last_used_state_for_resize to grab_last_user_action_was_snap
* Add a bunch of questions that I want to ask the usability guysElijah Newren2005-11-102-2/+24
| | | | | | | 2005-11-09 Elijah Newren <newren@gmail.com> * src/constraints-ideas.txt: Add a bunch of questions that I want to ask the usability guys
* Get timeouts for screen/xinerama edge resistance working.Elijah Newren2005-11-106-34/+239
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2005-11-09 Elijah Newren <newren@gmail.com> Get timeouts for screen/xinerama edge resistance working. * src/constraints-ideas.txt: Update slightly * src/constraint.c (constrain_fully_onscreen): don't apply this constraint for user resizes as edge resistance does that well enough * src/display.h (meta_display_apply_edge_resistance): needs to take a couple extra arguments to get the job done * src/display.c: (struct EdgeResistanceTimeoutData): new struct (struct MetaEdgeResistanceData): add an EdgeResistanceTimeoutData for each side (movement_towards_edge): new function to determine if the user is moving a window towards a certain side or away (so that, e.g. timeouts are only added when trying to move offscreen instead of moving back onscreen) (edge_resistance_timeout): helper function called when a edge resistance timer goes off, which calls the real timeout function as well as handles some extra basic janitorial stuff with edge timeout data (apply_edge_resistance): add handling for timeouts, lower the edge resistance threshold for normal window edge resistance (meta_display_apply_edge_resistance): take extra arguments and pass them on to functions so they can do the timeout stuff (cleanup_edges): cleanup the timeouts too (compute_resistance_and_snapping_edges): initialize the timeouts to not-setup-state too * src/window.c: (update_move_timeout): new function (update_move, update_resize): pass the extra arguments that meta_display_apply_edge_resistance() now needs
* Get edge auto-snapping to work again (and for the first time ever forElijah Newren2005-11-084-64/+313
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2005-11-08 Elijah Newren <newren@gmail.com> Get edge auto-snapping to work again (and for the first time ever for mouse resizing). NOTE THAT EDGE RESISTANCE IS STILL NOT COMPLETE AND I STILL HAVE A RIDICULOUSLY HUGE THRESHOLD FOR THAT REASON. ;-) * src/display.h: (struct MetaDisplay): new display->grab_last_used_state_for_resize field, so that xsync messages know whether to snap-resize or just normally resize. I don't know if this is the right way to do this or not... (meta_display_apply_edge_resistance): take an auto_snap parameter * src/display.c: (meta_display_begin_grab_op): initialize display->grab_last_used_state_for_resize (find_index_of_edge_near_position): declare the edge array to be const (find_nearest_position): new function, also binary-search-esque (apply_edge_snapping): simple front-end to find_nearest_position() so that it can be called for multiple edge arrays and the closest overall one used. (meta_display_apply_edge_resistance): take an auto_snap parameter and use apply_edge_snapping() instead of apply_edge_resistance() if it is set * src/window.c: (update_move): track the proposed window size so that we can compare the edge-resisted-modifications to both the original window and the size initially proposed, handle snapping too (update_resize_timeout, meta_window_handle_mouse_grab_op_event): make use of display->grab_last_used_state_for_resize so that the resize knows whether to snap or not. I hope this is the right way to do this. (update_resize): take a mask tracking which buttons are pressed (like update_move), save the mask to window->display->grab_last_used_state_for_resize, handle snapping (meta_window_handle_mouse_grab_op_event): pass the xbutton/xmotion/xcrossing modifier state to update_resize()
* get basic edge resistance to work with resizing too. I'm so cool. :-)Elijah Newren2005-11-082-0/+26
| | | | | | | 2005-11-08 Elijah Newren <newren@gmail.com> * src/window.c (update_resize): get basic edge resistance to work with resizing too. I'm so cool. :-)
* Very basic edge resistance stuff starting to work. Only for moves,Elijah Newren2005-11-084-8/+294
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2005-11-08 Elijah Newren <newren@gmail.com> Very basic edge resistance stuff starting to work. Only for moves, debugging threshold ridiculously huge for easier testing, snap-moving disabled, yadda yadda yadda IT ISN'T READY YET. * src/display.c: (find_index_of_edge_near_position): new binary-search-esque function (apply_edge_resistance): new function, only very basics implemented so far (with a ridiculously huge threshold just for testing) (cache_edges): remove an extraneous debugging warning that I missed earlier * src/display.[ch]: (meta_display_apply_edge_resistance): new public function, doing work through calls to apply_edge_resistance() currently * src/window.c: (update_move): temporarily disable snap moving, call meta_display_apply_edge_resistance() to get some basic edge resistance working
* (meta_rectangle_remove_intersections_with_boxes_from_edges): removeElijah Newren2005-11-074-66/+59
| | | | | | | | | | | | | | | | | | | | 2005-11-07 Elijah Newren <newren@gmail.com> * src/boxes.[ch]: (meta_rectangle_remove_intersections_with_boxes_from_edges): remove rectangles_are_struts parameter as we in general want left sides of windows to be treated as resisting the right edge of the moving window -- i.e. everything is treated the same as struts. * src/display.c: (compute_resistance_and_snapping_edges): note that left sides of windows are considered right edges because that's what the right side of the moving window will be resisted-by/snapped-to (and similarly for all the other edges), combine the obscuring_windows and obscuring_docks as made possible by this change
* Cache (and sort) all the edges in some nice arrays for quick access. CleanElijah Newren2005-11-073-8/+284
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2005-11-06 Elijah Newren <newren@gmail.com> Cache (and sort) all the edges in some nice arrays for quick access. Clean them up when the grab op ends. * src/display.[ch]: (struct MetaDisplay): add a grab_edge_resistance_data field for caching information relevant for edge resistance * src/display.c: (struct MetaEdgeResistanceData): new struct where we cache all these edges in a nice sorted way (cleanup_edges): new function (meta_display_end_grab_op): if it's a move or resize operation, call cleanup_edges() (stupid_sort_requiring_extra_pointer_dereference): simple helper function for cache_edges() (cache_edges): new function -- make arrays for each of the edges types, fill them up, and sort them (compute_resistance_and_snapping_edges): make sure to cache the edges and then free the temporary window edge list now that the data is in the cache (meta_display_open): initialize grab_edge_resistance_data to NULL too
* Compute the non-obscured normal window edges for edge resistance/snapping.Elijah Newren2005-11-066-46/+346
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2005-11-06 Elijah Newren <newren@gmail.com> Compute the non-obscured normal window edges for edge resistance/snapping. Not yet used, but one more step is done. :) * src/boxes.[ch]: (meta_rectangle_edge_cmp, meta_rectangle_find_onscreen_edges, meta_rectangle_find_nonintersected_xinerama_edges): rename sort_edges to meta_rectangle_edge_cmp (meta_rectangle_remove_intersections_with_boxes_from_edges, meta_rectangle_find_nonintersected_xinerama_edges): split out some common functionality from meta_rectangle_find_nonintersected_xinerama_edges() into the new meta_rectangle_remove_intersections_with_boxes_from_edges() * src/testboxes.c: (test_find_nonintersected_xinerama_edges): correct a couple tests * src/display.c (meta_display_begin_grab_op): add a call to meta_display_compute_resistance_and_snapping_edges() for moving/resizing operations (WINDOW_EDGE_RELEVANT): new macro for whether a window's edges should be considered relevant in computing window eges (meta_display_compute_resistance_and_snapping_edges): new function
* Cache screen and xinerama edges for edge resistance/snapping at the sameElijah Newren2005-11-043-0/+39
| | | | | | | | | | | | | | 2005-11-04 Elijah Newren <newren@gmail.com> Cache screen and xinerama edges for edge resistance/snapping at the same time the workarea and on-screen/on-xinerama areas are computed. * src/workspace.[ch] (struct MetaWorkspace, meta_workspace_new, meta_workspace_free, meta_workspace_invalidate_work_area, ensure_work_areas_validated): add new screen_edges and xinerama_edges data fields to the workspace
* Add routines to find all the edges between adjacent xineramas, minus thoseElijah Newren2005-11-044-16/+345
| | | | | | | | | | | | | | | | | | 2005-11-03 Elijah Newren <newren@gmail.com> Add routines to find all the edges between adjacent xineramas, minus those intersected by struts. Includes a thorough testing case. * src/boxes.[ch] (meta_rect): new convenience function, moved here from testboxes.c, (meta_rectangle_find_nonintersected_xinerama_edges): new function * src/testboxes.c (meta_rect): removed now that it's in boxes.c, (new_xinerama_edge): new helper function to make a xinerama edge, (get_xinerama_edges): new helper function to find a pre-defined set of xinerama edges, (test_find_nonintersected_xinerama_edges): new test function
* Add more ideas mostly relating to edge resistance just to ensure I don'tElijah Newren2005-11-023-24/+62
| | | | | | | | | | | | 2005-11-01 Elijah Newren <newren@gmail.com> * constraints-ideas.txt: Add more ideas mostly relating to edge resistance just to ensure I don't forget them, make sure I don't forget the important edge resistance and documentation things to cover * src/boxes.c (edges_overlap, rectangle_and_edge_intersection): some basic code simplifications and a couple more comments
* Add routines to find all the "screen edges" (where struts are consideredElijah Newren2005-11-016-48/+861
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2005-10-31 Elijah Newren <newren@gmail.com> Add routines to find all the "screen edges" (where struts are considered to be offscreen), plus a thorough testing case. * src/boxes.[ch] (meta_rectangle_free_list_and_elements): * src/testboxes.c (test_regions_okay, test_region_fitting, test_clamping_to_region, test_clipping_to_region, test_shoving_into_region): * src/workspace.c (meta_workspace_free, meta_workspace_invalidate_work_area): meta_rectangle_free_spanning_set() was renamed to meta_rectangle_free_list_and_elements() * src/boxes.c: (meta_rectangle_region_to_string): Output SOMETHING if the list is empty (meta_rectangle_edge_to_string, meta_rectangle_edge_list_to_string): new printing functions for edges (meta_rectangle_get_minimal_spanning_set_for_region): clean up the overview comment a little (struts_are_disjoint): (sort_edges): (edges_overlap): (rectangle_and_edge_intersection): (add_edges): (split_edge): (fix_up_edges): (meta_rectangle_find_onscreen_edges): New functions to do various parts of finding all the screen edges * src/boxes.h: (BOX_LEFT, BOX_RIGHT, BOX_TOP, BOX_BOTTOM): convenience macros that I should have defined a long time ago (enum MetaEdgeType): (struct MetaEdge): new types for edges (meta_rectangle_edge_to_string): (meta_rectangle_edge_list_to_string): (meta_rectangle_find_onscreen_edges): new functions * src/common.h: (enum MetaDirection): direction stuff seems to be used everywhere so add a type here; only used in boxes for now, but add a note explaining several other places where it could be used to remove duplicative enums * src/testboxes.c: (new_onscreen_edge): (verify_edge_lists_are_equal): (test_find_onscreen_edges): new functions for testing the new "screen edge" finding abilities (main): add test_find_onscreen_edges() to the list (get_strut_list): new function factored out from get_screen_region() (get_screen_region): call get_strut_list() since it now has most of the code this function used to have. (get_screen_edges): new function to compute the screen edges using the struts in get_strut_list() and the meta_rectangle_find_onscreen_edges() function.
* Three major changes: (1) Caching the spanning_rectangles in eachElijah Newren2005-10-2817-568/+548
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2005-10-28 Elijah Newren <newren@gmail.com> Three major changes: (1) Caching the spanning_rectangles in each workspace, (2) replace x,y,width,height stuff in some data structures with rectangles, (3) replace TONS of code with calls to functions from boxes.c. Reasons: (1) only compute these regions when the strut list changes instead of doing so everytime any window happens to move or otherwise need to be constrained (2) to enable more of -3-, (3) remove redundant code and also to simplify the code a TON. NET REDUCTION OF ALMOST 500 LINES OF CODE, INCLUDING OVER 100 IN CONSTRAINTS.C! BOO YEAH!!! Nasty details...: * src/bell.c (meta_bell_flash_screen): * src/core.c (meta_core_get_screen_size): * src/place.c (get_vertical_edges, get_horizontal_edges): * src/screen.c (reload_xinerama_infos, meta_screen_new, set_desktop_geometry_hint, meta_screen_resize): * src/screen.h (struct MetaScreen): * src/stack.c (window_is_fullscreen_size): * src/tabpopup.c (selectable_workspace_new): * src/window.c (implement_showing, meta_window_update_struts, recalc_window_features, meta_window_get_work_area_all_xineramas, warp_grab_pointer): * src/workspace.c (ensure_work_areas_validated): replace screen width and height with a rectangle (always starting at (0,0) for the upper left corner) * src/constraints.c (setup_constraint_info, place_window_if_needed): * src/place.c (find_first_fit, meta_window_place, get_vertical_edges, get_horizontal_edges): * src/screen.c (reload_xinerama_infos, meta_screen_get_xinerama_for_rect): * src/screen.h (struct MetaXineramaScreenInfo): * src/stack.c (window_is_fullscreen_size): * src/window.c (get_work_area_xinerama): * src/workspace.c (ensure_work_areas_validated): replace xinerama x_origin, y_origin, width, and height with a single rectangle * src/place.c (find_first_fit, get_vertical_edges, get_horizontal_edges): * src/screen.c (meta_screen_get_xinerama_for_rect, meta_screen_get_xinerama_neighbor, meta_screen_get_current_xinerama): * src/stack.c (window_is_fullscreen_size): * src/window.c (get_work_area_xinerama, meta_window_get_work_area_all_xineramas): make use of functions from boxes.c to simplify stuff * src/screen.c (meta_screen_ensure_tab_poup): * src/tabpopup.c (meta_ui_tab_popup_new): * src/tabpopup.h (struct MetaTabEntry): replace tabpopup x, y, width, and height with a rectangle * constraints-ideas.txt: Mark a couple things off the checklist. * src/boxes.c (merge_spanning_rects_in_region): don't assert the region is nonempty but rather just warn if it is since there are sanity checks elsewhere to deal with such a case, * src/boxes.[ch] (meta_rectangle_get_minimal_spanning_set_for_region): break out the directional expansion into a separate function, meta_rectangle_expand_region() * src/constraints.c (struct ConstraintInfo): (setup_constraint_info): (update_onscreen_requirements): (constrain_to_single_xinerama): (constrain_fully_onscreen): (constrain_partially_onscreen): keep a copy of the onscreen and on-xinerama regions from the workspace handy, use them instead of computing them on the fly. Offscreen extending of these is still done on the fly, though (get_screen_relative_spanning_rects): (get_all_workspace_struts): (get_screen_rect_size): remove these functions, no longer needed * src/place.c: (rect_fits_in_work_area): (rects_overlap_vertically): (rects_overlap_horizontally): remove these functions, functions in boxes[ch] replace them (meta_window_place): comment out the hack for having new windows placed on a single xinerama * src/screen.[ch] (meta_screen_rect_intersects_xinerama): remove this function, replaced by meta_rectangle_overlaps() * src/testboxes.c: (test_intersect): verify that using a single rectangle for both an input and an output works as expected (get_screen_region): add two new regions--one which makes the whole screen be covered, and one which makes a strut cover everything to the left of another partial strut (test_regions_okay): test that the spanning rects from the two new regions in get_screen_region() are generated correctly, do a couple other small cleanups * src/window.c (meta_window_update_struts): remove the gap as it is no longer necessary with the new constraints and the sanity checking that already exists in workspace.c:ensure_work_areas_validated() -- closes #144126 * src/workspace.[ch]: (meta_workspace_new): (meta_workspace_free): (meta_workspace_invalidate_work_area): (meta_workspace_get_work_area_for_xinerama): (struct MetaWorkspace): rename work_areas to work_area_xinerama and all_work_areas to work_area_screen (meta_workspace_new): (meta_workspace_free): (meta_workspace_invalidate_work_area): (ensure_work_areas_validated): (struct MetaWorkspace): replace left, right, top, and bottom strut lists with all_struts (meta_workspace_new): (meta_workspace_free): (meta_workspace_invalidate_work_area): (ensure_work_areas_validated): (struct MetaWorkspace): add a screen_region and xinerama_region to the workspace to cache the spanning rectangles for these areas. (ensure_work_areas_validated): generate the screen_region and xinerama_region, make sure they're sufficiently sane
* Make alt-middle-click resizing divide the window into nine regions insteadElijah Newren2005-10-272-20/+41
| | | | | | | | | | 2005-10-26 Elijah Newren <newren@gmail.com> * src/display.c (event_callback): Make alt-middle-click resizing divide the window into nine regions instead of four in order to allow unidirectional resizing and in order to reduce the (currently large) number of times that I erroneously resize in the wrong direction(s). Fixes #308521.
* Fix keyboard resizing and bouncing weirdness with mouse movement, andElijah Newren2005-10-244-41/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2005-10-24 Elijah Newren <newren@gmail.com> Fix keyboard resizing and bouncing weirdness with mouse movement, and cleanup the crap from the last patch. We should now have bug #154670 fixed, and bug #124582 and bug #122670 should be much less severe. Fixing will require removing the pointer warping, disabling doing both keyboard and mouse moving/resizing interchangeably, or something else even more drastic. * src/display.h (struct MetaDisplay): * src/display.c (meta_display_begin_grab_op): * src/window.c (meta_window_handle_mouse_grab_op_event): Remove changes made in last patch in regards to the new display->grab_ignore_enter_leave_until_mouse_motion field * src/window.c: (meta_window_handle_mouse_grab_op_event): #ifdef out the EnterNotify/LeaveNotify events so that they don't bust things (warp_grab_pointer): clamp the new position to be within the screen coordinates, set grab_latest_motion_(x|y) and grab_anchor_window_pos.(width|height) as well (meta_window_update_keyboard_resize): remove the manual fixup to handle pointer warping since that code is now in warp_grab_pointer (it wasn't complete here anyway, and also needed to be done for move operations)
* Fix (both keyboard and mouse) snap-moving from erroneously operatingElijah Newren2005-10-244-4/+48
| | | | | | | | | | | | | | | | | | | | | | | 2005-10-23 Elijah Newren <newren@gmail.com> Fix (both keyboard and mouse) snap-moving from erroneously operating multi-dimensionally. #124582. * src/display.h (struct MetaDisplay): to avoid some flickering, add a grab_ignore_enter_leave_until_mouse_motion field * src/display.c (meta_display_being_grab_op): Initialize display->grab_ignore_enter_leave_until_mouse_motion * src/window.c (update_move): get the old position of the window and only do snap moving if the position has changed, also fix a horizontal/vertical maximization positioning bug, (meta_window_handle_mouse_grab_op_event): handle display->grab_ignore_enter_leave_until_mouse_motion, (warp_grab_pointer): update the grab position so that the mouse motion from the warping of the pointer doesn't cause snapping too, turn off using enter/leave notify events for mouse motion in order to avoid some flickering
* Various tiny cleanupsElijah Newren2005-10-234-37/+47
| | | | | | | | | | | | | | | | | | | | | | 2005-10-23 Elijah Newren <newren@gmail.com> Various tiny cleanups * constraints-ideas.txt: Update for little things fixed, reminder that documentation needs to be updated * src/constraints.c (struct ConstraintInfo, setup_constraint_info): remove work_area_screen member as it isn't used, (constrain_size_limits, constrain_partially_onscreen): use the CLAMP() macro instead of trying to use both MIN and MAX to manually implement it, (do_screen_and_xinerama_relative_constraints): shut the stupid compiler up, (constrain_to_single_xinerama): don't apply this constraint unless we have a multiple xinerama setup * src/window.c (meta_window_move_resize_internal): clean up the huge comment by noting that two of the five cases were actually the same
* Make maximize_vertically and maximize_horizontally toggle and beElijah Newren2005-10-2310-193/+264
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2005-10-22 Elijah Newren <newren@gmail.com> Make maximize_vertically and maximize_horizontally toggle and be constrained. Partially based on patches from John Russell and Bert Vermeulen in bug 113601. * constraints-ideas.txt: I need to remove the compiling warnings from constraints.c sometime even if it's just the compiler being stupid * src/constraints.c (constrain_maximization): constrain different maximization directions individually * src/keybindings.c (handle_maximize_vert, handle_maximize_horiz): have these functions toggle the maximization in the relevant direction * src/window.c (meta_window_save_rect): only save the coordinate for directions that aren't maximized * src/constraints.c (place_window_if_needed, constrain_size_increments, constrain_aspect_ratio): * src/core.c (meta_core_maximize, meta_core_toggle_maximize, meta_core_unmaximize): * src/frame.c (meta_frame_get_flags): * src/keybindings.c (handle_toggle_maximize, handle_maximize, handle_unmaximize): * src/place.c (meta_window_place): * src/session.c (save_state): * src/window.[ch] (struct MetaWindow, meta_window_new_with_attrs, meta_window_apply_session_info, meta_window_free, set_net_wm_state, meta_window_maximize_internal, meta_window_maximize, meta_window_unmaximize, meta_window_client_message, update_net_wm_state, menu_callback, meta_window_show_menu, update_move): need to deal with maximization in separate directions now, use the META_WINDOW_MAXIMIZED() macro for determining when both directions are maximized, and specify the relevant directions to meta_window_(un)maximize(_internal) * src/window.c (check_maximize_to_work_area, meta_window_fill_horizontal, meta_window_fill_vertical): remove these functions as they are no longer needed
* Nailed the "gnome-terminal drifts upward and leftward" problemElijah Newren2005-10-222-5/+11
| | | | | | | | | | | | | | | | | | 2005-10-21 Elijah Newren <newren@gmail.com> * constraints-ideas.txt: Nailed the "gnome-terminal drifts upward and leftward" problem * src/boxes.c (meta_rectangle_resize_with_gravity): rect->x and rect->y should be ignored because we're resizing old_rect according to the given gravity, not rect. So, in the cases where nothing fancy needs to be done, we need to at least copy over old_rect->x and old_rect->y. Stupid bug caused by usage being different than original version and most testcases not catching the difference... * src/testboxes.c (test_gravity_resize): modify one of the tests so that it would have caught the above bug
* Nailed the "gnome-terminal drifts upward and leftward" problemElijah Newren2005-10-223-5/+18
| | | | | | | | | | | | | | | 2005-10-21 Elijah Newren <newren@gmail.com> * constraints-ideas.txt: Nailed the "gnome-terminal drifts upward and leftward" problem * src/boxes.c (meta_rectangle_resize_with_gravity): rect->x and rect->y should be ignored because we're resizing old_rect according to the given gravity, not rect. So, in the cases where nothing fancy needs to be done, we need to at least copy over old_rect->x and old_rect->y. Stupid bug caused by usage being different than original version and most testcases not catching the difference...
* Five quick ideas/problems/cleanups I thought of today and at various timesElijah Newren2005-10-212-0/+20
| | | | | | | | 2005-10-21 Elijah Newren <newren@gmail.com> * constraints-ideas.txt: Five quick ideas/problems/cleanups I thought of today and at various times in the past but kept forgetting and don't want to forget again
* Add two more bugs to look at from latest scouring of bugzillaElijah Newren2005-10-212-0/+7
| | | | | | | 2005-10-20 Elijah Newren <newren@gmail.com> * constraints-ideas.txt: Add two more bugs to look at from latest scouring of bugzilla
* Note about decorationless windows and screen-relative constraints, markElijah Newren2005-10-205-118/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2005-10-20 Elijah Newren <newren@gmail.com> * constraints-ideas.txt: Note about decorationless windows and screen-relative constraints, mark gravity bug as fixed (YAAY!) * src/constraints.c (meta_window_constrain): Make a big note to notify people that rectangles are for positions/sizes of inner windows, not outer, to try to avoid a very common mistake * src/display.c (handle_net_moveresize_window): Update the FIXME to provide more hints on exactly how this is broken, (handle_net_restack_window): put a couple FIXMEs in there since this function is broken too--thank goodness both of these are #ifdef'd out * src/window.c: (meta_window_new_with_attrs, meta_window_apply_session_info, meta_window_configure_request): Specify the REAL GRAVITY INSTEAD OF LYING and saying it's NorthWest, and then hoping that adjust_for_gravity() will bail us out by figuring out what we really meant. (!) (adjust_for_gravity): Simplify the argument list by just taking the stupid rectangle, don't manually figure out the window's gravity but instead have it get passed to this function (otherwise display.c:handle_net_moveresize_window() will break)--besides doing this manual figuring out of the gravity masked a bug in having the wrong gravity passed to meta_window_move_resize_internal() (meta_window_move_resize_internal): make that SUPER STINKING LONG COMMENT on the gotchas of this function EVEN LONGER to explain how things are actually slightly worse than I previously expected and to make some clarifications on new stuff I learned and to note some slight changes made elsewhere to make things more sane (*really deep breath to get some air again*), for all resize actions use meta_rectangle_resize_with_gravity() instead of only using that for user actions, only do the adjust_for_gravity() stuff if it's not a resize action
* Got the testcases and cleanup done nowElijah Newren2005-10-205-90/+237
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2005-10-19 Elijah Newren <newren@gmail.com> * constraints-ideas.txt: Got the testcases and cleanup done now * src/boxes.c: * src/utils.c: * src/testboxes.c: C comments use /* and */ not // -- oops * src/testboxes.c: remove old obsolete comment, (print_rect, print_rects, alt_print_rect, alt_print_rects): remove these unused functions (print_rect_list): remove this function since meta_rectangle_region_to_string() replaces it (test_area, test_intersect, test_equal, test_overlap_funcs, test_basic_fitting, test_merge_regions, test_regions_okay, test_region_fitting, test_clamping_to_region, test_clipping_to_region, test_shoving_into_region): declare these functions static to avoid warnings from the stupid -Wmissing-prototypes flag (test_merge_regions, test_regions_okay): use *_to_string() functions from boxes.[ch] and various other small cleanups (test_gravity_resize, test_find_closest_point_to_line): new functions (main): call test_gravity_resize() and test_find_closest_point_to_line() too
* Update things fixed, list new bug that I previously forgotElijah Newren2005-10-195-54/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | 2005-10-19 Elijah Newren <newren@gmail.com> * constraints-ideas.txt: Update things fixed, list new bug that I previously forgot * src/boxes.c (rect2String): remove this function, (meta_rectangle_get_minimal_spanning_set_for_region, merge_spanning_rects_in_region): use meta_rectangle_to_string() and meta_rectangle_region_to_string() instead of manually printing out rectangles or using print_rect_list(). * src/boxes.h (meta_rectangle_to_string): correct comment above this function about the size of the string needed to hold the output * src/window.c (meta_window_configure_request): only try to move/resize the window if part of the configure request included a move or resize request, (update_resize): point out stupidity of the function due to meta_window_update_wireframe() not taking or making use of gravity, don't allow supposed North/South resizes during META_GRAB_OP_RESIZING_(E|W) and vice versa, don't call meta_window_resize_with_gravity() if we don't have a different size to specify
* Update docs, fix up the require onscreen/on-single-xinerama flagElijah Newren2005-10-196-20/+119
| | | | | | | | | | | | | | | | | | | | 2005-10-19 Elijah Newren <newren@gmail.com> Update docs, fix up the require onscreen/on-single-xinerama flag setting/unsetting. * README: Note that things sorta kinda work now. * constraints-ideas.txt: Add some ideas for fixing some bugs and another bug * src/boxes.[ch] (meta_rectangle_to_string): new printing function * src/constraints.c (update_onscreen_requirements): only apply these to normal windows, remember that these apply to the outer window (i.e. window + frame) not to just the inner window, log some debugging messages when the requirements get toggled, don't forget to remove the struts from the available xinerama area.
* Get aspect ratio resizing to mostly work, and prevent size constraintsElijah Newren2005-10-177-195/+241
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2005-10-17 Elijah Newren <newren@gmail.com> Get aspect ratio resizing to mostly work, and prevent size constraints from causing window movement during a resize operation. * constraints-ideas.txt: record what's still broken with aspect ratio resizing, record the new bug found with clicking on an XMMS window, reorder the TODO list so finished stuff is at the bottom * src/boxes.[ch] (meta_rectangle_resize_with_gravity): fix adjustment for the various centered-somewhere gravities, (meta_rectangle_find_linepoint_closest_to_point): new function which is useful for finding an optimal rectangle size when we need to chose from a range of candidates that are spread in a line-like way between two sizes. * src/constraints.c (setup_constraint_info): I have no clue what I was thinking when I wrote that pseudogravity stuff--it was very broken and stuff works great without it so just delete it, (constrain_aspect_ratio): totally rewritten * src/keybindings.c (process_keyboard_resize_grab): Use meta_window_resize_with_gravity() instead of meta_window_move_resize() in order to provide a gravity to constraints so that constraints.c knows how to correctly fix the size when needed for minimum size hints * src/window.c (meta_window_configure_request): Add a FIXME since clicking on an XMMS window results in a failed assertion
* The various keep-'em-onscreen constraints should only apply to normalElijah Newren2005-10-162-5/+32
| | | | | | | | | | | | 2005-10-16 Elijah Newren <newren@gmail.com> * src/constraints.c: (constrain_to_single_xinerama): (constrain_fully_onscreen): (constrain_partially_onscreen): The various keep-'em-onscreen constraints should only apply to normal windows (otherwise, docks get shoved out of their place by their own strut)
* remove the debugging information added a couple commits ago; it wasElijah Newren2005-10-162-59/+16
| | | | | | | | | | | | | | | | | | 2005-10-16 Elijah Newren <newren@gmail.com> * src/window.c: (meta_window_new_with_attrs): (meta_window_apply_session_info): (meta_window_resize): (meta_window_move): (meta_window_move_resize): (meta_window_resize_with_gravity): (meta_window_configure_request): remove the debugging information added a couple commits ago; it was causing segfault when not running under Xnest (since all windows in my Xnest session had a frame); I think I found the big problem with these calls in the last commit, and I just don't think the extra debug spew is worth the extra effort anymore
* I was supposed to determine the amount that the window was allowed to moveElijah Newren2005-10-164-5/+31
| | | | | | | | | | | | | | | | | | 2005-10-15 Elijah Newren <newren@gmail.com> * src/constraints.c (constrain_partially_onscreen): I was supposed to determine the amount that the window was allowed to move off the screen, not the amount that was supposed to remain onscreen * src/window.c (meta_window_resize): a function for resizing probably shouldn't tell meta_window_move_resize_internal() that it's a pure move function, (meta_window_move): a function for moving probably shouldn't tell meta_window_move_resize_internal() that it's a pure resize function * constraints-ideas.txt: Note window.c bug fixed from above, but add another bug I discovered other than the constraints.c one also fixed above...