2006-10-01 18:30:10 -04:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
/* Metacity Workspaces */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2001 Havoc Pennington
|
2004-02-22 20:48:29 -05:00
|
|
|
* Copyright (C) 2003 Rob Adams
|
2005-10-08 15:38:54 -04:00
|
|
|
* Copyright (C) 2004, 2005 Elijah Newren
|
2001-06-06 00:47:37 -04:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
* 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2002-06-08 23:44:16 -04:00
|
|
|
#include <config.h>
|
2001-06-06 00:47:37 -04:00
|
|
|
#include "workspace.h"
|
2001-06-09 01:14:43 -04:00
|
|
|
#include "errors.h"
|
2002-11-03 14:06:39 -05:00
|
|
|
#include "prefs.h"
|
2001-06-09 01:14:43 -04:00
|
|
|
#include <X11/Xatom.h>
|
2002-06-22 00:52:35 -04:00
|
|
|
#include <string.h>
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2005-02-02 13:46:09 -05:00
|
|
|
void meta_workspace_queue_calc_showing (MetaWorkspace *workspace);
|
|
|
|
static void set_active_space_hint (MetaScreen *screen);
|
|
|
|
static void focus_ancestor_or_mru_window (MetaWorkspace *workspace,
|
|
|
|
MetaWindow *not_this_one,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
guint32 timestamp);
|
2001-06-09 01:14:43 -04:00
|
|
|
|
2004-08-27 13:22:54 -04:00
|
|
|
static void
|
|
|
|
maybe_add_to_list (MetaScreen *screen, MetaWindow *window, gpointer data)
|
|
|
|
{
|
|
|
|
GList **mru_list = data;
|
|
|
|
|
|
|
|
if (window->on_all_workspaces)
|
|
|
|
*mru_list = g_list_prepend (*mru_list, window);
|
|
|
|
}
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
MetaWorkspace*
|
|
|
|
meta_workspace_new (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
MetaWorkspace *workspace;
|
|
|
|
|
|
|
|
workspace = g_new (MetaWorkspace, 1);
|
|
|
|
|
|
|
|
workspace->screen = screen;
|
2002-10-16 16:12:24 -04:00
|
|
|
workspace->screen->workspaces =
|
|
|
|
g_list_append (workspace->screen->workspaces, workspace);
|
2001-06-06 00:47:37 -04:00
|
|
|
workspace->windows = NULL;
|
2003-08-15 18:09:55 -04:00
|
|
|
workspace->mru_list = NULL;
|
2004-08-27 13:22:54 -04:00
|
|
|
meta_screen_foreach_window (screen, maybe_add_to_list, &workspace->mru_list);
|
2001-06-07 01:18:10 -04:00
|
|
|
|
2003-02-23 12:09:46 -05:00
|
|
|
workspace->work_areas_invalid = TRUE;
|
Merge of all the changes on the constraints_experiments branch. This is
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-11-19 09:58:50 -05:00
|
|
|
workspace->work_area_xinerama = NULL;
|
|
|
|
workspace->work_area_screen.x = 0;
|
|
|
|
workspace->work_area_screen.y = 0;
|
|
|
|
workspace->work_area_screen.width = 0;
|
|
|
|
workspace->work_area_screen.height = 0;
|
2003-06-25 23:09:38 -04:00
|
|
|
|
Merge of all the changes on the constraints_experiments branch. This is
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-11-19 09:58:50 -05:00
|
|
|
workspace->screen_region = NULL;
|
|
|
|
workspace->xinerama_region = NULL;
|
|
|
|
workspace->screen_edges = NULL;
|
|
|
|
workspace->xinerama_edges = NULL;
|
2006-02-11 00:06:08 -05:00
|
|
|
workspace->list_containing_self = g_list_prepend (NULL, workspace);
|
Merge of all the changes on the constraints_experiments branch. This is
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-11-19 09:58:50 -05:00
|
|
|
|
|
|
|
workspace->all_struts = NULL;
|
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 00:28:29 -04:00
|
|
|
|
|
|
|
workspace->showing_desktop = FALSE;
|
2002-01-10 01:31:31 -05:00
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
return workspace;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_workspace_free (MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
GList *tmp;
|
2001-12-09 22:55:26 -05:00
|
|
|
MetaScreen *screen;
|
Merge of all the changes on the constraints_experiments branch. This is
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-11-19 09:58:50 -05:00
|
|
|
int i;
|
2001-12-09 22:55:26 -05:00
|
|
|
|
|
|
|
g_return_if_fail (workspace != workspace->screen->active_workspace);
|
|
|
|
|
|
|
|
/* Here we assume all the windows are already on another workspace
|
|
|
|
* as well, so they won't be "orphaned"
|
|
|
|
*/
|
2001-06-06 00:47:37 -04:00
|
|
|
|
|
|
|
tmp = workspace->windows;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
GList *next;
|
2001-12-09 22:55:26 -05:00
|
|
|
MetaWindow *window = tmp->data;
|
2001-06-06 00:47:37 -04:00
|
|
|
next = tmp->next;
|
2001-12-09 22:55:26 -05:00
|
|
|
|
|
|
|
/* pop front of list we're iterating over */
|
|
|
|
meta_workspace_remove_window (workspace, window);
|
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 18:52:52 -05:00
|
|
|
g_assert (window->workspace != NULL);
|
2001-06-06 00:47:37 -04:00
|
|
|
|
|
|
|
tmp = next;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_assert (workspace->windows == NULL);
|
2001-12-09 22:55:26 -05:00
|
|
|
|
|
|
|
screen = workspace->screen;
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2002-10-16 16:12:24 -04:00
|
|
|
workspace->screen->workspaces =
|
|
|
|
g_list_remove (workspace->screen->workspaces, workspace);
|
2002-06-22 00:52:35 -04:00
|
|
|
|
Merge of all the changes on the constraints_experiments branch. This is
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-11-19 09:58:50 -05:00
|
|
|
g_free (workspace->work_area_xinerama);
|
2003-06-25 23:09:38 -04:00
|
|
|
|
2003-12-17 11:01:00 -05:00
|
|
|
g_list_free (workspace->mru_list);
|
Merge of all the changes on the constraints_experiments branch. This is
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-11-19 09:58:50 -05:00
|
|
|
g_slist_free (workspace->all_struts);
|
2006-02-11 00:06:08 -05:00
|
|
|
g_list_free (workspace->list_containing_self);
|
Merge of all the changes on the constraints_experiments branch. This is
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-11-19 09:58:50 -05:00
|
|
|
|
|
|
|
for (i = 0; i < screen->n_xinerama_infos; i++)
|
|
|
|
meta_rectangle_free_list_and_elements (workspace->xinerama_region[i]);
|
|
|
|
g_free (workspace->xinerama_region);
|
|
|
|
meta_rectangle_free_list_and_elements (workspace->screen_region);
|
|
|
|
meta_rectangle_free_list_and_elements (workspace->screen_edges);
|
|
|
|
meta_rectangle_free_list_and_elements (workspace->xinerama_edges);
|
2003-06-25 23:09:38 -04:00
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
g_free (workspace);
|
2001-12-09 22:55:26 -05:00
|
|
|
|
2002-06-22 00:52:35 -04:00
|
|
|
/* don't bother to reset names, pagers can just ignore
|
|
|
|
* extra ones
|
|
|
|
*/
|
2001-06-06 00:47:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_workspace_add_window (MetaWorkspace *workspace,
|
|
|
|
MetaWindow *window)
|
|
|
|
{
|
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 18:52:52 -05:00
|
|
|
g_return_if_fail (window->workspace == NULL);
|
2001-06-09 23:17:15 -04:00
|
|
|
|
2003-12-14 14:19:40 -05:00
|
|
|
/* If the window is on all workspaces, we want to add it to all mru
|
|
|
|
* lists, otherwise just add it to this workspaces mru list
|
|
|
|
*/
|
|
|
|
if (window->on_all_workspaces)
|
|
|
|
{
|
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 18:52:52 -05:00
|
|
|
if (window->workspace == NULL)
|
2003-12-14 14:19:40 -05:00
|
|
|
{
|
|
|
|
GList* tmp = window->screen->workspaces;
|
|
|
|
while (tmp)
|
|
|
|
{
|
|
|
|
MetaWorkspace* work = (MetaWorkspace*) tmp->data;
|
|
|
|
if (!g_list_find (work->mru_list, window))
|
2004-02-15 09:27:43 -05:00
|
|
|
work->mru_list = g_list_prepend (work->mru_list, window);
|
2003-12-14 14:19:40 -05:00
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_assert (g_list_find (workspace->mru_list, window) == NULL);
|
2004-02-15 09:27:43 -05:00
|
|
|
workspace->mru_list = g_list_prepend (workspace->mru_list, window);
|
2003-12-14 14:19:40 -05:00
|
|
|
}
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
workspace->windows = g_list_prepend (workspace->windows, window);
|
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 18:52:52 -05:00
|
|
|
window->workspace = workspace;
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2001-06-09 23:17:15 -04:00
|
|
|
meta_window_set_current_workspace_hint (window);
|
2001-06-09 01:14:43 -04:00
|
|
|
|
2003-06-25 23:09:38 -04:00
|
|
|
if (window->struts)
|
2002-02-07 22:34:26 -05:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
|
|
|
"Invalidating work area of workspace %d since we're adding window %s to it\n",
|
|
|
|
meta_workspace_index (workspace), window->desc);
|
|
|
|
meta_workspace_invalidate_work_area (workspace);
|
|
|
|
}
|
2002-01-10 01:31:31 -05:00
|
|
|
|
|
|
|
/* queue a move_resize since changing workspaces may change
|
|
|
|
* the relevant struts
|
|
|
|
*/
|
Refactor thrice-duplicated queue code in window.c. Closes #376760.
2007-06-10 Thomas Thurman <thomas@thurman.org.uk>
Refactor thrice-duplicated queue code in window.c. Closes #376760.
* src/window.c (meta_window_queue, meta_window_unqueue):
New functions.
* src/window.[ch] (meta_window_unqueue_*, meta_window_queue_*):
Removed functions.
* src/window.c (meta_window_new_with_attrs, meta_window_free,
meta_window_flush_calc_showing, queue_calc_showing_func,
meta_window_minimize, meta_window_unminimize, meta_window_maximize,
meta_window_make_fullscreen, meta_window_shade,
meta_window_unshade, meta_window_move_resize_internal,
window_stick_impl, window_unstick_impl,
meta_window_client_message, process_property_notify): Modified to
use new queueing functions.
* src/window.c (idle_move_resize, idle_update_icon,
idle_calc_showing): update to receive queue number from pointer.
* src/window.h (MetaQueueType): new enum.
* src/window.h (MetaWindow): *_queued replaced with is_in_queue
bitfield.
* src/core.c (meta_core_queue_frame_resize):
* src/display.c (event_callback,
meta_display_queue_retheme_all_windows): Using new queueing functions.
* src/frame.c (meta_window_destroy_frame): Using new queueing functions.
* src/screen.c (queue_resize, meta_screen_resize_func,
queue_windows_showing): Using new queueing functions.
* src/window-props.c (reload_mwm_hints, reload_wm_hints,
reload_transient_for): Using new queueing functions.
* src/workspace.c (meta_workspace_add_window,
meta_workspace_remove_window, meta_workspace_queue_calc_showing,
meta_workspace_invalidate_work_area): Using new queueing functions.
svn path=/trunk/; revision=3236
2007-06-10 21:15:33 -04:00
|
|
|
meta_window_queue (window, META_QUEUE_CALC_SHOWING|META_QUEUE_MOVE_RESIZE);
|
2001-06-06 00:47:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_workspace_remove_window (MetaWorkspace *workspace,
|
|
|
|
MetaWindow *window)
|
|
|
|
{
|
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 18:52:52 -05:00
|
|
|
g_return_if_fail (window->workspace == workspace);
|
2001-06-06 00:47:37 -04:00
|
|
|
|
|
|
|
workspace->windows = g_list_remove (workspace->windows, window);
|
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 18:52:52 -05:00
|
|
|
window->workspace = NULL;
|
2003-12-14 14:19:40 -05:00
|
|
|
|
|
|
|
/* If the window is on all workspaces, we don't want to remove it
|
|
|
|
* from the MRU list unless this causes it to be removed from all
|
|
|
|
* workspaces
|
|
|
|
*/
|
|
|
|
if (window->on_all_workspaces)
|
|
|
|
{
|
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 18:52:52 -05:00
|
|
|
GList* tmp = window->screen->workspaces;
|
|
|
|
while (tmp)
|
2003-12-14 14:19:40 -05:00
|
|
|
{
|
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 18:52:52 -05:00
|
|
|
MetaWorkspace* work = (MetaWorkspace*) tmp->data;
|
|
|
|
work->mru_list = g_list_remove (work->mru_list, window);
|
2003-12-14 14:19:40 -05:00
|
|
|
|
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 18:52:52 -05:00
|
|
|
tmp = tmp->next;
|
2003-12-14 14:19:40 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
workspace->mru_list = g_list_remove (workspace->mru_list, window);
|
|
|
|
g_assert (g_list_find (workspace->mru_list, window) == NULL);
|
|
|
|
}
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2001-06-09 23:17:15 -04:00
|
|
|
meta_window_set_current_workspace_hint (window);
|
2001-06-09 01:14:43 -04:00
|
|
|
|
2003-06-25 23:09:38 -04:00
|
|
|
if (window->struts)
|
2002-02-07 22:34:26 -05:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
|
|
|
"Invalidating work area of workspace %d since we're removing window %s from it\n",
|
|
|
|
meta_workspace_index (workspace), window->desc);
|
|
|
|
meta_workspace_invalidate_work_area (workspace);
|
|
|
|
}
|
2002-01-10 01:31:31 -05:00
|
|
|
|
|
|
|
/* queue a move_resize since changing workspaces may change
|
|
|
|
* the relevant struts
|
|
|
|
*/
|
Refactor thrice-duplicated queue code in window.c. Closes #376760.
2007-06-10 Thomas Thurman <thomas@thurman.org.uk>
Refactor thrice-duplicated queue code in window.c. Closes #376760.
* src/window.c (meta_window_queue, meta_window_unqueue):
New functions.
* src/window.[ch] (meta_window_unqueue_*, meta_window_queue_*):
Removed functions.
* src/window.c (meta_window_new_with_attrs, meta_window_free,
meta_window_flush_calc_showing, queue_calc_showing_func,
meta_window_minimize, meta_window_unminimize, meta_window_maximize,
meta_window_make_fullscreen, meta_window_shade,
meta_window_unshade, meta_window_move_resize_internal,
window_stick_impl, window_unstick_impl,
meta_window_client_message, process_property_notify): Modified to
use new queueing functions.
* src/window.c (idle_move_resize, idle_update_icon,
idle_calc_showing): update to receive queue number from pointer.
* src/window.h (MetaQueueType): new enum.
* src/window.h (MetaWindow): *_queued replaced with is_in_queue
bitfield.
* src/core.c (meta_core_queue_frame_resize):
* src/display.c (event_callback,
meta_display_queue_retheme_all_windows): Using new queueing functions.
* src/frame.c (meta_window_destroy_frame): Using new queueing functions.
* src/screen.c (queue_resize, meta_screen_resize_func,
queue_windows_showing): Using new queueing functions.
* src/window-props.c (reload_mwm_hints, reload_wm_hints,
reload_transient_for): Using new queueing functions.
* src/workspace.c (meta_workspace_add_window,
meta_workspace_remove_window, meta_workspace_queue_calc_showing,
meta_workspace_invalidate_work_area): Using new queueing functions.
svn path=/trunk/; revision=3236
2007-06-10 21:15:33 -04:00
|
|
|
meta_window_queue (window, META_QUEUE_CALC_SHOWING|META_QUEUE_MOVE_RESIZE);
|
2001-06-06 00:47:37 -04:00
|
|
|
}
|
|
|
|
|
2001-12-09 22:55:26 -05:00
|
|
|
void
|
|
|
|
meta_workspace_relocate_windows (MetaWorkspace *workspace,
|
|
|
|
MetaWorkspace *new_home)
|
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
GList *copy;
|
|
|
|
|
|
|
|
g_return_if_fail (workspace != new_home);
|
|
|
|
|
|
|
|
/* can't modify list we're iterating over */
|
|
|
|
copy = g_list_copy (workspace->windows);
|
|
|
|
|
|
|
|
tmp = copy;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *window = tmp->data;
|
|
|
|
|
|
|
|
meta_workspace_remove_window (workspace, window);
|
2005-10-08 19:18:05 -04:00
|
|
|
meta_workspace_add_window (new_home, window);
|
2001-12-09 22:55:26 -05:00
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (copy);
|
|
|
|
|
|
|
|
g_assert (workspace->windows == NULL);
|
|
|
|
}
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
void
|
|
|
|
meta_workspace_queue_calc_showing (MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
|
|
|
|
tmp = workspace->windows;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
Refactor thrice-duplicated queue code in window.c. Closes #376760.
2007-06-10 Thomas Thurman <thomas@thurman.org.uk>
Refactor thrice-duplicated queue code in window.c. Closes #376760.
* src/window.c (meta_window_queue, meta_window_unqueue):
New functions.
* src/window.[ch] (meta_window_unqueue_*, meta_window_queue_*):
Removed functions.
* src/window.c (meta_window_new_with_attrs, meta_window_free,
meta_window_flush_calc_showing, queue_calc_showing_func,
meta_window_minimize, meta_window_unminimize, meta_window_maximize,
meta_window_make_fullscreen, meta_window_shade,
meta_window_unshade, meta_window_move_resize_internal,
window_stick_impl, window_unstick_impl,
meta_window_client_message, process_property_notify): Modified to
use new queueing functions.
* src/window.c (idle_move_resize, idle_update_icon,
idle_calc_showing): update to receive queue number from pointer.
* src/window.h (MetaQueueType): new enum.
* src/window.h (MetaWindow): *_queued replaced with is_in_queue
bitfield.
* src/core.c (meta_core_queue_frame_resize):
* src/display.c (event_callback,
meta_display_queue_retheme_all_windows): Using new queueing functions.
* src/frame.c (meta_window_destroy_frame): Using new queueing functions.
* src/screen.c (queue_resize, meta_screen_resize_func,
queue_windows_showing): Using new queueing functions.
* src/window-props.c (reload_mwm_hints, reload_wm_hints,
reload_transient_for): Using new queueing functions.
* src/workspace.c (meta_workspace_add_window,
meta_workspace_remove_window, meta_workspace_queue_calc_showing,
meta_workspace_invalidate_work_area): Using new queueing functions.
svn path=/trunk/; revision=3236
2007-06-10 21:15:33 -04:00
|
|
|
meta_window_queue (tmp->data, META_QUEUE_CALC_SHOWING);
|
2001-06-06 00:47:37 -04:00
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-05-30 16:24:00 -04:00
|
|
|
meta_workspace_activate_with_focus (MetaWorkspace *workspace,
|
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 16:32:59 -04:00
|
|
|
MetaWindow *focus_this,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
guint32 timestamp)
|
2001-06-06 00:47:37 -04:00
|
|
|
{
|
|
|
|
MetaWorkspace *old;
|
2004-02-15 00:29:49 -05:00
|
|
|
MetaWindow *move_window;
|
2001-06-06 00:47:37 -04:00
|
|
|
|
|
|
|
meta_verbose ("Activating workspace %d\n",
|
|
|
|
meta_workspace_index (workspace));
|
|
|
|
|
|
|
|
if (workspace->screen->active_workspace == workspace)
|
|
|
|
return;
|
|
|
|
|
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 00:28:29 -04:00
|
|
|
/* Note that old can be NULL; e.g. when starting up */
|
2001-06-06 00:47:37 -04:00
|
|
|
old = workspace->screen->active_workspace;
|
|
|
|
|
|
|
|
workspace->screen->active_workspace = workspace;
|
|
|
|
|
2001-06-09 23:17:15 -04:00
|
|
|
set_active_space_hint (workspace->screen);
|
2002-08-04 16:17:37 -04:00
|
|
|
|
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 00:28:29 -04:00
|
|
|
/* If the "show desktop" mode is active for either the old workspace
|
|
|
|
* or the new one *but not both*, then update the
|
|
|
|
* _net_showing_desktop hint
|
|
|
|
*/
|
|
|
|
if (old && (old->showing_desktop ^ workspace->showing_desktop))
|
|
|
|
meta_screen_update_showing_desktop_hint (workspace->screen);
|
|
|
|
|
2002-08-04 16:17:37 -04:00
|
|
|
if (old == NULL)
|
|
|
|
return;
|
|
|
|
|
2004-02-15 00:29:49 -05:00
|
|
|
move_window = NULL;
|
|
|
|
if (workspace->screen->display->grab_op == META_GRAB_OP_MOVING ||
|
|
|
|
workspace->screen->display->grab_op == META_GRAB_OP_KEYBOARD_MOVING)
|
|
|
|
move_window = workspace->screen->display->grab_window;
|
|
|
|
|
|
|
|
if (move_window != NULL)
|
|
|
|
{
|
|
|
|
if (move_window->on_all_workspaces)
|
|
|
|
move_window = NULL; /* don't move it after all */
|
|
|
|
|
|
|
|
/* We put the window on the new workspace, flip spaces,
|
|
|
|
* then remove from old workspace, so the window
|
|
|
|
* never gets unmapped and we maintain the button grab
|
|
|
|
* on it.
|
|
|
|
*/
|
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 18:52:52 -05:00
|
|
|
if (move_window && (move_window->workspace != workspace))
|
2004-02-15 00:29:49 -05:00
|
|
|
{
|
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 18:52:52 -05:00
|
|
|
meta_workspace_remove_window (workspace, move_window);
|
|
|
|
meta_workspace_add_window (workspace, move_window);
|
2004-02-15 00:29:49 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
meta_workspace_queue_calc_showing (old);
|
|
|
|
meta_workspace_queue_calc_showing (workspace);
|
2002-01-03 18:28:19 -05:00
|
|
|
|
2005-02-21 21:11:25 -05:00
|
|
|
/* FIXME: Why do we need this?!? Isn't it handled in the lines above? */
|
2004-02-15 00:29:49 -05:00
|
|
|
if (move_window)
|
|
|
|
/* Removes window from other spaces */
|
|
|
|
meta_window_change_workspace (move_window, workspace);
|
|
|
|
|
2003-05-30 16:24:00 -04:00
|
|
|
if (focus_this)
|
|
|
|
{
|
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 16:32:59 -04:00
|
|
|
meta_window_focus (focus_this, timestamp);
|
2003-05-30 16:24:00 -04:00
|
|
|
meta_window_raise (focus_this);
|
|
|
|
}
|
2004-02-15 00:29:49 -05:00
|
|
|
else if (move_window)
|
|
|
|
{
|
|
|
|
meta_window_raise (move_window);
|
|
|
|
}
|
2003-05-30 16:24:00 -04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS, "Focusing default window on new workspace\n");
|
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 16:32:59 -04:00
|
|
|
meta_workspace_focus_default_window (workspace, NULL, timestamp);
|
2003-05-30 16:24:00 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
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 16:32:59 -04:00
|
|
|
meta_workspace_activate (MetaWorkspace *workspace,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
guint32 timestamp)
|
2003-05-30 16:24:00 -04:00
|
|
|
{
|
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 16:32:59 -04:00
|
|
|
meta_workspace_activate_with_focus (workspace, NULL, timestamp);
|
2001-06-06 00:47:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
meta_workspace_index (MetaWorkspace *workspace)
|
|
|
|
{
|
2007-12-21 14:56:07 -05:00
|
|
|
int ret;
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2007-12-21 14:56:07 -05:00
|
|
|
ret = g_list_index (workspace->screen->workspaces, workspace);
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2007-12-21 14:56:07 -05:00
|
|
|
if (ret < 0)
|
|
|
|
meta_bug ("Workspace does not exist to index!\n");
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2007-12-21 14:56:07 -05:00
|
|
|
return ret;
|
2001-06-06 00:47:37 -04:00
|
|
|
}
|
2001-06-09 01:14:43 -04:00
|
|
|
|
2002-01-10 01:31:31 -05:00
|
|
|
/* get windows contained on workspace, including workspace->windows
|
|
|
|
* and also sticky windows.
|
|
|
|
*/
|
|
|
|
GList*
|
|
|
|
meta_workspace_list_windows (MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
GSList *display_windows;
|
|
|
|
GSList *tmp;
|
|
|
|
GList *workspace_windows;
|
|
|
|
|
|
|
|
display_windows = meta_display_list_windows (workspace->screen->display);
|
|
|
|
|
|
|
|
workspace_windows = NULL;
|
|
|
|
tmp = display_windows;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *window = tmp->data;
|
|
|
|
|
2004-12-22 19:20:33 -05:00
|
|
|
if (meta_window_located_on_workspace (window, workspace))
|
2002-01-10 01:31:31 -05:00
|
|
|
workspace_windows = g_list_prepend (workspace_windows,
|
|
|
|
window);
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (display_windows);
|
|
|
|
|
|
|
|
return workspace_windows;
|
|
|
|
}
|
|
|
|
|
2002-10-21 17:44:35 -04:00
|
|
|
static void
|
on unminimize, queue calc_showing on all transients
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-05-05 01:41:13 -04:00
|
|
|
set_active_space_hint (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
unsigned long data[1];
|
2002-11-20 23:48:53 -05:00
|
|
|
|
|
|
|
/* this is because we destroy the spaces in order,
|
|
|
|
* so we always end up setting a current desktop of
|
|
|
|
* 0 when closing a screen, so lose the current desktop
|
|
|
|
* on restart. By doing this we keep the current
|
|
|
|
* desktop on restart.
|
|
|
|
*/
|
|
|
|
if (screen->closing > 0)
|
|
|
|
return;
|
on unminimize, queue calc_showing on all transients
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-05-05 01:41:13 -04:00
|
|
|
|
2002-10-16 16:12:24 -04:00
|
|
|
data[0] = meta_workspace_index (screen->active_workspace);
|
on unminimize, queue calc_showing on all transients
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-05-05 01:41:13 -04:00
|
|
|
|
2006-01-20 17:03:56 -05:00
|
|
|
meta_verbose ("Setting _NET_CURRENT_DESKTOP to %lu\n", data[0]);
|
on unminimize, queue calc_showing on all transients
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-05-05 01:41:13 -04:00
|
|
|
|
|
|
|
meta_error_trap_push (screen->display);
|
|
|
|
XChangeProperty (screen->display->xdisplay, screen->xroot,
|
|
|
|
screen->display->atom_net_current_desktop,
|
|
|
|
XA_CARDINAL,
|
|
|
|
32, PropModeReplace, (guchar*) data, 1);
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_pop (screen->display, FALSE);
|
on unminimize, queue calc_showing on all transients
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-05-05 01:41:13 -04:00
|
|
|
}
|
|
|
|
|
2002-01-10 01:31:31 -05:00
|
|
|
void
|
|
|
|
meta_workspace_invalidate_work_area (MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
GList *tmp;
|
2002-02-08 01:01:58 -05:00
|
|
|
GList *windows;
|
Merge of all the changes on the constraints_experiments branch. This is
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-11-19 09:58:50 -05:00
|
|
|
int i;
|
2002-02-08 01:01:58 -05:00
|
|
|
|
2003-02-23 12:09:46 -05:00
|
|
|
if (workspace->work_areas_invalid)
|
2002-02-07 22:34:26 -05:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
|
|
|
"Work area for workspace %d is already invalid\n",
|
|
|
|
meta_workspace_index (workspace));
|
|
|
|
return;
|
|
|
|
}
|
2002-01-18 22:50:03 -05:00
|
|
|
|
2002-02-07 22:34:26 -05:00
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
|
|
|
"Invalidating work area for workspace %d\n",
|
|
|
|
meta_workspace_index (workspace));
|
2003-02-23 12:09:46 -05:00
|
|
|
|
Merge of all the changes on the constraints_experiments branch. This is
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-11-19 09:58:50 -05:00
|
|
|
g_free (workspace->work_area_xinerama);
|
|
|
|
workspace->work_area_xinerama = NULL;
|
2003-06-28 12:12:32 -04:00
|
|
|
|
Merge of all the changes on the constraints_experiments branch. This is
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-11-19 09:58:50 -05:00
|
|
|
g_slist_free (workspace->all_struts);
|
|
|
|
workspace->all_struts = NULL;
|
|
|
|
|
|
|
|
for (i = 0; i < workspace->screen->n_xinerama_infos; i++)
|
|
|
|
meta_rectangle_free_list_and_elements (workspace->xinerama_region[i]);
|
|
|
|
g_free (workspace->xinerama_region);
|
|
|
|
meta_rectangle_free_list_and_elements (workspace->screen_region);
|
|
|
|
meta_rectangle_free_list_and_elements (workspace->screen_edges);
|
|
|
|
meta_rectangle_free_list_and_elements (workspace->xinerama_edges);
|
|
|
|
workspace->xinerama_region = NULL;
|
|
|
|
workspace->screen_region = NULL;
|
|
|
|
workspace->screen_edges = NULL;
|
|
|
|
workspace->xinerama_edges = NULL;
|
2002-01-10 01:31:31 -05:00
|
|
|
|
2003-02-23 12:09:46 -05:00
|
|
|
workspace->work_areas_invalid = TRUE;
|
2002-01-10 01:31:31 -05:00
|
|
|
|
|
|
|
/* redo the size/position constraints on all windows */
|
2002-02-08 01:01:58 -05:00
|
|
|
windows = meta_workspace_list_windows (workspace);
|
|
|
|
tmp = windows;
|
2002-01-10 01:31:31 -05:00
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *w = tmp->data;
|
|
|
|
|
Refactor thrice-duplicated queue code in window.c. Closes #376760.
2007-06-10 Thomas Thurman <thomas@thurman.org.uk>
Refactor thrice-duplicated queue code in window.c. Closes #376760.
* src/window.c (meta_window_queue, meta_window_unqueue):
New functions.
* src/window.[ch] (meta_window_unqueue_*, meta_window_queue_*):
Removed functions.
* src/window.c (meta_window_new_with_attrs, meta_window_free,
meta_window_flush_calc_showing, queue_calc_showing_func,
meta_window_minimize, meta_window_unminimize, meta_window_maximize,
meta_window_make_fullscreen, meta_window_shade,
meta_window_unshade, meta_window_move_resize_internal,
window_stick_impl, window_unstick_impl,
meta_window_client_message, process_property_notify): Modified to
use new queueing functions.
* src/window.c (idle_move_resize, idle_update_icon,
idle_calc_showing): update to receive queue number from pointer.
* src/window.h (MetaQueueType): new enum.
* src/window.h (MetaWindow): *_queued replaced with is_in_queue
bitfield.
* src/core.c (meta_core_queue_frame_resize):
* src/display.c (event_callback,
meta_display_queue_retheme_all_windows): Using new queueing functions.
* src/frame.c (meta_window_destroy_frame): Using new queueing functions.
* src/screen.c (queue_resize, meta_screen_resize_func,
queue_windows_showing): Using new queueing functions.
* src/window-props.c (reload_mwm_hints, reload_wm_hints,
reload_transient_for): Using new queueing functions.
* src/workspace.c (meta_workspace_add_window,
meta_workspace_remove_window, meta_workspace_queue_calc_showing,
meta_workspace_invalidate_work_area): Using new queueing functions.
svn path=/trunk/; revision=3236
2007-06-10 21:15:33 -04:00
|
|
|
meta_window_queue (w, META_QUEUE_MOVE_RESIZE);
|
2002-02-08 01:01:58 -05:00
|
|
|
|
2002-01-10 01:31:31 -05:00
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
2002-02-08 01:01:58 -05:00
|
|
|
|
|
|
|
g_list_free (windows);
|
on unminimize, queue calc_showing on all transients
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-05-05 01:41:13 -04:00
|
|
|
|
2002-06-24 21:12:37 -04:00
|
|
|
meta_screen_queue_workarea_recalc (workspace->screen);
|
2002-01-10 01:31:31 -05:00
|
|
|
}
|
|
|
|
|
2003-02-23 12:09:46 -05:00
|
|
|
static void
|
|
|
|
ensure_work_areas_validated (MetaWorkspace *workspace)
|
|
|
|
{
|
Patch from Carlo Wood to fix handling of unidirectional maximization and
2007-04-02 Elijah Newren <newren gmail com>
Patch from Carlo Wood to fix handling of unidirectional
maximization and partial struts. #358311.
* src/constraints.c (constrain_maximization):
determine target size for unidirectionally maximized windows by
determining how far they can be maximized without hitting
orthogonal struts. Avoids weird "empty spaces".
* src/boxes.[ch] (meta_rectangle_expand_to_avoiding_struts):
new function
2007-04-02 Elijah Newren <newren gmail com>
Make the strut lists (stored in workspaces) record both the
rectangle and the side that the strut is on. Lots of code
cleanups relating to struts.
* src/boxes.h (struct MetaStrut):
new struct for struts
* src/window.[ch] (struct MetaStruts, struct MetaWindow,
meta_window_update_struts):
overhaul to make window's struts remember their side as well as
their rectangular location, and just use a list instead of several
copies of near-identical code for left/right/top/bottom (allowing
us to nuke MetaStruts struct as well)
* src/testboxes.c (new_meta_strut, get_strut_list):
* src/workspace.c (ensure_work_areas_validated):
* src/boxes.c (meta_rectangle_get_minimal_spanning_set_for_region,
meta_rectangle_expand_to_avoiding_struts,
get_disjoint_strut_rect_list_in_region, fix_up_edges,
meta_rectangle_find_onscreen_edges,
meta_rectangle_find_nonintersected_xinerama_edges):
modify to handle struts being rectangle + side instead of just rectangle
* src/workspace.c (ensure_work_areas_validated):
simplify strut list creation considerably given MetaWindow change,
modify work_area computations to take advantage of region
computations being done (makes the code shorter as well as more
robust against pathological cases).
* src/util.[ch] (meta_free_gslist_and_elements):
new convenience function
* src/common.h (enum MetaDirection):
* src/edge-resistance.c (movement_towards_edge):
* src/boxes.c (meta_rectangle_edge_aligns,
rectangle_and_edge_intersection, split_edge):
Add more MetaDirection fields for convenience
* src/boxes.h (enum FixedDirections):
* src/constraints.c (setup_constraint_info, place_window_if_needed):
add a FIXED_DIRECTION_NONE to the FixedDirections enum to make
code more clear
svn path=/trunk/; revision=3144
2007-04-02 23:41:10 -04:00
|
|
|
GList *windows;
|
|
|
|
GList *tmp;
|
|
|
|
MetaRectangle work_area;
|
|
|
|
int i; /* C89 absolutely sucks... */
|
2003-02-23 12:09:46 -05:00
|
|
|
|
|
|
|
if (!workspace->work_areas_invalid)
|
|
|
|
return;
|
2003-06-25 23:09:38 -04:00
|
|
|
|
Merge of all the changes on the constraints_experiments branch. This is
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-11-19 09:58:50 -05:00
|
|
|
g_assert (workspace->all_struts == NULL);
|
|
|
|
g_assert (workspace->xinerama_region == NULL);
|
|
|
|
g_assert (workspace->screen_region == NULL);
|
|
|
|
g_assert (workspace->screen_edges == NULL);
|
|
|
|
g_assert (workspace->xinerama_edges == NULL);
|
2003-02-23 12:09:46 -05:00
|
|
|
|
Patch from Carlo Wood to fix handling of unidirectional maximization and
2007-04-02 Elijah Newren <newren gmail com>
Patch from Carlo Wood to fix handling of unidirectional
maximization and partial struts. #358311.
* src/constraints.c (constrain_maximization):
determine target size for unidirectionally maximized windows by
determining how far they can be maximized without hitting
orthogonal struts. Avoids weird "empty spaces".
* src/boxes.[ch] (meta_rectangle_expand_to_avoiding_struts):
new function
2007-04-02 Elijah Newren <newren gmail com>
Make the strut lists (stored in workspaces) record both the
rectangle and the side that the strut is on. Lots of code
cleanups relating to struts.
* src/boxes.h (struct MetaStrut):
new struct for struts
* src/window.[ch] (struct MetaStruts, struct MetaWindow,
meta_window_update_struts):
overhaul to make window's struts remember their side as well as
their rectangular location, and just use a list instead of several
copies of near-identical code for left/right/top/bottom (allowing
us to nuke MetaStruts struct as well)
* src/testboxes.c (new_meta_strut, get_strut_list):
* src/workspace.c (ensure_work_areas_validated):
* src/boxes.c (meta_rectangle_get_minimal_spanning_set_for_region,
meta_rectangle_expand_to_avoiding_struts,
get_disjoint_strut_rect_list_in_region, fix_up_edges,
meta_rectangle_find_onscreen_edges,
meta_rectangle_find_nonintersected_xinerama_edges):
modify to handle struts being rectangle + side instead of just rectangle
* src/workspace.c (ensure_work_areas_validated):
simplify strut list creation considerably given MetaWindow change,
modify work_area computations to take advantage of region
computations being done (makes the code shorter as well as more
robust against pathological cases).
* src/util.[ch] (meta_free_gslist_and_elements):
new convenience function
* src/common.h (enum MetaDirection):
* src/edge-resistance.c (movement_towards_edge):
* src/boxes.c (meta_rectangle_edge_aligns,
rectangle_and_edge_intersection, split_edge):
Add more MetaDirection fields for convenience
* src/boxes.h (enum FixedDirections):
* src/constraints.c (setup_constraint_info, place_window_if_needed):
add a FIXED_DIRECTION_NONE to the FixedDirections enum to make
code more clear
svn path=/trunk/; revision=3144
2007-04-02 23:41:10 -04:00
|
|
|
/* STEP 1: Get the list of struts */
|
|
|
|
windows = meta_workspace_list_windows (workspace);
|
|
|
|
for (tmp = windows; tmp != NULL; tmp = tmp->next)
|
2002-01-10 01:31:31 -05:00
|
|
|
{
|
Patch from Carlo Wood to fix handling of unidirectional maximization and
2007-04-02 Elijah Newren <newren gmail com>
Patch from Carlo Wood to fix handling of unidirectional
maximization and partial struts. #358311.
* src/constraints.c (constrain_maximization):
determine target size for unidirectionally maximized windows by
determining how far they can be maximized without hitting
orthogonal struts. Avoids weird "empty spaces".
* src/boxes.[ch] (meta_rectangle_expand_to_avoiding_struts):
new function
2007-04-02 Elijah Newren <newren gmail com>
Make the strut lists (stored in workspaces) record both the
rectangle and the side that the strut is on. Lots of code
cleanups relating to struts.
* src/boxes.h (struct MetaStrut):
new struct for struts
* src/window.[ch] (struct MetaStruts, struct MetaWindow,
meta_window_update_struts):
overhaul to make window's struts remember their side as well as
their rectangular location, and just use a list instead of several
copies of near-identical code for left/right/top/bottom (allowing
us to nuke MetaStruts struct as well)
* src/testboxes.c (new_meta_strut, get_strut_list):
* src/workspace.c (ensure_work_areas_validated):
* src/boxes.c (meta_rectangle_get_minimal_spanning_set_for_region,
meta_rectangle_expand_to_avoiding_struts,
get_disjoint_strut_rect_list_in_region, fix_up_edges,
meta_rectangle_find_onscreen_edges,
meta_rectangle_find_nonintersected_xinerama_edges):
modify to handle struts being rectangle + side instead of just rectangle
* src/workspace.c (ensure_work_areas_validated):
simplify strut list creation considerably given MetaWindow change,
modify work_area computations to take advantage of region
computations being done (makes the code shorter as well as more
robust against pathological cases).
* src/util.[ch] (meta_free_gslist_and_elements):
new convenience function
* src/common.h (enum MetaDirection):
* src/edge-resistance.c (movement_towards_edge):
* src/boxes.c (meta_rectangle_edge_aligns,
rectangle_and_edge_intersection, split_edge):
Add more MetaDirection fields for convenience
* src/boxes.h (enum FixedDirections):
* src/constraints.c (setup_constraint_info, place_window_if_needed):
add a FIXED_DIRECTION_NONE to the FixedDirections enum to make
code more clear
svn path=/trunk/; revision=3144
2007-04-02 23:41:10 -04:00
|
|
|
MetaWindow *win = tmp->data;
|
|
|
|
GSList *s_iter;
|
2002-01-10 01:31:31 -05:00
|
|
|
|
Patch from Carlo Wood to fix handling of unidirectional maximization and
2007-04-02 Elijah Newren <newren gmail com>
Patch from Carlo Wood to fix handling of unidirectional
maximization and partial struts. #358311.
* src/constraints.c (constrain_maximization):
determine target size for unidirectionally maximized windows by
determining how far they can be maximized without hitting
orthogonal struts. Avoids weird "empty spaces".
* src/boxes.[ch] (meta_rectangle_expand_to_avoiding_struts):
new function
2007-04-02 Elijah Newren <newren gmail com>
Make the strut lists (stored in workspaces) record both the
rectangle and the side that the strut is on. Lots of code
cleanups relating to struts.
* src/boxes.h (struct MetaStrut):
new struct for struts
* src/window.[ch] (struct MetaStruts, struct MetaWindow,
meta_window_update_struts):
overhaul to make window's struts remember their side as well as
their rectangular location, and just use a list instead of several
copies of near-identical code for left/right/top/bottom (allowing
us to nuke MetaStruts struct as well)
* src/testboxes.c (new_meta_strut, get_strut_list):
* src/workspace.c (ensure_work_areas_validated):
* src/boxes.c (meta_rectangle_get_minimal_spanning_set_for_region,
meta_rectangle_expand_to_avoiding_struts,
get_disjoint_strut_rect_list_in_region, fix_up_edges,
meta_rectangle_find_onscreen_edges,
meta_rectangle_find_nonintersected_xinerama_edges):
modify to handle struts being rectangle + side instead of just rectangle
* src/workspace.c (ensure_work_areas_validated):
simplify strut list creation considerably given MetaWindow change,
modify work_area computations to take advantage of region
computations being done (makes the code shorter as well as more
robust against pathological cases).
* src/util.[ch] (meta_free_gslist_and_elements):
new convenience function
* src/common.h (enum MetaDirection):
* src/edge-resistance.c (movement_towards_edge):
* src/boxes.c (meta_rectangle_edge_aligns,
rectangle_and_edge_intersection, split_edge):
Add more MetaDirection fields for convenience
* src/boxes.h (enum FixedDirections):
* src/constraints.c (setup_constraint_info, place_window_if_needed):
add a FIXED_DIRECTION_NONE to the FixedDirections enum to make
code more clear
svn path=/trunk/; revision=3144
2007-04-02 23:41:10 -04:00
|
|
|
for (s_iter = win->struts; s_iter != NULL; s_iter = s_iter->next)
|
|
|
|
workspace->all_struts = g_slist_prepend (workspace->all_struts,
|
|
|
|
s_iter->data);
|
2003-02-23 12:09:46 -05:00
|
|
|
}
|
|
|
|
g_list_free (windows);
|
|
|
|
|
Patch from Carlo Wood to fix handling of unidirectional maximization and
2007-04-02 Elijah Newren <newren gmail com>
Patch from Carlo Wood to fix handling of unidirectional
maximization and partial struts. #358311.
* src/constraints.c (constrain_maximization):
determine target size for unidirectionally maximized windows by
determining how far they can be maximized without hitting
orthogonal struts. Avoids weird "empty spaces".
* src/boxes.[ch] (meta_rectangle_expand_to_avoiding_struts):
new function
2007-04-02 Elijah Newren <newren gmail com>
Make the strut lists (stored in workspaces) record both the
rectangle and the side that the strut is on. Lots of code
cleanups relating to struts.
* src/boxes.h (struct MetaStrut):
new struct for struts
* src/window.[ch] (struct MetaStruts, struct MetaWindow,
meta_window_update_struts):
overhaul to make window's struts remember their side as well as
their rectangular location, and just use a list instead of several
copies of near-identical code for left/right/top/bottom (allowing
us to nuke MetaStruts struct as well)
* src/testboxes.c (new_meta_strut, get_strut_list):
* src/workspace.c (ensure_work_areas_validated):
* src/boxes.c (meta_rectangle_get_minimal_spanning_set_for_region,
meta_rectangle_expand_to_avoiding_struts,
get_disjoint_strut_rect_list_in_region, fix_up_edges,
meta_rectangle_find_onscreen_edges,
meta_rectangle_find_nonintersected_xinerama_edges):
modify to handle struts being rectangle + side instead of just rectangle
* src/workspace.c (ensure_work_areas_validated):
simplify strut list creation considerably given MetaWindow change,
modify work_area computations to take advantage of region
computations being done (makes the code shorter as well as more
robust against pathological cases).
* src/util.[ch] (meta_free_gslist_and_elements):
new convenience function
* src/common.h (enum MetaDirection):
* src/edge-resistance.c (movement_towards_edge):
* src/boxes.c (meta_rectangle_edge_aligns,
rectangle_and_edge_intersection, split_edge):
Add more MetaDirection fields for convenience
* src/boxes.h (enum FixedDirections):
* src/constraints.c (setup_constraint_info, place_window_if_needed):
add a FIXED_DIRECTION_NONE to the FixedDirections enum to make
code more clear
svn path=/trunk/; revision=3144
2007-04-02 23:41:10 -04:00
|
|
|
/* STEP 2: Get the maximal/spanning rects for the onscreen and
|
|
|
|
* on-single-xinerama regions
|
Merge of all the changes on the constraints_experiments branch. This is
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-11-19 09:58:50 -05:00
|
|
|
*/
|
|
|
|
g_assert (workspace->xinerama_region == NULL);
|
|
|
|
g_assert (workspace->screen_region == NULL);
|
|
|
|
|
|
|
|
workspace->xinerama_region = g_new (GList*,
|
|
|
|
workspace->screen->n_xinerama_infos);
|
|
|
|
for (i = 0; i < workspace->screen->n_xinerama_infos; i++)
|
|
|
|
{
|
|
|
|
workspace->xinerama_region[i] =
|
|
|
|
meta_rectangle_get_minimal_spanning_set_for_region (
|
|
|
|
&workspace->screen->xinerama_infos[i].rect,
|
|
|
|
workspace->all_struts);
|
|
|
|
}
|
|
|
|
workspace->screen_region =
|
|
|
|
meta_rectangle_get_minimal_spanning_set_for_region (
|
|
|
|
&workspace->screen->rect,
|
|
|
|
workspace->all_struts);
|
Patch from Carlo Wood to fix handling of unidirectional maximization and
2007-04-02 Elijah Newren <newren gmail com>
Patch from Carlo Wood to fix handling of unidirectional
maximization and partial struts. #358311.
* src/constraints.c (constrain_maximization):
determine target size for unidirectionally maximized windows by
determining how far they can be maximized without hitting
orthogonal struts. Avoids weird "empty spaces".
* src/boxes.[ch] (meta_rectangle_expand_to_avoiding_struts):
new function
2007-04-02 Elijah Newren <newren gmail com>
Make the strut lists (stored in workspaces) record both the
rectangle and the side that the strut is on. Lots of code
cleanups relating to struts.
* src/boxes.h (struct MetaStrut):
new struct for struts
* src/window.[ch] (struct MetaStruts, struct MetaWindow,
meta_window_update_struts):
overhaul to make window's struts remember their side as well as
their rectangular location, and just use a list instead of several
copies of near-identical code for left/right/top/bottom (allowing
us to nuke MetaStruts struct as well)
* src/testboxes.c (new_meta_strut, get_strut_list):
* src/workspace.c (ensure_work_areas_validated):
* src/boxes.c (meta_rectangle_get_minimal_spanning_set_for_region,
meta_rectangle_expand_to_avoiding_struts,
get_disjoint_strut_rect_list_in_region, fix_up_edges,
meta_rectangle_find_onscreen_edges,
meta_rectangle_find_nonintersected_xinerama_edges):
modify to handle struts being rectangle + side instead of just rectangle
* src/workspace.c (ensure_work_areas_validated):
simplify strut list creation considerably given MetaWindow change,
modify work_area computations to take advantage of region
computations being done (makes the code shorter as well as more
robust against pathological cases).
* src/util.[ch] (meta_free_gslist_and_elements):
new convenience function
* src/common.h (enum MetaDirection):
* src/edge-resistance.c (movement_towards_edge):
* src/boxes.c (meta_rectangle_edge_aligns,
rectangle_and_edge_intersection, split_edge):
Add more MetaDirection fields for convenience
* src/boxes.h (enum FixedDirections):
* src/constraints.c (setup_constraint_info, place_window_if_needed):
add a FIXED_DIRECTION_NONE to the FixedDirections enum to make
code more clear
svn path=/trunk/; revision=3144
2007-04-02 23:41:10 -04:00
|
|
|
|
|
|
|
/* STEP 3: Get the work areas (region-to-maximize-to) for the screen and
|
|
|
|
* xineramas.
|
Merge of all the changes on the constraints_experiments branch. This is
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-11-19 09:58:50 -05:00
|
|
|
*/
|
Patch from Carlo Wood to fix handling of unidirectional maximization and
2007-04-02 Elijah Newren <newren gmail com>
Patch from Carlo Wood to fix handling of unidirectional
maximization and partial struts. #358311.
* src/constraints.c (constrain_maximization):
determine target size for unidirectionally maximized windows by
determining how far they can be maximized without hitting
orthogonal struts. Avoids weird "empty spaces".
* src/boxes.[ch] (meta_rectangle_expand_to_avoiding_struts):
new function
2007-04-02 Elijah Newren <newren gmail com>
Make the strut lists (stored in workspaces) record both the
rectangle and the side that the strut is on. Lots of code
cleanups relating to struts.
* src/boxes.h (struct MetaStrut):
new struct for struts
* src/window.[ch] (struct MetaStruts, struct MetaWindow,
meta_window_update_struts):
overhaul to make window's struts remember their side as well as
their rectangular location, and just use a list instead of several
copies of near-identical code for left/right/top/bottom (allowing
us to nuke MetaStruts struct as well)
* src/testboxes.c (new_meta_strut, get_strut_list):
* src/workspace.c (ensure_work_areas_validated):
* src/boxes.c (meta_rectangle_get_minimal_spanning_set_for_region,
meta_rectangle_expand_to_avoiding_struts,
get_disjoint_strut_rect_list_in_region, fix_up_edges,
meta_rectangle_find_onscreen_edges,
meta_rectangle_find_nonintersected_xinerama_edges):
modify to handle struts being rectangle + side instead of just rectangle
* src/workspace.c (ensure_work_areas_validated):
simplify strut list creation considerably given MetaWindow change,
modify work_area computations to take advantage of region
computations being done (makes the code shorter as well as more
robust against pathological cases).
* src/util.[ch] (meta_free_gslist_and_elements):
new convenience function
* src/common.h (enum MetaDirection):
* src/edge-resistance.c (movement_towards_edge):
* src/boxes.c (meta_rectangle_edge_aligns,
rectangle_and_edge_intersection, split_edge):
Add more MetaDirection fields for convenience
* src/boxes.h (enum FixedDirections):
* src/constraints.c (setup_constraint_info, place_window_if_needed):
add a FIXED_DIRECTION_NONE to the FixedDirections enum to make
code more clear
svn path=/trunk/; revision=3144
2007-04-02 23:41:10 -04:00
|
|
|
work_area = workspace->screen->rect; /* start with the screen */
|
|
|
|
if (workspace->screen_region == NULL)
|
|
|
|
work_area = meta_rect (0, 0, -1, -1);
|
|
|
|
else
|
|
|
|
meta_rectangle_clip_to_region (workspace->screen_region,
|
|
|
|
FIXED_DIRECTION_NONE,
|
|
|
|
&work_area);
|
|
|
|
|
|
|
|
/* Lots of paranoia checks, forcing work_area_screen to be sane */
|
|
|
|
#define MIN_SANE_AREA 100
|
|
|
|
if (work_area.width < MIN_SANE_AREA)
|
|
|
|
{
|
|
|
|
meta_warning ("struts occupy an unusually large percentage of the screen; "
|
|
|
|
"available remaining width = %d < %d",
|
|
|
|
work_area.width, MIN_SANE_AREA);
|
|
|
|
if (work_area.width < 1)
|
|
|
|
{
|
|
|
|
work_area.x = (workspace->screen->rect.width - MIN_SANE_AREA)/2;
|
|
|
|
work_area.width = MIN_SANE_AREA;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int amount = (MIN_SANE_AREA - work_area.width)/2;
|
|
|
|
work_area.x -= amount;
|
|
|
|
work_area.width += 2*amount;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (work_area.height < MIN_SANE_AREA)
|
|
|
|
{
|
|
|
|
meta_warning ("struts occupy an unusually large percentage of the screen; "
|
|
|
|
"available remaining height = %d < %d",
|
|
|
|
work_area.height, MIN_SANE_AREA);
|
|
|
|
if (work_area.height < 1)
|
|
|
|
{
|
|
|
|
work_area.y = (workspace->screen->rect.height - MIN_SANE_AREA)/2;
|
|
|
|
work_area.height = MIN_SANE_AREA;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int amount = (MIN_SANE_AREA - work_area.height)/2;
|
|
|
|
work_area.y -= amount;
|
|
|
|
work_area.height += 2*amount;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
workspace->work_area_screen = work_area;
|
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
|
|
|
"Computed work area for workspace %d: %d,%d %d x %d\n",
|
|
|
|
meta_workspace_index (workspace),
|
|
|
|
workspace->work_area_screen.x,
|
|
|
|
workspace->work_area_screen.y,
|
|
|
|
workspace->work_area_screen.width,
|
|
|
|
workspace->work_area_screen.height);
|
|
|
|
|
|
|
|
/* Now find the work areas for each xinerama */
|
|
|
|
g_free (workspace->work_area_xinerama);
|
|
|
|
workspace->work_area_xinerama = g_new (MetaRectangle,
|
|
|
|
workspace->screen->n_xinerama_infos);
|
|
|
|
|
|
|
|
for (i = 0; i < workspace->screen->n_xinerama_infos; i++)
|
|
|
|
{
|
|
|
|
work_area = workspace->screen->xinerama_infos[i].rect;
|
|
|
|
|
|
|
|
if (workspace->xinerama_region[i] == NULL)
|
|
|
|
/* FIXME: constraints.c untested with this, but it might be nice for
|
|
|
|
* a screen reader or magnifier.
|
|
|
|
*/
|
|
|
|
work_area = meta_rect (work_area.x, work_area.y, -1, -1);
|
|
|
|
else
|
|
|
|
meta_rectangle_clip_to_region (workspace->xinerama_region[i],
|
|
|
|
FIXED_DIRECTION_NONE,
|
|
|
|
&work_area);
|
|
|
|
|
|
|
|
workspace->work_area_xinerama[i] = work_area;
|
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
|
|
|
"Computed work area for workspace %d "
|
|
|
|
"xinerama %d: %d,%d %d x %d\n",
|
|
|
|
meta_workspace_index (workspace),
|
|
|
|
i,
|
|
|
|
workspace->work_area_xinerama[i].x,
|
|
|
|
workspace->work_area_xinerama[i].y,
|
|
|
|
workspace->work_area_xinerama[i].width,
|
|
|
|
workspace->work_area_xinerama[i].height);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* STEP 4: Make sure the screen_region is nonempty (separate from step 2
|
|
|
|
* since it relies on step 3).
|
|
|
|
*/
|
Merge of all the changes on the constraints_experiments branch. This is
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-11-19 09:58:50 -05:00
|
|
|
if (workspace->screen_region == NULL)
|
|
|
|
{
|
|
|
|
MetaRectangle *nonempty_region;
|
|
|
|
nonempty_region = g_new (MetaRectangle, 1);
|
|
|
|
*nonempty_region = workspace->work_area_screen;
|
|
|
|
workspace->screen_region = g_list_prepend (NULL, nonempty_region);
|
|
|
|
}
|
|
|
|
|
Patch from Carlo Wood to fix handling of unidirectional maximization and
2007-04-02 Elijah Newren <newren gmail com>
Patch from Carlo Wood to fix handling of unidirectional
maximization and partial struts. #358311.
* src/constraints.c (constrain_maximization):
determine target size for unidirectionally maximized windows by
determining how far they can be maximized without hitting
orthogonal struts. Avoids weird "empty spaces".
* src/boxes.[ch] (meta_rectangle_expand_to_avoiding_struts):
new function
2007-04-02 Elijah Newren <newren gmail com>
Make the strut lists (stored in workspaces) record both the
rectangle and the side that the strut is on. Lots of code
cleanups relating to struts.
* src/boxes.h (struct MetaStrut):
new struct for struts
* src/window.[ch] (struct MetaStruts, struct MetaWindow,
meta_window_update_struts):
overhaul to make window's struts remember their side as well as
their rectangular location, and just use a list instead of several
copies of near-identical code for left/right/top/bottom (allowing
us to nuke MetaStruts struct as well)
* src/testboxes.c (new_meta_strut, get_strut_list):
* src/workspace.c (ensure_work_areas_validated):
* src/boxes.c (meta_rectangle_get_minimal_spanning_set_for_region,
meta_rectangle_expand_to_avoiding_struts,
get_disjoint_strut_rect_list_in_region, fix_up_edges,
meta_rectangle_find_onscreen_edges,
meta_rectangle_find_nonintersected_xinerama_edges):
modify to handle struts being rectangle + side instead of just rectangle
* src/workspace.c (ensure_work_areas_validated):
simplify strut list creation considerably given MetaWindow change,
modify work_area computations to take advantage of region
computations being done (makes the code shorter as well as more
robust against pathological cases).
* src/util.[ch] (meta_free_gslist_and_elements):
new convenience function
* src/common.h (enum MetaDirection):
* src/edge-resistance.c (movement_towards_edge):
* src/boxes.c (meta_rectangle_edge_aligns,
rectangle_and_edge_intersection, split_edge):
Add more MetaDirection fields for convenience
* src/boxes.h (enum FixedDirections):
* src/constraints.c (setup_constraint_info, place_window_if_needed):
add a FIXED_DIRECTION_NONE to the FixedDirections enum to make
code more clear
svn path=/trunk/; revision=3144
2007-04-02 23:41:10 -04:00
|
|
|
/* STEP 5: Cache screen and xinerama edges for edge resistance and snapping */
|
Merge of all the changes on the constraints_experiments branch. This is
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-11-19 09:58:50 -05:00
|
|
|
g_assert (workspace->screen_edges == NULL);
|
|
|
|
g_assert (workspace->xinerama_edges == NULL);
|
|
|
|
workspace->screen_edges =
|
|
|
|
meta_rectangle_find_onscreen_edges (&workspace->screen->rect,
|
|
|
|
workspace->all_struts);
|
|
|
|
tmp = NULL;
|
|
|
|
for (i = 0; i < workspace->screen->n_xinerama_infos; i++)
|
|
|
|
tmp = g_list_prepend (tmp, &workspace->screen->xinerama_infos[i].rect);
|
|
|
|
workspace->xinerama_edges =
|
|
|
|
meta_rectangle_find_nonintersected_xinerama_edges (tmp,
|
|
|
|
workspace->all_struts);
|
|
|
|
g_list_free (tmp);
|
|
|
|
|
|
|
|
/* We're all done, YAAY! Record that everything has been validated. */
|
2003-02-23 12:09:46 -05:00
|
|
|
workspace->work_areas_invalid = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_workspace_get_work_area_for_xinerama (MetaWorkspace *workspace,
|
|
|
|
int which_xinerama,
|
|
|
|
MetaRectangle *area)
|
|
|
|
{
|
|
|
|
g_assert (which_xinerama >= 0);
|
2002-01-10 01:31:31 -05:00
|
|
|
|
2003-02-23 12:09:46 -05:00
|
|
|
ensure_work_areas_validated (workspace);
|
|
|
|
g_assert (which_xinerama < workspace->screen->n_xinerama_infos);
|
|
|
|
|
Merge of all the changes on the constraints_experiments branch. This is
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-11-19 09:58:50 -05:00
|
|
|
*area = workspace->work_area_xinerama[which_xinerama];
|
2003-02-23 12:09:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_workspace_get_work_area_all_xineramas (MetaWorkspace *workspace,
|
|
|
|
MetaRectangle *area)
|
|
|
|
{
|
|
|
|
ensure_work_areas_validated (workspace);
|
|
|
|
|
Merge of all the changes on the constraints_experiments branch. This is
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-11-19 09:58:50 -05:00
|
|
|
*area = workspace->work_area_screen;
|
|
|
|
}
|
|
|
|
|
|
|
|
GList*
|
|
|
|
meta_workspace_get_onscreen_region (MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
ensure_work_areas_validated (workspace);
|
|
|
|
|
|
|
|
return workspace->screen_region;
|
|
|
|
}
|
|
|
|
|
|
|
|
GList*
|
|
|
|
meta_workspace_get_onxinerama_region (MetaWorkspace *workspace,
|
|
|
|
int which_xinerama)
|
|
|
|
{
|
|
|
|
ensure_work_areas_validated (workspace);
|
|
|
|
|
|
|
|
return workspace->xinerama_region[which_xinerama];
|
2002-01-10 01:31:31 -05:00
|
|
|
}
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef WITH_VERBOSE_MODE
|
2002-11-07 18:13:12 -05:00
|
|
|
static char *
|
|
|
|
meta_motion_direction_to_string (MetaMotionDirection direction)
|
|
|
|
{
|
|
|
|
switch (direction)
|
|
|
|
{
|
|
|
|
case META_MOTION_UP:
|
|
|
|
return "Up";
|
|
|
|
case META_MOTION_DOWN:
|
|
|
|
return "Down";
|
|
|
|
case META_MOTION_LEFT:
|
|
|
|
return "Left";
|
|
|
|
case META_MOTION_RIGHT:
|
|
|
|
return "Right";
|
|
|
|
}
|
|
|
|
|
|
|
|
return "Unknown";
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* WITH_VERBOSE_MODE */
|
2002-11-07 18:13:12 -05:00
|
|
|
|
2002-06-08 23:44:16 -04:00
|
|
|
MetaWorkspace*
|
|
|
|
meta_workspace_get_neighbor (MetaWorkspace *workspace,
|
|
|
|
MetaMotionDirection direction)
|
|
|
|
{
|
2003-01-05 13:36:01 -05:00
|
|
|
MetaWorkspaceLayout layout;
|
|
|
|
int i, current_space, num_workspaces;
|
2007-05-25 10:36:12 -04:00
|
|
|
gboolean ltr;
|
2003-01-05 13:36:01 -05:00
|
|
|
|
|
|
|
current_space = meta_workspace_index (workspace);
|
2002-06-08 23:44:16 -04:00
|
|
|
num_workspaces = meta_screen_get_n_workspaces (workspace->screen);
|
2002-11-05 14:25:06 -05:00
|
|
|
meta_screen_calc_workspace_layout (workspace->screen, num_workspaces,
|
2003-01-05 13:36:01 -05:00
|
|
|
current_space, &layout);
|
2002-11-05 14:25:06 -05:00
|
|
|
|
2003-01-05 13:36:01 -05:00
|
|
|
meta_verbose ("Getting neighbor of %d in direction %s\n",
|
|
|
|
current_space, meta_motion_direction_to_string (direction));
|
2002-05-16 21:48:57 -04:00
|
|
|
|
2007-05-25 10:36:12 -04:00
|
|
|
ltr = meta_ui_get_direction() == META_UI_DIRECTION_LTR;
|
|
|
|
|
2002-11-05 14:25:06 -05:00
|
|
|
switch (direction)
|
|
|
|
{
|
|
|
|
case META_MOTION_LEFT:
|
2007-05-25 10:36:12 -04:00
|
|
|
layout.current_col -= ltr ? 1 : -1;
|
2002-11-05 14:25:06 -05:00
|
|
|
break;
|
|
|
|
case META_MOTION_RIGHT:
|
2007-05-25 10:36:12 -04:00
|
|
|
layout.current_col += ltr ? 1 : -1;
|
2002-11-05 14:25:06 -05:00
|
|
|
break;
|
|
|
|
case META_MOTION_UP:
|
2003-01-05 13:36:01 -05:00
|
|
|
layout.current_row -= 1;
|
2002-11-05 14:25:06 -05:00
|
|
|
break;
|
|
|
|
case META_MOTION_DOWN:
|
2003-01-05 13:36:01 -05:00
|
|
|
layout.current_row += 1;
|
2002-11-05 14:25:06 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-01-05 13:36:01 -05:00
|
|
|
if (layout.current_col < 0)
|
|
|
|
layout.current_col = 0;
|
|
|
|
if (layout.current_col >= layout.cols)
|
|
|
|
layout.current_col = layout.cols - 1;
|
|
|
|
if (layout.current_row < 0)
|
|
|
|
layout.current_row = 0;
|
|
|
|
if (layout.current_row >= layout.rows)
|
|
|
|
layout.current_row = layout.rows - 1;
|
|
|
|
|
|
|
|
i = layout.grid[layout.current_row * layout.cols + layout.current_col];
|
|
|
|
|
|
|
|
if (i < 0)
|
|
|
|
i = current_space;
|
|
|
|
|
|
|
|
if (i >= num_workspaces)
|
|
|
|
meta_bug ("calc_workspace_layout left an invalid (too-high) workspace number %d in the grid\n",
|
|
|
|
i);
|
|
|
|
|
|
|
|
meta_verbose ("Neighbor workspace is %d at row %d col %d\n",
|
|
|
|
i, layout.current_row, layout.current_col);
|
|
|
|
|
|
|
|
meta_screen_free_workspace_layout (&layout);
|
2002-05-16 00:03:36 -04:00
|
|
|
|
2002-11-07 18:13:12 -05:00
|
|
|
return meta_screen_get_workspace_by_index (workspace->screen, i);
|
2002-04-28 00:52:26 -04:00
|
|
|
}
|
2002-06-08 23:44:16 -04:00
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
const char*
|
|
|
|
meta_workspace_get_name (MetaWorkspace *workspace)
|
2002-06-22 00:52:35 -04:00
|
|
|
{
|
2002-11-03 14:06:39 -05:00
|
|
|
return meta_prefs_get_workspace_name (meta_workspace_index (workspace));
|
2002-06-22 00:52:35 -04:00
|
|
|
}
|
2003-08-15 18:09:55 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
meta_workspace_focus_default_window (MetaWorkspace *workspace,
|
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 16:32:59 -04:00
|
|
|
MetaWindow *not_this_one,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
guint32 timestamp)
|
2003-08-15 18:09:55 -04:00
|
|
|
{
|
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 16:32:59 -04:00
|
|
|
if (timestamp == CurrentTime)
|
|
|
|
{
|
|
|
|
meta_warning ("CurrentTime used to choose focus window; "
|
|
|
|
"focus window may not be correct.\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-02-21 21:11:25 -05:00
|
|
|
if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_CLICK ||
|
|
|
|
!workspace->screen->display->mouse_mode)
|
2005-02-02 13:46:09 -05:00
|
|
|
focus_ancestor_or_mru_window (workspace, not_this_one, timestamp);
|
2003-08-15 18:09:55 -04:00
|
|
|
else
|
2004-06-24 16:02:46 -04:00
|
|
|
{
|
|
|
|
MetaWindow * window;
|
|
|
|
window = meta_screen_get_mouse_window (workspace->screen, not_this_one);
|
2004-08-02 15:23:03 -04:00
|
|
|
if (window &&
|
|
|
|
window->type != META_WINDOW_DOCK &&
|
|
|
|
window->type != META_WINDOW_DESKTOP)
|
2004-06-24 16:02:46 -04:00
|
|
|
{
|
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 16:32:59 -04:00
|
|
|
if (timestamp == CurrentTime)
|
|
|
|
{
|
|
|
|
|
|
|
|
/* We would like for this to never happen. However, if
|
|
|
|
* it does happen then we kludge since using CurrentTime
|
|
|
|
* can mean ugly race conditions--and we can avoid these
|
|
|
|
* by allowing EnterNotify events (which come with
|
|
|
|
* timestamps) to handle focus.
|
|
|
|
*/
|
2004-06-24 16:02:46 -04:00
|
|
|
|
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 16:32:59 -04:00
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Not focusing mouse window %s because EnterNotify events should handle that\n", window->desc);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Focusing mouse window %s\n", window->desc);
|
|
|
|
meta_window_focus (window, timestamp);
|
|
|
|
}
|
2004-10-04 17:09:08 -04:00
|
|
|
|
|
|
|
if (workspace->screen->display->autoraise_window != window &&
|
|
|
|
meta_prefs_get_auto_raise ())
|
|
|
|
{
|
|
|
|
meta_display_queue_autoraise_callback (workspace->screen->display,
|
|
|
|
window);
|
|
|
|
}
|
2004-06-24 16:02:46 -04:00
|
|
|
}
|
|
|
|
else if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_SLOPPY)
|
2005-02-02 13:46:09 -05:00
|
|
|
focus_ancestor_or_mru_window (workspace, not_this_one, timestamp);
|
2004-06-24 16:02:46 -04:00
|
|
|
else if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_MOUSE)
|
2004-08-06 14:13:55 -04:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Setting focus to no_focus_window, since no valid "
|
|
|
|
"window to focus found.\n");
|
2004-10-04 17:09:08 -04:00
|
|
|
meta_display_focus_the_no_focus_window (workspace->screen->display,
|
2005-12-28 01:24:30 -05:00
|
|
|
workspace->screen,
|
2004-10-04 17:09:08 -04:00
|
|
|
timestamp);
|
2004-08-06 14:13:55 -04:00
|
|
|
}
|
2004-06-24 16:02:46 -04:00
|
|
|
}
|
2003-08-15 18:09:55 -04:00
|
|
|
}
|
|
|
|
|
2005-02-02 13:46:09 -05:00
|
|
|
static gboolean
|
|
|
|
record_ancestor (MetaWindow *window,
|
|
|
|
void *data)
|
|
|
|
{
|
|
|
|
MetaWindow **result = data;
|
|
|
|
|
|
|
|
*result = window;
|
|
|
|
return FALSE; /* quit with the first ancestor we find */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Focus ancestor of not_this_one if there is one, otherwise focus the MRU
|
|
|
|
* window on active workspace
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
focus_ancestor_or_mru_window (MetaWorkspace *workspace,
|
|
|
|
MetaWindow *not_this_one,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
guint32 timestamp)
|
2003-08-15 18:09:55 -04:00
|
|
|
{
|
|
|
|
MetaWindow *window = NULL;
|
2006-01-16 01:07:29 -05:00
|
|
|
MetaWindow *desktop_window = NULL;
|
2003-08-15 18:09:55 -04:00
|
|
|
GList *tmp;
|
|
|
|
|
|
|
|
if (not_this_one)
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Focusing MRU window excluding %s\n", not_this_one->desc);
|
2005-02-02 13:46:09 -05:00
|
|
|
else
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Focusing MRU window\n");
|
|
|
|
|
|
|
|
/* First, check to see if we need to focus an ancestor of a window */
|
|
|
|
if (not_this_one)
|
|
|
|
{
|
|
|
|
MetaWindow *ancestor;
|
|
|
|
ancestor = NULL;
|
|
|
|
meta_window_foreach_ancestor (not_this_one, record_ancestor, &ancestor);
|
|
|
|
if (ancestor != NULL)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Focusing %s, ancestor of %s\n",
|
|
|
|
ancestor->desc, not_this_one->desc);
|
|
|
|
|
|
|
|
meta_window_focus (ancestor, timestamp);
|
|
|
|
|
|
|
|
/* Also raise the window if in click-to-focus */
|
|
|
|
if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_CLICK)
|
|
|
|
meta_window_raise (ancestor);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* No ancestor, look for the MRU window */
|
2003-08-15 18:09:55 -04:00
|
|
|
tmp = workspace->mru_list;
|
|
|
|
|
|
|
|
while (tmp)
|
|
|
|
{
|
2004-08-02 15:23:03 -04:00
|
|
|
MetaWindow* tmp_window;
|
|
|
|
tmp_window = ((MetaWindow*) tmp->data);
|
|
|
|
if (tmp_window != not_this_one &&
|
2005-10-03 15:06:17 -04:00
|
|
|
meta_window_showing_on_its_workspace (tmp_window) &&
|
2004-08-02 15:23:03 -04:00
|
|
|
tmp_window->type != META_WINDOW_DOCK &&
|
|
|
|
tmp_window->type != META_WINDOW_DESKTOP)
|
2003-08-15 18:09:55 -04:00
|
|
|
{
|
|
|
|
window = tmp->data;
|
2006-01-16 01:07:29 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (tmp_window != not_this_one &&
|
|
|
|
desktop_window == NULL &&
|
|
|
|
meta_window_showing_on_its_workspace (tmp_window) &&
|
|
|
|
tmp_window->type == META_WINDOW_DESKTOP)
|
|
|
|
{
|
|
|
|
/* Found the most recently used desktop window */
|
|
|
|
desktop_window = tmp_window;
|
2003-08-15 18:09:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
2006-01-16 01:07:29 -05:00
|
|
|
/* If no window was found, default to the MRU desktop-window */
|
|
|
|
if (window == NULL)
|
|
|
|
window = desktop_window;
|
|
|
|
|
2003-08-15 18:09:55 -04:00
|
|
|
if (window)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Focusing workspace MRU window %s\n", window->desc);
|
|
|
|
|
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 16:32:59 -04:00
|
|
|
meta_window_focus (window, timestamp);
|
2003-08-15 18:09:55 -04:00
|
|
|
|
|
|
|
/* Also raise the window if in click-to-focus */
|
|
|
|
if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_CLICK)
|
|
|
|
meta_window_raise (window);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-09-15 12:53:20 -04:00
|
|
|
meta_topic (META_DEBUG_FOCUS, "No MRU window to focus found; focusing no_focus_window.\n");
|
2004-10-04 17:09:08 -04:00
|
|
|
meta_display_focus_the_no_focus_window (workspace->screen->display,
|
2005-12-28 01:24:30 -05:00
|
|
|
workspace->screen,
|
2004-10-04 17:09:08 -04:00
|
|
|
timestamp);
|
2003-08-15 18:09:55 -04:00
|
|
|
}
|
|
|
|
}
|