2006-10-01 22:30:10 +00:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
2014-05-02 13:34:02 +00:00
|
|
|
/*
|
2001-06-06 04:47:37 +00:00
|
|
|
* Copyright (C) 2001 Havoc Pennington
|
2004-02-23 01:48:29 +00:00
|
|
|
* Copyright (C) 2003 Rob Adams
|
2005-10-08 19:38:54 +00:00
|
|
|
* Copyright (C) 2004, 2005 Elijah Newren
|
2014-05-02 13:34:02 +00:00
|
|
|
*
|
2001-06-06 04:47:37 +00: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 13:34:02 +00:00
|
|
|
*
|
2001-06-06 04:47:37 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2014-01-12 01:42:06 +00:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2001-06-06 04:47:37 +00:00
|
|
|
*/
|
|
|
|
|
2013-03-11 15:52:36 +00:00
|
|
|
/**
|
2023-03-28 14:35:11 +00:00
|
|
|
* MetaWorkspace:
|
2023-05-23 18:25:54 +00:00
|
|
|
*
|
2023-03-28 14:35:11 +00:00
|
|
|
* Workspaces
|
2013-03-11 15:52:36 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2018-07-10 08:36:24 +00:00
|
|
|
#include "config.h"
|
2008-09-18 15:09:11 +00:00
|
|
|
|
2018-07-10 08:36:24 +00:00
|
|
|
#include "meta/workspace.h"
|
2008-09-18 15:09:11 +00:00
|
|
|
|
2002-06-22 04:52:35 +00:00
|
|
|
#include <string.h>
|
2001-06-06 04:47:37 +00:00
|
|
|
|
2018-07-10 08:36:24 +00:00
|
|
|
#include "backends/meta-backend-private.h"
|
2022-07-11 22:45:43 +00:00
|
|
|
#include "backends/meta-cursor-tracker-private.h"
|
2018-07-10 08:36:24 +00:00
|
|
|
#include "backends/meta-logical-monitor.h"
|
2020-02-17 17:32:35 +00:00
|
|
|
#include "cogl/cogl.h"
|
2022-09-07 15:45:23 +00:00
|
|
|
#include "compositor/compositor-private.h"
|
2018-07-10 08:36:24 +00:00
|
|
|
#include "core/boxes-private.h"
|
|
|
|
#include "core/meta-workspace-manager-private.h"
|
|
|
|
#include "core/workspace-private.h"
|
|
|
|
#include "meta/prefs.h"
|
|
|
|
|
2005-02-02 18:46:09 +00:00
|
|
|
void meta_workspace_queue_calc_showing (MetaWorkspace *workspace);
|
2022-06-29 13:44:11 +00:00
|
|
|
static void focus_ancestor_or_mru_window (MetaWorkspace *workspace,
|
2005-02-02 18:46:09 +00: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 16:32:33 +00:00
|
|
|
guint32 timestamp);
|
2022-07-11 22:45:43 +00:00
|
|
|
static MetaWindow * get_pointer_window (MetaWorkspace *workspace,
|
|
|
|
MetaWindow *not_this_one);
|
2001-06-09 05:14:43 +00:00
|
|
|
|
2008-11-17 20:56:34 +00:00
|
|
|
G_DEFINE_TYPE (MetaWorkspace, meta_workspace, G_TYPE_OBJECT);
|
|
|
|
|
2018-12-19 08:04:25 +00:00
|
|
|
enum
|
|
|
|
{
|
2014-08-16 12:02:19 +00:00
|
|
|
PROP_0,
|
|
|
|
|
|
|
|
PROP_N_WINDOWS,
|
2014-08-16 12:03:10 +00:00
|
|
|
PROP_WORKSPACE_INDEX,
|
2020-06-28 23:06:30 +00:00
|
|
|
PROP_ACTIVE,
|
2014-08-16 12:02:19 +00:00
|
|
|
|
2018-02-10 12:36:48 +00:00
|
|
|
PROP_LAST,
|
2014-08-16 12:02:19 +00:00
|
|
|
};
|
|
|
|
|
2018-02-10 12:36:48 +00:00
|
|
|
static GParamSpec *obj_props[PROP_LAST];
|
2014-08-16 12:02:19 +00:00
|
|
|
|
2009-02-02 20:27:43 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
WINDOW_ADDED,
|
|
|
|
WINDOW_REMOVED,
|
|
|
|
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2014-08-16 12:02:19 +00:00
|
|
|
static guint signals[LAST_SIGNAL] = { 0 };
|
2009-02-02 20:27:43 +00:00
|
|
|
|
2016-12-02 09:39:01 +00:00
|
|
|
typedef struct _MetaWorkspaceLogicalMonitorData
|
|
|
|
{
|
|
|
|
GList *logical_monitor_region;
|
2023-07-19 23:46:15 +00:00
|
|
|
MtkRectangle logical_monitor_work_area;
|
2016-12-02 09:39:01 +00:00
|
|
|
} MetaWorkspaceLogicalMonitorData;
|
|
|
|
|
2018-11-13 07:31:52 +00:00
|
|
|
typedef struct _MetaWorkspaceFocusableAncestorData
|
|
|
|
{
|
|
|
|
MetaWorkspace *workspace;
|
|
|
|
MetaWindow *out_window;
|
|
|
|
} MetaWorkspaceFocusableAncestorData;
|
|
|
|
|
2016-12-02 09:39:01 +00:00
|
|
|
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);
|
2017-11-06 19:38:43 +00:00
|
|
|
g_free (data);
|
2016-12-02 09:39:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2009-03-17 08:54:19 +00:00
|
|
|
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
|
2020-08-26 09:49:50 +00:00
|
|
|
* the list length ?
|
2009-03-17 08:54:19 +00:00
|
|
|
*/
|
|
|
|
g_value_set_uint (value, g_list_length (ws->windows));
|
|
|
|
break;
|
2014-08-16 12:03:10 +00:00
|
|
|
case PROP_WORKSPACE_INDEX:
|
|
|
|
g_value_set_uint (value, meta_workspace_index (ws));
|
|
|
|
break;
|
2020-06-28 23:06:30 +00:00
|
|
|
case PROP_ACTIVE:
|
|
|
|
g_value_set_boolean (value, ws->manager->active_workspace == ws);
|
|
|
|
break;
|
2009-03-17 08:54:19 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-17 20:56:34 +00:00
|
|
|
static void
|
|
|
|
meta_workspace_class_init (MetaWorkspaceClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2009-03-17 08:54:19 +00:00
|
|
|
object_class->get_property = meta_workspace_get_property;
|
|
|
|
|
2009-02-02 20:27:43 +00:00
|
|
|
signals[WINDOW_ADDED] = g_signal_new ("window-added",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
0,
|
2011-10-18 22:06:14 +00:00
|
|
|
NULL, NULL, NULL,
|
2009-02-02 20:27:43 +00: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 22:06:14 +00:00
|
|
|
NULL, NULL, NULL,
|
2009-02-02 20:27:43 +00:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
META_TYPE_WINDOW);
|
|
|
|
|
2023-06-28 12:02:43 +00:00
|
|
|
obj_props[PROP_N_WINDOWS] = g_param_spec_uint ("n-windows", NULL, NULL,
|
2014-08-16 12:02:19 +00:00
|
|
|
0, G_MAXUINT, 0,
|
2014-08-16 12:02:34 +00:00
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
2023-06-28 12:02:43 +00:00
|
|
|
obj_props[PROP_WORKSPACE_INDEX] = g_param_spec_uint ("workspace-index", NULL, NULL,
|
2014-08-16 12:03:10 +00:00
|
|
|
0, G_MAXUINT, 0,
|
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
2023-06-28 12:02:43 +00:00
|
|
|
obj_props[PROP_ACTIVE] = g_param_spec_boolean ("active", NULL, NULL,
|
2020-06-28 23:06:30 +00:00
|
|
|
FALSE,
|
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
2008-11-17 20:56:34 +00:00
|
|
|
|
2018-02-10 12:36:48 +00:00
|
|
|
g_object_class_install_properties (object_class, PROP_LAST, obj_props);
|
2008-11-17 20:56:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_workspace_init (MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-08-27 19:02:40 +00:00
|
|
|
MetaWorkspace *
|
|
|
|
meta_workspace_new (MetaWorkspaceManager *workspace_manager)
|
2001-06-06 04:47:37 +00:00
|
|
|
{
|
2017-08-27 19:02:40 +00:00
|
|
|
MetaDisplay *display = workspace_manager->display;
|
2001-06-06 04:47:37 +00:00
|
|
|
MetaWorkspace *workspace;
|
2014-09-29 21:02:02 +00:00
|
|
|
GSList *windows, *l;
|
2001-06-06 04:47:37 +00:00
|
|
|
|
2008-11-17 20:56:34 +00:00
|
|
|
workspace = g_object_new (META_TYPE_WORKSPACE, NULL);
|
2001-06-06 04:47:37 +00:00
|
|
|
|
2017-08-26 19:39:46 +00:00
|
|
|
workspace->display = display;
|
2017-08-27 19:02:40 +00:00
|
|
|
workspace->manager = workspace_manager;
|
|
|
|
|
|
|
|
workspace_manager->workspaces =
|
|
|
|
g_list_append (workspace_manager->workspaces, workspace);
|
2001-06-06 04:47:37 +00:00
|
|
|
workspace->windows = NULL;
|
2003-08-15 22:09:55 +00:00
|
|
|
workspace->mru_list = NULL;
|
2001-06-07 05:18:10 +00:00
|
|
|
|
2003-02-23 17:09:46 +00: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 14:58:50 +00: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-26 03:09:38 +00: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 14:58:50 +00:00
|
|
|
workspace->screen_region = NULL;
|
|
|
|
workspace->screen_edges = NULL;
|
2009-08-31 13:52:16 +00:00
|
|
|
workspace->monitor_edges = NULL;
|
2006-02-11 05:06:08 +00: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 14:58:50 +00:00
|
|
|
|
2008-11-17 19:46:38 +00: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 14:58:50 +00: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 04:28:29 +00:00
|
|
|
|
|
|
|
workspace->showing_desktop = FALSE;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2014-10-12 09:18:58 +00:00
|
|
|
/* make sure sticky windows are in our mru_list */
|
2017-08-26 19:39:46 +00:00
|
|
|
windows = meta_display_list_windows (display, META_LIST_SORTED);
|
2014-10-12 09:18:58 +00:00
|
|
|
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 04:47:37 +00:00
|
|
|
return workspace;
|
|
|
|
}
|
|
|
|
|
2008-09-01 03:10:31 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* workspace_free_all_struts:
|
|
|
|
* @workspace: The workspace.
|
2008-09-01 03:10:31 +00:00
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Frees the combined struts list of a workspace.
|
2008-09-01 03:10:31 +00:00
|
|
|
*/
|
|
|
|
static void
|
2008-11-17 19:46:38 +00:00
|
|
|
workspace_free_all_struts (MetaWorkspace *workspace)
|
2008-09-01 03:10:31 +00:00
|
|
|
{
|
|
|
|
if (workspace->all_struts == NULL)
|
|
|
|
return;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2019-05-15 18:56:35 +00:00
|
|
|
g_slist_free_full (workspace->all_struts, g_free);
|
2008-09-01 03:10:31 +00:00
|
|
|
workspace->all_struts = NULL;
|
|
|
|
}
|
|
|
|
|
2008-11-17 19:46:38 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* workspace_free_builtin_struts:
|
|
|
|
* @workspace: The workspace.
|
2008-11-17 19:46:38 +00:00
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Frees the struts list set with meta_workspace_set_builtin_struts
|
2008-11-17 19:46:38 +00:00
|
|
|
*/
|
|
|
|
static void
|
|
|
|
workspace_free_builtin_struts (MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
if (workspace->builtin_struts == NULL)
|
|
|
|
return;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2019-05-15 18:56:35 +00:00
|
|
|
g_slist_free_full (workspace->builtin_struts, g_free);
|
2008-11-17 19:46:38 +00:00
|
|
|
workspace->builtin_struts = NULL;
|
|
|
|
}
|
|
|
|
|
2014-08-25 12:57:13 +00: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 04:47:37 +00:00
|
|
|
void
|
2008-11-17 20:56:34 +00:00
|
|
|
meta_workspace_remove (MetaWorkspace *workspace)
|
2001-06-06 04:47:37 +00:00
|
|
|
{
|
2017-08-27 19:02:40 +00:00
|
|
|
MetaWorkspaceManager *manager = workspace->display->workspace_manager;
|
|
|
|
|
|
|
|
g_return_if_fail (workspace != manager->active_workspace);
|
2001-12-10 03:55:26 +00:00
|
|
|
|
2014-08-25 12:57:13 +00:00
|
|
|
assert_workspace_empty (workspace);
|
2001-12-10 03:55:26 +00:00
|
|
|
|
2017-08-27 19:02:40 +00:00
|
|
|
manager->workspaces =
|
|
|
|
g_list_remove (manager->workspaces, workspace);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2016-12-02 09:39:01 +00:00
|
|
|
meta_workspace_clear_logical_monitor_data (workspace);
|
2003-06-26 03:09:38 +00:00
|
|
|
|
2003-12-17 16:01:00 +00:00
|
|
|
g_list_free (workspace->mru_list);
|
2006-02-11 05:06:08 +00: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 14:58:50 +00:00
|
|
|
|
2008-11-17 19:46:38 +00:00
|
|
|
workspace_free_builtin_struts (workspace);
|
|
|
|
|
2008-07-13 22:16:23 +00: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 19:46:38 +00:00
|
|
|
workspace_free_all_struts (workspace);
|
2008-07-13 22:16:23 +00:00
|
|
|
meta_rectangle_free_list_and_elements (workspace->screen_region);
|
|
|
|
meta_rectangle_free_list_and_elements (workspace->screen_edges);
|
2009-08-31 13:52:16 +00:00
|
|
|
meta_rectangle_free_list_and_elements (workspace->monitor_edges);
|
2008-07-13 22:16:23 +00:00
|
|
|
}
|
2003-06-26 03:09:38 +00:00
|
|
|
|
2008-11-17 20:56:34 +00:00
|
|
|
g_object_unref (workspace);
|
2001-12-10 03:55:26 +00:00
|
|
|
|
2002-06-22 04:52:35 +00:00
|
|
|
/* don't bother to reset names, pagers can just ignore
|
|
|
|
* extra ones
|
|
|
|
*/
|
2001-06-06 04:47:37 +00:00
|
|
|
}
|
|
|
|
|
2019-10-12 18:55:26 +00:00
|
|
|
static void
|
|
|
|
update_workspace_default_focus (MetaWorkspace *workspace,
|
|
|
|
MetaWindow *not_this_one)
|
|
|
|
{
|
|
|
|
g_autoptr (GSList) windows = NULL;
|
|
|
|
GSList *l;
|
|
|
|
|
|
|
|
windows = meta_display_list_windows (workspace->display, META_LIST_DEFAULT);
|
|
|
|
for (l = windows; l; l = l->next)
|
|
|
|
{
|
|
|
|
MetaWindow *window = META_WINDOW (l->data);
|
|
|
|
|
|
|
|
if (meta_window_located_on_workspace (window, workspace) &&
|
|
|
|
window != not_this_one)
|
|
|
|
meta_window_update_appears_focused (window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-06-06 04:47:37 +00:00
|
|
|
void
|
|
|
|
meta_workspace_add_window (MetaWorkspace *workspace,
|
|
|
|
MetaWindow *window)
|
|
|
|
{
|
2019-10-12 18:55:26 +00:00
|
|
|
MetaWorkspaceManager *workspace_manager;
|
|
|
|
|
2021-01-28 17:59:22 +00:00
|
|
|
g_return_if_fail (g_list_find (workspace->mru_list, window) == NULL);
|
|
|
|
|
2019-08-29 17:34:18 +00:00
|
|
|
COGL_TRACE_BEGIN_SCOPED (MetaWorkspaceAddWindow,
|
2023-11-16 04:28:23 +00:00
|
|
|
"Meta::Workspace::add_window()");
|
2019-08-29 17:34:18 +00:00
|
|
|
|
2019-10-12 18:55:26 +00:00
|
|
|
workspace_manager = workspace->display->workspace_manager;
|
|
|
|
|
2014-08-16 17:22:05 +00:00
|
|
|
workspace->mru_list = g_list_prepend (workspace->mru_list, window);
|
2003-12-14 19:19:40 +00:00
|
|
|
|
2001-06-06 04:47:37 +00:00
|
|
|
workspace->windows = g_list_prepend (workspace->windows, window);
|
2009-03-17 08:54:19 +00:00
|
|
|
|
2003-06-26 03:09:38 +00:00
|
|
|
if (window->struts)
|
2002-02-08 03:34:26 +00:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
2020-10-02 15:47:22 +00:00
|
|
|
"Invalidating work area of workspace %d since we're adding window %s to it",
|
2002-02-08 03:34:26 +00:00
|
|
|
meta_workspace_index (workspace), window->desc);
|
|
|
|
meta_workspace_invalidate_work_area (workspace);
|
|
|
|
}
|
2002-01-10 06:31:31 +00:00
|
|
|
|
2019-10-12 18:55:26 +00:00
|
|
|
if (workspace != workspace_manager->active_workspace)
|
|
|
|
update_workspace_default_focus (workspace, window);
|
|
|
|
|
2009-02-02 20:27:43 +00:00
|
|
|
g_signal_emit (workspace, signals[WINDOW_ADDED], 0, window);
|
2014-08-16 12:02:19 +00:00
|
|
|
g_object_notify_by_pspec (G_OBJECT (workspace), obj_props[PROP_N_WINDOWS]);
|
2001-06-06 04:47:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_workspace_remove_window (MetaWorkspace *workspace,
|
|
|
|
MetaWindow *window)
|
|
|
|
{
|
2019-10-12 18:55:26 +00:00
|
|
|
MetaWorkspaceManager *workspace_manager = workspace->display->workspace_manager;
|
|
|
|
|
2019-08-29 17:34:18 +00:00
|
|
|
COGL_TRACE_BEGIN_SCOPED (MetaWorkspaceRemoveWindow,
|
2023-11-16 04:28:23 +00:00
|
|
|
"Meta::Workspace::remove_window()");
|
2019-08-29 17:34:18 +00:00
|
|
|
|
2001-06-06 04:47:37 +00:00
|
|
|
workspace->windows = g_list_remove (workspace->windows, window);
|
2003-12-14 19:19:40 +00:00
|
|
|
|
2014-08-16 17:22:05 +00:00
|
|
|
workspace->mru_list = g_list_remove (workspace->mru_list, window);
|
|
|
|
g_assert (g_list_find (workspace->mru_list, window) == NULL);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2003-06-26 03:09:38 +00:00
|
|
|
if (window->struts)
|
2002-02-08 03:34:26 +00:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
2020-10-02 15:47:22 +00:00
|
|
|
"Invalidating work area of workspace %d since we're removing window %s from it",
|
2002-02-08 03:34:26 +00:00
|
|
|
meta_workspace_index (workspace), window->desc);
|
|
|
|
meta_workspace_invalidate_work_area (workspace);
|
|
|
|
}
|
2002-01-10 06:31:31 +00:00
|
|
|
|
2019-10-12 18:55:26 +00:00
|
|
|
if (workspace != workspace_manager->active_workspace)
|
|
|
|
update_workspace_default_focus (workspace, window);
|
|
|
|
|
2009-02-02 20:27:43 +00:00
|
|
|
g_signal_emit (workspace, signals[WINDOW_REMOVED], 0, window);
|
2009-03-17 08:54:19 +00:00
|
|
|
g_object_notify (G_OBJECT (workspace), "n-windows");
|
2001-06-06 04:47:37 +00:00
|
|
|
}
|
|
|
|
|
2001-12-10 03:55:26 +00:00
|
|
|
void
|
|
|
|
meta_workspace_relocate_windows (MetaWorkspace *workspace,
|
|
|
|
MetaWorkspace *new_home)
|
|
|
|
{
|
2014-08-16 03:01:31 +00:00
|
|
|
GList *copy, *l;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2001-12-10 03:55:26 +00: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 13:34:02 +00:00
|
|
|
|
2014-08-16 03:01:31 +00:00
|
|
|
for (l = copy; l != NULL; l = l->next)
|
2001-12-10 03:55:26 +00:00
|
|
|
{
|
2014-08-16 03:01:31 +00:00
|
|
|
MetaWindow *window = l->data;
|
2014-08-25 13:00:00 +00:00
|
|
|
|
2014-09-29 22:09:32 +00:00
|
|
|
if (!window->on_all_workspaces)
|
2014-08-25 13:00:00 +00:00
|
|
|
meta_window_change_workspace (window, new_home);
|
2001-12-10 03:55:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (copy);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2014-08-25 12:57:13 +00:00
|
|
|
assert_workspace_empty (workspace);
|
2001-12-10 03:55:26 +00:00
|
|
|
}
|
|
|
|
|
2001-06-06 04:47:37 +00:00
|
|
|
void
|
|
|
|
meta_workspace_queue_calc_showing (MetaWorkspace *workspace)
|
|
|
|
{
|
2014-08-16 03:01:31 +00:00
|
|
|
GList *l;
|
2001-06-06 04:47:37 +00:00
|
|
|
|
2014-08-16 03:01:31 +00:00
|
|
|
for (l = workspace->windows; l != NULL; l = l->next)
|
|
|
|
meta_window_queue (l->data, META_QUEUE_CALC_SHOWING);
|
2001-06-06 04:47:37 +00:00
|
|
|
}
|
|
|
|
|
2009-02-12 00:53:23 +00:00
|
|
|
static void
|
2022-11-23 09:25:04 +00:00
|
|
|
workspace_switch_sound (MetaWorkspace *from,
|
|
|
|
MetaWorkspace *to)
|
2009-02-12 00:53:23 +00:00
|
|
|
{
|
2018-12-17 22:38:43 +00:00
|
|
|
MetaSoundPlayer *player;
|
2009-02-12 00:53:23 +00:00
|
|
|
MetaWorkspaceLayout layout;
|
2022-11-23 09:25:04 +00:00
|
|
|
int n_workspaces;
|
|
|
|
int from_idx, to_idx;
|
|
|
|
int i;
|
|
|
|
int x, y;
|
|
|
|
const char *sound_name;
|
2009-02-12 00:53:23 +00:00
|
|
|
|
2022-11-23 09:25:04 +00:00
|
|
|
n_workspaces = meta_workspace_manager_get_n_workspaces (from->manager);
|
|
|
|
from_idx = meta_workspace_index(from);
|
|
|
|
to_idx = meta_workspace_index(to);
|
2009-02-12 00:53:23 +00:00
|
|
|
|
2017-08-27 19:02:40 +00:00
|
|
|
meta_workspace_manager_calc_workspace_layout (from->manager,
|
2022-11-23 09:25:04 +00:00
|
|
|
n_workspaces,
|
|
|
|
from_idx,
|
2017-08-27 19:02:40 +00:00
|
|
|
&layout);
|
2009-02-12 00:53:23 +00:00
|
|
|
|
2022-11-23 09:25:04 +00:00
|
|
|
for (i = 0; i < n_workspaces; i++)
|
|
|
|
{
|
|
|
|
if (layout.grid[i] == to_idx)
|
|
|
|
break;
|
|
|
|
}
|
2009-02-12 00:53:23 +00:00
|
|
|
|
2022-11-23 09:25:04 +00:00
|
|
|
if (i >= n_workspaces)
|
2009-02-12 00:53:23 +00:00
|
|
|
{
|
2022-11-20 19:35:29 +00:00
|
|
|
g_warning ("Failed to find destination workspace in layout");
|
2009-02-12 00:53:23 +00:00
|
|
|
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)
|
2022-11-23 09:25:04 +00:00
|
|
|
sound_name = "desktop-switch-left";
|
2009-02-12 00:53:23 +00:00
|
|
|
else if (x > layout.current_col)
|
2022-11-23 09:25:04 +00:00
|
|
|
sound_name = "desktop-switch-right";
|
2009-02-12 00:53:23 +00:00
|
|
|
else if (y < layout.current_row)
|
2022-11-23 09:25:04 +00:00
|
|
|
sound_name = "desktop-switch-up";
|
2009-02-12 00:53:23 +00:00
|
|
|
else if (y > layout.current_row)
|
2022-11-23 09:25:04 +00:00
|
|
|
sound_name = "desktop-switch-down";
|
2009-02-12 00:53:23 +00:00
|
|
|
else
|
|
|
|
{
|
2022-11-20 19:35:29 +00:00
|
|
|
g_warn_if_reached ();
|
2009-02-12 00:53:23 +00:00
|
|
|
goto finish;
|
|
|
|
}
|
|
|
|
|
2018-12-17 22:38:43 +00:00
|
|
|
player = meta_display_get_sound_player (from->display);
|
2022-11-23 09:25:04 +00:00
|
|
|
meta_sound_player_play_from_theme (player,
|
|
|
|
sound_name, _("Workspace switched"),
|
|
|
|
NULL);
|
2009-02-12 00:53:23 +00:00
|
|
|
|
|
|
|
finish:
|
2017-08-27 19:02:40 +00:00
|
|
|
meta_workspace_manager_free_workspace_layout (&layout);
|
2009-02-12 00:53:23 +00:00
|
|
|
}
|
|
|
|
|
2009-08-26 16:32:06 +00: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 04:47:37 +00:00
|
|
|
void
|
2003-05-30 20:24:00 +00: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 20:32:59 +00: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 16:32:33 +00:00
|
|
|
guint32 timestamp)
|
2001-06-06 04:47:37 +00:00
|
|
|
{
|
2009-07-02 15:19:02 +00:00
|
|
|
MetaWorkspace *old;
|
|
|
|
MetaWindow *move_window;
|
|
|
|
MetaCompositor *comp;
|
|
|
|
MetaWorkspaceLayout layout1, layout2;
|
|
|
|
gint num_workspaces, current_space, new_space;
|
|
|
|
MetaMotionDirection direction;
|
2022-10-21 10:56:24 +00:00
|
|
|
MetaWindowDrag *window_drag;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2022-11-23 09:26:55 +00:00
|
|
|
g_return_if_fail (META_IS_WORKSPACE (workspace));
|
|
|
|
g_return_if_fail (meta_workspace_index (workspace) != -1);
|
|
|
|
|
2020-10-02 15:47:22 +00:00
|
|
|
meta_verbose ("Activating workspace %d",
|
2001-06-06 04:47:37 +00:00
|
|
|
meta_workspace_index (workspace));
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2017-08-27 19:02:40 +00:00
|
|
|
if (workspace->manager->active_workspace == workspace)
|
2019-05-02 18:57:02 +00:00
|
|
|
{
|
|
|
|
if (focus_this)
|
|
|
|
meta_window_activate (focus_this, timestamp);
|
|
|
|
return;
|
|
|
|
}
|
2001-06-06 04:47:37 +00:00
|
|
|
|
2022-10-27 16:11:21 +00:00
|
|
|
window_drag =
|
|
|
|
meta_compositor_get_current_window_drag (workspace->display->compositor);
|
|
|
|
|
2010-02-09 21:44:16 +00:00
|
|
|
/* Free any cached pointers to the workspaces's edges from
|
|
|
|
* a current resize or move operation */
|
2022-10-27 16:11:21 +00:00
|
|
|
if (window_drag)
|
|
|
|
meta_window_drag_update_edges (window_drag);
|
2010-02-09 21:44:16 +00:00
|
|
|
|
2017-08-27 19:02:40 +00:00
|
|
|
if (workspace->manager->active_workspace)
|
|
|
|
workspace_switch_sound (workspace->manager->active_workspace, workspace);
|
2009-02-12 00:53:23 +00: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 04:28:29 +00:00
|
|
|
/* Note that old can be NULL; e.g. when starting up */
|
2017-08-27 19:02:40 +00:00
|
|
|
old = workspace->manager->active_workspace;
|
2009-07-02 15:19:02 +00:00
|
|
|
|
2017-08-27 19:02:40 +00:00
|
|
|
workspace->manager->active_workspace = workspace;
|
2001-06-06 04:47:37 +00:00
|
|
|
|
2017-08-27 19:02:40 +00:00
|
|
|
g_signal_emit_by_name (workspace->manager, "active-workspace-changed");
|
2017-08-26 20:29:10 +00:00
|
|
|
|
2020-06-28 23:06:30 +00:00
|
|
|
g_object_notify_by_pspec (G_OBJECT (workspace), obj_props[PROP_ACTIVE]);
|
|
|
|
|
2017-08-26 20:29:10 +00:00
|
|
|
if (old == NULL)
|
|
|
|
return;
|
2002-08-04 20:17:37 +00:00
|
|
|
|
2020-06-28 23:06:30 +00:00
|
|
|
g_object_notify_by_pspec (G_OBJECT (old), obj_props[PROP_ACTIVE]);
|
|
|
|
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 04:28:29 +00:00
|
|
|
/* 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
|
|
|
|
*/
|
2017-08-26 20:29:10 +00:00
|
|
|
if (old->showing_desktop != workspace->showing_desktop)
|
2017-08-27 19:02:40 +00:00
|
|
|
g_signal_emit_by_name (workspace->manager, "showing-desktop-changed");
|
2002-08-04 20:17:37 +00:00
|
|
|
|
2004-02-15 05:29:49 +00:00
|
|
|
move_window = NULL;
|
2022-10-21 10:56:24 +00:00
|
|
|
if (window_drag &&
|
|
|
|
meta_grab_op_is_moving (meta_window_drag_get_grab_op (window_drag)))
|
|
|
|
move_window = meta_window_drag_get_window (window_drag);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2004-02-15 05:29:49 +00: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-11 03:37:54 +00:00
|
|
|
*
|
|
|
|
* \bug This comment appears to be the reverse of what happens
|
2004-02-15 05:29:49 +00:00
|
|
|
*/
|
2014-08-16 17:22:05 +00:00
|
|
|
if (!meta_window_located_on_workspace (move_window, workspace))
|
|
|
|
meta_window_change_workspace (move_window, workspace);
|
2004-02-15 05:29:49 +00:00
|
|
|
}
|
|
|
|
|
2001-06-06 04:47:37 +00:00
|
|
|
meta_workspace_queue_calc_showing (old);
|
|
|
|
meta_workspace_queue_calc_showing (workspace);
|
2002-01-03 23:28:19 +00:00
|
|
|
|
2009-07-02 15:19:02 +00: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 21:10:40 +00:00
|
|
|
* Notify the compositor that the active workspace is changing.
|
2009-07-02 15:19:02 +00:00
|
|
|
*/
|
2017-08-27 19:02:40 +00:00
|
|
|
comp = meta_display_get_compositor (workspace->display);
|
2009-07-02 15:19:02 +00:00
|
|
|
direction = 0;
|
|
|
|
|
|
|
|
current_space = meta_workspace_index (old);
|
|
|
|
new_space = meta_workspace_index (workspace);
|
2017-08-27 19:02:40 +00:00
|
|
|
num_workspaces = meta_workspace_manager_get_n_workspaces (workspace->manager);
|
|
|
|
meta_workspace_manager_calc_workspace_layout (workspace->manager, num_workspaces,
|
|
|
|
current_space, &layout1);
|
2009-07-02 15:19:02 +00:00
|
|
|
|
2017-08-27 19:02:40 +00:00
|
|
|
meta_workspace_manager_calc_workspace_layout (workspace->manager, num_workspaces,
|
|
|
|
new_space, &layout2);
|
2009-07-02 15:19:02 +00:00
|
|
|
|
2014-08-18 02:57:51 +00:00
|
|
|
if (meta_get_locale_direction () == META_LOCALE_DIRECTION_RTL)
|
2010-11-15 16:25:22 +00: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 15:19:02 +00: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;
|
|
|
|
}
|
|
|
|
|
2017-08-27 19:02:40 +00:00
|
|
|
meta_workspace_manager_free_workspace_layout (&layout1);
|
|
|
|
meta_workspace_manager_free_workspace_layout (&layout2);
|
2009-07-02 15:19:02 +00:00
|
|
|
|
2014-03-18 21:31:22 +00:00
|
|
|
meta_compositor_switch_workspace (comp, old, workspace, direction);
|
2009-07-02 15:19:02 +00: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 21:10:40 +00: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 16:32:06 +00:00
|
|
|
meta_window_activate (focus_this, timestamp);
|
2019-10-12 18:55:26 +00:00
|
|
|
update_workspace_default_focus (workspace, focus_this);
|
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 21:10:40 +00:00
|
|
|
}
|
|
|
|
else if (move_window)
|
|
|
|
{
|
|
|
|
meta_window_raise (move_window);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-02 15:47:22 +00:00
|
|
|
meta_topic (META_DEBUG_FOCUS, "Focusing default window on new workspace");
|
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 21:10:40 +00:00
|
|
|
meta_workspace_focus_default_window (workspace, NULL, timestamp);
|
|
|
|
}
|
|
|
|
|
2017-08-27 19:02:40 +00:00
|
|
|
meta_workspace_manager_workspace_switched (workspace->manager, current_space,
|
|
|
|
new_space, direction);
|
2003-05-30 20:24:00 +00: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 20:32:59 +00: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 16:32:33 +00:00
|
|
|
guint32 timestamp)
|
2003-05-30 20:24:00 +00: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 20:32:59 +00:00
|
|
|
meta_workspace_activate_with_focus (workspace, NULL, timestamp);
|
2001-06-06 04:47:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
meta_workspace_index (MetaWorkspace *workspace)
|
|
|
|
{
|
2007-12-21 19:56:07 +00:00
|
|
|
int ret;
|
2001-06-06 04:47:37 +00:00
|
|
|
|
2022-12-18 15:54:55 +00:00
|
|
|
g_return_val_if_fail (META_IS_WORKSPACE (workspace), -1);
|
|
|
|
|
2017-08-27 19:02:40 +00:00
|
|
|
ret = g_list_index (workspace->manager->workspaces, workspace);
|
2022-12-18 15:54:55 +00:00
|
|
|
|
2021-12-04 22:39:58 +00:00
|
|
|
g_return_val_if_fail (ret >= 0, -1);
|
2001-06-06 04:47:37 +00:00
|
|
|
|
2007-12-21 19:56:07 +00:00
|
|
|
return ret;
|
2001-06-06 04:47:37 +00:00
|
|
|
}
|
2001-06-09 05:14:43 +00:00
|
|
|
|
2009-01-09 15:04:53 +00:00
|
|
|
void
|
2014-08-16 12:03:10 +00:00
|
|
|
meta_workspace_index_changed (MetaWorkspace *workspace)
|
2009-01-09 15:04:53 +00:00
|
|
|
{
|
2014-08-16 03:01:31 +00:00
|
|
|
GList *l;
|
|
|
|
for (l = workspace->windows; l != NULL; l = l->next)
|
2009-01-09 15:04:53 +00:00
|
|
|
{
|
|
|
|
MetaWindow *win = l->data;
|
2014-05-20 19:46:21 +00:00
|
|
|
meta_window_current_workspace_changed (win);
|
2009-01-09 15:04:53 +00:00
|
|
|
}
|
2014-08-16 12:03:10 +00:00
|
|
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (workspace), obj_props[PROP_WORKSPACE_INDEX]);
|
2009-01-09 15:04:53 +00:00
|
|
|
}
|
|
|
|
|
2009-06-15 19:32:23 +00:00
|
|
|
/**
|
|
|
|
* meta_workspace_list_windows:
|
2010-09-15 00:10:09 +00:00
|
|
|
* @workspace: a #MetaWorkspace
|
2009-06-15 19:32:23 +00:00
|
|
|
*
|
|
|
|
* Gets windows contained on the workspace, including workspace->windows
|
|
|
|
* and also sticky windows. Override-redirect windows are not included.
|
|
|
|
*
|
2009-11-12 16:14:48 +00:00
|
|
|
* Return value: (transfer container) (element-type MetaWindow): the list of windows.
|
2002-01-10 06:31:31 +00:00
|
|
|
*/
|
|
|
|
GList*
|
|
|
|
meta_workspace_list_windows (MetaWorkspace *workspace)
|
|
|
|
{
|
2014-08-16 03:01:31 +00:00
|
|
|
GSList *display_windows, *l;
|
2002-01-10 06:31:31 +00:00
|
|
|
GList *workspace_windows;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2017-08-26 19:39:46 +00:00
|
|
|
display_windows = meta_display_list_windows (workspace->display,
|
2009-06-15 19:32:23 +00:00
|
|
|
META_LIST_DEFAULT);
|
2002-01-10 06:31:31 +00:00
|
|
|
|
|
|
|
workspace_windows = NULL;
|
2014-08-16 03:01:31 +00:00
|
|
|
for (l = display_windows; l != NULL; l = l->next)
|
2002-01-10 06:31:31 +00:00
|
|
|
{
|
2014-08-16 03:01:31 +00:00
|
|
|
MetaWindow *window = l->data;
|
2002-01-10 06:31:31 +00:00
|
|
|
|
2004-12-23 00:20:33 +00:00
|
|
|
if (meta_window_located_on_workspace (window, workspace))
|
2002-01-10 06:31:31 +00: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)
|
|
|
|
{
|
2022-10-27 16:11:21 +00:00
|
|
|
MetaWindowDrag *window_drag;
|
2016-11-28 12:11:24 +00:00
|
|
|
GList *windows, *l;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2003-02-23 17:09:46 +00:00
|
|
|
if (workspace->work_areas_invalid)
|
2002-02-08 03:34:26 +00:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
2020-10-02 15:47:22 +00:00
|
|
|
"Work area for workspace %d is already invalid",
|
2002-02-08 03:34:26 +00:00
|
|
|
meta_workspace_index (workspace));
|
|
|
|
return;
|
|
|
|
}
|
2002-01-19 03:50:03 +00:00
|
|
|
|
2002-02-08 03:34:26 +00:00
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
2020-10-02 15:47:22 +00:00
|
|
|
"Invalidating work area for workspace %d",
|
2002-02-08 03:34:26 +00:00
|
|
|
meta_workspace_index (workspace));
|
2003-02-23 17:09:46 +00:00
|
|
|
|
2022-10-27 16:11:21 +00:00
|
|
|
window_drag =
|
|
|
|
meta_compositor_get_current_window_drag (workspace->display->compositor);
|
|
|
|
|
2010-02-09 21:44:16 +00:00
|
|
|
/* If we are in the middle of a resize or move operation, we
|
|
|
|
* might have cached pointers to the workspace's edges */
|
2022-10-27 16:11:21 +00:00
|
|
|
if (window_drag &&
|
|
|
|
workspace == workspace->manager->active_workspace)
|
|
|
|
meta_window_drag_update_edges (window_drag);
|
2010-02-09 21:44:16 +00:00
|
|
|
|
2016-12-02 09:39:01 +00:00
|
|
|
meta_workspace_clear_logical_monitor_data (workspace);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2008-11-17 19:46:38 +00: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 14:58:50 +00:00
|
|
|
|
|
|
|
meta_rectangle_free_list_and_elements (workspace->screen_region);
|
|
|
|
meta_rectangle_free_list_and_elements (workspace->screen_edges);
|
2009-08-31 13:52:16 +00: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 14:58:50 +00:00
|
|
|
workspace->screen_region = NULL;
|
|
|
|
workspace->screen_edges = NULL;
|
2009-08-31 13:52:16 +00:00
|
|
|
workspace->monitor_edges = NULL;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2003-02-23 17:09:46 +00:00
|
|
|
workspace->work_areas_invalid = TRUE;
|
2002-01-10 06:31:31 +00:00
|
|
|
|
|
|
|
/* redo the size/position constraints on all windows */
|
2002-02-08 06:01:58 +00:00
|
|
|
windows = meta_workspace_list_windows (workspace);
|
2002-01-10 06:31:31 +00:00
|
|
|
|
2014-08-16 03:01:31 +00: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-11 01:15:33 +00:00
|
|
|
meta_window_queue (w, META_QUEUE_MOVE_RESIZE);
|
2002-01-10 06:31:31 +00:00
|
|
|
}
|
2002-02-08 06:01:58 +00: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 05:41:13 +00:00
|
|
|
|
2017-08-26 19:39:46 +00:00
|
|
|
meta_display_queue_workarea_recalc (workspace->display);
|
2002-01-10 06:31:31 +00:00
|
|
|
}
|
|
|
|
|
2008-11-17 19:46:38 +00:00
|
|
|
static MetaStrut *
|
|
|
|
copy_strut(MetaStrut *original)
|
|
|
|
{
|
2021-02-04 17:45:59 +00:00
|
|
|
return g_memdup2 (original, sizeof (MetaStrut));
|
2008-11-17 19:46:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GSList *
|
|
|
|
copy_strut_list(GSList *original)
|
|
|
|
{
|
|
|
|
GSList *result = NULL;
|
|
|
|
|
2014-08-16 03:01:31 +00:00
|
|
|
for (; original != NULL; original = original->next)
|
|
|
|
result = g_slist_prepend (result, copy_strut (original->data));
|
2008-11-17 19:46:38 +00:00
|
|
|
|
|
|
|
return g_slist_reverse (result);
|
|
|
|
}
|
|
|
|
|
2003-02-23 17:09:46 +00:00
|
|
|
static void
|
|
|
|
ensure_work_areas_validated (MetaWorkspace *workspace)
|
|
|
|
{
|
2022-05-27 20:27:07 +00:00
|
|
|
MetaContext *context = meta_display_get_context (workspace->display);
|
|
|
|
MetaBackend *backend = meta_context_get_backend (context);
|
2016-11-28 12:11:24 +00:00
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
|
|
|
GList *windows;
|
|
|
|
GList *tmp;
|
2016-12-02 08:00:03 +00:00
|
|
|
GList *logical_monitors, *l;
|
2023-07-19 23:46:15 +00:00
|
|
|
MtkRectangle display_rect = { 0 };
|
|
|
|
MtkRectangle work_area;
|
2003-02-23 17:09:46 +00:00
|
|
|
|
|
|
|
if (!workspace->work_areas_invalid)
|
|
|
|
return;
|
2003-06-26 03:09:38 +00: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 14:58:50 +00:00
|
|
|
g_assert (workspace->all_struts == NULL);
|
|
|
|
g_assert (workspace->screen_region == NULL);
|
|
|
|
g_assert (workspace->screen_edges == NULL);
|
2009-08-31 13:52:16 +00:00
|
|
|
g_assert (workspace->monitor_edges == NULL);
|
2003-02-23 17:09:46 +00:00
|
|
|
|
2017-08-27 18:44:38 +00:00
|
|
|
meta_display_get_size (workspace->display,
|
|
|
|
&display_rect.width,
|
|
|
|
&display_rect.height);
|
|
|
|
|
2008-11-17 19:46:38 +00: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-03 03:41:10 +00:00
|
|
|
windows = meta_workspace_list_windows (workspace);
|
|
|
|
for (tmp = windows; tmp != NULL; tmp = tmp->next)
|
2002-01-10 06:31:31 +00: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-03 03:41:10 +00:00
|
|
|
MetaWindow *win = tmp->data;
|
|
|
|
GSList *s_iter;
|
2002-01-10 06:31:31 +00:00
|
|
|
|
2008-08-18 02:48:36 +00: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-03 03:41:10 +00:00
|
|
|
workspace->all_struts = g_slist_prepend (workspace->all_struts,
|
2008-11-17 19:46:38 +00:00
|
|
|
copy_strut(s_iter->data));
|
2008-08-18 02:48:36 +00:00
|
|
|
}
|
2003-02-23 17:09:46 +00: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-03 03:41:10 +00:00
|
|
|
/* STEP 2: Get the maximal/spanning rects for the onscreen and
|
2009-08-31 13:52:16 +00:00
|
|
|
* on-single-monitor regions
|
2014-05-02 13:34:02 +00: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 14:58:50 +00:00
|
|
|
g_assert (workspace->screen_region == NULL);
|
|
|
|
|
2016-11-28 12:11:24 +00:00
|
|
|
logical_monitors =
|
2016-12-02 08:00:03 +00: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 14:58:50 +00:00
|
|
|
{
|
2016-12-02 08:00:03 +00:00
|
|
|
MetaLogicalMonitor *logical_monitor = l->data;
|
2016-12-02 09:39:01 +00:00
|
|
|
MetaWorkspaceLogicalMonitorData *data;
|
|
|
|
|
|
|
|
g_assert (!meta_workspace_get_logical_monitor_data (workspace,
|
|
|
|
logical_monitor));
|
2016-12-02 08:00:03 +00:00
|
|
|
|
2016-12-02 09:39:01 +00: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 14:58:50 +00:00
|
|
|
meta_rectangle_get_minimal_spanning_set_for_region (
|
2016-12-02 08:00:03 +00: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 14:58:50 +00:00
|
|
|
workspace->all_struts);
|
|
|
|
}
|
2016-11-28 12:11:24 +00: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 14:58:50 +00:00
|
|
|
workspace->screen_region =
|
|
|
|
meta_rectangle_get_minimal_spanning_set_for_region (
|
2017-08-27 18:44:38 +00:00
|
|
|
&display_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 14:58:50 +00:00
|
|
|
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-03 03:41:10 +00:00
|
|
|
|
|
|
|
/* STEP 3: Get the work areas (region-to-maximize-to) for the screen and
|
2009-08-31 13:52:16 +00: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 14:58:50 +00:00
|
|
|
*/
|
2017-08-27 18:44:38 +00:00
|
|
|
work_area = display_rect; /* start with the screen */
|
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-03 03:41:10 +00:00
|
|
|
if (workspace->screen_region == NULL)
|
2023-07-19 22:37:59 +00:00
|
|
|
work_area = MTK_RECTANGLE_INIT (0, 0, -1, -1);
|
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-03 03:41:10 +00:00
|
|
|
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
|
2021-01-29 09:06:18 +00:00
|
|
|
if (work_area.width < MIN_SANE_AREA &&
|
|
|
|
work_area.width != display_rect.width)
|
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-03 03:41:10 +00:00
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
2017-08-27 18:44:38 +00:00
|
|
|
work_area.x = (display_rect.width - MIN_SANE_AREA)/2;
|
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-03 03:41:10 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2021-01-29 09:06:18 +00:00
|
|
|
if (work_area.height < MIN_SANE_AREA &&
|
|
|
|
work_area.height != display_rect.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-03 03:41:10 +00:00
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
2017-08-27 18:44:38 +00:00
|
|
|
work_area.y = (display_rect.height - MIN_SANE_AREA)/2;
|
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-03 03:41:10 +00:00
|
|
|
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,
|
2020-10-02 15:47:22 +00:00
|
|
|
"Computed work area for workspace %d: %d,%d %d x %d",
|
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-03 03:41:10 +00:00
|
|
|
meta_workspace_index (workspace),
|
|
|
|
workspace->work_area_screen.x,
|
|
|
|
workspace->work_area_screen.y,
|
|
|
|
workspace->work_area_screen.width,
|
2014-05-02 13:34:02 +00: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-03 03:41:10 +00:00
|
|
|
|
2009-08-31 13:52:16 +00:00
|
|
|
/* Now find the work areas for each monitor */
|
2016-12-02 08:00:03 +00: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-03 03:41:10 +00:00
|
|
|
{
|
2016-12-02 08:00:03 +00:00
|
|
|
MetaLogicalMonitor *logical_monitor = l->data;
|
2016-12-02 09:39:01 +00:00
|
|
|
MetaWorkspaceLogicalMonitorData *data;
|
2016-12-02 08:00:03 +00:00
|
|
|
|
2016-12-02 09:39:01 +00:00
|
|
|
data = meta_workspace_get_logical_monitor_data (workspace,
|
|
|
|
logical_monitor);
|
2016-12-02 08:00:03 +00: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-03 03:41:10 +00:00
|
|
|
|
2016-12-02 09:39:01 +00: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-03 03:41:10 +00:00
|
|
|
/* FIXME: constraints.c untested with this, but it might be nice for
|
|
|
|
* a screen reader or magnifier.
|
|
|
|
*/
|
2023-07-19 22:37:59 +00:00
|
|
|
work_area = MTK_RECTANGLE_INIT (work_area.x, work_area.y, -1, -1);
|
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-03 03:41:10 +00:00
|
|
|
else
|
2016-12-02 09:39:01 +00: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-03 03:41:10 +00:00
|
|
|
FIXED_DIRECTION_NONE,
|
|
|
|
&work_area);
|
|
|
|
|
2016-12-02 09:39:01 +00: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-03 03:41:10 +00:00
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
|
|
|
"Computed work area for workspace %d "
|
2020-10-02 15:47:22 +00:00
|
|
|
"monitor %d: %d,%d %d x %d",
|
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-03 03:41:10 +00:00
|
|
|
meta_workspace_index (workspace),
|
2016-12-02 09:39:01 +00: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-03 03:41:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* STEP 4: Make sure the screen_region is nonempty (separate from step 2
|
|
|
|
* since it relies on step 3).
|
2014-05-02 13:34:02 +00: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 14:58:50 +00:00
|
|
|
if (workspace->screen_region == NULL)
|
|
|
|
{
|
2023-07-19 23:46:15 +00:00
|
|
|
MtkRectangle *nonempty_region;
|
|
|
|
nonempty_region = g_new (MtkRectangle, 1);
|
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 14:58:50 +00:00
|
|
|
*nonempty_region = workspace->work_area_screen;
|
|
|
|
workspace->screen_region = g_list_prepend (NULL, nonempty_region);
|
|
|
|
}
|
|
|
|
|
2009-08-31 13:52:16 +00: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 14:58:50 +00:00
|
|
|
g_assert (workspace->screen_edges == NULL);
|
2009-08-31 13:52:16 +00: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 14:58:50 +00:00
|
|
|
workspace->screen_edges =
|
2017-08-27 18:44:38 +00:00
|
|
|
meta_rectangle_find_onscreen_edges (&display_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 14:58:50 +00:00
|
|
|
workspace->all_struts);
|
|
|
|
tmp = NULL;
|
2016-12-02 08:00:03 +00: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 13:52:16 +00: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 14:58:50 +00:00
|
|
|
workspace->all_struts);
|
|
|
|
g_list_free (tmp);
|
|
|
|
|
|
|
|
/* We're all done, YAAY! Record that everything has been validated. */
|
2003-02-23 17:09:46 +00:00
|
|
|
workspace->work_areas_invalid = FALSE;
|
|
|
|
}
|
|
|
|
|
2010-02-10 14:48:46 +00: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 ||
|
2023-07-19 15:14:13 +00:00
|
|
|
!mtk_rectangle_equal (&a->rect, &b->rect))
|
2010-02-10 14:48:46 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return l == NULL && m == NULL;
|
|
|
|
}
|
|
|
|
|
2008-11-17 19:46:38 +00:00
|
|
|
/**
|
|
|
|
* meta_workspace_set_builtin_struts:
|
|
|
|
* @workspace: a #MetaWorkspace
|
2010-10-18 18:34:14 +00:00
|
|
|
* @struts: (element-type Meta.Strut) (transfer none): list of #MetaStrut
|
2008-11-17 19:46:38 +00: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)
|
|
|
|
{
|
2022-05-27 20:27:07 +00:00
|
|
|
MetaContext *context = meta_display_get_context (workspace->display);
|
|
|
|
MetaBackend *backend = meta_context_get_backend (context);
|
2016-12-01 04:52:07 +00:00
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
2017-08-26 19:39:46 +00:00
|
|
|
MetaDisplay *display = workspace->display;
|
2023-07-19 23:46:15 +00:00
|
|
|
MtkRectangle display_rect = { 0 };
|
2014-06-11 00:16:13 +00:00
|
|
|
GSList *l;
|
|
|
|
|
2017-08-27 18:44:38 +00:00
|
|
|
meta_display_get_size (display, &display_rect.width, &display_rect.height);
|
|
|
|
|
2014-06-11 00:16:13 +00:00
|
|
|
for (l = struts; l; l = l->next)
|
|
|
|
{
|
|
|
|
MetaStrut *strut = l->data;
|
2016-12-01 04:52:07 +00:00
|
|
|
MetaLogicalMonitor *logical_monitor;
|
|
|
|
|
|
|
|
logical_monitor =
|
|
|
|
meta_monitor_manager_get_logical_monitor_from_rect (monitor_manager,
|
|
|
|
&strut->rect);
|
2014-06-11 00:16:13 +00:00
|
|
|
|
|
|
|
switch (strut->side)
|
|
|
|
{
|
|
|
|
case META_SIDE_TOP:
|
2016-12-01 07:15:52 +00:00
|
|
|
if (meta_monitor_manager_get_logical_monitor_neighbor (monitor_manager,
|
|
|
|
logical_monitor,
|
2017-08-26 19:22:34 +00:00
|
|
|
META_DISPLAY_UP))
|
2014-06-11 00:16:13 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
strut->rect.height += strut->rect.y;
|
|
|
|
strut->rect.y = 0;
|
|
|
|
break;
|
|
|
|
case META_SIDE_BOTTOM:
|
2016-12-01 07:15:52 +00:00
|
|
|
if (meta_monitor_manager_get_logical_monitor_neighbor (monitor_manager,
|
|
|
|
logical_monitor,
|
2017-08-26 19:22:34 +00:00
|
|
|
META_DISPLAY_DOWN))
|
2014-06-11 00:16:13 +00:00
|
|
|
continue;
|
|
|
|
|
2017-08-27 18:44:38 +00:00
|
|
|
strut->rect.height = display_rect.height - strut->rect.y;
|
2014-06-11 00:16:13 +00:00
|
|
|
break;
|
|
|
|
case META_SIDE_LEFT:
|
2016-12-01 07:15:52 +00:00
|
|
|
if (meta_monitor_manager_get_logical_monitor_neighbor (monitor_manager,
|
|
|
|
logical_monitor,
|
2017-08-26 19:22:34 +00:00
|
|
|
META_DISPLAY_LEFT))
|
2014-06-11 00:16:13 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
strut->rect.width += strut->rect.x;
|
|
|
|
strut->rect.x = 0;
|
|
|
|
break;
|
|
|
|
case META_SIDE_RIGHT:
|
2016-12-01 07:15:52 +00:00
|
|
|
if (meta_monitor_manager_get_logical_monitor_neighbor (monitor_manager,
|
|
|
|
logical_monitor,
|
2017-08-26 19:22:34 +00:00
|
|
|
META_DISPLAY_RIGHT))
|
2014-06-11 00:16:13 +00:00
|
|
|
continue;
|
|
|
|
|
2017-08-27 18:44:38 +00:00
|
|
|
strut->rect.width = display_rect.width - strut->rect.x;
|
2014-06-11 00:16:13 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-10 14:48:46 +00: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 19:46:38 +00:00
|
|
|
workspace_free_builtin_struts (workspace);
|
|
|
|
workspace->builtin_struts = copy_strut_list (struts);
|
|
|
|
|
|
|
|
meta_workspace_invalidate_work_area (workspace);
|
|
|
|
}
|
|
|
|
|
2016-11-29 03:48:52 +00:00
|
|
|
void
|
|
|
|
meta_workspace_get_work_area_for_logical_monitor (MetaWorkspace *workspace,
|
|
|
|
MetaLogicalMonitor *logical_monitor,
|
2023-07-19 23:46:15 +00:00
|
|
|
MtkRectangle *area)
|
2016-11-29 03:48:52 +00:00
|
|
|
{
|
|
|
|
meta_workspace_get_work_area_for_monitor (workspace,
|
|
|
|
logical_monitor->number,
|
|
|
|
area);
|
|
|
|
}
|
|
|
|
|
2013-01-28 04:08:17 +00: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 17:09:46 +00:00
|
|
|
void
|
2009-08-31 13:52:16 +00:00
|
|
|
meta_workspace_get_work_area_for_monitor (MetaWorkspace *workspace,
|
|
|
|
int which_monitor,
|
2023-07-19 23:46:15 +00:00
|
|
|
MtkRectangle *area)
|
2003-02-23 17:09:46 +00:00
|
|
|
{
|
2022-05-27 20:27:07 +00:00
|
|
|
MetaContext *context = meta_display_get_context (workspace->display);
|
|
|
|
MetaBackend *backend = meta_context_get_backend (context);
|
2016-11-28 12:11:24 +00:00
|
|
|
MetaMonitorManager *monitor_manager =
|
|
|
|
meta_backend_get_monitor_manager (backend);
|
2016-12-02 09:39:01 +00:00
|
|
|
MetaLogicalMonitor *logical_monitor;
|
|
|
|
MetaWorkspaceLogicalMonitorData *data;
|
2002-01-10 06:31:31 +00:00
|
|
|
|
2016-12-02 09:39:01 +00:00
|
|
|
logical_monitor =
|
|
|
|
meta_monitor_manager_get_logical_monitor_from_number (monitor_manager,
|
|
|
|
which_monitor);
|
2017-10-13 01:07:12 +00:00
|
|
|
g_return_if_fail (logical_monitor != NULL);
|
|
|
|
|
|
|
|
ensure_work_areas_validated (workspace);
|
2016-12-02 09:39:01 +00:00
|
|
|
data = meta_workspace_get_logical_monitor_data (workspace, logical_monitor);
|
|
|
|
|
2017-10-13 01:07:12 +00:00
|
|
|
g_return_if_fail (data != NULL);
|
|
|
|
|
2016-12-02 09:39:01 +00:00
|
|
|
*area = data->logical_monitor_work_area;
|
2003-02-23 17:09:46 +00:00
|
|
|
}
|
|
|
|
|
2012-05-31 17:17:49 +00: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 17:09:46 +00:00
|
|
|
void
|
2009-08-31 13:52:16 +00:00
|
|
|
meta_workspace_get_work_area_all_monitors (MetaWorkspace *workspace,
|
2023-07-19 23:46:15 +00:00
|
|
|
MtkRectangle *area)
|
2003-02-23 17:09:46 +00:00
|
|
|
{
|
|
|
|
ensure_work_areas_validated (workspace);
|
2014-05-02 13:34:02 +00: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 14:58:50 +00: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 09:39:01 +00: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 14:58:50 +00:00
|
|
|
{
|
2016-12-02 09:39:01 +00: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 14:58:50 +00:00
|
|
|
ensure_work_areas_validated (workspace);
|
|
|
|
|
2016-12-02 09:39:01 +00:00
|
|
|
data = meta_workspace_get_logical_monitor_data (workspace, logical_monitor);
|
|
|
|
|
|
|
|
return data->logical_monitor_region;
|
2002-01-10 06:31:31 +00:00
|
|
|
}
|
2002-04-28 04:52:26 +00:00
|
|
|
|
2002-12-08 19:17:17 +00:00
|
|
|
#ifdef WITH_VERBOSE_MODE
|
2015-09-23 23:13:59 +00:00
|
|
|
static const char *
|
2002-11-07 23:13:12 +00: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 16:57:12 +00: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 23:13:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return "Unknown";
|
|
|
|
}
|
2002-12-08 19:17:17 +00:00
|
|
|
#endif /* WITH_VERBOSE_MODE */
|
2002-11-07 23:13:12 +00:00
|
|
|
|
2012-04-14 12:30:45 +00:00
|
|
|
/**
|
|
|
|
* meta_workspace_get_neighbor:
|
|
|
|
* @workspace: a #MetaWorkspace
|
|
|
|
* @direction: a #MetaMotionDirection, relative to @workspace
|
|
|
|
*
|
2020-08-26 09:49:50 +00:00
|
|
|
* Calculate and retrieve the workspace that is next to @workspace,
|
2012-04-14 12:30:45 +00:00
|
|
|
* 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-09 03:44:16 +00:00
|
|
|
MetaWorkspace*
|
|
|
|
meta_workspace_get_neighbor (MetaWorkspace *workspace,
|
|
|
|
MetaMotionDirection direction)
|
|
|
|
{
|
2014-05-02 13:34:02 +00:00
|
|
|
MetaWorkspaceLayout layout;
|
2003-01-05 18:36:01 +00:00
|
|
|
int i, current_space, num_workspaces;
|
2007-05-25 14:36:12 +00:00
|
|
|
gboolean ltr;
|
2003-01-05 18:36:01 +00:00
|
|
|
|
|
|
|
current_space = meta_workspace_index (workspace);
|
2017-08-27 19:02:40 +00:00
|
|
|
num_workspaces = meta_workspace_manager_get_n_workspaces (workspace->manager);
|
|
|
|
meta_workspace_manager_calc_workspace_layout (workspace->manager, num_workspaces,
|
|
|
|
current_space, &layout);
|
2002-11-05 19:25:06 +00:00
|
|
|
|
2020-10-02 15:47:22 +00:00
|
|
|
meta_verbose ("Getting neighbor of %d in direction %s",
|
2003-01-05 18:36:01 +00:00
|
|
|
current_space, meta_motion_direction_to_string (direction));
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2014-08-18 02:57:51 +00:00
|
|
|
ltr = (meta_get_locale_direction () == META_LOCALE_DIRECTION_LTR);
|
2007-05-25 14:36:12 +00:00
|
|
|
|
2014-05-02 13:34:02 +00:00
|
|
|
switch (direction)
|
2002-11-05 19:25:06 +00:00
|
|
|
{
|
|
|
|
case META_MOTION_LEFT:
|
2007-05-25 14:36:12 +00:00
|
|
|
layout.current_col -= ltr ? 1 : -1;
|
2002-11-05 19:25:06 +00:00
|
|
|
break;
|
|
|
|
case META_MOTION_RIGHT:
|
2007-05-25 14:36:12 +00:00
|
|
|
layout.current_col += ltr ? 1 : -1;
|
2002-11-05 19:25:06 +00:00
|
|
|
break;
|
|
|
|
case META_MOTION_UP:
|
2003-01-05 18:36:01 +00:00
|
|
|
layout.current_row -= 1;
|
2002-11-05 19:25:06 +00:00
|
|
|
break;
|
|
|
|
case META_MOTION_DOWN:
|
2003-01-05 18:36:01 +00:00
|
|
|
layout.current_row += 1;
|
2002-11-05 19:25:06 +00:00
|
|
|
break;
|
2008-10-09 16:57:12 +00:00
|
|
|
default:;
|
2002-11-05 19:25:06 +00:00
|
|
|
}
|
|
|
|
|
2003-01-05 18:36:01 +00: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)
|
2020-10-02 15:47:22 +00:00
|
|
|
meta_bug ("calc_workspace_layout left an invalid (too-high) workspace number %d in the grid",
|
2003-01-05 18:36:01 +00:00
|
|
|
i);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2020-10-02 15:47:22 +00:00
|
|
|
meta_verbose ("Neighbor workspace is %d at row %d col %d",
|
2003-01-05 18:36:01 +00:00
|
|
|
i, layout.current_row, layout.current_col);
|
|
|
|
|
2017-08-27 19:02:40 +00:00
|
|
|
meta_workspace_manager_free_workspace_layout (&layout);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2017-08-27 19:02:40 +00:00
|
|
|
return meta_workspace_manager_get_workspace_by_index (workspace->manager, i);
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
2002-06-09 03:44:16 +00:00
|
|
|
|
2023-09-07 17:20:11 +00:00
|
|
|
static MetaWindow *
|
|
|
|
workspace_find_focused_window (MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
GList *l;
|
|
|
|
|
|
|
|
for (l = workspace->windows; l != NULL; l = l->next)
|
|
|
|
{
|
|
|
|
MetaWindow *win = l->data;
|
|
|
|
|
|
|
|
if (meta_window_has_focus (win))
|
|
|
|
return win;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-08-15 22:09:55 +00: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 20:32:59 +00: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 16:32:33 +00:00
|
|
|
guint32 timestamp)
|
2003-08-15 22:09:55 +00:00
|
|
|
{
|
2023-09-07 17:20:11 +00:00
|
|
|
MetaWindow *window = NULL;
|
|
|
|
MetaWindow *current_focus_window = NULL;
|
|
|
|
|
2017-08-26 20:24:21 +00:00
|
|
|
if (timestamp == META_CURRENT_TIME)
|
|
|
|
meta_warning ("META_CURRENT_TIME used to choose focus window; "
|
2020-10-02 15:47:22 +00:00
|
|
|
"focus window may not be correct.");
|
Fix a variety of focus race conditions in all focus modes, or at least
2004-10-04 Elijah Newren <newren@math.utah.edu>
Fix a variety of focus race conditions in all focus modes, or at
least make them harder to trigger (fixes #152000)
* src/core.[ch] (meta_core_user_lower_and_unfocus): add a
timestamp parameter; pass it along to
meta_workspace_focus_default_window
* src/display.[ch] (meta_display_get_current_time_roundtrip): new
function
* src/display.c (event_callback): pass a timestamp to the
meta_workspace_activate and meta_workspace_focus_default_window
function calls
* src/frames.c (meta_frames_button_press_event): pass a timestamp
to meta_core_user_lower_and_unfocus
* src/keybindings.c (handle_activate_workspace): pass a timestamp
to meta_workspace_activate, (process_workspace_switch_grab): pass
a timestamp to meta_workspace_focus_default_window and
meta_workspace_activate, (handle_toggle_desktop): pass a timestamp
to meta_workspace_focus_default_window,
(do_handle_move_to_workspace): pass a timestamp to
meta_workspace_activate_with_focus, (handle_workspace_switch):
meta_workspace_activate
* src/screen.c (meta_screen_new): pass a timestamp to
meta_workspace_activate
* src/window.c (meta_window_free): pass a timestamp to
meta_workspace_focus_default_window, (idle_calc_showing): don't
increment the focus sentinel here, (meta_window_minimize): pass a
timestamp to meta_workspace_focus_default_window,
(meta_window_client_message), pass a timestamp to
meta_workspace_focus_default_window
* src/workspace.h (meta_workspace_activate): add timestamp
parameter, (meta_workspace_activate_with_focus): add timestamp
parameter, (meta_workspace_focus_default_window): add timestamp
parameter
* src/workspace.c (meta_workspace_focus_mru_window): make this
function take a timestamp and use it for meta_window_focus or
XSetInputFocus, (meta_workspace_activate_with_focus): make this
function take a timestamp and pass it along to meta_window_focus
and meta_workspace_focus_default_window,
(meta_workspace_activate): make this function take a timestamp and
pass it to meta_workspace_activate_with_focus),
(meta_workspace_focus_default_window): make this function take a
timestamp, warn if its 0 but try to handle that case sanely, and
pass the timestamp on to meta_window_focus or
meta_workspace_focus_mru_window or XSetInputFocus
2004-10-04 20:32:59 +00:00
|
|
|
|
2023-09-07 17:20:11 +00:00
|
|
|
current_focus_window = workspace_find_focused_window (workspace);
|
|
|
|
|
|
|
|
if (current_focus_window)
|
|
|
|
{
|
|
|
|
focus_ancestor_or_mru_window (workspace, not_this_one, timestamp);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
if (meta_prefs_get_focus_mode () == G_DESKTOP_FOCUS_MODE_CLICK ||
|
2017-08-26 19:39:46 +00:00
|
|
|
!workspace->display->mouse_mode)
|
2022-06-29 13:44:11 +00:00
|
|
|
{
|
|
|
|
focus_ancestor_or_mru_window (workspace, not_this_one, timestamp);
|
2023-09-08 14:14:18 +00:00
|
|
|
return;
|
2022-06-29 13:44:11 +00:00
|
|
|
}
|
2022-07-11 22:45:43 +00:00
|
|
|
|
2023-09-08 14:14:18 +00:00
|
|
|
window = get_pointer_window (workspace, not_this_one);
|
|
|
|
|
|
|
|
if (!window ||
|
|
|
|
window->type == META_WINDOW_DOCK ||
|
|
|
|
window->type == META_WINDOW_DESKTOP)
|
|
|
|
{
|
|
|
|
if (meta_prefs_get_focus_mode () == G_DESKTOP_FOCUS_MODE_MOUSE)
|
2004-08-06 18:13:55 +00:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Setting focus to no_focus_window, since no valid "
|
2020-10-02 15:47:22 +00:00
|
|
|
"window to focus found.");
|
2018-12-30 20:23:07 +00:00
|
|
|
meta_display_unset_input_focus (workspace->display, timestamp);
|
2004-08-06 18:13:55 +00:00
|
|
|
}
|
2023-09-08 14:14:18 +00:00
|
|
|
else /* G_DESKTOP_FOCUS_MODE_SLOPPY */
|
|
|
|
{
|
|
|
|
focus_ancestor_or_mru_window (workspace, not_this_one, timestamp);
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (timestamp == META_CURRENT_TIME)
|
|
|
|
{
|
|
|
|
/* We would like for this to never happen. However, if
|
|
|
|
* it does happen then we kludge since using META_CURRENT_TIME
|
|
|
|
* can mean ugly race conditions--and we can avoid these
|
|
|
|
* by allowing EnterNotify events (which come with
|
|
|
|
* timestamps) to handle focus.
|
|
|
|
*/
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Not focusing mouse window %s because EnterNotify events should handle that",
|
|
|
|
window->desc);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Focusing mouse window %s", window->desc);
|
|
|
|
meta_window_focus (window, timestamp);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (workspace->display->autoraise_window != window &&
|
|
|
|
meta_prefs_get_auto_raise ())
|
|
|
|
{
|
|
|
|
meta_display_queue_autoraise_callback (workspace->display, window);
|
2004-06-24 20:02:46 +00:00
|
|
|
}
|
2003-08-15 22:09:55 +00:00
|
|
|
}
|
|
|
|
|
2022-06-29 13:44:11 +00:00
|
|
|
static gboolean
|
|
|
|
is_focusable (MetaWindow *window,
|
|
|
|
MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
return !window->unmanaging &&
|
2022-07-11 22:45:43 +00:00
|
|
|
window->unmaps_pending == 0 &&
|
|
|
|
window->type != META_WINDOW_DOCK &&
|
2022-06-29 13:44:11 +00:00
|
|
|
meta_window_is_focusable (window) &&
|
2023-04-15 20:04:39 +00:00
|
|
|
meta_window_should_be_showing_on_workspace (window, workspace);
|
2022-06-29 13:44:11 +00:00
|
|
|
}
|
|
|
|
|
2005-02-02 18:46:09 +00:00
|
|
|
static gboolean
|
2018-11-13 07:31:52 +00:00
|
|
|
find_focusable_ancestor (MetaWindow *window,
|
|
|
|
gpointer user_data)
|
2005-02-02 18:46:09 +00:00
|
|
|
{
|
2018-11-13 07:31:52 +00:00
|
|
|
MetaWorkspaceFocusableAncestorData *data = user_data;
|
|
|
|
|
2022-06-29 13:44:11 +00:00
|
|
|
if (is_focusable (window, data->workspace) && !window->hidden)
|
2018-11-13 07:31:52 +00:00
|
|
|
{
|
|
|
|
data->out_window = window;
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-02-02 18:46:09 +00:00
|
|
|
|
2018-11-13 07:31:52 +00:00
|
|
|
return TRUE;
|
2005-02-02 18:46:09 +00:00
|
|
|
}
|
|
|
|
|
2022-07-11 22:45:43 +00:00
|
|
|
GList *
|
|
|
|
meta_workspace_get_default_focus_candidates (MetaWorkspace *workspace)
|
2022-06-29 13:44:11 +00:00
|
|
|
{
|
|
|
|
GList *l;
|
2022-07-11 22:45:43 +00:00
|
|
|
GList *candidates = NULL;
|
2022-06-29 13:44:11 +00:00
|
|
|
|
|
|
|
for (l = workspace->mru_list; l; l = l->next)
|
2022-07-11 22:45:43 +00:00
|
|
|
{
|
|
|
|
MetaWindow *window = l->data;
|
|
|
|
|
|
|
|
g_assert (window);
|
|
|
|
|
|
|
|
if (!is_focusable (window, workspace))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
candidates = g_list_prepend (candidates, window);
|
|
|
|
}
|
|
|
|
|
|
|
|
return candidates;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
window_contains_point (MetaWindow *window,
|
|
|
|
int root_x,
|
|
|
|
int root_y)
|
|
|
|
{
|
2023-07-19 23:46:15 +00:00
|
|
|
MtkRectangle rect;
|
2022-07-11 22:45:43 +00:00
|
|
|
|
|
|
|
meta_window_get_frame_rect (window, &rect);
|
|
|
|
|
|
|
|
return META_POINT_IN_RECT (root_x, root_y, rect);
|
|
|
|
}
|
|
|
|
|
|
|
|
MetaWindow *
|
|
|
|
meta_workspace_get_default_focus_window_at_point (MetaWorkspace *workspace,
|
|
|
|
MetaWindow *not_this_one,
|
|
|
|
int root_x,
|
|
|
|
int root_y)
|
|
|
|
{
|
|
|
|
g_autoptr (GList) sorted = NULL;
|
|
|
|
GList *l;
|
|
|
|
MetaStack *stack;
|
|
|
|
|
|
|
|
g_return_val_if_fail (META_IS_WORKSPACE (workspace), NULL);
|
|
|
|
g_return_val_if_fail (!not_this_one || META_IS_WINDOW (not_this_one), NULL);
|
|
|
|
|
|
|
|
stack = workspace->display->stack;
|
|
|
|
|
|
|
|
g_return_val_if_fail (META_IS_STACK (stack), NULL);
|
|
|
|
|
|
|
|
/* Find the topmost, focusable, mapped, window.
|
|
|
|
* not_this_one is being unfocused or going away, so exclude it.
|
|
|
|
*/
|
|
|
|
sorted = g_list_reverse (meta_stack_list_windows (stack, workspace));
|
|
|
|
|
|
|
|
/* top of this layer is at the front of the list */
|
|
|
|
for (l = sorted; l != NULL; l = l->next)
|
2022-06-29 13:44:11 +00:00
|
|
|
{
|
|
|
|
MetaWindow *window = l->data;
|
|
|
|
|
|
|
|
g_assert (window);
|
|
|
|
|
|
|
|
if (window == not_this_one)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (!is_focusable (window, workspace))
|
|
|
|
continue;
|
|
|
|
|
2022-07-11 22:45:43 +00:00
|
|
|
if (!window_contains_point (window, root_x, root_y))
|
|
|
|
continue;
|
|
|
|
|
2022-06-29 13:44:11 +00:00
|
|
|
return window;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
MetaWindow *
|
2022-07-11 22:45:43 +00:00
|
|
|
meta_workspace_get_default_focus_window (MetaWorkspace *workspace,
|
|
|
|
MetaWindow *not_this_one)
|
2022-06-29 13:44:11 +00:00
|
|
|
{
|
2022-07-11 22:45:43 +00:00
|
|
|
GList *l;
|
|
|
|
|
|
|
|
g_return_val_if_fail (META_IS_WORKSPACE (workspace), NULL);
|
|
|
|
g_return_val_if_fail (!not_this_one || META_IS_WINDOW (not_this_one), NULL);
|
|
|
|
|
|
|
|
for (l = workspace->mru_list; l; l = l->next)
|
2022-06-29 13:44:11 +00:00
|
|
|
{
|
2022-07-11 22:45:43 +00:00
|
|
|
MetaWindow *window = l->data;
|
|
|
|
|
|
|
|
g_assert (window);
|
|
|
|
|
|
|
|
if (window == not_this_one)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (!is_focusable (window, workspace))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
return window;
|
2022-06-29 13:44:11 +00:00
|
|
|
}
|
2022-07-11 22:45:43 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static MetaWindow *
|
|
|
|
get_pointer_window (MetaWorkspace *workspace,
|
|
|
|
MetaWindow *not_this_one)
|
|
|
|
{
|
2022-05-27 20:27:07 +00:00
|
|
|
MetaContext *context = meta_display_get_context (workspace->display);
|
|
|
|
MetaBackend *backend = meta_context_get_backend (context);
|
2022-07-11 22:45:43 +00:00
|
|
|
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
|
|
|
|
graphene_point_t point;
|
|
|
|
|
|
|
|
if (not_this_one)
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Focusing mouse window excluding %s", not_this_one->desc);
|
|
|
|
|
|
|
|
meta_cursor_tracker_get_pointer (cursor_tracker, &point, NULL);
|
|
|
|
|
|
|
|
return meta_workspace_get_default_focus_window_at_point (workspace,
|
|
|
|
not_this_one,
|
|
|
|
point.x, point.y);
|
2022-06-29 13:44:11 +00:00
|
|
|
}
|
|
|
|
|
2020-12-16 15:51:24 +00:00
|
|
|
static gboolean
|
|
|
|
try_to_set_focus_and_check (MetaWindow *window,
|
|
|
|
MetaWindow *not_this_one,
|
|
|
|
uint32_t timestamp)
|
|
|
|
{
|
|
|
|
meta_window_focus (window, timestamp);
|
|
|
|
|
2021-02-08 08:54:43 +00:00
|
|
|
/* meta_focus_window() will not change focus for clients using the
|
|
|
|
* "globally active input" model of input handling, hence defeating
|
|
|
|
* the assumption that focus should be changed for such windows.
|
|
|
|
* See https://tronche.com/gui/x/icccm/sec-4.html#s-4.1.7
|
|
|
|
*/
|
|
|
|
if (meta_window_is_focus_async (window))
|
|
|
|
return TRUE;
|
|
|
|
|
2020-12-16 15:51:24 +00:00
|
|
|
/* meta_window_focus() does not guarantee that focus will end up
|
|
|
|
* where we expect, it can fail for various reasons, better check
|
|
|
|
* it did not actually changed or even left focus to the window we
|
|
|
|
* explicitly want to avoid.
|
|
|
|
*/
|
|
|
|
if (not_this_one &&
|
|
|
|
meta_display_get_focus_window (window->display) == not_this_one)
|
|
|
|
{
|
|
|
|
meta_warning ("Failed to focus window %s while avoiding %s",
|
|
|
|
window->desc, not_this_one->desc);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-10-18 05:39:01 +00:00
|
|
|
/* Focus ancestor of not_this_one if there is one */
|
2005-02-02 18:46:09 +00:00
|
|
|
static void
|
2022-06-29 13:44:11 +00:00
|
|
|
focus_ancestor_or_mru_window (MetaWorkspace *workspace,
|
2005-02-02 18:46:09 +00: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 16:32:33 +00:00
|
|
|
guint32 timestamp)
|
2003-08-15 22:09:55 +00:00
|
|
|
{
|
|
|
|
MetaWindow *window = NULL;
|
|
|
|
|
|
|
|
if (not_this_one)
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
2020-10-02 15:47:22 +00:00
|
|
|
"Focusing MRU window excluding %s", not_this_one->desc);
|
2005-02-02 18:46:09 +00:00
|
|
|
else
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
2020-10-02 15:47:22 +00:00
|
|
|
"Focusing MRU window");
|
2005-02-02 18:46:09 +00:00
|
|
|
|
2014-05-02 13:34:02 +00:00
|
|
|
/* First, check to see if we need to focus an ancestor of a window */
|
2005-02-02 18:46:09 +00:00
|
|
|
if (not_this_one)
|
|
|
|
{
|
|
|
|
MetaWindow *ancestor;
|
2018-11-13 07:31:52 +00:00
|
|
|
MetaWorkspaceFocusableAncestorData data;
|
|
|
|
|
|
|
|
data = (MetaWorkspaceFocusableAncestorData) {
|
|
|
|
.workspace = workspace,
|
|
|
|
};
|
|
|
|
meta_window_foreach_ancestor (not_this_one, find_focusable_ancestor, &data);
|
|
|
|
ancestor = data.out_window;
|
|
|
|
|
|
|
|
if (ancestor)
|
2005-02-02 18:46:09 +00:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
2020-10-02 15:47:22 +00:00
|
|
|
"Focusing %s, ancestor of %s",
|
2005-02-02 18:46:09 +00:00
|
|
|
ancestor->desc, not_this_one->desc);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2020-12-16 15:51:24 +00:00
|
|
|
if (try_to_set_focus_and_check (ancestor, not_this_one, timestamp))
|
|
|
|
{
|
|
|
|
/* Also raise the window if in click-to-focus */
|
2022-12-05 23:56:31 +00:00
|
|
|
if (meta_prefs_get_focus_mode () == G_DESKTOP_FOCUS_MODE_CLICK &&
|
|
|
|
meta_prefs_get_raise_on_click ())
|
2020-12-16 15:51:24 +00:00
|
|
|
meta_window_raise (ancestor);
|
2005-02-02 18:46:09 +00:00
|
|
|
|
2020-12-16 15:51:24 +00:00
|
|
|
return;
|
|
|
|
}
|
2005-02-02 18:46:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-11 22:45:43 +00:00
|
|
|
window = meta_workspace_get_default_focus_window (workspace, not_this_one);
|
2006-01-16 06:07:29 +00:00
|
|
|
|
2003-08-15 22:09:55 +00:00
|
|
|
if (window)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
2020-10-02 15:47:22 +00:00
|
|
|
"Focusing workspace MRU window %s", window->desc);
|
2020-12-16 15:51:24 +00:00
|
|
|
if (try_to_set_focus_and_check (window, not_this_one, timestamp))
|
|
|
|
{
|
|
|
|
/* Also raise the window if in click-to-focus */
|
2022-12-05 23:56:31 +00:00
|
|
|
if (meta_prefs_get_focus_mode () == G_DESKTOP_FOCUS_MODE_CLICK &&
|
|
|
|
meta_prefs_get_raise_on_click ())
|
2020-12-16 15:51:24 +00:00
|
|
|
meta_window_raise (window);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2020-12-16 15:51:24 +00:00
|
|
|
return;
|
|
|
|
}
|
2003-08-15 22:09:55 +00:00
|
|
|
}
|
2020-12-16 15:51:24 +00:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"No MRU window to focus found; focusing no_focus_window.");
|
|
|
|
meta_display_unset_input_focus (workspace->display, timestamp);
|
2003-08-15 22:09:55 +00:00
|
|
|
}
|
2008-09-18 15:09:11 +00:00
|
|
|
|
2008-11-17 21:34:28 +00:00
|
|
|
/**
|
2017-08-26 19:39:46 +00:00
|
|
|
* meta_workspace_get_display:
|
2008-11-17 21:34:28 +00:00
|
|
|
* @workspace: a #MetaWorkspace
|
|
|
|
*
|
2017-08-26 19:39:46 +00:00
|
|
|
* Gets the #MetaDisplay that the workspace is part of.
|
2008-11-17 21:34:28 +00:00
|
|
|
*
|
2017-08-26 19:39:46 +00:00
|
|
|
* Return value: (transfer none): the #MetaDisplay for the workspace
|
2008-11-17 21:34:28 +00:00
|
|
|
*/
|
2017-08-26 19:39:46 +00:00
|
|
|
MetaDisplay *
|
|
|
|
meta_workspace_get_display (MetaWorkspace *workspace)
|
2008-09-18 15:09:11 +00:00
|
|
|
{
|
2017-08-26 19:39:46 +00:00
|
|
|
return workspace->display;
|
2008-09-18 15:09:11 +00:00
|
|
|
}
|