2007-04-12 Elijah Newren <newren gmail com>
* src/place.c (meta_window_place): do not auto-maximize windows
larger than the workarea in only a single direction. Fixes
#419810.
svn path=/trunk/; revision=3194
2006-10-01 Elijah Newren <newren gmail com>
* src/*.[ch]: Stick an emacs comment directive at the beginning of
all the code files so that people using emacs will be more likely
to get coding style correct in their patches. We still need a
similar vi directive. #358866
2006-05-15 Björn Lindqvist <bjourne@gmail.com>
* places.[ch] (intcmp, window_get_edges,
get_windows_showing_on_same_screen, get_vertical_edges,
get_horizontal_edges, meta_window_find_next_vertical_edge,
meta_window_find_next_horizontal_edge,
meta_window_find_nearest_vertical_edge,
meta_window_find_nearest_horizontal_edge): Remove the preceeding
functions as they are all obsoleted by the new edge-resistance
stuff. Fixes#341561.
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-10-23 Elijah Newren <newren@gmail.com>
Fix edge snapping for multi-screen (non-xinerama) setups. #319425
* src/place.c (get_windows_showing_on_same_screen,
get_vertical_edges, get_horizontal_edges): rename
get_windows_on_same_workspace() to
get_windows_showing_on_same_screen()
* src/place.c (get_windows_showing_on_same_screen): exclude windows
in the list that are on a different screen
2005-09-02 Brent Smith <gnome@nextreality.net>
* src/place.c: (meta_window_place): Moved the call to
meta_screen_get_natural_xinerama_list to earlier in
function so that xineramas_list is allocated before
find_first_fit is called. Fixes#315000
2005-08-03 Ray Strode <rstrode@redhat.com>
Improve the behavior of keyboard move/resize and edge
snapping. Still not perfect, bug 310888.
* src/effects.c (draw_xor_rect): Make the outside of a
wireframe rectangle line up with the outside edge of its
window, instead of centering the wireframe edges on the
window edges.
* src/keybindings.c (process_keyboard_move_grab): allow
edge snapping in wireframe mode. Adjust code to take
into account changed semantics of find_next_*_edge
functions.
(process_keyboard_resize_grab_op_change): new function
to take some orthogonal logic out of
process_keyboard_resize_grab_op. Only allow keyboard
resize cursor to go to flat edges, not corners.
(process_keyboard_resize_grab): allow edge snapping in
wireframe mode. Fix up snapping logic.
* src/place.c (get_{vertical,horizontal}_edges): use
GArray instead of int *, since the number of output
edges isn't known until the middle of the function now.
Use xor rect extents instead of window extends if in
wireframe mode.
(meta_window_find_next_{vertical,horizontal}_edge: add
new source_edge_position parameter to specify which edge
on the active window to start from when looking for next
edge on the screen. Return the coordinate of the edge
found and not the coordinate of where the window should be
moved to snap to where the edge was found.
* src/window.c (update_move): all the user to specify
an edge to resize with mouse in keyboard resize mode.
window
2005-07-24 Elijah Newren <newren@gmail.com>
* src/place.c (find_most_freespace): try to place windows denied
focus near the focus window and fix a xinerama bug with the
placement, (avoid_being_obscured_as_a_second_modal_dialog): avoid
modal dialogs being obscured in somewhat pathologically strange
circumstances that Eclipse seems to be good at triggering,
(meta_window_place): have dialog windows make use of
avoid_being_obscured_as_a_second_modal_dialog(). Fixes one of the
issues found in #307875.
2005-02-20 Elijah Newren <newren@gmail.com>
Fix an obscure xinerama placement bug with windows that are too
large to fit in the workarea in both dimensions. #166757
* src/place.c: (meta_window_place): use the current xinerama
instead of arbitrarily resetting to 0
2005-02-11 Elijah Newren <newren@gmail.com>
Avoid new windows being obscured by the focus window (and thus
possibly lost). Fixes#166524.
* src/place.c: new MetaWindowDirection enum,
(find_most_freespace): new function to find where there is the
most space available around the focused window,
(meta_window_place): if a window is denied focus and the window
overlaps the focused window, retry the first-fit algorithm only
paying attention to the focus window position and if that fails
just find the location on the screen with the most space
available.
* src/window.h: (struct MetaWindow): new
denied_focus_and_not_transient bitfield
* src/window.c: (meta_window_new_with_attrs): initialize
denied_focus_and_not_transient, (meta_window_show): set and unset
the denied_focus_and_not_transient field appropriately
2005-01-28 Elijah Newren <newren@gmail.com>
Take into account the appropriate list of windows when placing a
new one. Fixes#165381.
* src/place.c: (meta_window_place): use
meta_window_showing_on_its_workspace(w) instead of !w->minimzed,
also take into account sticky windows
* src/window.[ch]: rename window_showing_on_its_workspace to
meta_window_showing_on_its_workspace and export it
2005-01-27 Elijah Newren <newren@gmail.com>
Plug a pair of leaks. Fixes#165378
* src/place.c: (meta_window_place, get_windows_on_same_workspace):
free list returned by meta_display_list_windows.
2004-12-22 Elijah Newren <newren@gmail.com>
Partially resolve the conflicting requirements of windows on
multiple workspaces and hidden being a global quantity for windows
(fixes bug 156182; the remainder of the work is bug 87531 and is a
libwnck issue)
* src/display.c (event_callback):
* src/window.c (meta_window_visible_on_workspace, meta_window_unstick):
* src/workspace.c (meta_workspace_add_window,
meta_workspace_contains_window,
meta_workspace_queue_calc_showing):
* src/workspace.h:
Remove meta_workspace_contains_window, replace with simple
comparison utilizing window->workspace
* src/place.c (meta_window_place):
* src/window.c (meta_window_shares_some_workspace):
* src/window.h:
Remove meta_window_shares_some_workspace, replace with a simple
comparison utilizing window->workspace
* src/session.c (save_state),
* src/window.c (meta_window_new_with_attrs,
meta_window_apply_session_info, meta_window_free,
window_showing_on_its_workspace,
meta_window_change_workspace_without_transients,
meta_window_unstick, meta_window_set_current_workspace_hint,
meta_window_get_workspaces):
* src/window.h:
* src/workspace.c (meta_workspace_free, meta_workspace_add_window,
meta_workspace_remove_window):
Only one workspace now
2004-12-19 Elijah Newren <newren@gmail.com>
When snap-moving, don't snap to transients of minimized windows
since they are hidden. Fixes#157180
* src/place.c (get_windows_on_same_workspace): make the logic to
determine hidden windows more thorough by calling
meta_window_should_be_showing()
* src/window.c (meta_window_should_be_showing): rename this
function from window_should_be_showing and also export it,
(implement_showing):
s/window_should_be_showing/meta_window_should_be_showing/,
(idle_calc_showing):
s/window_should_be_showing/meta_window_should_be_showing/
* src/window.h (meta_window_should_be_showing): Add this function
to the list so that it can be used in src/place.c
2003-11-07 Rob Adams <readams@readams.net>
* src/place.c (meta_window_place): use maximize_after_placement to
automaximize in meta_window_place; avoids a problem with not
recalculating the frame geometry after auto-maximizing.
2003-11-07 Rob Adams <readams@readams.net>
* src/main.c (main): Try harder to find a theme in the event that
the theme in the preference cannot be found. Patch from Marcin
Krzyzanowski. See #125815.
* src/place.c (meta_window_place): use "visual" centering for
dialog placement and clip new dialogs to an xinerama workspace.
Fix for #118336.
2003-06-09 Rob Adams <robadams@ucla.edu>
Revamp placement policy for windows that are maximized when they
are mapped, including windows that set a hint to be maximized or
windows that are auto-maximized using our heuristic. See #111902.
* src/window.h: add new flag maximize_after_placement and new
function meta_window_maximize_internal.
* src/window.c (meta_window_new): initialize
maximize_after_placement to FALSE and remove the automaximize
heuristic.
(meta_window_maximize_internal): new function accepts a saved_rect
argument to be used as the new saved_rect for the window, and does
not queue a move_resize.
(meta_window_maximize): re-implement using
meta_window_maximize_internal.
(update_net_wm_state): If a window has a maximize hint set on
startup set maximize_after_placement to TRUE
* src/constraints.c (meta_window_constrain): Update the xinerama
information in the ConstraintInfo after placing the window, and
maximize the window after placement if
window->maximize_after_placement
* src/place.c (find_first_fit): take a natural xinerama list as an
argument instead of generating it here
(constrain_placement): remove function, since it is no longer
needed
(meta_window_place): generate the natural xinerama list here and
pass it into find_first_fit. If find_first_fit fails, use the
list to find empty xineramas where we can place windows that may
be maximized later. This makes maximized windows follow the
correct placement policy. Move the automaximize heuristic here.
2003-04-05 Rob Adams <robadams@ucla.edu>
Update placement policy for screen with multiple xineramas.
Windows will be placed preferentially on the xinerama with the
pointer, and progressively further away as needed to find a place
where the window does not overlap other windows.
* src/place.c (rect_fits_in_work_area): function
fit_rect_in_xinerama greatly simplified to work with new placement
policy.
(find_first_fit): implement new first first placement scheme
* src/screen.c (meta_screen_get_xinerama_neighbor): look for an
xinerama in the xinerama list that is adjacent to the specified
xinerama.
(meta_screen_get_natural_xinerama_list): return a list of
xineramas in the order to be preferred by the placement algorithm
as determined by the current location of the pointer.
* src/screen.h: add function prototypes and an enum used by
meta_screen_get_xinerama_neighbor.
2003-02-23 Havoc Pennington <hp@pobox.com>
Patch from Rob Adams addresses #95014 (placement issues),
makes first fit algorithm "center tile", adds most code
for per-xinerama workspaces (#86682) but disables it for now.
* src/workspace.c (meta_workspace_get_work_area_for_xinerama)
(meta_workspace_get_work_area_all_xineramas): new xinerama
functions, maintain workspace->work_areas with a different
work area for each xinerama. However for now all the work
areas are the same, because haven't quite figured out how
_NET_WM_STRUT is supposed to work
* src/window.c: adapt to new meta_window_* xinerama APIs
(meta_window_get_work_area_current_xinerama): new xinerama
API
(meta_window_get_work_area_for_xinerama): new xinerama API
(constrain_position): be a bit more clever about which xinerama's
work area we choose to use.
* src/stack.c: adapt to new Xinerama API
* src/screen.c (reload_xinerama_infos): invalidate all work areas
(meta_screen_get_xinerama_for_rect): new function
(meta_screen_window_intersects_xinerama): new function
* src/place.c (find_first_fit): change to use
"center tiling" (center a screen full of tiled windows,
rather than aligning them top left). Adapt to new
xinerama functions.
2002-10-01 Havoc Pennington <hp@pobox.com>
* src/place.c (find_next_cascade): try extra cascades alongside
the first, if the first fails; patch from readams@hmc.edu
2002-09-27 Havoc Pennington <hp@pobox.com>
* src/place.c (constrain_placement): constrain placement to try to
keep windows from going offscreen to the right/bottom
* src/stack.c (compute_layer): rearrange the logic here to say
that a window must always be in at least as high a layer as any of
its transient parents or group members, rather than special-casing
fullscreen. Also, group_member_is_fullscreen was leaking the list
of group members every time, a fairly major memory leak.
2002-09-24 Havoc Pennington <hp@pobox.com>
* src/place.c (fit_rect_in_xinerama): update best_overlap as we go
through the loop - doh. Fix from readams@hmc.edu for #90799.
(find_first_fit): try the origin of each xinerama screen
after the first. Also from readams@hmc.edu
2002-09-12 Havoc Pennington <hp@redhat.com>
* src/workspace.c (meta_workspace_screen_index)
(meta_workspace_index): fix compiler warnings
* src/tools/metacity-window-demo.c (menu_items): add a test for
dialogs with no transient parent
* src/place.c (find_first_fit): Try placing window at origin of
first Xinerama, even if there are no windows to place next to;
makes placement work when no other windows are open on the screen.
2002-07-12 Havoc Pennington <hp@redhat.com>
* src/window.c (meta_window_new): try to maximize windows that
are too big for the work area
* src/place.c (find_next_cascade): don't let the cascade algorithm
place windows off the screen, and fix it to always exhaustively
search the window list for cascade parents.
2002-06-17 Havoc Pennington <hp@pobox.com>
* src/place.c (find_next_cascade): increase the cascade threshold
a bit.
(find_first_fit): implement a somewhat lame first fit algorithm
2002-06-09 Havoc Pennington <hp@pobox.com>
* src/place.c (meta_window_place): don't run constrain_placement
on windows we allow to go anywhere (docks, etc.). Fixes
positioning of panel windows in certain cases.
2002-06-08 Havoc Pennington <hp@pobox.com>
Yeah I know maximization is broken, I'm too tired to fix it.
Probably because of the change to update_struts() that was
supposed to fix the 100% CPU bug.
* src/place.c (meta_window_place): don't run docks and things
through the placement algorithm. Thought it might fix
metacity-window-demo but it didn't.
* src/window.c (constrain_size): only get work area when needed
(meta_window_new): init the do_not_cover field
2002-06-08 Havoc Pennington <hp@pobox.com>
* src/screen.c (meta_screen_get_xinerama_for_window):
short-circuit the "only one xinerama" case, and use outer rect of
window instead of window->rect, so we get root window coords.
* src/theme.c (meta_frame_layout_get_borders): if fullscreen all
frame edges are zero-width.
* src/frame.c (meta_frame_get_flags): init fullscreen flag.
* src/common.h (enum): add META_FRAME_FULLSCREEN frame flag
* src/place.c: fix up calls to meta_window_get_work_area
* src/window.c (meta_window_get_work_area): add an arg for whether
the work area is for the screen or the xinerama subscreen.
(constrain_position): fix up calls to meta_window_get_work_area
(constrain_size): ditto
* src/screen.c (meta_screen_new): add METACITY_DEBUG_XINERAMA
environment variable which simulates xinerama on a single head.
2002-06-06 Havoc Pennington <hp@pobox.com>
* src/screen.c (meta_screen_get_current_xinerama): implement
* src/place.c (meta_window_place): cascade windows on the active
Xinerama screen
* src/window.c (meta_window_move_resize_internal): strip out the
#if 0 cruft about guessing fullscreen mode
(constrain_position, constrain_size): fullscreen/maximize to the
Xinerama head, not the whole screen
(meta_window_get_work_area): autocreate struts at the Xinerama
physical screen edges for the screen the window is on.
* src/screen.c (meta_screen_get_xinerama_for_window): someone
snuck in a for loop, fix it. ;-)
2002-05-25 Anders Carlsson <andersca@gnu.org>
* src/place.c: (get_vertical_edges), (get_horizontal_edges):
Take Xinerama screen edges into consideration.
* src/screen.c: (meta_rectangle_intersect),
(meta_screen_get_xinerama_for_window):
* src/screen.h:
Add a new function that returns the xinerama monitor that
a window is on.
2002-05-12 Havoc Pennington <hp@pobox.com>
* src/place.c (meta_window_place): move pposition/usposition
honoring code into here, instead of putting it in window.c.
Makes focusing new windows work, and cleans things up a bit.
#81585
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-04-30 Havoc Pennington <hp@pobox.com>
* src/window.c (recalc_window_features): don't try to decorate
toolbars.
* src/tools/metacity-window-demo.c: add menu and toolbar tests
* src/place.c (meta_window_place): only dialogs should be centered
over parent, not anything with transient for set.
* src/window.c (meta_window_configure_request): become more
fascist about window positioning if workarounds are disabled, and
less fascist if they are enabled.
* src/metacity.schemas: add a "disable_workarounds" option. Kind
of crack-smoking. But we just can't get all applications
fixed. And I need no-workarounds mode to monitor which apps are
broken and what needs fixing in specs.
* src/window.c (meta_window_configure_request): always allow
windows to resize themselves
* src/keybindings.c (reload_modmap): don't filter out Mode_switch,
apparently some people bind window manager shortcuts to that.
2002-02-09 Havoc Pennington <hp@pobox.com>
* src/themes/Atlanta/metacity-theme-1.xml: put in some kind of
distinctive frame for UTILITY, though it's ugly. Also put in the
borderless look for maximized windows.
* src/stack.c (compute_layer): put splash screen in the splash
layer
* src/stack.h (enum): create a splash screen layer
* src/place.c (meta_window_place): center splashscreen, and fix a
typo in the centering code
* src/window.c (recalc_window_features): disable most features on
splash screens
* src/screen.c (set_supported_hint): add UTILITY and SPLASHSCREEN
hints
* src/window.c: add UTILITY, SPLASHSCREEN implementation
* src/window.h (enum): add UTILITY, SPLASHSCREEN types
* src/theme-parser.c (parse_toplevel_element): parser support
for has_title attribute
* src/theme.c (meta_frame_layout_get_borders): handle a has_title
field in the layout, for utility windows that don't display a
title (would be better to be able to shrink the title text,
but that's kind of tricky to implement :-/)
2002-02-07 Havoc Pennington <hp@pobox.com>
Throughout: move to meta_topic rather than meta_verbose so
metacity.log can start being more useful
* src/util.h (enum): add more debug topics
* src/frames.c: clean up some cruft that caused warnings
2002-01-09 Havoc Pennington <hp@pobox.com>
* src/window.c, src/window.h: store strut information,
update it on property changes, etc. etc. so we avoid panel
on maximize.
* src/workspace.c (meta_workspace_get_work_area): add accessor for
work area so we can compute it lazily
* src/display.h, src/display.c: add _NET_WM_STRUT atom
and _WIN_HINTS atom
2001-10-29 Havoc Pennington <hp@pobox.com>
* src/window.c (idle_calc_showing): handle queue/unqueue of
calc showings as we are iterating over the pending list
(meta_window_show): focus placed transients in here instead
of in meta_window_place - now it should actually work, yay
* src/place.c (meta_window_place): remove focusing of transient
child from here; this was really broken
2001-10-25 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_visible_on_workspace):
I was using meta_workspace_contains_window() in a number of
places where on_all_workspaces should also have been considered,
thus this new function. Fixes bugs such as pinned windows
not appearing in the tab order.
(meta_window_client_message): use meta_window_visible_on_workspace
* src/stack.c (find_tab_forward): ditto
(find_tab_backward): ditto
(meta_stack_get_tab_next): ditto
(meta_stack_get_tab_list): ditto
* src/place.c (get_windows_on_same_workspace): ditto
* src/keybindings.c (handle_focus_previous): ditto
(handle_focus_previous): ditto
2001-09-08 Havoc Pennington <hp@pobox.com>
* src/ui.c (meta_ui_init): don't use gdk_display_name
* src/frame.c (meta_window_ensure_frame): create frame
with screen default visual, rather than client window visual;
for DRI games, the client window visual was not allowed to be
a child of another window with the same visual, apparently.
Anyhow now we copy twm, etc. so it must be correct.
* src/place.c (meta_window_place): if a transient is placed and
its parent has focus, focus the transient.