2006-10-01 18:30:10 -04:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
2014-05-02 09:34:02 -04:00
|
|
|
/*
|
2001-06-06 00:47:37 -04:00
|
|
|
* 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
|
2014-05-02 09:34:02 -04:00
|
|
|
*
|
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.
|
2014-05-02 09:34:02 -04:00
|
|
|
*
|
2001-06-06 00:47:37 -04:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2014-01-11 20:42:06 -05:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2001-06-06 00:47:37 -04:00
|
|
|
*/
|
|
|
|
|
2013-03-11 11:52:36 -04:00
|
|
|
/**
|
|
|
|
* SECTION:workspace
|
2013-03-15 13:24:58 -04:00
|
|
|
* @title:MetaWorkspace
|
2013-03-11 11:52:36 -04:00
|
|
|
* @short_description:Workspaces
|
|
|
|
*
|
|
|
|
* A workspace is a set of windows which all live on the same
|
|
|
|
* screen. (You may also see the name "desktop" around the place,
|
|
|
|
* which is the EWMH's name for the same thing.) Only one workspace
|
|
|
|
* of a screen may be active at once; all windows on all other workspaces
|
|
|
|
* are unmapped.
|
|
|
|
*/
|
|
|
|
|
2002-06-08 23:44:16 -04:00
|
|
|
#include <config.h>
|
2016-11-28 07:11:24 -05:00
|
|
|
#include "backends/meta-backend-private.h"
|
2016-12-12 21:37:11 -05:00
|
|
|
#include "backends/meta-logical-monitor.h"
|
2011-01-25 16:27:31 -05:00
|
|
|
#include "screen-private.h"
|
2011-03-05 19:29:12 -05:00
|
|
|
#include <meta/workspace.h>
|
2008-09-18 11:09:11 -04:00
|
|
|
#include "workspace-private.h"
|
2010-10-18 14:34:14 -04:00
|
|
|
#include "boxes-private.h"
|
2011-03-05 19:29:12 -05:00
|
|
|
#include <meta/errors.h>
|
|
|
|
#include <meta/prefs.h>
|
2008-09-18 11:09:11 -04:00
|
|
|
|
2011-03-05 19:29:12 -05:00
|
|
|
#include <meta/compositor.h>
|
2008-09-18 11:09:11 -04:00
|
|
|
|
2001-06-09 01:14:43 -04:00
|
|
|
#include <X11/Xatom.h>
|
2002-06-22 00:52:35 -04:00
|
|
|
#include <string.h>
|
2010-02-11 10:28:20 -05:00
|
|
|
#ifdef HAVE_LIBCANBERRA
|
2009-02-11 19:53:23 -05:00
|
|
|
#include <canberra-gtk.h>
|
2010-02-11 10:28:20 -05:00
|
|
|
#endif
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2005-02-02 13:46:09 -05:00
|
|
|
void meta_workspace_queue_calc_showing (MetaWorkspace *workspace);
|
2011-10-18 01:39:01 -04:00
|
|
|
static void focus_ancestor_or_top_window (MetaWorkspace *workspace,
|
2005-02-02 13:46:09 -05: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);
|
2008-08-31 23:10:31 -04:00
|
|
|
static void free_this (gpointer candidate,
|
|
|
|
gpointer dummy);
|
2001-06-09 01:14:43 -04:00
|
|
|
|
2008-11-17 15:56:34 -05:00
|
|
|
G_DEFINE_TYPE (MetaWorkspace, meta_workspace, G_TYPE_OBJECT);
|
|
|
|
|
2014-08-16 08:02:19 -04:00
|
|
|
enum {
|
|
|
|
PROP_0,
|
|
|
|
|
|
|
|
PROP_N_WINDOWS,
|
2014-08-16 08:03:10 -04:00
|
|
|
PROP_WORKSPACE_INDEX,
|
2014-08-16 08:02:19 -04:00
|
|
|
|
|
|
|
LAST_PROP,
|
|
|
|
};
|
|
|
|
|
|
|
|
static GParamSpec *obj_props[LAST_PROP];
|
|
|
|
|
2009-02-02 15:27:43 -05:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
WINDOW_ADDED,
|
|
|
|
WINDOW_REMOVED,
|
|
|
|
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2014-08-16 08:02:19 -04:00
|
|
|
static guint signals[LAST_SIGNAL] = { 0 };
|
2009-02-02 15:27:43 -05:00
|
|
|
|
2016-12-02 04:39:01 -05:00
|
|
|
typedef struct _MetaWorkspaceLogicalMonitorData
|
|
|
|
{
|
|
|
|
GList *logical_monitor_region;
|
|
|
|
MetaRectangle logical_monitor_work_area;
|
|
|
|
} MetaWorkspaceLogicalMonitorData;
|
|
|
|
|
|
|
|
static MetaWorkspaceLogicalMonitorData *
|
|
|
|
meta_workspace_get_logical_monitor_data (MetaWorkspace *workspace,
|
|
|
|
MetaLogicalMonitor *logical_monitor)
|
|
|
|
{
|
|
|
|
if (!workspace->logical_monitor_data)
|
|
|
|
return NULL;
|
|
|
|
return g_hash_table_lookup (workspace->logical_monitor_data, logical_monitor);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
workspace_logical_monitor_data_free (MetaWorkspaceLogicalMonitorData *data)
|
|
|
|
{
|
|
|
|
g_clear_pointer (&data->logical_monitor_region,
|
|
|
|
meta_rectangle_free_list_and_elements);
|
|
|
|
}
|
|
|
|
|
|
|
|
static MetaWorkspaceLogicalMonitorData *
|
|
|
|
meta_workspace_ensure_logical_monitor_data (MetaWorkspace *workspace,
|
|
|
|
MetaLogicalMonitor *logical_monitor)
|
|
|
|
{
|
|
|
|
MetaWorkspaceLogicalMonitorData *data;
|
|
|
|
|
|
|
|
data = meta_workspace_get_logical_monitor_data (workspace, logical_monitor);
|
|
|
|
if (data)
|
|
|
|
return data;
|
|
|
|
|
|
|
|
if (!workspace->logical_monitor_data)
|
|
|
|
{
|
|
|
|
workspace->logical_monitor_data =
|
|
|
|
g_hash_table_new_full (g_direct_hash,
|
|
|
|
g_direct_equal,
|
|
|
|
NULL,
|
|
|
|
(GDestroyNotify) workspace_logical_monitor_data_free);
|
|
|
|
}
|
|
|
|
|
|
|
|
data = g_new0 (MetaWorkspaceLogicalMonitorData, 1);
|
|
|
|
g_hash_table_insert (workspace->logical_monitor_data, logical_monitor, data);
|
|
|
|
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_workspace_clear_logical_monitor_data (MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
g_clear_pointer (&workspace->logical_monitor_data, g_hash_table_destroy);
|
|
|
|
}
|
|
|
|
|
2008-11-17 15:56:34 -05:00
|
|
|
static void
|
|
|
|
meta_workspace_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
/* Actual freeing done in meta_workspace_remove() for now */
|
2013-09-14 08:18:02 -04:00
|
|
|
G_OBJECT_CLASS (meta_workspace_parent_class)->finalize (object);
|
2008-11-17 15:56:34 -05:00
|
|
|
}
|
|
|
|
|
2009-03-17 04:54:19 -04:00
|
|
|
static void
|
|
|
|
meta_workspace_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_workspace_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
MetaWorkspace *ws = META_WORKSPACE (object);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_N_WINDOWS:
|
|
|
|
/*
|
|
|
|
* This is reliable, but not very efficient; should we store
|
|
|
|
* the list lenth ?
|
|
|
|
*/
|
|
|
|
g_value_set_uint (value, g_list_length (ws->windows));
|
|
|
|
break;
|
2014-08-16 08:03:10 -04:00
|
|
|
case PROP_WORKSPACE_INDEX:
|
|
|
|
g_value_set_uint (value, meta_workspace_index (ws));
|
|
|
|
break;
|
2009-03-17 04:54:19 -04:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-17 15:56:34 -05:00
|
|
|
static void
|
|
|
|
meta_workspace_class_init (MetaWorkspaceClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2009-03-17 04:54:19 -04:00
|
|
|
object_class->finalize = meta_workspace_finalize;
|
|
|
|
object_class->get_property = meta_workspace_get_property;
|
|
|
|
object_class->set_property = meta_workspace_set_property;
|
|
|
|
|
2009-02-02 15:27:43 -05:00
|
|
|
signals[WINDOW_ADDED] = g_signal_new ("window-added",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
2011-10-18 18:06:14 -04:00
|
|
|
NULL, NULL, NULL,
|
2009-02-02 15:27:43 -05:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
META_TYPE_WINDOW);
|
|
|
|
signals[WINDOW_REMOVED] = g_signal_new ("window-removed",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
2011-10-18 18:06:14 -04:00
|
|
|
NULL, NULL, NULL,
|
2009-02-02 15:27:43 -05:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
META_TYPE_WINDOW);
|
|
|
|
|
2014-08-16 08:02:19 -04:00
|
|
|
obj_props[PROP_N_WINDOWS] = g_param_spec_uint ("n-windows",
|
|
|
|
"N Windows",
|
|
|
|
"Number of windows",
|
|
|
|
0, G_MAXUINT, 0,
|
2014-08-16 08:02:34 -04:00
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
2014-08-16 08:03:10 -04:00
|
|
|
obj_props[PROP_WORKSPACE_INDEX] = g_param_spec_uint ("workspace-index",
|
|
|
|
"Workspace index",
|
|
|
|
"The workspace's index",
|
|
|
|
0, G_MAXUINT, 0,
|
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
2008-11-17 15:56:34 -05:00
|
|
|
|
2014-08-16 08:02:19 -04:00
|
|
|
g_object_class_install_properties (object_class, LAST_PROP, obj_props);
|
2008-11-17 15:56:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_workspace_init (MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
MetaWorkspace*
|
|
|
|
meta_workspace_new (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
MetaWorkspace *workspace;
|
2014-09-29 17:02:02 -04:00
|
|
|
GSList *windows, *l;
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2008-11-17 15:56:34 -05:00
|
|
|
workspace = g_object_new (META_TYPE_WORKSPACE, NULL);
|
2001-06-06 00:47:37 -04:00
|
|
|
|
|
|
|
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;
|
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_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->screen_edges = NULL;
|
2009-08-31 09:52:16 -04:00
|
|
|
workspace->monitor_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
|
|
|
|
2008-11-17 14:46:38 -05:00
|
|
|
workspace->builtin_struts = NULL;
|
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;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-10-12 05:18:58 -04:00
|
|
|
/* make sure sticky windows are in our mru_list */
|
|
|
|
windows = meta_display_list_windows (screen->display, META_LIST_SORTED);
|
|
|
|
for (l = windows; l; l = l->next)
|
|
|
|
if (meta_window_located_on_workspace (l->data, workspace))
|
|
|
|
meta_workspace_add_window (workspace, l->data);
|
|
|
|
g_slist_free (windows);
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
return workspace;
|
|
|
|
}
|
|
|
|
|
2011-11-02 11:34:45 -04:00
|
|
|
/* Foreach function for workspace_free_struts() */
|
2008-08-31 23:10:31 -04:00
|
|
|
static void
|
|
|
|
free_this (gpointer candidate, gpointer dummy)
|
|
|
|
{
|
|
|
|
g_free (candidate);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-11-02 11:34:45 -04:00
|
|
|
* workspace_free_all_struts:
|
|
|
|
* @workspace: The workspace.
|
2008-08-31 23:10:31 -04:00
|
|
|
*
|
2011-11-02 11:34:45 -04:00
|
|
|
* Frees the combined struts list of a workspace.
|
2008-08-31 23:10:31 -04:00
|
|
|
*/
|
|
|
|
static void
|
2008-11-17 14:46:38 -05:00
|
|
|
workspace_free_all_struts (MetaWorkspace *workspace)
|
2008-08-31 23:10:31 -04:00
|
|
|
{
|
|
|
|
if (workspace->all_struts == NULL)
|
|
|
|
return;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2008-08-31 23:10:31 -04:00
|
|
|
g_slist_foreach (workspace->all_struts, free_this, NULL);
|
|
|
|
g_slist_free (workspace->all_struts);
|
|
|
|
workspace->all_struts = NULL;
|
|
|
|
}
|
|
|
|
|
2008-11-17 14:46:38 -05:00
|
|
|
/**
|
2011-11-02 11:34:45 -04:00
|
|
|
* workspace_free_builtin_struts:
|
|
|
|
* @workspace: The workspace.
|
2008-11-17 14:46:38 -05:00
|
|
|
*
|
2011-11-02 11:34:45 -04:00
|
|
|
* Frees the struts list set with meta_workspace_set_builtin_struts
|
2008-11-17 14:46:38 -05:00
|
|
|
*/
|
|
|
|
static void
|
|
|
|
workspace_free_builtin_struts (MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
if (workspace->builtin_struts == NULL)
|
|
|
|
return;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2008-11-17 14:46:38 -05:00
|
|
|
g_slist_foreach (workspace->builtin_struts, free_this, NULL);
|
|
|
|
g_slist_free (workspace->builtin_struts);
|
|
|
|
workspace->builtin_struts = NULL;
|
|
|
|
}
|
|
|
|
|
2014-08-25 08:57:13 -04:00
|
|
|
/* Ensure that the workspace is empty by making sure that
|
|
|
|
* all of our windows are on-all-workspaces. */
|
|
|
|
static void
|
|
|
|
assert_workspace_empty (MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
GList *l;
|
|
|
|
for (l = workspace->windows; l != NULL; l = l->next)
|
|
|
|
{
|
|
|
|
MetaWindow *window = l->data;
|
|
|
|
g_assert (window->on_all_workspaces);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
void
|
2008-11-17 15:56:34 -05:00
|
|
|
meta_workspace_remove (MetaWorkspace *workspace)
|
2001-06-06 00:47:37 -04:00
|
|
|
{
|
2001-12-09 22:55:26 -05:00
|
|
|
g_return_if_fail (workspace != workspace->screen->active_workspace);
|
|
|
|
|
2014-08-25 08:57:13 -04:00
|
|
|
assert_workspace_empty (workspace);
|
2001-12-09 22:55:26 -05:00
|
|
|
|
2002-10-16 16:12:24 -04:00
|
|
|
workspace->screen->workspaces =
|
|
|
|
g_list_remove (workspace->screen->workspaces, workspace);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2016-12-02 04:39:01 -05:00
|
|
|
meta_workspace_clear_logical_monitor_data (workspace);
|
2003-06-25 23:09:38 -04:00
|
|
|
|
2003-12-17 11:01:00 -05:00
|
|
|
g_list_free (workspace->mru_list);
|
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
|
|
|
|
2008-11-17 14:46:38 -05:00
|
|
|
workspace_free_builtin_struts (workspace);
|
|
|
|
|
2008-07-13 18:16:23 -04:00
|
|
|
/* screen.c:update_num_workspaces(), which calls us, removes windows from
|
|
|
|
* workspaces first, which can cause the workareas on the workspace to be
|
|
|
|
* invalidated (and hence for struts/regions/edges to be freed).
|
|
|
|
* So, no point trying to double free it; that causes a crash
|
|
|
|
* anyway. #361804.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!workspace->work_areas_invalid)
|
|
|
|
{
|
2008-11-17 14:46:38 -05:00
|
|
|
workspace_free_all_struts (workspace);
|
2008-07-13 18:16:23 -04:00
|
|
|
meta_rectangle_free_list_and_elements (workspace->screen_region);
|
|
|
|
meta_rectangle_free_list_and_elements (workspace->screen_edges);
|
2009-08-31 09:52:16 -04:00
|
|
|
meta_rectangle_free_list_and_elements (workspace->monitor_edges);
|
2008-07-13 18:16:23 -04:00
|
|
|
}
|
2003-06-25 23:09:38 -04:00
|
|
|
|
2008-11-17 15:56:34 -05:00
|
|
|
g_object_unref (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)
|
|
|
|
{
|
2014-08-16 13:22:05 -04:00
|
|
|
g_assert (g_list_find (workspace->mru_list, window) == NULL);
|
|
|
|
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);
|
2009-03-17 04:54:19 -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
|
|
|
|
2009-02-02 15:27:43 -05:00
|
|
|
g_signal_emit (workspace, signals[WINDOW_ADDED], 0, window);
|
2014-08-16 08:02:19 -04:00
|
|
|
g_object_notify_by_pspec (G_OBJECT (workspace), obj_props[PROP_N_WINDOWS]);
|
2001-06-06 00:47:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_workspace_remove_window (MetaWorkspace *workspace,
|
|
|
|
MetaWindow *window)
|
|
|
|
{
|
|
|
|
workspace->windows = g_list_remove (workspace->windows, window);
|
2003-12-14 14:19:40 -05:00
|
|
|
|
2014-08-16 13:22:05 -04:00
|
|
|
workspace->mru_list = g_list_remove (workspace->mru_list, window);
|
|
|
|
g_assert (g_list_find (workspace->mru_list, window) == NULL);
|
2014-05-02 09:34:02 -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
|
|
|
|
2009-02-02 15:27:43 -05:00
|
|
|
g_signal_emit (workspace, signals[WINDOW_REMOVED], 0, window);
|
2009-03-17 04:54:19 -04:00
|
|
|
g_object_notify (G_OBJECT (workspace), "n-windows");
|
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)
|
|
|
|
{
|
2014-08-15 23:01:31 -04:00
|
|
|
GList *copy, *l;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-12-09 22:55:26 -05:00
|
|
|
g_return_if_fail (workspace != new_home);
|
|
|
|
|
|
|
|
/* can't modify list we're iterating over */
|
|
|
|
copy = g_list_copy (workspace->windows);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-08-15 23:01:31 -04:00
|
|
|
for (l = copy; l != NULL; l = l->next)
|
2001-12-09 22:55:26 -05:00
|
|
|
{
|
2014-08-15 23:01:31 -04:00
|
|
|
MetaWindow *window = l->data;
|
2014-08-25 09:00:00 -04:00
|
|
|
|
2014-09-29 18:09:32 -04:00
|
|
|
if (!window->on_all_workspaces)
|
2014-08-25 09:00:00 -04:00
|
|
|
meta_window_change_workspace (window, new_home);
|
2001-12-09 22:55:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (copy);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-08-25 08:57:13 -04:00
|
|
|
assert_workspace_empty (workspace);
|
2001-12-09 22:55:26 -05:00
|
|
|
}
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
void
|
|
|
|
meta_workspace_queue_calc_showing (MetaWorkspace *workspace)
|
|
|
|
{
|
2014-08-15 23:01:31 -04:00
|
|
|
GList *l;
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2014-08-15 23:01:31 -04:00
|
|
|
for (l = workspace->windows; l != NULL; l = l->next)
|
|
|
|
meta_window_queue (l->data, META_QUEUE_CALC_SHOWING);
|
2001-06-06 00:47:37 -04:00
|
|
|
}
|
|
|
|
|
2009-02-11 19:53:23 -05:00
|
|
|
static void
|
|
|
|
workspace_switch_sound(MetaWorkspace *from,
|
|
|
|
MetaWorkspace *to)
|
|
|
|
{
|
2010-02-11 10:28:20 -05:00
|
|
|
#ifdef HAVE_LIBCANBERRA
|
2009-02-11 19:53:23 -05:00
|
|
|
MetaWorkspaceLayout layout;
|
|
|
|
int i, nw, x, y, fi, ti;
|
|
|
|
const char *e;
|
|
|
|
|
|
|
|
nw = meta_screen_get_n_workspaces(from->screen);
|
|
|
|
fi = meta_workspace_index(from);
|
|
|
|
ti = meta_workspace_index(to);
|
|
|
|
|
|
|
|
meta_screen_calc_workspace_layout(from->screen,
|
|
|
|
nw,
|
|
|
|
fi,
|
|
|
|
&layout);
|
|
|
|
|
|
|
|
for (i = 0; i < nw; i++)
|
|
|
|
if (layout.grid[i] == ti)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (i >= nw)
|
|
|
|
{
|
|
|
|
meta_bug("Failed to find destination workspace in layout\n");
|
|
|
|
goto finish;
|
|
|
|
}
|
|
|
|
|
|
|
|
y = i / layout.cols;
|
|
|
|
x = i % layout.cols;
|
|
|
|
|
|
|
|
/* We priorize horizontal over vertical movements here. The
|
|
|
|
rationale for this is that horizontal movements are probably more
|
|
|
|
interesting for sound effects because speakers are usually
|
|
|
|
positioned on a horizontal and not a vertical axis. i.e. your
|
|
|
|
spatial "Woosh!" effects will easily be able to encode horizontal
|
|
|
|
movement but not such much vertical movement. */
|
|
|
|
|
|
|
|
if (x < layout.current_col)
|
|
|
|
e = "desktop-switch-left";
|
|
|
|
else if (x > layout.current_col)
|
|
|
|
e = "desktop-switch-right";
|
|
|
|
else if (y < layout.current_row)
|
|
|
|
e = "desktop-switch-up";
|
|
|
|
else if (y > layout.current_row)
|
|
|
|
e = "desktop-switch-down";
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_bug("Uh, origin and destination workspace at same logic position!\n");
|
|
|
|
goto finish;
|
|
|
|
}
|
|
|
|
|
|
|
|
ca_context_play(ca_gtk_context_get(), 1,
|
|
|
|
CA_PROP_EVENT_ID, e,
|
|
|
|
CA_PROP_EVENT_DESCRIPTION, "Desktop switched",
|
2009-11-20 11:38:21 -05:00
|
|
|
CA_PROP_CANBERRA_CACHE_CONTROL, "permanent",
|
2009-02-11 19:53:23 -05:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
finish:
|
|
|
|
meta_screen_free_workspace_layout (&layout);
|
2010-02-11 10:28:20 -05:00
|
|
|
#endif /* HAVE_LIBCANBERRA */
|
2009-02-11 19:53:23 -05:00
|
|
|
}
|
|
|
|
|
2009-08-26 12:32:06 -04:00
|
|
|
/**
|
|
|
|
* meta_workspace_activate_with_focus:
|
|
|
|
* @workspace: a #MetaWorkspace
|
|
|
|
* @focus_this: the #MetaWindow to be focused, or %NULL
|
|
|
|
* @timestamp: timestamp for @focus_this
|
|
|
|
*
|
|
|
|
* Switches to @workspace and possibly activates the window @focus_this.
|
|
|
|
*
|
|
|
|
* The window @focus_this is activated by calling meta_window_activate()
|
|
|
|
* which will unminimize it and transient parents, raise it and give it
|
|
|
|
* the focus.
|
|
|
|
*
|
|
|
|
* If a window is currently being moved by the user, it will be
|
|
|
|
* moved to @workspace.
|
|
|
|
*
|
|
|
|
* The advantage of calling this function instead of meta_workspace_activate()
|
|
|
|
* followed by meta_window_activate() is that it happens as a unit, so
|
|
|
|
* no other window gets focused first before @focus_this.
|
|
|
|
*/
|
2001-06-06 00:47:37 -04:00
|
|
|
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
|
|
|
{
|
2009-07-02 11:19:02 -04:00
|
|
|
MetaWorkspace *old;
|
|
|
|
MetaWindow *move_window;
|
|
|
|
MetaScreen *screen;
|
|
|
|
MetaDisplay *display;
|
|
|
|
MetaCompositor *comp;
|
|
|
|
MetaWorkspaceLayout layout1, layout2;
|
|
|
|
gint num_workspaces, current_space, new_space;
|
|
|
|
MetaMotionDirection direction;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
meta_verbose ("Activating workspace %d\n",
|
|
|
|
meta_workspace_index (workspace));
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
if (workspace->screen->active_workspace == workspace)
|
|
|
|
return;
|
|
|
|
|
2010-02-09 16:44:16 -05:00
|
|
|
/* Free any cached pointers to the workspaces's edges from
|
|
|
|
* a current resize or move operation */
|
|
|
|
meta_display_cleanup_edges (workspace->screen->display);
|
|
|
|
|
2009-02-11 19:53:23 -05:00
|
|
|
if (workspace->screen->active_workspace)
|
|
|
|
workspace_switch_sound (workspace->screen->active_workspace, workspace);
|
|
|
|
|
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;
|
2009-07-02 11:19:02 -04:00
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
workspace->screen->active_workspace = workspace;
|
|
|
|
|
2011-01-25 16:27:31 -05:00
|
|
|
meta_screen_set_active_workspace_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
|
|
|
|
*/
|
2014-08-15 22:48:50 -04:00
|
|
|
if (old && (old->showing_desktop != workspace->showing_desktop))
|
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
|
|
|
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;
|
2014-08-15 13:48:22 -04:00
|
|
|
if (meta_grab_op_is_moving (workspace->screen->display->grab_op))
|
2004-02-15 00:29:49 -05:00
|
|
|
move_window = workspace->screen->display->grab_window;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2004-02-15 00:29:49 -05:00
|
|
|
if (move_window != NULL)
|
|
|
|
{
|
|
|
|
/* 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.
|
2008-03-10 23:37:54 -04:00
|
|
|
*
|
|
|
|
* \bug This comment appears to be the reverse of what happens
|
2004-02-15 00:29:49 -05:00
|
|
|
*/
|
2014-08-16 13:22:05 -04:00
|
|
|
if (!meta_window_located_on_workspace (move_window, workspace))
|
|
|
|
meta_window_change_workspace (move_window, workspace);
|
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
|
|
|
|
2009-07-02 11:19:02 -04:00
|
|
|
/*
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 17:10:40 -04:00
|
|
|
* Notify the compositor that the active workspace is changing.
|
2009-07-02 11:19:02 -04:00
|
|
|
*/
|
|
|
|
screen = workspace->screen;
|
|
|
|
display = meta_screen_get_display (screen);
|
|
|
|
comp = meta_display_get_compositor (display);
|
|
|
|
direction = 0;
|
|
|
|
|
|
|
|
current_space = meta_workspace_index (old);
|
|
|
|
new_space = meta_workspace_index (workspace);
|
|
|
|
num_workspaces = meta_screen_get_n_workspaces (workspace->screen);
|
|
|
|
meta_screen_calc_workspace_layout (workspace->screen, num_workspaces,
|
|
|
|
current_space, &layout1);
|
|
|
|
|
|
|
|
meta_screen_calc_workspace_layout (workspace->screen, num_workspaces,
|
|
|
|
new_space, &layout2);
|
|
|
|
|
2014-08-17 22:57:51 -04:00
|
|
|
if (meta_get_locale_direction () == META_LOCALE_DIRECTION_RTL)
|
2010-11-15 11:25:22 -05:00
|
|
|
{
|
|
|
|
if (layout1.current_col > layout2.current_col)
|
|
|
|
direction = META_MOTION_RIGHT;
|
|
|
|
else if (layout1.current_col < layout2.current_col)
|
|
|
|
direction = META_MOTION_LEFT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (layout1.current_col < layout2.current_col)
|
|
|
|
direction = META_MOTION_RIGHT;
|
|
|
|
else if (layout1.current_col > layout2.current_col)
|
|
|
|
direction = META_MOTION_LEFT;
|
|
|
|
}
|
2009-07-02 11:19:02 -04:00
|
|
|
|
|
|
|
if (layout1.current_row < layout2.current_row)
|
|
|
|
{
|
|
|
|
if (!direction)
|
|
|
|
direction = META_MOTION_DOWN;
|
|
|
|
else if (direction == META_MOTION_RIGHT)
|
|
|
|
direction = META_MOTION_DOWN_RIGHT;
|
|
|
|
else
|
|
|
|
direction = META_MOTION_DOWN_LEFT;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (layout1.current_row > layout2.current_row)
|
|
|
|
{
|
|
|
|
if (!direction)
|
|
|
|
direction = META_MOTION_UP;
|
|
|
|
else if (direction == META_MOTION_RIGHT)
|
|
|
|
direction = META_MOTION_UP_RIGHT;
|
|
|
|
else
|
|
|
|
direction = META_MOTION_UP_LEFT;
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_screen_free_workspace_layout (&layout1);
|
|
|
|
meta_screen_free_workspace_layout (&layout2);
|
|
|
|
|
2014-03-18 17:31:22 -04:00
|
|
|
meta_compositor_switch_workspace (comp, old, workspace, direction);
|
2009-07-02 11:19:02 -04:00
|
|
|
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 17:10:40 -04:00
|
|
|
/* This needs to be done after telling the compositor we are switching
|
|
|
|
* workspaces since focusing a window will cause it to be immediately
|
|
|
|
* shown and that would confuse the compositor if it didn't know we
|
|
|
|
* were in a workspace switch.
|
|
|
|
*/
|
|
|
|
if (focus_this)
|
|
|
|
{
|
2009-08-26 12:32:06 -04:00
|
|
|
meta_window_activate (focus_this, timestamp);
|
Simplify relationship between mapping and visibility
Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.
Simplify this so that visibility is controlled by:
meta_compositor_show_window()
meta_compositor_hide_window()
With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)
The map state of the window is signalled separately by:
meta_compositor_map_window()
meta_compositor_unmap_window()
And is used only to control resource handling.
Other changes:
* The desired effect on show/hide is explicitly stored in
MetaWindow, avoiding the need for the was_minimized flag.
At idle, once we calculate the window state, we pass the
effect to the compositor if it matches the new window
state, and then clear the effect to start over for future
map state changes.
* meta_compositor_switch_workspace() is called before any windows
are hidden or shown, allowing the compositor to avoid hiding
or showing an effect for windows involved in the switch.
http://bugzilla.gnome.org/show_bug.cgi?id=582341
* Handling of post-effect cleanups for MutterWindow are
simplified - instead of trying to do different things based
on the individual needs of different effects, we just wait until
all effects complete and sync the window state to what it
should be.
* On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
that we've done so, so it can clean up and unbind. (The
unbinding doesn't seem to be working properly because of
ClutterGLXPixmap or video driver issues.)
http://bugzilla.gnome.org/show_bug.cgi?id=587251
2009-06-28 17:10:40 -04:00
|
|
|
}
|
|
|
|
else if (move_window)
|
|
|
|
{
|
|
|
|
meta_window_raise (move_window);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS, "Focusing default window on new workspace\n");
|
|
|
|
meta_workspace_focus_default_window (workspace, NULL, timestamp);
|
|
|
|
}
|
|
|
|
|
2009-07-02 11:19:02 -04:00
|
|
|
/* Emit switched signal from screen.c */
|
|
|
|
meta_screen_workspace_switched (screen, current_space, new_space, direction);
|
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
|
|
|
|
2009-01-09 10:04:53 -05:00
|
|
|
void
|
2014-08-16 08:03:10 -04:00
|
|
|
meta_workspace_index_changed (MetaWorkspace *workspace)
|
2009-01-09 10:04:53 -05:00
|
|
|
{
|
2014-08-15 23:01:31 -04:00
|
|
|
GList *l;
|
|
|
|
for (l = workspace->windows; l != NULL; l = l->next)
|
2009-01-09 10:04:53 -05:00
|
|
|
{
|
|
|
|
MetaWindow *win = l->data;
|
2014-05-20 15:46:21 -04:00
|
|
|
meta_window_current_workspace_changed (win);
|
2009-01-09 10:04:53 -05:00
|
|
|
}
|
2014-08-16 08:03:10 -04:00
|
|
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (workspace), obj_props[PROP_WORKSPACE_INDEX]);
|
2009-01-09 10:04:53 -05:00
|
|
|
}
|
|
|
|
|
2009-06-15 15:32:23 -04:00
|
|
|
/**
|
|
|
|
* meta_workspace_list_windows:
|
2010-09-14 20:10:09 -04:00
|
|
|
* @workspace: a #MetaWorkspace
|
2009-06-15 15:32:23 -04:00
|
|
|
*
|
|
|
|
* Gets windows contained on the workspace, including workspace->windows
|
|
|
|
* and also sticky windows. Override-redirect windows are not included.
|
|
|
|
*
|
2009-11-12 11:14:48 -05:00
|
|
|
* Return value: (transfer container) (element-type MetaWindow): the list of windows.
|
2002-01-10 01:31:31 -05:00
|
|
|
*/
|
|
|
|
GList*
|
|
|
|
meta_workspace_list_windows (MetaWorkspace *workspace)
|
|
|
|
{
|
2014-08-15 23:01:31 -04:00
|
|
|
GSList *display_windows, *l;
|
2002-01-10 01:31:31 -05:00
|
|
|
GList *workspace_windows;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2009-06-15 15:32:23 -04:00
|
|
|
display_windows = meta_display_list_windows (workspace->screen->display,
|
|
|
|
META_LIST_DEFAULT);
|
2002-01-10 01:31:31 -05:00
|
|
|
|
|
|
|
workspace_windows = NULL;
|
2014-08-15 23:01:31 -04:00
|
|
|
for (l = display_windows; l != NULL; l = l->next)
|
2002-01-10 01:31:31 -05:00
|
|
|
{
|
2014-08-15 23:01:31 -04:00
|
|
|
MetaWindow *window = l->data;
|
2002-01-10 01:31:31 -05:00
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (display_windows);
|
|
|
|
|
|
|
|
return workspace_windows;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_workspace_invalidate_work_area (MetaWorkspace *workspace)
|
|
|
|
{
|
2016-11-28 07:11:24 -05:00
|
|
|
GList *windows, *l;
|
2014-05-02 09:34:02 -04: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
|
|
|
|
2010-02-09 16:44:16 -05:00
|
|
|
/* If we are in the middle of a resize or move operation, we
|
|
|
|
* might have cached pointers to the workspace's edges */
|
|
|
|
if (workspace == workspace->screen->active_workspace)
|
|
|
|
meta_display_cleanup_edges (workspace->screen->display);
|
|
|
|
|
2016-12-02 04:39:01 -05:00
|
|
|
meta_workspace_clear_logical_monitor_data (workspace);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2008-11-17 14:46:38 -05:00
|
|
|
workspace_free_all_struts (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
|
|
|
|
|
|
|
meta_rectangle_free_list_and_elements (workspace->screen_region);
|
|
|
|
meta_rectangle_free_list_and_elements (workspace->screen_edges);
|
2009-08-31 09:52:16 -04:00
|
|
|
meta_rectangle_free_list_and_elements (workspace->monitor_edges);
|
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->screen_edges = NULL;
|
2009-08-31 09:52:16 -04:00
|
|
|
workspace->monitor_edges = NULL;
|
2014-05-02 09:34:02 -04: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);
|
2002-01-10 01:31:31 -05:00
|
|
|
|
2014-08-15 23:01:31 -04:00
|
|
|
for (l = windows; l != NULL; l = l->next)
|
|
|
|
{
|
|
|
|
MetaWindow *w = l->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-01-10 01:31:31 -05:00
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2008-11-17 14:46:38 -05:00
|
|
|
static MetaStrut *
|
|
|
|
copy_strut(MetaStrut *original)
|
|
|
|
{
|
|
|
|
return g_memdup(original, sizeof(MetaStrut));
|
|
|
|
}
|
|
|
|
|
|
|
|
static GSList *
|
|
|
|
copy_strut_list(GSList *original)
|
|
|
|
{
|
|
|
|
GSList *result = NULL;
|
|
|
|
|
2014-08-15 23:01:31 -04:00
|
|
|
for (; original != NULL; original = original->next)
|
|
|
|
result = g_slist_prepend (result, copy_strut (original->data));
|
2008-11-17 14:46:38 -05:00
|
|
|
|
|
|
|
return g_slist_reverse (result);
|
|
|
|
}
|
|
|
|
|
2003-02-23 12:09:46 -05:00
|
|
|
static void
|
|
|
|
ensure_work_areas_validated (MetaWorkspace *workspace)
|
|
|
|
{
|
2016-11-28 07:11:24 -05:00
|
|
|
MetaBackend *backend = meta_get_backend ();
|
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
|
|
|
GList *windows;
|
|
|
|
GList *tmp;
|
2016-12-02 03:00:03 -05:00
|
|
|
GList *logical_monitors, *l;
|
2016-11-28 07:11:24 -05:00
|
|
|
MetaRectangle work_area;
|
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->screen_region == NULL);
|
|
|
|
g_assert (workspace->screen_edges == NULL);
|
2009-08-31 09:52:16 -04:00
|
|
|
g_assert (workspace->monitor_edges == NULL);
|
2003-02-23 12:09:46 -05:00
|
|
|
|
2008-11-17 14:46:38 -05:00
|
|
|
/* STEP 1: Get the list of struts */
|
|
|
|
|
|
|
|
workspace->all_struts = copy_strut_list (workspace->builtin_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
|
|
|
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
|
|
|
|
2008-08-17 22:48:36 -04:00
|
|
|
for (s_iter = win->struts; s_iter != NULL; s_iter = s_iter->next) {
|
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
|
|
|
workspace->all_struts = g_slist_prepend (workspace->all_struts,
|
2008-11-17 14:46:38 -05:00
|
|
|
copy_strut(s_iter->data));
|
2008-08-17 22:48:36 -04:00
|
|
|
}
|
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
|
2009-08-31 09:52:16 -04:00
|
|
|
* on-single-monitor regions
|
2014-05-02 09:34:02 -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->screen_region == NULL);
|
|
|
|
|
2016-11-28 07:11:24 -05:00
|
|
|
logical_monitors =
|
2016-12-02 03:00:03 -05:00
|
|
|
meta_monitor_manager_get_logical_monitors (monitor_manager);
|
|
|
|
for (l = logical_monitors; l; l = l->next)
|
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
|
|
|
{
|
2016-12-02 03:00:03 -05:00
|
|
|
MetaLogicalMonitor *logical_monitor = l->data;
|
2016-12-02 04:39:01 -05:00
|
|
|
MetaWorkspaceLogicalMonitorData *data;
|
|
|
|
|
|
|
|
g_assert (!meta_workspace_get_logical_monitor_data (workspace,
|
|
|
|
logical_monitor));
|
2016-12-02 03:00:03 -05:00
|
|
|
|
2016-12-02 04:39:01 -05:00
|
|
|
data = meta_workspace_ensure_logical_monitor_data (workspace,
|
|
|
|
logical_monitor);
|
|
|
|
data->logical_monitor_region =
|
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
|
|
|
meta_rectangle_get_minimal_spanning_set_for_region (
|
2016-12-02 03:00:03 -05:00
|
|
|
&logical_monitor->rect,
|
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);
|
|
|
|
}
|
2016-11-28 07:11:24 -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
|
|
|
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
|
2009-08-31 09:52:16 -04:00
|
|
|
* monitors.
|
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,
|
2014-05-02 09:34:02 -04:00
|
|
|
workspace->work_area_screen.height);
|
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
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
/* Now find the work areas for each monitor */
|
2016-12-02 03:00:03 -05:00
|
|
|
for (l = logical_monitors; l; l = l->next)
|
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
|
|
|
{
|
2016-12-02 03:00:03 -05:00
|
|
|
MetaLogicalMonitor *logical_monitor = l->data;
|
2016-12-02 04:39:01 -05:00
|
|
|
MetaWorkspaceLogicalMonitorData *data;
|
2016-12-02 03:00:03 -05:00
|
|
|
|
2016-12-02 04:39:01 -05:00
|
|
|
data = meta_workspace_get_logical_monitor_data (workspace,
|
|
|
|
logical_monitor);
|
2016-12-02 03:00:03 -05:00
|
|
|
work_area = logical_monitor->rect;
|
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
|
|
|
|
2016-12-02 04:39:01 -05:00
|
|
|
if (!data->logical_monitor_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
|
|
|
/* 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
|
2016-12-02 04:39:01 -05:00
|
|
|
meta_rectangle_clip_to_region (data->logical_monitor_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
|
|
|
FIXED_DIRECTION_NONE,
|
|
|
|
&work_area);
|
|
|
|
|
2016-12-02 04:39:01 -05:00
|
|
|
data->logical_monitor_work_area = work_area;
|
|
|
|
|
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
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
|
|
|
"Computed work area for workspace %d "
|
2009-08-31 09:52:16 -04:00
|
|
|
"monitor %d: %d,%d %d x %d\n",
|
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
|
|
|
meta_workspace_index (workspace),
|
2016-12-02 04:39:01 -05:00
|
|
|
logical_monitor->number,
|
|
|
|
data->logical_monitor_work_area.x,
|
|
|
|
data->logical_monitor_work_area.y,
|
|
|
|
data->logical_monitor_work_area.width,
|
|
|
|
data->logical_monitor_work_area.height);
|
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 4: Make sure the screen_region is nonempty (separate from step 2
|
|
|
|
* since it relies on step 3).
|
2014-05-02 09:34:02 -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
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2009-08-31 09:52:16 -04:00
|
|
|
/* STEP 5: Cache screen and monitor 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);
|
2009-08-31 09:52:16 -04:00
|
|
|
g_assert (workspace->monitor_edges == NULL);
|
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_edges =
|
|
|
|
meta_rectangle_find_onscreen_edges (&workspace->screen->rect,
|
|
|
|
workspace->all_struts);
|
|
|
|
tmp = NULL;
|
2016-12-02 03:00:03 -05:00
|
|
|
for (l = logical_monitors; l; l = l->next)
|
|
|
|
{
|
|
|
|
MetaLogicalMonitor *logical_monitor = l->data;
|
|
|
|
|
|
|
|
tmp = g_list_prepend (tmp, &logical_monitor->rect);
|
|
|
|
}
|
2009-08-31 09:52:16 -04:00
|
|
|
workspace->monitor_edges =
|
|
|
|
meta_rectangle_find_nonintersected_monitor_edges (tmp,
|
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);
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2010-02-10 09:48:46 -05:00
|
|
|
static gboolean
|
|
|
|
strut_lists_equal (GSList *l,
|
|
|
|
GSList *m)
|
|
|
|
{
|
|
|
|
for (; l && m; l = l->next, m = m->next)
|
|
|
|
{
|
|
|
|
MetaStrut *a = l->data;
|
|
|
|
MetaStrut *b = m->data;
|
|
|
|
|
|
|
|
if (a->side != b->side ||
|
|
|
|
!meta_rectangle_equal (&a->rect, &b->rect))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return l == NULL && m == NULL;
|
|
|
|
}
|
|
|
|
|
2008-11-17 14:46:38 -05:00
|
|
|
/**
|
|
|
|
* meta_workspace_set_builtin_struts:
|
|
|
|
* @workspace: a #MetaWorkspace
|
2010-10-18 14:34:14 -04:00
|
|
|
* @struts: (element-type Meta.Strut) (transfer none): list of #MetaStrut
|
2008-11-17 14:46:38 -05:00
|
|
|
*
|
|
|
|
* Sets a list of struts that will be used in addition to the struts
|
|
|
|
* of the windows in the workspace when computing the work area of
|
|
|
|
* the workspace.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
meta_workspace_set_builtin_struts (MetaWorkspace *workspace,
|
|
|
|
GSList *struts)
|
|
|
|
{
|
2016-11-30 23:52:07 -05:00
|
|
|
MetaBackend *backend = meta_get_backend ();
|
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
2014-06-10 20:16:13 -04:00
|
|
|
MetaScreen *screen = workspace->screen;
|
|
|
|
GSList *l;
|
|
|
|
|
|
|
|
for (l = struts; l; l = l->next)
|
|
|
|
{
|
|
|
|
MetaStrut *strut = l->data;
|
2016-11-30 23:52:07 -05:00
|
|
|
MetaLogicalMonitor *logical_monitor;
|
|
|
|
|
|
|
|
logical_monitor =
|
|
|
|
meta_monitor_manager_get_logical_monitor_from_rect (monitor_manager,
|
|
|
|
&strut->rect);
|
2014-06-10 20:16:13 -04:00
|
|
|
|
|
|
|
switch (strut->side)
|
|
|
|
{
|
|
|
|
case META_SIDE_TOP:
|
2016-12-01 02:15:52 -05:00
|
|
|
if (meta_monitor_manager_get_logical_monitor_neighbor (monitor_manager,
|
|
|
|
logical_monitor,
|
|
|
|
META_SCREEN_UP))
|
2014-06-10 20:16:13 -04:00
|
|
|
continue;
|
|
|
|
|
|
|
|
strut->rect.height += strut->rect.y;
|
|
|
|
strut->rect.y = 0;
|
|
|
|
break;
|
|
|
|
case META_SIDE_BOTTOM:
|
2016-12-01 02:15:52 -05:00
|
|
|
if (meta_monitor_manager_get_logical_monitor_neighbor (monitor_manager,
|
|
|
|
logical_monitor,
|
|
|
|
META_SCREEN_DOWN))
|
2014-06-10 20:16:13 -04:00
|
|
|
continue;
|
|
|
|
|
|
|
|
strut->rect.height = screen->rect.height - strut->rect.y;
|
|
|
|
break;
|
|
|
|
case META_SIDE_LEFT:
|
2016-12-01 02:15:52 -05:00
|
|
|
if (meta_monitor_manager_get_logical_monitor_neighbor (monitor_manager,
|
|
|
|
logical_monitor,
|
|
|
|
META_SCREEN_LEFT))
|
2014-06-10 20:16:13 -04:00
|
|
|
continue;
|
|
|
|
|
|
|
|
strut->rect.width += strut->rect.x;
|
|
|
|
strut->rect.x = 0;
|
|
|
|
break;
|
|
|
|
case META_SIDE_RIGHT:
|
2016-12-01 02:15:52 -05:00
|
|
|
if (meta_monitor_manager_get_logical_monitor_neighbor (monitor_manager,
|
|
|
|
logical_monitor,
|
|
|
|
META_SCREEN_RIGHT))
|
2014-06-10 20:16:13 -04:00
|
|
|
continue;
|
|
|
|
|
|
|
|
strut->rect.width = screen->rect.width - strut->rect.x;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-10 09:48:46 -05:00
|
|
|
/* Reordering doesn't actually matter, so we don't catch all
|
|
|
|
* no-impact changes, but this is just a (possibly unnecessary
|
|
|
|
* anyways) optimization */
|
|
|
|
if (strut_lists_equal (struts, workspace->builtin_struts))
|
|
|
|
return;
|
|
|
|
|
2008-11-17 14:46:38 -05:00
|
|
|
workspace_free_builtin_struts (workspace);
|
|
|
|
workspace->builtin_struts = copy_strut_list (struts);
|
|
|
|
|
|
|
|
meta_workspace_invalidate_work_area (workspace);
|
|
|
|
}
|
|
|
|
|
2016-11-28 22:48:52 -05:00
|
|
|
void
|
|
|
|
meta_workspace_get_work_area_for_logical_monitor (MetaWorkspace *workspace,
|
|
|
|
MetaLogicalMonitor *logical_monitor,
|
|
|
|
MetaRectangle *area)
|
|
|
|
{
|
|
|
|
meta_workspace_get_work_area_for_monitor (workspace,
|
|
|
|
logical_monitor->number,
|
|
|
|
area);
|
|
|
|
}
|
|
|
|
|
2013-01-27 23:08:17 -05:00
|
|
|
/**
|
|
|
|
* meta_workspace_get_work_area_for_monitor:
|
|
|
|
* @workspace: a #MetaWorkspace
|
|
|
|
* @which_monitor: a monitor index
|
|
|
|
* @area: (out): location to store the work area
|
|
|
|
*
|
|
|
|
* Stores the work area for @which_monitor on @workspace
|
|
|
|
* in @area.
|
|
|
|
*/
|
2003-02-23 12:09:46 -05:00
|
|
|
void
|
2009-08-31 09:52:16 -04:00
|
|
|
meta_workspace_get_work_area_for_monitor (MetaWorkspace *workspace,
|
|
|
|
int which_monitor,
|
|
|
|
MetaRectangle *area)
|
2003-02-23 12:09:46 -05:00
|
|
|
{
|
2016-11-28 07:11:24 -05:00
|
|
|
MetaBackend *backend = meta_get_backend();
|
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
2016-12-02 04:39:01 -05:00
|
|
|
MetaLogicalMonitor *logical_monitor;
|
|
|
|
MetaWorkspaceLogicalMonitorData *data;
|
2002-01-10 01:31:31 -05:00
|
|
|
|
2003-02-23 12:09:46 -05:00
|
|
|
ensure_work_areas_validated (workspace);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2016-12-02 04:39:01 -05:00
|
|
|
logical_monitor =
|
|
|
|
meta_monitor_manager_get_logical_monitor_from_number (monitor_manager,
|
|
|
|
which_monitor);
|
|
|
|
data = meta_workspace_get_logical_monitor_data (workspace, logical_monitor);
|
|
|
|
|
|
|
|
*area = data->logical_monitor_work_area;
|
2003-02-23 12:09:46 -05:00
|
|
|
}
|
|
|
|
|
2012-05-31 13:17:49 -04:00
|
|
|
/**
|
|
|
|
* meta_workspace_get_work_area_all_monitors:
|
|
|
|
* @workspace: a #MetaWorkspace
|
|
|
|
* @area: (out): location to store the work area
|
|
|
|
*
|
|
|
|
* Stores the work area in @area.
|
|
|
|
*/
|
2003-02-23 12:09:46 -05:00
|
|
|
void
|
2009-08-31 09:52:16 -04:00
|
|
|
meta_workspace_get_work_area_all_monitors (MetaWorkspace *workspace,
|
|
|
|
MetaRectangle *area)
|
2003-02-23 12:09:46 -05:00
|
|
|
{
|
|
|
|
ensure_work_areas_validated (workspace);
|
2014-05-02 09:34:02 -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
|
|
|
*area = workspace->work_area_screen;
|
|
|
|
}
|
|
|
|
|
|
|
|
GList*
|
|
|
|
meta_workspace_get_onscreen_region (MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
ensure_work_areas_validated (workspace);
|
|
|
|
|
|
|
|
return workspace->screen_region;
|
|
|
|
}
|
|
|
|
|
2016-12-02 04:39:01 -05:00
|
|
|
GList *
|
|
|
|
meta_workspace_get_onmonitor_region (MetaWorkspace *workspace,
|
|
|
|
MetaLogicalMonitor *logical_monitor)
|
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
|
|
|
{
|
2016-12-02 04:39:01 -05:00
|
|
|
MetaWorkspaceLogicalMonitorData *data;
|
|
|
|
|
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
|
|
|
ensure_work_areas_validated (workspace);
|
|
|
|
|
2016-12-02 04:39:01 -05:00
|
|
|
data = meta_workspace_get_logical_monitor_data (workspace, logical_monitor);
|
|
|
|
|
|
|
|
return data->logical_monitor_region;
|
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
|
2015-09-23 19:13:59 -04:00
|
|
|
static const char *
|
2002-11-07 18:13:12 -05:00
|
|
|
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";
|
2008-10-09 12:57:12 -04:00
|
|
|
case META_MOTION_UP_RIGHT:
|
|
|
|
return "Up-Right";
|
|
|
|
case META_MOTION_DOWN_RIGHT:
|
|
|
|
return "Down-Right";
|
|
|
|
case META_MOTION_UP_LEFT:
|
|
|
|
return "Up-Left";
|
|
|
|
case META_MOTION_DOWN_LEFT:
|
|
|
|
return "Down-Left";
|
2002-11-07 18:13:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return "Unknown";
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* WITH_VERBOSE_MODE */
|
2002-11-07 18:13:12 -05:00
|
|
|
|
2012-04-14 08:30:45 -04:00
|
|
|
/**
|
|
|
|
* meta_workspace_get_neighbor:
|
|
|
|
* @workspace: a #MetaWorkspace
|
|
|
|
* @direction: a #MetaMotionDirection, relative to @workspace
|
|
|
|
*
|
|
|
|
* Calculate and retrive the workspace that is next to @workspace,
|
|
|
|
* according to @direction and the current workspace layout, as set
|
|
|
|
* by meta_screen_override_workspace_layout().
|
|
|
|
*
|
|
|
|
* Returns: (transfer none): the workspace next to @workspace, or
|
|
|
|
* @workspace itself if the neighbor would be outside the layout
|
|
|
|
*/
|
2002-06-08 23:44:16 -04:00
|
|
|
MetaWorkspace*
|
|
|
|
meta_workspace_get_neighbor (MetaWorkspace *workspace,
|
|
|
|
MetaMotionDirection direction)
|
|
|
|
{
|
2014-05-02 09:34:02 -04:00
|
|
|
MetaWorkspaceLayout layout;
|
2003-01-05 13:36:01 -05:00
|
|
|
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));
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-08-17 22:57:51 -04:00
|
|
|
ltr = (meta_get_locale_direction () == META_LOCALE_DIRECTION_LTR);
|
2007-05-25 10:36:12 -04:00
|
|
|
|
2014-05-02 09:34:02 -04:00
|
|
|
switch (direction)
|
2002-11-05 14:25:06 -05:00
|
|
|
{
|
|
|
|
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;
|
2008-10-09 12:57:12 -04:00
|
|
|
default:;
|
2002-11-05 14:25:06 -05:00
|
|
|
}
|
|
|
|
|
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);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2003-01-05 13:36:01 -05:00
|
|
|
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);
|
2014-05-02 09:34:02 -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)
|
2014-09-04 16:55:51 -04:00
|
|
|
meta_warning ("CurrentTime used to choose focus window; "
|
|
|
|
"focus window may not be correct.\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
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
if (meta_prefs_get_focus_mode () == G_DESKTOP_FOCUS_MODE_CLICK ||
|
2005-02-21 21:11:25 -05:00
|
|
|
!workspace->screen->display->mouse_mode)
|
2011-10-18 01:39:01 -04:00
|
|
|
focus_ancestor_or_top_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 &&
|
2014-05-02 09:34:02 -04:00
|
|
|
meta_prefs_get_auto_raise ())
|
2004-10-04 17:09:08 -04:00
|
|
|
{
|
|
|
|
meta_display_queue_autoraise_callback (workspace->screen->display,
|
|
|
|
window);
|
|
|
|
}
|
2004-06-24 16:02:46 -04:00
|
|
|
}
|
2011-06-24 12:14:15 -04:00
|
|
|
else if (meta_prefs_get_focus_mode () == G_DESKTOP_FOCUS_MODE_SLOPPY)
|
2011-10-18 01:39:01 -04:00
|
|
|
focus_ancestor_or_top_window (workspace, not_this_one, timestamp);
|
2011-06-24 12:14:15 -04:00
|
|
|
else if (meta_prefs_get_focus_mode () == G_DESKTOP_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 */
|
|
|
|
}
|
|
|
|
|
2011-10-18 01:39:01 -04:00
|
|
|
/* Focus ancestor of not_this_one if there is one */
|
2005-02-02 13:46:09 -05:00
|
|
|
static void
|
2011-10-18 01:39:01 -04:00
|
|
|
focus_ancestor_or_top_window (MetaWorkspace *workspace,
|
2005-02-02 13:46:09 -05: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
|
|
|
{
|
|
|
|
MetaWindow *window = NULL;
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
2014-05-02 09:34:02 -04:00
|
|
|
/* First, check to see if we need to focus an ancestor of a window */
|
2005-02-02 13:46:09 -05:00
|
|
|
if (not_this_one)
|
|
|
|
{
|
|
|
|
MetaWindow *ancestor;
|
|
|
|
ancestor = NULL;
|
|
|
|
meta_window_foreach_ancestor (not_this_one, record_ancestor, &ancestor);
|
2009-10-19 18:43:00 -04:00
|
|
|
if (ancestor != NULL &&
|
2013-01-18 14:55:23 -05:00
|
|
|
meta_window_located_on_workspace (ancestor, workspace) &&
|
2009-10-19 18:43:00 -04:00
|
|
|
meta_window_showing_on_its_workspace (ancestor))
|
2005-02-02 13:46:09 -05:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
2014-05-02 09:34:02 -04:00
|
|
|
"Focusing %s, ancestor of %s\n",
|
2005-02-02 13:46:09 -05:00
|
|
|
ancestor->desc, not_this_one->desc);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2005-02-02 13:46:09 -05:00
|
|
|
meta_window_focus (ancestor, timestamp);
|
|
|
|
|
|
|
|
/* Also raise the window if in click-to-focus */
|
2011-06-24 12:14:15 -04:00
|
|
|
if (meta_prefs_get_focus_mode () == G_DESKTOP_FOCUS_MODE_CLICK)
|
2005-02-02 13:46:09 -05:00
|
|
|
meta_window_raise (ancestor);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-18 01:39:01 -04:00
|
|
|
window = meta_stack_get_default_focus_window (workspace->screen->stack,
|
|
|
|
workspace,
|
2012-07-13 18:17:43 -04:00
|
|
|
not_this_one);
|
2006-01-16 01:07:29 -05:00
|
|
|
|
2003-08-15 18:09:55 -04:00
|
|
|
if (window)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Focusing workspace MRU window %s\n", window->desc);
|
2014-05-02 09:34:02 -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_window_focus (window, timestamp);
|
2003-08-15 18:09:55 -04:00
|
|
|
|
|
|
|
/* Also raise the window if in click-to-focus */
|
2011-06-24 12:14:15 -04:00
|
|
|
if (meta_prefs_get_focus_mode () == G_DESKTOP_FOCUS_MODE_CLICK)
|
2003-08-15 18:09:55 -04:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|
2008-09-18 11:09:11 -04:00
|
|
|
|
2008-11-17 16:34:28 -05:00
|
|
|
/**
|
|
|
|
* meta_workspace_get_screen:
|
|
|
|
* @workspace: a #MetaWorkspace
|
|
|
|
*
|
|
|
|
* Gets the #MetaScreen that the workspace is part of.
|
|
|
|
*
|
|
|
|
* Return value: (transfer none): the #MetaScreen for the workspace
|
|
|
|
*/
|
2008-09-18 11:09:11 -04:00
|
|
|
MetaScreen *
|
|
|
|
meta_workspace_get_screen (MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
return workspace->screen;
|
|
|
|
}
|
|
|
|
|