1
0
Fork 0
Commit graph

434 commits

Author SHA1 Message Date
Elijah Newren
e1891161d0 don't accidentally treat maximize vertically as maximize in both
2005-05-26  Elijah Newren  <newren@gmail.com>

	* src/window.c (check_maximize_to_work_area): don't accidentally
	treat maximize vertically as maximize in both directions.  Fixes
	#302204.
2005-05-26 18:42:55 +00:00
Elijah Newren
eb46b01e97 put all transients of the new window, if any exist, in the calc_showing
2005-05-26  Elijah Newren  <newren@gmail.com>

	* src/window.c: (meta_window_new_with_attrs): put all transients
	of the new window, if any exist, in the calc_showing queue.  Fixes
	#303284.
2005-05-26 17:15:56 +00:00
Elijah Newren
ebae340a1e Fix crash that occurs when stupid apps claim that a window is its own
2005-02-23  Elijah Newren  <newren@gmail.com>

	* src/window.c: (meta_window_new_with_attrs): Fix crash that
	occurs when stupid apps claim that a window is its own parent.
	#168207
2005-02-23 17:42:51 +00:00
Elijah Newren
612507260a Handle keynav vs. mousenav in mouse and sloppy focus modes. Fixes #167545.
2005-02-21  Elijah Newren  <newren@gmail.com>

	Handle keynav vs. mousenav in mouse and sloppy focus modes.  Fixes
	#167545.

	* doc/how-to-get-focus-right.txt: Update due to this new method
	for handling keynav vs. mousenav, plus various other updates that
	I previously forgot.

	* src/display.h: (struct _MetaDisplay): add a mouse_mode boolean

	* src/display.c: (meta_display_open): initialize mouse_mode to
	true, (event_callback): have EnterNotify and LeaveNotify events
	set mouse_mode to true when focusing a window

	* src/keybindings.c: (process_tab_grab): set mouse_mode to false
	when using alt-tab/alt-esc, (do_choose_window): likewise,
	(do_handle_move_to_workspace): set mouse_mode to false on
	move-window-to-workspace-<n> keybindings

	* src/window.c (idle_calc_showing): if we're in keynav mode while
	using sloppy or mouse focus, use metacity_sentinel to avoid
	EnterNotify events being generated from events other than mouse
	movement.

	* src/workspace.c (meta_workspace_activate_with_focus): add a
	FIXME in a potentially duplicate section of code,
	(meta_workspace_focus_default_window): use the same focus choice
	as click-to-focus if in keynav mode.
2005-02-22 02:11:25 +00:00
Elijah Newren
8de466b582 when receiving a _NET_ACTIVE_WINDOW message, switch to the desktop where
2005-02-20  Elijah Newren  <newren@gmail.com>

	* src/window.c: (meta_window_activate): when receiving a
	_NET_ACTIVE_WINDOW message, switch to the desktop where the window
	is located before activating instead of moving the window to the
	current desktop.  Thanks to Lubos Lunak for catching this issue.
	Fixes #128380.
2005-02-20 22:44:15 +00:00
Elijah Newren
79f2b91679 Ignore all focus and focus-stealing-prevention code in meta_window_show
2005-02-20  Elijah Newren  <newren@gmail.com>

	* src/window.c (meta_window_show): Ignore all focus and
	focus-stealing-prevention code in meta_window_show when not
	showing the window for the first time.  Fixes #167199.
2005-02-20 22:40:08 +00:00
Elijah Newren
50312dd0e8 Big patch to cover about 6 different issues in order to correct rare
2005-02-20  Elijah Newren  <newren@gmail.com>

	Big patch to cover about 6 different issues in order to correct
	rare problems with timestamps (make sure window selected in
	tasklist actually gets focus, sanity check timestamps to avoid
	rogue apps hosing the system, correct the updating of
	net_wm_user_time, correctly handle timestamps of 0 when comparing
	xserver timestamps for those who have had their systems up for
	over 25 days or so, add some debugging information to verbose
	logs, some code cleanups).  Fixes all issues listed in #167358.

	* src/display.h: (struct _MetaDisplay): clarify comment on
	last_focus_time, introduce a new variable--last_user_time,
	(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
	separate macro and then introduce a new macro with this name that
	uses the old one but adds additional special-case checks for
	timestamps that are 0, (comment to
	meta_display_set_input_focus_window): add information about how
	last_user_time should be used in this function

	* src/display.c (santiy_check_timestamps): new function,
	(meta_display_open): intialize display->last_user_time,
	(meta_display_get_current_time_roundtrip): use the timestamp,
	which is known to be good, in order to sanity_check_timestamps,
	(event_callback): use the new meta_window_ste_user_time() function
	in order to correct problems, use the timestamp of KeyPress and
	ButtonPress events, which are known to be good, in order to
	sanity_check_timestamps, (timestamp_too_old): new function for
	common behavior of meta_display_focus_the_no_focus_window and
	meta_display_set_input_focus_window, with added checking for
	display->last_user_time in addition to display->last_focus_time,
	(meta_display_set_input_focus_window): replace some of the code
	with a call to timestamp_too_old(),
	(meta_display_focus_the_no_focus_window): replace some of th ecode
	with a call to timestamp_too_old()

	* src/window.h: (meta_window_set_user_time): new function to
	abstract the many things that need to be done when updating the
	net_wm_user_time of any window

	* src/window.c: (meta_window_activate): add debugging spew, make
	sure the comparison is made with last_user_time NOT
	last_focus_time, use meta_window_set_user_time() function in order
	to correct problems, (meta_window_client_message): add a newline
	to a debugging message to make them easier to read,
	(meta_window_set_user_time): new function

	* src/window-props.c (reload_net_wm_user_time): use the new
	meta_window_ste_user_time() function in order to correct problems
2005-02-20 17:14:16 +00:00
Elijah Newren
0488efc8c1 Raise the ancestor of a window instead of the window itself. Fixes
2005-02-12  Elijah Newren  <newren@gmail.com>

	Raise the ancestor of a window instead of the window itself.
	Fixes #166894.

	* src/window.c: (find_root_ancestor): new function,
	(meta_window_raise): get the ancestor of the given window and
	raise it if possible instead of the window
2005-02-12 07:34:30 +00:00
Elijah Newren
9fa5c1d4b9 Don't unconditionally place splashscreens (and other not-to-befocused
2005-02-12  Elijah Newren  <newren@gmail.com>

	Don't unconditionally place splashscreens (and other
	not-to-befocused windows) below the focus window.  Fixes #167042.

	* src/window.c: (intervening_user_event_occurred): new function
	taken from the timestamp comparison portion of the old
	window_takes_focus_on_map function, (window_state_on_map): new
	function with remainder of old window_takes_focus_on_map function
	that determines both whether the window will take focus and
	whether it should be placed on top, (meta_window_show): use
	place_on_top_on_map to determine window stacking instead of trying
	to infer it from takes_focus_on_map
2005-02-12 07:19:41 +00:00
Elijah Newren
d31a0829be Avoid new windows being obscured by the focus window (and thus possibly
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-02-11 19:20:44 +00:00
Elijah Newren
fe1416c65f Avoid using CurrentTime when focusing, handle it better in case we miss
2005-02-08  Elijah Newren  <newren@gmail.com>

	Avoid using CurrentTime when focusing, handle it better in case we
	miss any cases.  Fixes #166732.

	* src/window.c: (meta_window_shade): use
	meta_display_get_current_time_roundtrip() to ensure we have a
	valid timestamp, (meta_window_unshade): same

	* src/display.c: (meta_display_set_input_focus_window): If
	CurrentTime was passed, get one from the XServer in addition to
	throwing a warning, (meta_display_focus_the_no_focus_window): same
2005-02-09 03:18:46 +00:00
Elijah Newren
454e595ef8 If we're not passed a timestamp, make sure to manually get one. Fixes
2005-02-08  Elijah Newren  <newren@gmail.com>

	* src/window.c: (meta_window_activate): If we're not passed a
	timestamp, make sure to manually get one.  Fixes #166728.
2005-02-09 03:15:11 +00:00
Elijah Newren
459c6668fb Ignore xconfigurerequest events for stacking when it should be safe to do
2005-02-06  Elijah Newren  <newren@gmail.com>

	Ignore xconfigurerequest events for stacking when it should be
	safe to do so.  Again, thanks to Crispin Flowerday for the test
	case.  Thanks to KWin for the inspiration (and to Google for
	indexing their source code).  Fixes the other half of #166395.

	* src/window.c: (meta_window_configure_request): if the
	active_window is from a separate application than the one getting
	the configure request and the net_wm_user_time of the active
	window is later than that of the window getting the configure
	request, then ignore the request.
2005-02-06 17:01:41 +00:00
Elijah Newren
d11681e505 If activation requests are too old, set the demands_attention hint instead
2005-02-06  Elijah Newren  <newren@gmail.com>

	If activation requests are too old, set the demands_attention hint
	instead of actually activating.  Thanks to Crispin Flowerday for
	the test case and for testing the patch.  Fixes half of #166395.

	* src/window.c: (meta_window_activate): if the request came before
	the last focus time, set the demands attention hint instead
2005-02-06 16:52:26 +00:00
Elijah Newren
84312194e8 Make sure window->border_only is initialized so we don't get random
2005-02-04  Elijah Newren  <newren@gmail.com>

	Make sure window->border_only is initialized so we don't get
	random windows without decorations.  Thanks to Sinisa Segvic and
	Owen Taylor for providing test cases.  Fixes #145131.

	* src/window.c: (update_mwm_hints): Be sure to call
	recalc_window_features even if no MWM hints are set
2005-02-05 03:02:42 +00:00
Elijah Newren
51bbd0e1a8 Correct the stacking when return from fullscreen mode. Fixes #165718.
2005-01-31  Elijah Newren  <newren@gmail.com>

	Correct the stacking when return from fullscreen mode.  Fixes
	#165718.

	* src/window.c: (meta_window_unmake_fullscreen): Update the layer
	after resizing the window
2005-01-31 16:49:23 +00:00
Elijah Newren
7d0ef20a9c Change wording of menu to "Always on Current Workspace" from "Put on All
2005-01-28  Elijah Newren  <newren@gmail.com>

	* src/menu.c: Change wording of menu to "Always on Current
	Workspace" from "Put on All Workspaces", remove a quick-key
	conflict between "On _Top" and "Only on _This Workspace" by
	switching the latter to "_Only on This Workspace"

	* src/window.c: Remove a comment that is no longer necessary
	(since bug 87531 has been fixed)
2005-01-28 16:36:14 +00:00
Elijah Newren
5389f135ce Take into account the appropriate list of windows when placing a new one.
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-28 14:48:47 +00:00
Elijah Newren
0a95c706bf shaded windows should not show up in pagers. Fixes #165377.
2005-01-27  Elijah Newren  <newren@gmail.com>

	* src/window.c: (set_net_wm_state): shaded windows should not show
	up in pagers.  Fixes #165377.
2005-01-27 18:23:51 +00:00
Elijah Newren
5fe06b5fff Stick and unstick transients with their parent automatically. Fixes
2005-01-26  Elijah Newren  <newren@gmail.com>

	Stick and unstick transients with their parent automatically.
	Fixes #152283.

	* src/window.c: (window_stick_impl, window_unstick_impl): rename
	from meta_window_stick and meta_window_unstick respectively,
	(stick_foreach_func): a function to assist calling
	window_(un)stick_impl on each transient, (meta_window_stick,
	meta_window_unstick): new functions that call window_stick_impl or
	window_unstick_impl for the window and each of its transients.
2005-01-26 23:25:05 +00:00
Elijah Newren
bb03725397 set the window state hints _after_ applying session information. Fixes
2005-01-25  Elijah Newren  <newren@gmail.com>

	* src/window.c: (meta_window_new_with_attrs): set the window state
	hints _after_ applying session information.  Fixes #164677.
2005-01-26 02:47:49 +00:00
Elijah Newren
f31c57a049 Refuse to focus a window with a modal transient, and focus the transient
2005-01-25  Elijah Newren  <newren@gmail.com>

	Refuse to focus a window with a modal transient, and focus the
	transient instead.  Fixes #164716.

	* src/window.c: (get_modal_transient): new function,
	(meta_window_focus): if the window has a modal transient, make
	sure it is on the current workspace and then focus it instead.
2005-01-25 17:26:06 +00:00
Elijah Newren
814cc4b698 Patch from John Paul Wallington to fix #163420.
2005-01-23  Elijah Newren  <newren@gmail.com>

	Patch from John Paul Wallington to fix #163420.

	* src/window.c: (check_maximize_to_work_area): fix vertical
	maximization for second screen
2005-01-24 04:21:14 +00:00
Elijah Newren
7d747092a6 Remove the hack from bug 128200; it isn't needed anymore with the fix from
2005-01-09  Elijah Newren  <newren@gmail.com>

	* src/display.c (meta_display_open):
	* src/display.h (struct _MetaDisplay):
	* src/window.c (meta_window_free, meta_window_client_message,
	meta_window_notify_focus):

	Remove the hack from bug 128200; it isn't needed anymore with the
	fix from bug #160470.
2005-01-10 00:27:00 +00:00
Leena Gunda
7549d1511a Restore the wireframe rectangle co-ordinates to saved window co-ordinates.
2005-01-06  Leena Gunda  <leena.gunda@wipro.com>

        * src/window.c (meta_window_unmaximize): Restore the wireframe
        rectangle co-ordinates to saved window co-ordinates. Fixes
        bug #161236.
2005-01-06 05:24:59 +00:00
Elijah Newren
c74ab35c6c Focus windows that manually position themselves too (fixes #107347).
2004-12-27  Elijah Newren  <newren@gmail.com>

	Focus windows that manually position themselves too (fixes
	#107347).

	* src/window.h (struct _MetaWindow): add a new
	showing_for_first_time flag

	* src/window.c (meta_window_new_with_attrs): initialize
	showing_for_first_time flag to !mapped, (meta_window_show):
	replace did_placement with showing_for_first_time in the section
	to decided whether to focus since did_placement isn't quite what
	we want
2004-12-28 06:01:42 +00:00
Elijah Newren
aab8f21475 Don't show menu if all options are invalid (fixes #148915)
2004-12-24  Elijah Newren  <newren@gmail.com>

	* src/window.c (meta_window_show_menu): Don't show menu if all
	options are invalid (fixes #148915)
2004-12-24 19:40:09 +00:00
Elijah Newren
ce8c2d9463 Fix error in distinguishing < vs. <= introduced by the patch in #154598,
2004-12-24  Elijah Newren  <newren@gmail.com>

	* src/window.c (window_takes_focus_on_map): Fix error in
	distinguishing < vs. <= introduced by the patch in #154598,
	restructure code so that verbose log matches code better in order
	ensure such mistakes are harder to make in the future (fixes
	#162172)
2004-12-24 17:27:29 +00:00
Elijah Newren
892cb8a8dd Wrap XSetInputFocus, making display->expected_focus_window a little more
2004-12-22  Elijah Newren  <newren@gmail.com>

	Wrap XSetInputFocus, making display->expected_focus_window a
	little more reliable (see #154598)

	* src/display.h: (struct _MetaDisplay): add a large comment about
	the expected_focus_window, add a last_focus_time field,
	(XSERVER_TIME_IS_BEFORE): new macro moved from window.c but fixed
	for 64-bit systems, (meta_display_set_input_focus_window): new
	function

	* src/display.c (meta_display_open): initialize last_focus_time,
	add a comment about brokenness of trying to set intial focus
	window, (meta_display_set_input_focus_window): new function that
	wraps XSetInputFocus,
	(meta_display_focus_the_no_focus_window): make this function
	closer to a wrapping of XSetInputFocus for the no_focus_window.

	* src/window.c (XSERVER_TIME_IS_LATER): remove this macro in favor
	of the improved one added to display.h

	* src/display.c (meta_display_open):
	* src/window.c (meta_window_focus):
	use meta_display_focus_the_no_focus_window and
	meta_display_set_input_focus instead of XSetInputFocus
2004-12-23 06:44:56 +00:00
Elijah Newren
e46fc46701 Rename meta_window_visible_on_workspace to
2004-12-22  Elijah Newren  <newren@gmail.com>

	* src/core.c (meta_core_user_lower_and_unfocus):
	* src/display.c (meta_display_get_current_tab):
	* src/stack.c (get_default_focus_window, meta_stack_list_windows):
	* src/window.c (set_net_wm_state, meta_window_should_be_showing,
	implement_showing, meta_window_activate,
	meta_window_notify_focus):
	* src/window.h:
	* src/workspace.c (meta_workspace_list_windows):

	Rename meta_window_visible_on_workspace to
	meta_window_located_on_workspace (whether or not the window was
	showing wasn't taken into account, which made "visible"
	confusing).  Fixes #136314.
2004-12-23 00:20:33 +00:00
Elijah Newren
f4f8699d84 Partially resolve the conflicting requirements of windows on multiple
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-22 23:52:52 +00:00
Elijah Newren
d178f5e330 When snap-moving, don't snap to transients of minimized windows since they
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
2004-12-20 02:53:08 +00:00
Elijah Newren
2a5689911f Don't lower newly mapped windows when they're denied focus, if they are
2004-10-25  Elijah Newren  <newren@math.utah.edu>

	Don't lower newly mapped windows when they're denied focus, if
	they are transients of the focused window.  Instead, defocus the
	currently focused window.  (fixes #151996).

	(Also, reenable focus stealing prevention and do a small spacing
	cleanup)

	* src/window-props.c (init_net_startup_id): fix spacing

	* src/window.c (window_takes_focus_on_map): re-enable focus
	stealing prevention, (meta_window_show): if the new window is
	denied focus and is a transient of the currently focused window,
	defocus the currently focused window but keep the transient on
	top; remove some old code about transients and focus; make sure
	that EnterNotify events won't accidentally focus the new window.
2004-10-25 16:28:57 +00:00
Elijah Newren
6d77251c71 Update _NET_WM_STATE_HIDDEN so the pager on the panel will know whether to
2004-10-22  Elijah Newren  <newren@math.utah.edu>

	Update _NET_WM_STATE_HIDDEN so the pager on the panel will know
	whether to display windows as visible or hidden (#105665)

	* src/screen.c (queue_windows_showing): Revert the
	queue_windows_showing portion of the patch committed on 2004-10-16
	for #142198--it was an ill-advised optimization.

	* src/window.c (window_showing_on_its_workspace,
	window_should_be_showing): split the old window_should_be_showing
	into these two functions, (set_net_wm_state): hidden state is more
	complex; use window_showing_on_its_workspace to determine the
	correct value
2004-10-22 20:28:36 +00:00
Elijah Newren
e84778d1eb Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16  Elijah Newren  <newren@math.utah.edu>

	Make the "showing desktop" mode be per-workspace instead of
	per-screen. (fixes #142198)

	* src/keybindings.c (handle_toggle_desktop): access
	showing_desktop through the active workspace

	* src/screen.c (meta_screen_new): remove initialization of
	screen->showing_desktop,
	(meta_screen_update_showing_desktop_hint): rename and make not
	static and access showing_desktop through the active workspace,
	(queue_windows_showing): replace meta_display_list_windows() with
	screen->active_workspace->windows,
	(meta_screen_minimize_all_on_active_workspace_except): renamed
	from meta_screen_minimize_all_except since it now only works on
	the active workspace, (meta_screen_show_desktop,
	meta_screen_unshow_desktop): access showing_desktop through the
	active workspace

	* src/screen.h (struct _MetaScreen): remove showing_desktop field,
	(meta_screen_minimize_all_on_active_workspace_except): rename from
	meta_screen_minimize_all_except,
	(meta_screen_update)_showing_desktop_hint): export this function too

	* src/window.c (maybe_leave_show_desktop_mode): access
	showing_desktop through the active workspace and use new name for
	meta_screen_minimize_all_on_active_workspace_except,
	(window_should_be_showing): access showing_desktop through the
	active workspace

	* src/workspace.c (meta_workspace_new): initialize
	workspace->showing_desktop, (meta_workspace_activate_with_focus):
	add note that old can be NULL, update showing_desktop_hint if
	different on this workspace than the previous one

	* src/workspace.h (struct _MetaWorkspace): add showing_desktop
	field
2004-10-17 04:28:29 +00:00
Elijah Newren
05388194fc Code cleanup
2004-10-13  Elijah Newren  <newren@math.utah.edu>

	Code cleanup

	* src/window.c (is_in_dock_group, docks_at_end_cmp,
	shuffle_docks_to_end): removed functions,
	(meta_window_notify_focus): no need to call is_in_dock_group or
	shuffle_docks_to_end because of the patch from #120100 that was
	committed.
2004-10-13 18:54:46 +00:00
Elijah Newren
79b4de04fc Alter the meaning of expected_focus_window; doesn't affect current
2004-10-08  Elijah Newren  <newren@math.utah.edu>

         Alter the meaning of expected_focus_window; doesn't affect
	 current operation but assists in fixing some other bugs
	 (#154598)

	* src/display.c (meta_display_focus_the_no_focus_window): set the
	expected_focus_window to NULL.

	* src/window.c (meta_window_notify_focus): don't NULL the
	expected_focus_window when that window receives a FocusIn event
2004-10-08 21:57:01 +00:00
Elijah Newren
70e40c235c Fix a variety of issues with autoraise (#134206)
2004-10-04  Elijah Newren  <newren@math.utah.edu>

	Fix a variety of issues with autoraise (#134206)

	* src/display.h: (struct _MetaDisplay): add an autoraise_window
	parameter

	* src/display.[hc] (meta_display_focus_the_no_focus_window): new
	function, (meta_display_queue_autoraise_callback): new function,
	(meta_display_remove_autoraise_callback): new function

	* src/display.c (meta_display_open): intialize
	display->autoraise_window too, (meta_display_close): remove any
	pending autoraise callback, (window_raise_with_delay_callback):
	clear out auto_raise->display->autoraise_window too,
	(event_callback): call meta_display_queue_autoraise_callback
	instead of having the code inline, call
	meta_display_focus_the_no_focus_window to handle focusing that
	window

	* src/window.c (meta_window_focus): If there's a window with an
	autoraise timeout that isn't the window being focused, remove the
	autoraise timeout

	* src/workspace.c (meta_workspace_focus_default_window): If no
	autoraise timeout is queued for the given window then queue one
	now, call meta_display_focus_the_no_focus_window to handle
	focusing that window, (meta_workspace_focus_mru_window): call
	meta_display_focus_the_no_focus_window to handle focusing that
	window
2004-10-04 21:09:08 +00:00
Elijah Newren
16b9aff47c Fix a variety of focus race conditions in all focus modes, or at least
2004-10-04  Elijah Newren  <newren@math.utah.edu>

	Fix a variety of focus race conditions in all focus modes, or at
	least make them harder to trigger (fixes #152000)

	* src/core.[ch] (meta_core_user_lower_and_unfocus): add a
	timestamp parameter; pass it along to
	meta_workspace_focus_default_window

	* src/display.[ch] (meta_display_get_current_time_roundtrip): new
	function

	* src/display.c (event_callback): pass a timestamp to the
	meta_workspace_activate and meta_workspace_focus_default_window
	function calls

	* src/frames.c (meta_frames_button_press_event): pass a timestamp
	to meta_core_user_lower_and_unfocus

	* src/keybindings.c (handle_activate_workspace): pass a timestamp
	to meta_workspace_activate, (process_workspace_switch_grab): pass
	a timestamp to meta_workspace_focus_default_window and
	meta_workspace_activate, (handle_toggle_desktop): pass a timestamp
	to meta_workspace_focus_default_window,
	(do_handle_move_to_workspace): pass a timestamp to
	meta_workspace_activate_with_focus, (handle_workspace_switch):
	meta_workspace_activate

	* src/screen.c (meta_screen_new): pass a timestamp to
	meta_workspace_activate

	* src/window.c (meta_window_free): pass a timestamp to
	meta_workspace_focus_default_window, (idle_calc_showing): don't
	increment the focus sentinel here, (meta_window_minimize): pass a
	timestamp to meta_workspace_focus_default_window,
	(meta_window_client_message), pass a timestamp to
	meta_workspace_focus_default_window

	* src/workspace.h (meta_workspace_activate): add timestamp
	parameter, (meta_workspace_activate_with_focus): add timestamp
	parameter, (meta_workspace_focus_default_window): add timestamp
	parameter

	* src/workspace.c (meta_workspace_focus_mru_window): make this
	function take a timestamp and use it for meta_window_focus or
	XSetInputFocus, (meta_workspace_activate_with_focus): make this
	function take a timestamp and pass it along to meta_window_focus
	and meta_workspace_focus_default_window,
	(meta_workspace_activate): make this function take a timestamp and
	pass it to meta_workspace_activate_with_focus),
	(meta_workspace_focus_default_window): make this function take a
	timestamp, warn if its 0 but try to handle that case sanely, and
	pass the timestamp on to meta_window_focus or
	meta_workspace_focus_mru_window or XSetInputFocus
2004-10-04 20:32:59 +00:00
Elijah Newren
5ac6fcad73 Remove race condition for focus window choice on window close followed by
2004-09-15  Elijah Newren  <newren@math.utah.edu>

	Remove race condition for focus window choice on window close
	followed by rapid mouse movement in sloppy and mouse focus modes
	(fixes #152000)

	* src/window.c (meta_window_free): Don't increment the focus
	sentinel for windows being freed, (idle_calc_showing): don't
	increment the focus sentinel for windows being minimized
2004-09-15 15:54:51 +00:00
Elijah Newren
4b9fe2cae7 Focus correct window after minimizing via the tasklist (fixes #128200; see
2004-09-15  Elijah Newren  <newren@math.utah.edu>

	Focus correct window after minimizing via the tasklist (fixes
	#128200; see also #107681)

	* src/display.h (struct _MetaDisplay): track the
	previously_focused_window

	* src/display.c (meta_display_open): initialize
	previously_focused_window

	* src/window.c (meta_window_free): clear the
	previously_focused_window if it's being freed,
	(meta_window_client_message): if we get a request to minimize the
	previously_focused_window and the focus_window is a dock or the
	desktop, focus the default window, (meta_window_notify_focus):
	update the previously_focused_window
2004-09-15 15:38:09 +00:00
Elijah Newren
8c7f81eac9 Disable focus-stealing-prevention for now; there are still some issues and
2004-08-29  Elijah Newren  <newren@math.utah.edu>

	* src/window.c (window_takes_focus_on_map): Disable
	focus-stealing-prevention for now; there are still some issues and
	hard code freeze is tomorrow...so this will have to wait until
	Gnome 2.10.
2004-08-30 04:56:07 +00:00
Elijah Newren
522e9916b6 Prevent an assertion failure that can occur after increasing the number of
2004-08-27  Elijah Newren  <newren@math.utah.edu>

	Prevent an assertion failure that can occur after increasing the
	number of workspaces; also fix a warning and stacking order when a
	window is denied focus (fixes #150615)

	* src/window.c (meta_window_stack_just_below): the position of the
	window should be set equal to that of the one we want to be below,
	not 1 lower than that number

	* src/workspace.c (maybe_add_to_list): new function to add
	on_all_workspace windows to an mru_list, (meta_workspace_new):
	call maybe_add_to_list for all windows on the screen in order to
	initialize the mru_list
2004-08-27 17:22:54 +00:00
Havoc Pennington
06a58f43c0 track the last_xor_rect separately from the current window size, and then
2004-08-18  Havoc Pennington  <hp@redhat.com>

	* src/display.h (struct _MetaDisplay): track the last_xor_rect
	separately from the current window size, and then use that to
	paint the wireframe including the frame, and taking into
	account shaded windows.

	* src/window.c (meta_window_get_xor_rect): new function to compute
	the xor rect; it is not really 100% right, because it uses the
	frame dimensions from the window at the start of the move/resize.
	But probably won't break in practice.
2004-08-19 02:05:24 +00:00
Rob Adams
afee4a4251 use height and top/bottom struts to compute gap (copy/paste bug).
2004-08-15  Rob Adams  <readams@readams.net>

	* src/windows.c (meta_window_update_struts): use height and
	top/bottom struts to compute gap (copy/paste bug).
2004-08-15 17:32:45 +00:00
Rob Adams
caaad4449c Allow struts larger than 1/2 the screen width/height, as long as there's a
2004-08-15  Rob Adams  <readams@readams.net>

	* src/window.c (meta_window_update_struts): Allow struts larger
	than 1/2 the screen width/height, as long as there's a minimum
	sized gap between them.  Patch from Bill Haneman <billh@gnome.org>
	for bug #144126.
2004-08-15 15:26:30 +00:00
Rob Adams
5f1de4bf7a Add #ifdef around XSYNC code; fixes compile problem if XSYNC is disabled.
2004-08-08  Rob Adams  <readams@readams.net>

	* src/window.c (meta_window_move_resize_internal): Add #ifdef
	around XSYNC code; fixes compile problem if XSYNC is disabled.
	Path for #149314 from Peter O'Shea and independently Mike Castle.
2004-08-08 16:18:52 +00:00
Elijah Newren
bd73853f72 Revert Rob's 2004-07-31 patch that ignored net_wm_user_time when
2004-08-07  Elijah Newren  <newren@math.utah.edu>

	* window.c, window.h: Revert Rob's 2004-07-31 patch that ignored
	net_wm_user_time when unminimizing a window

	* window.c (meta_window_activate): If a nonzero timestamp is
	passed, update the window's net_wm_user_time accordingly.  (see
	comments 102-108 of bug 118372)
2004-08-08 00:02:02 +00:00
Rob Adams
de4c7a0610 Remove some extraneous items that could sometimes appear in the window
2004-08-07  Rob Adams  <readams@readams.net>

	Remove some extraneous items that could sometimes appear in the
	window menu.  Fix for #144493.

	* src/menu.c (menuitems): Change the second separator to key on
	whether there are any workspaces.
	(meta_window_menu_new): use NULL label instead of 0 op to identify
	separator

	* src/window.c (meta_window_show_menu): Change the conditions on
	the directions to take into account "holes" in the workspace
	layout and also only set META_MENU_OP_WORKSPACES when there's more
	than one workspace.
2004-08-07 17:50:40 +00:00
Elijah Newren
abe183c14c Have newly mapped windows that are denied focus appear after the focused
2004-08-05  Elijah Newren  <newren@math.utah.edu>

	Have newly mapped windows that are denied focus appear after the
	focused window in the alt-tab list.  This allows one to switch to
	such a window with a single alt-tab press.

	* src/window.c (ensure_mru_position_after): new function,
	(meta_window_show): If newly mapped window is denied focus, call
	ensure_mru_position_after to make the window appear after the
	focus window in the mru list.
2004-08-05 17:48:39 +00:00
Elijah Newren
b834001fe7 prepend window to mru list instead of appending, since making the window
2004-08-05  Elijah Newren  <newren@math.utah.edu>

	* src/window.c (meta_window_stick): prepend window to mru list
	instead of appending, since making the window sticky should imply
	that it is the most recently used, not the least recently.  (fixes
	#149369)
2004-08-05 16:23:37 +00:00
Rob Adams
12f4f7c6b0 Fix bug that caused windows to not be focused on unminimizing because of
2004-07-31  Rob Adams  <readams@readams.net>

	Fix bug that caused windows to not be focused on unminimizing
	because of user time support.

	* src/window.c (meta_window_new_with_attrs): initialize
	focus_despite_user_time bit
	(window_takes_focus_on_map): focus if focus_despite_user_time
	despite user time, interestingly enough
	(meta_window_show): reset focus_despite_user_time after showing

	* src/window.h (_MetaWindow): add focus_despite_user_time bit
2004-07-31 21:26:05 +00:00
Rob Adams
e60da6c006 Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31  Rob Adams  <readams@readams.net>

	Fix some support for EWMH hints, and fix USER_TIME support to
	include the DEMANDS_ATTENTION hint.  Also includes some code for
	implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
	this is disabled pending feature thaw.

	* COMPLIANCE: update with new information

	* src/display.c (meta_display_open): add new hints to list

	* src/display.h (_MetaDisplay): Add new atoms to struct

	* src/screen.c (set_supported_hint): update the list of support
	hints.
	(set_desktop_viewport_hint): new function sets the viewport hint
	to (0,0) as required by the spec for WMs with no viewport support.
	(set_desktop_geometry_hint): new function to set the desktop size
	hint to the size of the display, since we don't implement large
	desktop support, as required by the spec.
	(meta_screen_resize): update the geometry hint on screen resize

	* src/window.c (meta_window_new_with_attrs): Initialize
	demands_attention state
	(set_net_wm_state): Set demands_attention hint in the window state
	(meta_window_show): If we don't pop up a window because of
	USER_TIME, set DEMANDS_ATTENTION on the window.
	(meta_window_focus): When a window receives focus, remove
	DEMANDS_ATTENTION hint
	(meta_window_client_message): Allow other apps to set
	DEMANDS_ATTENTION on a window.  Also, if the _NET_ACTIVE_WINDOW
	hint includes a timestamp, use it.
	(update_net_wm_state): Read DEMANDS_ATTENTION state also

	* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 19:56:10 +00:00
Elijah Newren
9d1d8fa062 Make choice of focus window be consistent for each focus mode. Fixes
2004-06-24  Elijah Newren  <newren@math.utah.edu>

	Make choice of focus window be consistent for each focus mode.
	Fixes #135810.

	* src/delete.c: (meta_window_delete): In some #if 0'ed code,
	replace meta_workspace_focus_mru_window with
	meta_workspace_focus_default_window (just in case the code becomes
	un-#if 0'ed out).

	* src/screen.c, src/screen.h: Change
	meta_screen_focus_mouse_window to meta_screen_get_mouse_window,
	and don't focus the window when found but rather return it.

	* src/window.c: (meta_window_free, meta_window_minimize): replace
	meta_workspace_focus_mru_window with
	meta_workspace_focus_default_window.

	* src/workspace.c: (meta_workspace_focus_default_window): Focus
	appropriately for the given focus method:
	   click-to-focus: focus MRU window (== toplevel window)
	   sloppy focus:   focus the window under the pointer if there is
	                   such a window, otherwise focus the mru window
	   mouse focus:    focus the window under the pointer if there is
	                   such a window, otherwise don't focus anything
2004-06-24 20:02:46 +00:00
Elijah Newren
702a4c0da7 Avoid a race condition on the choice of window to focus after the
2004-06-24  Elijah Newren  <newren@math.utah.edu>

	* src/window.c: Avoid a race condition on the choice of window to
	focus after the previously focused window gets closed or
	minimized.  Fixes #131582.
2004-06-24 19:41:02 +00:00
Elijah Newren
28a54c6bb4 Add support for _NET_WM_USER_TIME
2004-06-17  Elijah Newren  <newren@math.utah.edu>

	Add support for _NET_WM_USER_TIME

	* src/display.c:
	(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
	(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
	(doesn't work since keyboard isn't grabbed) and ButtonPress (does
	work), this is just a fallback for applications that don't update
	this themselves.

	* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field

	* src/screen.c: (meta_screen_apply_startup_properties): Check for
	TIMESTAMP provided from startup sequence as well.

	* src/stack.c:
	s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
	(meta_window_set_stack_position): New function which calls the
	meta_window_set_stack_position_no_sync function followed immediately
	by calling meta_stack_sync_to_server.

	* src/window-props.c:
	(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
	(reload_wm_hints): also load atom_net_wm_user_time

	* src/window.c:
	new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
	(meta_window_new_with_attrs): add timestamp attributes,
	(window_takes_focus_on_map): use TIMESTAMP from startup
	notification and _NET_WM_USER_TIME to decide whether to focus new
	windows,
	(meta_window_show): if app doesn't take focus on map, place it
	just below the focused window in the stack
	(process_property_notify): check for changes to _NET_WM_USRE_TIME,
	(meta_window_stack_just_below): new function

	* src/window.h:
	(_MetaWindow struct): new fields for initial_timestamp,
	initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
	(meta_window_stack_just_below): new function
2004-06-24 15:47:05 +00:00
Anders Carlsson
ef1ecc8128 Add a timestamp argument to menu functions and use it in
2004-06-21  Anders Carlsson  <andersca@gnome.org>

	* src/common.h:
	* src/menu.c: (menu_closed), (activate_cb):
	* src/window.c: (menu_callback):
	Add a timestamp argument to menu functions and
	use it in meta_window_delete.
2004-06-21 16:47:27 +00:00
Anders Carlsson
adb26d0543 Get the timestamp from the client message.
2004-06-21  Anders Carlsson  <andersca@gnome.org>

	* src/window.c: (meta_window_client_message):
	Get the timestamp from the client message.
2004-06-21 09:53:23 +00:00
Soeren Sandmann
4cfb5152f7 Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004  Soeren Sandmann  <sandmann@daimi.au.dk>

	Fix bug 143333, support for update counter spec, and 109362,
	schedule compensation events when events are ignored.

	* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
	_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
	METACITY_SYNC_COUNTER stuff.
	(meta_display_begin_op): Setup the sync counter

	* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
	Add new atoms.

	* src/window.c (send_sync_request): new function.
	(meta_window_move_resize_internal): send a sync request before
	resizing.
	(check_move_resize_frequence): Rework logic to also check the SYNC
	case. If an event is ignored return the remaining time.
	(update_resize_timeout): Timeout that gets called when a
	compensation event is scheduled.
	(uddate_resize): schedule compensation events when an event is
	ignored.
	(meta_window_handle_mouse_grap_op_event): When an alarm is
	received and sync was turned off, turn it back on.

	* src/window.h (struct MetaWindow)  Add some variables
2004-06-19 00:45:24 +00:00
Rob Adams
16a8add6f8 only move on MRU list if the window belongs on the workspace, since the
2004-02-27  Rob Adams  <readams@readams.net>

	* src/window.c (meta_window_notify_focus): only move on MRU list
	if the window belongs on the workspace, since the FocusIn event
	could be for a window whose workspace we've since switched away
	from.  Possible fix for #122016.

	* src/workspace.c (meta_workspace_contains_window): search for the
	workspace in window->workspaces rather than the window in
	workspace->windows.  Since the number of workspaces is at most 36,
	this is a O(1) lookup rather than a O(n) lookup.  Sorry; couldn't
	resist.
2004-02-28 02:53:56 +00:00
Rob Adams
db108c1fc3 Add my copyright notice to a number of files on which it should already
2004-02-23  Rob Adams  <readams@readams.net>

	Add my copyright notice to a number of files on which it should
	already exist.

	* src/window.c (meta_window_notify_focus): modify code to move to
	front of MRU list so that we can have an assert that it was there
	in the first place.  This code may be causing some crashes.  See
	#131196.
2004-02-23 01:48:29 +00:00
Rob Adams
ad65847d7d reset drag state after shaking loose or reattaching. Fix for #132625.
2004-02-16  Rob Adams  <readams@readams.net>

	* src/window.c (update_move): reset drag state after shaking loose
	or reattaching.  Fix for #132625.
2004-02-16 19:01:25 +00:00
Rob Adams
40a710dad0 Don't show left/right/up/down if a window is sticky. Make "On Top"
2004-01-17  Rob Adams  <readams@readams.net>

	* src/window.c (meta_window_show_menu): Don't show
	left/right/up/down if a window is sticky.  Make "On Top"
	insensitive for docks, splash screens, and desktops since it has
	no effect anyway.
2004-01-17 18:57:26 +00:00
Thomas Fitzsimmons
a605da04c1 Add _NET_FRAME_EXTENTS and _NET_REQUEST_FRAME_EXTENTS.
2004-01-09  Thomas Fitzsimmons  <fitzsim@redhat.com>

	Add _NET_FRAME_EXTENTS and _NET_REQUEST_FRAME_EXTENTS.

	* src/display.c: include xprops.h
	(process_request_frame_extents): new function
	(meta_display_open): add _NET_FRAME_EXTENTS and
	_NET_REQUEST_FRAME_EXTENTS atoms
	(event_callback): handle frame extents message

	* src/display.h (struct _MetaDisplay): add atom_net_frame_extents
	and atom_net_request_frame_extents

	* src/theme.c (meta_pango_font_desc_get_text_height): make font_desc
	parameter const

	* src/ui.c: include prefs.h
	(meta_ui_theme_get_frame_borders): new function

	* src/window.c (update_net_frame_extents): new function
	(meta_window_move_resize_internal): update frame extents
	property when frame geometry changes

	* src/screen.c (set_supported_hint): add atom_net_frame_extents
	and atom_net_request_frame_extents
2004-01-10 17:16:07 +00:00
Rob Adams
2fdb75ad45 Maintain the button grab for sloppy and mouse focus all the time. This
2003-01-04  Rob Adams  <readams@readams.net>

	Maintain the button grab for sloppy and mouse focus all the time.
	This fixes a number of problem introduced by trying to drop the
	grab; we now do this only for click to focus mode.  This has the
	unfortunate effect that #102209 reappears for sloppy and mouse
	focus, but this seems unavoidable, because of limitations in the X
	protocol.  See #115072.

	* src/display.c (meta_display_grab_focus_window_button): #if 0 the
	section on not grabbing unless in click-to-focus mode.

	* src/window.c (meta_window_notify_focus): drop focus button grab
	on FocusIn and acquire it on FocusOut only when in click-to-focus
	mode.
2004-01-05 07:24:32 +00:00
Rob Adams
690100f1ad Reorganize the window menu according to discussion on #110904. The
2003-12-20  Rob Adams  <readams@readams.net>

	Reorganize the window menu according to discussion on #110904.
	The workspace name mnemonic chunk of the patch is thanks to
	Jonathan Blandford.

	* src/common.h: add MENU_OP_ABOVE, MENU_OP_UNABOVE, MENU_UP_MOVE_TO_*
	menu ops.

	* src/core.c (meta_core_get_menu_accelerator): add accelerator for
	the new menu ops.

	* src/menu.c: add checked attribute in _MenuItem struct to display
	a checkmark next to a menu item.  Add the new menu items to
	menuitems.
	(get_workspace_name_with_accel): Add mnemonics even to renamed
	workspaces.
	(menu_item_new): provide support for the checked attribute
	(meta_window_menu_new): construct new submenu for workspace
	switching.

	* src/window.c (menu_callback): implement support for the new menu
	ops.
	(meta_window_show_menu): don't use the OP_*SHAPE operations, and
	compute which of the OP_MOVE_TO_* ops should be used for the
	current workspace and workspace layout.  Add the OP_*ABOVE
	operations.
2003-12-21 06:31:40 +00:00
Rob Adams
191b3f2c21 set on_all_workspaces in all cases _before_ adding to the workspaces, so
2003-12-13  Rob Adams  <readams@readams.net>

	* src/window.c (meta_window_new_with_attrs): set on_all_workspaces
	in all cases _before_ adding to the workspaces, so that windows
	initially on all workspaces are added correctly to the MRU lists.
	Fix for #120907.

	* src/workspace.c (meta_workspace_add_window): handle sticky
	windows so that we add to add mru lists if needed
	(meta_workspace_remove_window): handle sticky windows so that they
	are removed from all mru lists if needed.
2003-12-14 19:19:40 +00:00
Rob Adams
9bde925d3d Revert prior change 2003-12-13 23:00:06 +00:00
Rob Adams
7630d22b8d Add increased robustness for dealing with all workspaces windows and MRU
2003-12-13  Rob Adams  <readams@readams.net>

	Add increased robustness for dealing with all workspaces windows
	and MRU lists.
	Also add very preliminary _NET_WM_USER_TIME
	support, limited to simply listening for the property and keeping
	an internal variable updated, and also treating some input events
	as though they were user time updates.

	* src/window.c (meta_window_new_with_attrs): set on_all_workspaces
	in all cases _before_ adding to the workspaces, so that windows
	initially on all workspaces are added correctly to the MRU lists.
	Fix for #120907.
	(process_property_notify): add net_wm_user_time support.

	* src/workspace.c (meta_workspace_add_window): handle sticky
	windows so that we add to add mru lists if needed
	(meta_workspace_remove_window): handle sticky windows so that they
	are removed from all mru lists if needed.

	* src/display.[ch] (meta_display_open): add net_wm_user_time support.
	(event_callback): simulate user time update on key and button presses.

	* src/screen.c (set_supported_hint): add net_wm_user_time support.

	* src/window-props.c (init_net_wm_user_time): new function for
	user_time support
	(reload_net_wm_user_time): new function for user_time support
	(meta_display_init_window_prop_hooks): add hook for user_time
2003-12-13 18:28:14 +00:00
Havoc Pennington
a92be6e319 unstick window to get it out of mru_list it should not be in; assert that
2003-12-12  Havoc Pennington  <hp@redhat.com>

	* src/window.c (meta_window_free): unstick window to get it out of
	mru_list it should not be in; assert that window has been removed
	from all mru_list. Perhaps fixes #122016 crash.
2003-12-13 03:58:55 +00:00
Havoc Pennington
8d892f76da Oops, did not mean to do that. 2003-11-24 23:05:04 +00:00
Havoc Pennington
03bbe3de17 fix the extension checks
2003-11-24  Havoc Pennington  <hp@redhat.com>

	* src/compositor.c (meta_compositor_new): fix the extension checks
2003-11-24 23:00:52 +00:00
Havoc Pennington
47a1c285c7 init prev_mask field
2003-11-24  Havoc Pennington  <hp@redhat.com>

	* src/iconcache.c (meta_icon_cache_init): init prev_mask field

	* src/window.c (meta_window_new_with_attrs): init xgroup_leader
	prior to use
2003-11-24 19:09:25 +00:00
Havoc Pennington
423b5f5f39 add an event_serial argument and use it when the pointer is already
2003-11-24  Havoc Pennington  <hp@redhat.com>

	* src/display.c (meta_display_begin_grab_op): add an event_serial
	argument and use it when the pointer is already grabbed
	automatically on the button press. May fix bug #126871
2003-11-24 18:09:47 +00:00
Havoc Pennington
feefcdd892 Apply patch from Gregory Merchan to avoid using CurrentTime when setting
2003-11-24  Havoc Pennington  <hp@redhat.com>

	* Apply patch from Gregory Merchan to avoid using CurrentTime when
	setting input focus. Bug #108881
2003-11-24 17:47:48 +00:00
Havoc Pennington
d538690bd4 new function
2003-11-20  Havoc Pennington  <hp@redhat.com>

	* src/window.c (meta_window_new_with_attrs): new function

	* src/display.c, src/screen.c: create the compositor and feed
	windows and events to it
2003-11-21 02:32:05 +00:00
Havoc Pennington
24d8655188 revert the change here
2003-11-20  Havoc Pennington  <hp@redhat.com>

	* src/window.c (meta_window_notify_focus): revert the change here
2003-11-20 05:52:37 +00:00
Rob Adams
917dfefd6c 2003-11-17 Rob Adams <readams@readams.net
* src/window.c (set_allowed_actions_hint): increment i between
	resize and fullscreen.
2003-11-17 16:46:01 +00:00
Rob Adams
9378a4fb4d Create COMPLIANCE document describing metacity specification compliance.
2003-11-16  Rob Adams  <readams@readams.net>

	Create COMPLIANCE document describing metacity specification
	compliance.  Right now gives detailed EWMH compliance; still need
	to add ICCCM compliance information.  Also some minor fixes to
	bring metacity into compliance on some points.

	* COMPLIANCE: new file

	* src/display.h, src/display.c (meta_display_open),
	src/screen.c (set_supported_hint): add
	atom_net_wm_action_fullscreen and atom_net_wm_action_minimize

	* src/window.c (set_allowed_actions_hint): some fixes to which
	hints to set and add fullscreen and minimize.
2003-11-17 00:06:58 +00:00
Rob Adams
67c36f0917 add paranoia check to make sure a window is really on a workspace before
2003-11-16  Rob Adams  <readams@readams.net>

	* src/window.c (meta_window_notify_focus): add paranoia check to
	make sure a window is really on a workspace before inserting it at
	the beginning of the MRU list.  Maybe there's a race condition
	with focusing and workspace switching.  Hopefully a fix for #122016.
2003-11-16 21:50:51 +00:00
Rob Adams
a88f44ea64 don't set window->type_atom here so that the type-inference code will
2003-11-15  Rob Adams  <readams@readams.net>

	* src/window.c (update_net_wm_type): don't set window->type_atom
	here so that the type-inference code will actually be called.  Fix
	for #126873 from Keith Packard.
2003-11-16 03:56:04 +00:00
Rob Adams
3c384d37c6 configure frame first if we grow more than we shrink combined in both
2003-11-08  Rob Adams  <readams@readams.net>

	* src/window.c (meta_window_move_resize_internal): configure frame
	first if we grow more than we shrink combined in both dimensions.
	Patch from Soren Sandmann for #108925.
2003-11-08 17:25:49 +00:00
Rob Adams
17dc2d6151 show the window if it's a transient of a dock or desktop, since otherwise
2003-11-07  Rob Adams  <readams@readams.net>

	* src/window.c (window_should_be_showing): show the window if it's
	a transient of a dock or desktop, since otherwise such windows are
	invisible in show desktop mode.  Fix for #124648.
2003-11-08 05:29:23 +00:00
Havoc Pennington
8658268847 if a window is focused which is not either a dock or a transient in the
2003-10-25  Havoc Pennington  <hp@redhat.com>

	* src/window.c (meta_window_notify_focus): if a window is focused
	which is not either a dock or a transient in the same group as a
	dock, shuffle all dock/desktop windows to the end of the MRU list
	so they won't annoyingly get focus all the time. #123816
2003-10-26 16:22:51 +00:00
Havoc Pennington
6aff3466c6 In the "prefs cause code complexity" department, here's a "sloppy focus
2003-10-13  Havoc Pennington  <hp@redhat.com>

        In the "prefs cause code complexity" department, here's a "sloppy
	focus die die die" kind of moment.

	* src/display.c (meta_display_grab_focus_window_button): don't
	grab in sloppy focus mode, since we were dropping the grab on
	window enter anyway this just removes races from the current
	behavior.

	* src/display.c (prefs_changed_callback): ungrab/grab on focus
	mode changes, since we treat sloppy and click differently.
2003-10-13 20:15:40 +00:00
Havoc Pennington
e98fad3e62 Merge reduced_resources mode patch from the branch. Offers wireframe and
2003-10-12  Havoc Pennington  <hp@redhat.com>

        Merge reduced_resources mode patch from the branch. Offers
	wireframe and no-animations.

	* src/window.c (implement_showing): no animation if we are
	in reduced resources mode

	* src/prefs.c: add REDUCED_RESOURCES pref

	* src/window.c (meta_window_update_keyboard_resize): fix to
	modify grab_anchor_window_pos to grab_wireframe_rect if
	appropriate instead of window->rect

	* src/display.h (struct _MetaDisplay): add grab_start_serial used
	to avoid responding to events that occurred prior to the grab
	initialization.

	Still broken in various ways, specifically EnterNotify that
	occurred prior to XGrabPointer is processed as if it occurred
	after.

	* src/window.c (meta_window_update_keyboard_move): add this
	instead of meta_window_warp_pointer() crack

	* src/effects.c (meta_effects_update_wireframe): draw a kind of
	grid for the wireframe, instead of just a rectangle, like twm

	* src/screen.c (meta_screen_new): line width of 3 for the XOR gc

        "Reduced resources" mode based on wireframe patch from
	Erwann Chenede. Still pretty buggy.

	* src/keybindings.c (process_keyboard_move_grab)
	(process_keyboard_resize_grab): add gruesome wireframe hacks

	* src/display.c (meta_display_end_grab_op): end wireframe
	(meta_display_begin_grab_op): begin wireframe

	* src/effects.c (meta_effects_end_wireframe)
	(meta_effects_update_wireframe, meta_effects_begin_wireframe):
	routines to draw the wireframe stuff

	* src/window.c (window_should_be_showing): hide window when
	doing wireframe, commented out as it breaks grab
	* src/window.c (meta_window_refresh_resize_popup): handle wireframe

	* src/screen.c (meta_screen_new): create a screen->root_xor_gc
	for use in drawing wireframes

	* src/frames.c (meta_frames_push_delay_exposes): repaint
	everything before we delay
2003-10-12 06:25:38 +00:00
Havoc Pennington
199d20197e add the moveresize idle at META_PRIORITY_RESIZE so it runs before GTK does
2003-09-30  Havoc Pennington  <hp@redhat.com>

	* src/window.c (meta_window_queue_move_resize): add the moveresize
	idle at META_PRIORITY_RESIZE so it runs before GTK does any
	drawing, may fix bug #109211 (seem to for me)

	* src/ui.h (META_PRIORITY_RESIZE): add this between GTK
	resize/redraw priorities

	* src/display.c (meta_display_queue_retheme_all_windows): remove
	some debug spew from meta_warning
2003-09-30 20:36:02 +00:00
Rached Ben Mustapha
37640a925e Fix bug #118428
2003-07-28  Rached Ben Mustapha <rached@benmur.net>

        Fix bug #118428

        * src/window.c (redraw_icon): Also redraw window icon if the window
	is not mapped but its frame is.
	(idle_update_icon): Unset the window->update_icon_queued flag.
2003-09-30 19:45:56 +00:00
Rob Adams
dc40522ea7 Fix bug where multiple entries could appear in MRU lists, or no entry when
2003-09-20  Rob Adams <readams@readams.net>

	Fix bug where multiple entries could appear in MRU lists, or no
	entry when sticking/unsticking windows.  Fix for #122016

	* src/window.c (meta_window_stick): use window->screen->workspaces
	instead of window->workspaces.
	(meta_window_unstick): use window->screen->workspaces instead of
	window->workspaces.
2003-09-20 17:05:35 +00:00
Rob Adams
de44b2d794 Fix a bug with partial-width panel struts caused by incorrect computation
2003-09-19  Rob Adams <readams@readams.net>

	Fix a bug with partial-width panel struts caused by incorrect
	computation of rectangle widths, and another when using different
	screen resolutions on xineramas.  See #122404.  Also fix a crash
	bug with the MRU list when sticking and unsticking windows.  See
	#120809.

	* src/constraints.c (get_outermost_onscreen_positions): Fix
	off-by-one error with partial-width struts.

	* src/window.c (meta_window_update_struts): Fix off-by-one error
	with partial-width struts.
	(meta_window_stick): assign back to GList after g_list_append
	(meta_window_unstick): assign back to GList after g_list_append

	* src/workspace.c (ensure_work_areas_validated): For right and
	bottom struts, compute strut relative to root window and not to
	xinerama edge in compliance with EWMH recommendations.
2003-09-20 04:58:25 +00:00
Rob Adams
dbcf03535d Complete the transition to using the MRU window as the default focus
2003-08-20  Rob Adams  <robadams@ucla.edu>

	Complete the transition to using the MRU window as the default
	focus window instead of the topmost window; fixes a number of
	problems with sloppy focus and utility windows.  See #112031.

	* src/window.c (meta_window_free): call
	meta_workspace_focus_mru_window
	(meta_window_minimize): call meta_workspace_focus_mru_window
2003-08-21 04:32:21 +00:00
Ray Strode
2fc880db19 Changed MRU list to be per workspace instead of per display, so sticky
2003-08-15  Ray Strode  <halfline@hawaii.rr.com>

	Changed MRU list to be per workspace instead of per display, so
	sticky windows don't hijack the window focus after workspace
	switching (Bug #97635).

	* src/delete.c (meta_window_delete): Use
	meta_workspace_focus_top_window instead of
	meta_screen_focus_top_window.

	* src/display.c (meta_display_open): Stop using display->mru_list.
	(find_tab_forward):
	(find_tab_backward):
	(meta_display_get_tab_list): Use workspace->mru_list instead of
	display->mru_list and remove unneeded calls to
	meta_window_visible_on_workspace

	* src/display.h: Remove mru_list from MetaDisplay

	* src/keybindings.c (handle_toggle_desktop): Use
	meta_workspace_focus_top_window instead of
	meta_screen_focus_top_window.

	* src/screen.c (meta_screen_focus_top_window):
	(meta_screen_focus_default_window): Remove functions.
	(meta_screen_show_desktop): Use meta_workspace_focus_top_window
	instead of meta_screen_focus_top_window.

	* src/screen.h: Remove meta_screen_focus_top_window and
	meta_screen_focus_default_window declarations.

	* src/window.c (meta_window_new): Stop using display->mru_list.
	(meta_window_free): Use meta_workspace_focus_top_window
	instead of meta_screen_focus_top_window and stop using
	display->mru_list.
	(meta_window_stick): Add sticky window to all workspace MRU lists.
	(meta_window_unstick): Remove non-sticky window from the workspace
	MRU lists it doesn't belong in.
	(meta_window_notify_focus): Move newly focused window to the front
	of active workspace's MRU list.

	* src/workspace.c (meta_workspace_new): Initialize
	workspace->mru_list to NULL.
	(meta_workspace_add_window): Add window to workspace's MRU list.
	(meta_workspace_remove_window): Remove window from workspace's MRU
	list.
	(meta_workspace_activate_with_focus): Use
	meta_workspace_focus_default_window instead of
	meta_screen_focus_default_window.
	(meta_workspace_focus_default_window):
	(meta_workspace_focus_mru_window):
	(meta_workspace_focus_top_window): Add functions.

	* src/workspace.h: Add mru_list to MetaWorkspace and add function
	declarations for meta_workspace_focus_default_window,
	meta_workspace_focus_mru_window, meta_workspace_focus_top_window.
2003-08-15 22:09:55 +00:00
Rob Adams
5727235572 Update window shaking loose so that the window is moved to the pointer and
2003-07-27  Rob Adams  <robadams@ucla.edu>

	* src/window.c (update_move):  Update window shaking loose so that
	the window is moved to the pointer and certain drag state is
	properly restored once windows "reattach".  Fix for #115000 based
	on the patch by Jurg Billeter.

	* src/screen.c (meta_screen_resize): Invalidate work areas after
	an xrandr screen size update.  Fix for #117230.

	* src/stack.c (window_is_fullscreen_size): Check the bottom corner
	of the window in addition to the top corner.  Fix for #118194.

	* src/constraints.c (meta_window_constrain): Support aspect ratio
	hints in the new constraints code.  Fix for #113798.

	* src/tools/metacity-window-demo.c (toggle_aspect_ratio): toggle
	the aspect ratio hints to force a 16:9 aspect ratio.
	(do_appwindow): add a button to toggle aspect ratio.
2003-07-28 02:09:20 +00:00
Rob Adams
d08fa29612 Update grab state when we unmaximize so double-clicking doesn't cause
2003-06-20  Rob Adams  <robadams@ucla.edu>

	* src/window.c (meta_window_unmaximize): Update grab state when we
	unmaximize so double-clicking doesn't cause weird window-jumping
	problems.  See #116292.
2003-06-30 14:49:11 +00:00
Havoc Pennington
fa075eb8f1 nuke the lists of struts here, to improve confidence that we never try to
2003-06-26  Havoc Pennington  <hp@pobox.com>

	* src/workspace.c (meta_workspace_invalidate_work_area): nuke the
	lists of struts here, to improve confidence that we never try to
	use them after a window with rects in the list gets freed.
	(it wasn't broken before I don't think, just making the
	code more robust against future mods)

	* src/window.c (meta_window_update_struts): replace magic "75"
	with a macro

	* src/constraints.c (constraint_hints_applies_func): don't apply
	hints to maximized or fullscreen, rather than only fullscreen
	(constrain_move): add paranoia max number of iterations to the
	heuristic loop
2003-06-28 16:12:32 +00:00
Rob Adams
34ec58af0a Add keybinding to allow the user to toggle _NET_WM_STATE_ABOVE on windows.
2003-06-26  Rob Adams  <robadams@ucla.edu>

	Add keybinding to allow the user to toggle _NET_WM_STATE_ABOVE on
	windows.  Disabled by default.  See #98387.

	* src/keybindings.c (handle_toggle_above): new function implements
	the keybinding

	* src/metacity.schemas.in: add toggle_above keybinding

	* src/prefs.[ch]: add toggle_above keybinding

	* src/window.[ch] (meta_window_make_above): new function to put a
	window into the above state
	(meta_window_unmake_above): new function takes a window out of the
	above state
2003-06-27 14:49:56 +00:00
Rob Adams
971f3f1207 Update constraints code to support the new _NET_WM_STRUT_PARTIAL EWMH
2003-06-10  Rob Adams  <robadams@ucla.edu>

	Update constraints code to support the new _NET_WM_STRUT_PARTIAL
	EWMH draft specification.  See #86682.  Also, fix a bug involving
	work area invalidation on metacity startup.  Fix for #108497.
	Finally, some minor fixes for full screen windows.

	* src/window.h: Add new MetaStruts structure to store strut rects
	for a window.  Remove has_struts and do_not_cover flag, and
	support new MetaStruts instead of the four ints.

	* src/window.c (meta_window_new): change initialization to work
	with new struts.  Also, move meta_window_update_struts call to
	after the workspaces are initialized to fix #108497.  Remove
	do_not_cover and related code.
	(process_property_notify): add strut_partial
	(update_struts): change function name to meta_window_update_struts
	and expose in external MetaWindow API.  Support partial width
	struts and the new strut rects.

	* src/workspace.h: add new GSLists containing pointers to all
	relevant struts for this workspace.

	* src/workspace.c (meta_workspace_new): initialize the list of
	strut rects for this workspace.
	(meta_workspace_free): free the strut rect lists
	(ensure_work_areas_validated): support new struts and new strut
	rect lists.  Unleash the per-xinerama work areas.

	* src/constraints.c (get_outermost_onscreen_positions): Use the
	current window position along with the new per-workspace strut
	rects to compute the constraints that apply to a particular
	window.
	(constraint_hint_applies_func): don't do hints constraints on
	fullscreen windows
	(update_position_limits): for maximized windows use the work areas
	to set the position limits; for other windows rely on the struts
	constraints to be computed later in
	get_outermost_onscreen_positions
	(meta_window_constrain): don't apply aspect ratio hints to full
	screen windows

	* src/display.c (meta_display_open): add _NET_WM_STRUT_PARTIAL atom
	(meta_rectangle_equal): new helper function for MetaRectangles
	(event_queue_callback): #ifndef out if USE_GDK_DISPLAY not set to
	avoid compiler warning

	* src/display.h: add atom_net_wm_strut_partial, and add
	meta_rectangle_equal.

	* src/screen.c (meta_screen_rect_intersects_xinerama): change
	_window_intersects_ to _rect_intersects_ which is more useful now.
	(meta_screen_resize_func): update struts on windows with struts
	since struts are relative to the screen size, and this function is
	called when the screen size updates.

	* src/screen.h (meta_screen_rect_intersects_xinerama): change
	_window_intersects_ to _rect_intersects_ which is more useful now.

	* src/window-props.c (meta_display_init_window_prop_hooks): add
	hook for strut_partial

	* src/tools/metacity-window-demo.c: Support partial-width struts
	on the dock window tests for metacity testing purposes.
2003-06-26 03:09:38 +00:00
Rob Adams
85826d0d9a Remove legacy support for Gnome 1 hints, since we deem it unlikely that
2003-06-12  Rob Adams  <robadams@ucla.edu>

	Remove legacy support for Gnome 1 hints, since we deem it unlikely
	that anyone is running a current metacity with Gnome 1.  The
	removed hints are _WIN_WORKSPACE, _WIN_LAYER, _WIN_PROTOCOLS,
	_WIN_SUPPORTING_WM_CHECK, and _WIN_HINTS.

	* display.c (meta_display_open): remove hints

	* display.h: remove atoms for hints

	* screen.c (set_wm_check_hint): don't set legacy hint
	(set_supported_hint): don't set legacy hint

	* window-props.c (init_win_workspace): removed
	(reload_win_workspace): removed
	(meta_display_init_window_prop_hooks): remove hints

	* window.h: remove do_not_cover flag

	* window.c: remove GnomeWinHints enum
	(recalc_do_not_cover_struts): removed
	(meta_window_new): don't initialize removed flags or compute
	legacy struts
	(move_resize_cmp): removed
	(idle_move_resize): Don't bother sorting the idle queue
	(meta_window_client_message): don't set legacy hint
	(process_property_notify): remove hints
	(update_net_wm_type): don't fall back to WIN_LAYER hint
	(update_struts): remove legacy struts
2003-06-12 07:03:04 +00:00
Havoc Pennington
0a20419628 make raise-on-click explicitly only happen in click to focus mode.
2003-06-12  Havoc Pennington  <hp@pobox.com>

	* src/display.c (event_callback): make raise-on-click explicitly
	only happen in click to focus mode.

	* src/window.c (update_move): apply patch from Jurg Billeter to
	allow you to "shake loose" maximized windows and move them between
	Xinerama heads. #93586

	* src/display.c: delete event_queue_callback

	* src/display.h (struct _MetaDisplay): get rid of
	grab_current_window_pos and grab_current_root_[xy] as I could find
	absolutely no code using them for anything. They were just sort of
	randomly assigned to for no apparent reason.

	* src/display.c (event_callback): double-click timeout is per
	screen, so get the screen and pass screen->ui to
	meta_ui_get_double_click_timeout()

	* src/ui.c (meta_ui_get_double_click_timeout): take a MetaUI
	argument so we get the right settings for each screen
	(meta_ui_get_drag_threshold): new function
2003-06-12 05:55:06 +00:00
Rob Adams
010e620a34 Revamp placement policy for windows that are maximized when they are
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-06-09 23:49:02 +00:00